Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Bug Reports
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Bug Reports Post about errors or bugs encountered.


color constants slightly off their readback value


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-11-2007, 08:42 AM
Basic4ppc Veteran
 
Join Date: Nov 2007
Posts: 316
Awards Showcase
Beta Tester 
Total Awards: 1
Default color constants slightly off their readback value

Erel can u post the list of what the color constants are actually set to?
Are they stored in a file or in the core of the Basic4ppc app?

Theres a slight problem that Ive come accross with some colors.
Due to 'rounding' on the screen. It would be better if colour constants were set to exactly what they will be read back as e.g.

plot (1,1,cPurple)
if getpixel(1,1)=cpurple then msgbox("True") else Msgbox("False")

...Will return False.!

Reason is screen R,G,B,s are stored to the nearest 8 for each R,G,B component
If the constants were set to the exact screen value the colors will still be the same but you could also use the color constants for checking pixels!

Last edited by colin9876 : 12-11-2007 at 08:47 AM.
Reply With Quote
  #2 (permalink)  
Old 12-11-2007, 11:00 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,143
Default

The color constants were tested to match both the device and the desktop.
It is possible that some devices change the color value a little bit different than other devices.
I've just checked cPurple and it matches correctly.
Reply With Quote
  #3 (permalink)  
Old 12-11-2007, 05:35 PM
Basic4ppc Veteran
 
Join Date: Nov 2007
Posts: 316
Awards Showcase
Beta Tester 
Total Awards: 1
Default example

cPurple is defined as = -8388480
RGB(128,0,128)

plot it and read it back gives -8126332
RGB(132,0,132)

What I was saying is better if cPurple defined as (132,0,132)
Looks exactly the same but reads back the same as it writes!

Last edited by colin9876 : 12-11-2007 at 05:39 PM.
Reply With Quote
  #4 (permalink)  
Old 12-11-2007, 06:33 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,704
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

Quote:
Originally Posted by colin9876 View Post
What I was saying is better if cPurple defined as (132,0,132) Looks exactly the same but reads back the same as it writes!
I think Erel knows what you are saying Colin but this is a well known artifact of mapping a large colour space onto a smaller one. Devices differ in the exact colour values used and so what is right for one device is not for another - as this purple example shows. It is correct for Erel's device but not yours. The way round it is to set then get a test pixel and use the value returned as the colout value.
Reply With Quote
  #5 (permalink)  
Old 12-11-2007, 07:01 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,143
Default

Quote:
Originally Posted by agraham View Post
The way round it is to set then get a test pixel and use the value returned as the colour value.
That is the recommended solution.
Reply With Quote
  #6 (permalink)  
Old 12-11-2007, 07:18 PM
Basic4ppc Veteran
 
Join Date: Nov 2007
Posts: 316
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Yes nice idea about write it & read it back to set it.

Just out of interest Erel what device did u try that cPurple did read and write at (128,0,128)?

All my pda phones read it back at (132,...) which is making me think that it is WM that does the rounding? - in which case all devices ought to be the same?
Reply With Quote
  #7 (permalink)  
Old 12-11-2007, 07:26 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,143
Default

I've tested it with a Windows Mobile 2003 device (HP hx2410).
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Hexadecimal constants? mjcoon Questions & Help Needed 5 06-19-2008 12:48 PM
Background Color im4retro Basic4ppc Wishlist 1 05-27-2008 06:11 PM
Background Color im4retro Questions & Help Needed 2 05-27-2008 04:55 PM
Image1.color cosmo15900 Questions & Help Needed 3 02-02-2008 10:47 PM
VB color value Leginus Questions & Help Needed 6 01-19-2008 11:58 AM


All times are GMT. The time now is 11:01 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0