Hi, Roger!rdonnay wrote:Eugene needed the pixel information in a 2-dimensional array that stores RGB colors as array elements.what i mean : what is this good for ... ? why not store Bitmap into BLOB ? (same Result on Screen)
He finds that it is easier to manipulate the data in an array that is representative of the image. I would tend to agree. Tweaking a color of a pixel would be simple.
Example:
Pixel 234/456 would be represented as aPixel[234,456].
The color would be a 3-element array.
aColor := aPixel[234,456]
aColor[1] += 10
aColor[2] += 10
aColor[3] += 10
This can be done before saving the array or restoring the array from the database. The image can then be repainted with TransferImage() or it can be saved to the database.
I really, as you say, I would like to be able to change the image. Something I did. For example, I was able to make contouring. Obtain and determine the minimum sufficient rectangular image area.
I wanted to use your example that you brought up, and try to change the brightness and contrast of the image. I wrote a function (shown below). Everything works. But it looks like something more difficult than in your example.
Code: Select all
FUNCTION LightImage( hDC1, hDC2, aPixel )
LOCAL i, j, nColor, lEmptyArray := aPixel[1,1] == nil, ;
nXSize := Len(aPixel), nYSize := Len(aPixel[1])
D = 10 // Шаг изменения яркости при одном нажатии
FOR i := 0 TO nXSize-1
FOR j := 0 TO nYSize-1
IF lEmptyArray
nColor = GetPixel(hDC1,i,j)
ELSE
nColor = aPixel[i+1,j+1]
ENDIF
nColor = AutomationTranslateColor(nColor, .t.)
* DC_DebugQout(nColor)
IF GraIsRGBColor(nColor)
aRGB = GraGetRGBIntensity(nColor)
* DC_DebugQout(nColor, aRGB[1], aRGB[2], aRGB[3] )
aRGB[1] = IF(aRGB[1]+D < 255, aRGB[1]+D, 255 )
aRGB[2] = IF(aRGB[2]+D < 255, aRGB[2]+D, 255 )
aRGB[3] = IF(aRGB[3]+D < 255, aRGB[3]+D, 255 )
aPixel[i+1,j+1] := AutomationTranslateColor(GraMakeRGBColor(aRGB),.f.)
SetPixel(hDC2,i,j,aPixel[i+1,j+1])
ENDIF
NEXT
NEXT
RETURN nil
I'm using the sample charts Roger master the different operations with images. Here is what is at the moment:
http://lc.kubagro.ru/Dima/DC_Graph9.zip
http://lc.kubagro.ru/Dima/a.doc (The universal cognitive analytical system 'Aidos')
Of course, there is still a lot of questions. For Example:
- I would like to be able to know not only the coordinates of the mouse, but also depressed there any mouse button (left or right);
- How to save a rectangular region of the image, given the coordinates, not in an array, but simply as an image file to disk;
- The use of standard graphics operations in Alaska along with the graphics in the style of Roger (accordingly, I understand a little like).