Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Big problem with Canvas.Pixels, Small sample included

This topic is 5645 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, can anybody help me with this one? For my own painter program I want to have a drawing method, to draw existing pixels brighter/darker. that makes it easier to make it look more 3d style. i have a little sample program, source included. Paint sample http://www.ericbehme.de\samplepaint.zip Just move the trackbar to -5 or +5 and draw on the bigger picture using mouse (left click) where the color is not black. the pixels will become brighter or darker. This works for values (trackbar) -5,-4,+4,+5 but not for the other values, it can't work for 0. There is a function (farbig) which takes the pixels rgb value and makes them brighter/darker, the result seems to be ok, but I only see in the picture the bigger changes, even if I set it to -2 and click on the same pixel 10 times. this is really very important for me, can anybody help me out? That would be great, thanks! Visit my homepage www.ericbehme.de Don't miss the download section

Share this post

Link to post
Share on other sites

I modified the Farbig function and it now reads.....

function tform1.Farbig(Alt:Tcolor;Abweich:extended):tcolor;
var rot,gruen,blau: integer;
ra,ga,ba: extended;
farb,fsub: string;
if rot>0 then ra:=rot/ges;
if gruen>0 then ga:=gruen/ges;
if blau>0 then ba:=blau/ges;
if blau>0 then blau:=blau+round(ba*abweich);
if rot>0 then rot:=rot+round(ra*abweich);
if gruen>0 then gruen:=gruen+round(ga*abweich);
if blau>255 then blau:=255;
if blau<0 then blau:=0;
if rot>255 then rot:=255;
if rot<0 then rot:=0;
if gruen>255 then gruen:=255;
if gruen<0 then gruen:=0;

The division by ges was too harsh and suppressed small increases.

Hope this helps


Don''t follow me, I''m lost.

Share this post

Link to post
Share on other sites
Thank you very much Stevie.
The main problem was 16bit are too less colors, I changed my pixelformat to 24 bit, and now every rgb-Value works perfect, even very little changes.

Share this post

Link to post
Share on other sites
My tests were done in 24 Bits and the small increases were killed by the division by the sum of the colours.

Anyway, glad to have helped.


Don''t follow me, I''m lost.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!