This site is no longer active and is available for archival purposes only. Registration and login is disabled.

Extract RGB from buf.puixels


Extract RGB from buf.puixels

Postby Maoz » Sep 9, 2003 @ 2:38pm

How can i extract the blue value for example from the RGB of a specific pixel.

//After fetching the pixel
uint16_t p = lockInfo.pixels[y * nPitch + x];

// What should i do here?

Thanks Maoz.
Maoz
 


Postby Guest » Sep 9, 2003 @ 6:15pm

when you have the 16 bit pixel value,
as in your code, you probably have a 565 format meaning 5 bits red, 6 bits green, 5 bits blue,
so do a bitwise 'and = &' operation on the pixel to remove the R & G component

eg: uint16_t pix = buffer[...];
int blueval = pix & 0x1F; // 0x1F = binary 11111
Guest
 


Postby fast_rx » Sep 9, 2003 @ 9:40pm

User avatar
fast_rx
pm Member
 
Posts: 660
Joined: Jun 10, 2003 @ 4:24pm


Return to PocketFrog & PocketHAL


Sort


Forum Description

SDKs for fast and robust device-independent access to Pocket PC display hardware.

Moderators:

sponge, Kzinti

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum