How to read a pixel's color on a sprite ?

Just starting out? Need help? Post your questions and find answers here.
pythagoras_156
User
User
Posts: 13
Joined: Wed Aug 20, 2003 11:08 am

How to read a pixel's color on a sprite ?

Post by pythagoras_156 »

Greetings,

I've been trying to retrieve the color of a pixel on a sprite by using GetPixel_(hdc,x,y) but to no avail. I guess the problem is to get the correct dc for the sprite. This is what i've been doing (wrong, probably) :

Code: Select all

hDC = GetDC_(sprite_id) 
color = GetPixel_(hDC,50,30)
Does someone know the correct way to do this ?

Thanks in advance,

Pythagoras
LarsG
Enthusiast
Enthusiast
Posts: 713
Joined: Mon Jun 02, 2003 1:06 pm
Location: Norway
Contact:

Post by LarsG »

Code: Select all

  If StartDrawing(SpriteOutput(#sprite_id))
    color = Point(x,y)
    StopDrawing()
  EndIf
That might do it..
(you might want to do an RGB conversion on the color variable)


-Lars

AMD Athlon XP2400, 512 MB RAM, Hercules 3D Prophet 9600 256MB RAM, WinXP
PIII 800MHz, 320 MB RAM, Nvidia Riva Tnt 2 Mach 64 (32MB), WinXP + Linux
17" iMac, 1.8 GHz G5, 512 MB DDR-RAM, 80 GB HD, 64 MB Geforce FX 5200, SuperDrive, OSX
pythagoras_156
User
User
Posts: 13
Joined: Wed Aug 20, 2003 11:08 am

Post by pythagoras_156 »

Thanks, that dit it :D


Pythagoras
Post Reply