Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

czar

GetPixel of a DXImagelist item

This topic is 5933 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I would like to be able to return the pixel colour of a given coordinate of an item in a dximagelist. What I am doing is the following. I work out if the mouse is hanging above a bitmap, then I check if the actual position is above a transparent colour in the dximage list, if it is then I don''t have to draw the higlight of the irregular shaped object. Here is my code rX := mc.x - Xc; rY := mc.y - Yc; // the relative x and y coords col := GetPixel(DXImageList1.Items[1].picture.BitMap.canvas.handle,rx,ry); if col <>clFuchsia then DXImageList1.Items[1].Draw(dxdraw1.surface,Xc, Yc,0); I have tried, GetPixels, Pixels and scanlines nothing seems to work. In this case the return value for "col" is -1. Could someone please have a look to see where I am stuffing up? Ralph

Share this post


Link to post
Share on other sites
Advertisement
Ah, fixed my own problem. For completeness I will post what I ended up with.


col := DXImageList1.Items[QArray[l].picnum].PatternSurfaces[0].Canvas.pixels[rx,ry];

DXImageList1.Items[QArray[l].picnum].Restore;

if col <>clFuchsia then
DXImageList1.Items[picnum].Draw(dxdraw1.surface,Xc, Yc,0);

The only change is that I used the patternsurfaces. I had to put in a restore, anyone know why that is required?

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!