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

Lighter and Darker..


Lighter and Darker..

Postby brendan » Oct 22, 2002 @ 4:00am

If I have a 16 bit PIXEL consisting of

RRRRRGGGGGGBBBBB how can I make the current content lighter and darker, keeping the same "Hue", i.e a dark red to a light red, is there a simple bit shift that can be performed am using easyce, does it have anything built in?

-B
User avatar
brendan
pm Insider
 
Posts: 451
Joined: Oct 23, 2001 @ 2:51am
Location: Hobart, Australia


Postby superman » Oct 22, 2002 @ 4:27am

To make a color darker, decrease each value by the same value until it reaches zero.

ex.

red (in rgb format)
255, 0, 0

to make a slightly darker red, subtract 25 from each value unless that value is 0, and if the value is < 25, set it to zero.

result: a slightly darker red
230, 0, 0

Now an example with R, G, and B values:

light gray:
192, 192, 192

reduced by 64 on each value yields dark gray
128, 128, 128

By subtracting the same number from each color value, you effectively lower the luminance of the color. To make the color lighter, simply add the same number to each of the R, G, and B values.
"Kittens give Morbo gas." - Morbo the News Monster
User avatar
superman
pm Member
 
Posts: 99
Joined: Nov 3, 2001 @ 1:09am


Postby brendan » Oct 22, 2002 @ 4:43am

yep, I know that, I was hoping that there was a bit mask (somthing) etc that could be performed on it, otherwise I'll have to so some fancy shifting or splitting it up.....
User avatar
brendan
pm Insider
 
Posts: 451
Joined: Oct 23, 2001 @ 2:51am
Location: Hobart, Australia


Postby brendan » Oct 22, 2002 @ 5:33am

User avatar
brendan
pm Insider
 
Posts: 451
Joined: Oct 23, 2001 @ 2:51am
Location: Hobart, Australia


yeah

Postby golan_trevize_x » Oct 22, 2002 @ 5:52am

I don't think mine is any more efficient than that really. Basically reducing the value of the R, G and B separately then putting 'em back together.

A faster way might be to use a series of bitmasks which you prepare beforehand, like hardcoded or something, but it's obviously not as elegant.
golan_trevize_x
pm Member
 
Posts: 67
Joined: Nov 23, 2001 @ 7:36pm
Location: Melbourne, Australia


Postby refractor » Oct 22, 2002 @ 9:36am

User avatar
refractor
pm Insider
 
Posts: 2304
Joined: Feb 5, 2002 @ 1:12pm
Location: Luxembourg


Postby Dave H » Oct 23, 2002 @ 10:05pm

Dave H.
Lead Programmer (Repton PPC/7650)
[url=http://www.handango.com/PlatformProductDetail.jsp?productId=43741]
Buy Repton Online here!
[/url]
User avatar
Dave H
pm Member
 
Posts: 164
Joined: Oct 3, 2002 @ 5:01pm


Adding two colors?

Postby Malmer » Oct 26, 2002 @ 4:05pm

All your base are belong to us
User avatar
Malmer
pm Member
 
Posts: 768
Joined: Apr 26, 2001 @ 5:15pm
Location: Sweden


Postby Dan East » Oct 26, 2002 @ 5:12pm

User avatar
Dan East
Site Admin
 
Posts: 5264
Joined: Jan 25, 2001 @ 5:19pm
Location: Virginia, USA


Postby Dave H » Oct 26, 2002 @ 7:19pm

Dave H.
Lead Programmer (Repton PPC/7650)
[url=http://www.handango.com/PlatformProductDetail.jsp?productId=43741]
Buy Repton Online here!
[/url]
User avatar
Dave H
pm Member
 
Posts: 164
Joined: Oct 3, 2002 @ 5:01pm


Postby Digby » Oct 26, 2002 @ 7:50pm

Digby
pm Insider
 
Posts: 1011
Joined: Apr 29, 2001 @ 1:53pm


Return to Windows Mobile


Sort


Forum Description

A discussion forum for mobile device developers on the Windows Mobile platform. Any platform specific topics are welcome.

Moderators:

Dan East, sponge, Digby, David Horn, Kevin Gelso, RICoder

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

cron