![]() |
|
|||||||
| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| Questions & Help Needed Post any question regarding Basic4ppc. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
I want to selectively get the Red, Green, or Blue value for a pixel. Ideally, I would like 3 functions: GetPixelRed(), GetPixelGreen(), and GetPixelBlue(). Each function would return a value from 0..255. This would better complement the existing SetPixel() function which takes 3 integers as arguments.
The existing GetPixel() function just returns a 32-bit value that I assume/suspect consists of the following byte fields Byte 3 = 0xFF Byte 2 = Red Value (0..255) Byte 1 = Green Value (0..255) Byte 0 = Blue Value (0..255) I could extract the particular R, G, or B value from this 32-bit value using some bitwise manipulation, but am concerned that the compiler wouldn't optimize it fast enough for my needs. Any ideas of what the fastest way to get a Red, Green, or Blue colour value from a pixel would be? Thanks,
__________________
Dell X50v WM2003 Wintec 100WBT GPS Great device... Dell should not have cancelled it!!!
|
|
||||
|
Try the following
ad three varables to the globals: R,G,B -This will be the color components The in the whatever sub try : RGB(R,G,B)=getpixel(x,y) msgbox("Your color is mador Red("&R&"), Green("&G&"), and Blue("&B&")") Please note that this is un-tested code...but i Think it will do what you want...
__________________
Paulo Gomes Porto, Portugal PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD PPC: Qtek9000, 1GB SD DLL Version Listing |
|
|||
|
I got something similar in one of my program.
vC = form1.GetPixel(x, y) + 16777216 vR = Int(vC / 65536) vG = Int((vC Mod 65536) / 256) vB = vC Mod 256 But that assumes the PPC is using 65535 colors, other color pallet will not work.
__________________
Yours, ![]() Dopod D810 WM6 GPS HSDPA 3G Wifi Bluetooth |
|
|||
|
Quote:
Thanks for your work at improving an impressive product.
__________________
Dell X50v WM2003 Wintec 100WBT GPS Great device... Dell should not have cancelled it!!!
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Forelayer text colour and weight! | agraham | Bug Reports | 4 | 10-09-2008 12:39 PM |
| Colour Values | Zenerdiode | Questions & Help Needed | 2 | 05-20-2008 06:01 AM |
| ploting just one pixel | colin9876 | Questions & Help Needed | 1 | 11-30-2007 07:38 PM |
| fastest way to search in database | Put Claude | Questions & Help Needed | 14 | 10-10-2007 09:53 PM |
| 2 pixel displacement | specci48 | Questions & Help Needed | 2 | 08-29-2007 07:04 PM |