Page 1 of 1

The order of pixels in the image array

Posted: Sun Jul 04, 2021 8:36 pm
by Eugene Lutsenko
Hi, Roger! What is the order of pixels in the image array?

Code: Select all

  @ 0,0 DCSTATIC TYPE XBPSTATIC_TYPE_BITMAP ;
        CAPTION oBitmap PREEVAL {|o|o:autoSize := .t.} ;
        EVAL {|o|hDC1 := GetWindowDC(o:getHWnd()), ;
               aPixel := Array(o:caption:xSize,o:caption:ySize)}

  DCREAD GUI FIT TITLE aFileName[i] ;
    EVAL {|o|LoadArray(hDC1,aPixel), ;
             Save2Dbf(aPixel,aFileName[i]), ;
             PostAppEvent(xbeP_Close,,,o)}

Re: The order of pixels in the image array

Posted: Sun Jul 04, 2021 9:01 pm
by rdonnay
The X axis is the horizontal axis and the Y axis is the vertical axis, therefore it is a 2-dimensional array with the X being the first dimension and the Y being the second dimension.

Re: The order of pixels in the image array

Posted: Sun Jul 04, 2021 9:25 pm
by Eugene Lutsenko
Thank you, Roger! This is understandable. But if you write a graphic file to the database, and then upload it, then the Y coordinate order changes to the opposite.

Re: The order of pixels in the image array

Posted: Wed Jul 07, 2021 6:03 am
by rdonnay
But if you write a graphic file to the database, and then upload it, then the Y coordinate order changes to the opposite.
That would mean that your code for reloading the array from the database needs to be fixed.

Re: The order of pixels in the image array

Posted: Wed Jul 07, 2021 7:36 am
by Eugene Lutsenko
I took this into account and now everything works as it should. But at first I thought that after downloading everything would be like before downloading