Jump to content

View more

Image of the Day

The night is still, but the invasion brings chaos. #screenshotsaturday #hanako #indiegame #gameart #ue4 #samurai https://t.co/cgILXuokoS
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Finding the color of a pixel

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
2 replies to this topic

#1 Anonymous Poster_Anonymous Poster_*   Guests   

Likes

Posted 24 October 1999 - 02:46 AM

Hey All,

I know that there has to be a way to determine the color of a pixel in 256 color mode, I'm just not sure what is is :-).

Can anyone help?

Thanks.


#2 jamesmcc   Members   

122
Like
Likes
Like

Posted 23 October 1999 - 03:16 PM

where ddsd is a directdraw surface
x,y are you co-ordinates

((BYTE *) ddsd.lpSurface)[y * ddsd.lPitch + x]


#3 NuFAN   Members   

122
Like
Likes
Like

Posted 24 October 1999 - 02:46 AM

Ok,
here's some source code :

code:

UCHAR* buffer;
DDSURFACEDESC2 ddsd;
UCHAR TheEntry;
PALETTEENTRY entry;
int r, g, b;

ZeroMemory(&ddsd, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
lpDDSWhatever->Lock(NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL);
buffer = (UCHAR*)ddsd.lpSurface;
TheEntry = buffer[x+(y*ddsd.lPitch)];
lpDDSWhatever->Unlock(NULL);

lpDDSWhatever->GetEntries(0, 0, 1, &entry[TheEntry]);
r = entry.peRed;
g = entry.peGreen;
b = entry.peBlue;


This should work, I hope.

CU

------------------
Skullpture Entertainment
#40842461

[This message has been edited by NuFAN (edited October 24, 1999).]





Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.