The order of pixels in the image array

This forum is for eXpress++ general support.
Post Reply
Message
Author
User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

The order of pixels in the image array

#1 Post 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)}

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: The order of pixels in the image array

#2 Post 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.
The eXpress train is coming - and it has more cars.

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: The order of pixels in the image array

#3 Post 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.

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: The order of pixels in the image array

#4 Post 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.
The eXpress train is coming - and it has more cars.

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: The order of pixels in the image array

#5 Post 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

Post Reply