look like drawn with a pen/pencil

Started by
11 comments, last by Oluseyi 16 years, 7 months ago
Quote:Original post by MadsGustaf
Sorry for probaly asking a dumb question,but im not very familiar with graphiclal programming.How can i get the intensity from the pixel(/or is it from the whole image) I know there probaly is a function for that in allegro, but i couldnt seem to find one. Do i get this information when i draw the image?

If you've got a greyscale/black and white image the colour *is* the intensity. Since the red, green and blue channels will be the same you just have to pick one and ignore the others.
Advertisement
this is o-some.
[size="2"]I like the Walrus best.
Quote:Original post by MadsGustaf
How can i get the intensity from the pixel(/or is it from the whole image)? I know there probably is a function for that in allegro, but i couldn't seem to find one. Do i get this information when i draw the image?

The technique being employed here is to take a small bitmap and use it as a "brush" by rendering it to the screen repeatedly. This brush is greyscale, with each pixel in it thus representing an intensity - all the channels (R, G, B) have the same value, and the "intensity" is what percentage of the channel max (255) that value is. So if you have a pixel with the value (64, 64, 64), that is an overall intensity of 64 / 255 * 100 → 25.09%

You then select a single color (RGB) to shade the entire brush, allowing you to generate lines that look like crayon. For each position of your virtual crayon, you draw the brush modulated by the color value. So if my color is peach (238, 203, 173), with an intensity level of 25.09%, the pixel at that corresponding point in the brush has a final RGB value of:
238 * 25.09% → 59.71 → 60203 * 25.09% → 50.93 → 51173 * 25.09% → 43.40 → 43


→ (60, 51, 43)

This topic is closed to new replies.

Advertisement