Jump to content
  • Advertisement
Sign in to follow this  
vaneger

Reading color of individual pixels in bitmap(allegro)

This topic is 4820 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

I'm trying to create a program that will make a mosaic like picture by reading the color of a pixel and surrounding pixels, thereby determining what that area's color should be; then I'd make a new bitmap made up of other bitmaps . So how can i read a pixels color in a bitmap using allegro?

Share this post


Link to post
Share on other sites
Advertisement
How you do depends on what kind of bitmap you've got. This page should give you details.

Edit: you can also use getpixel(), but that tends to be less efficient than direct memory access.

Share this post


Link to post
Share on other sites
i looked there but im not sure how read_line can determine the color of a pixel. i think getpixel is actually the thing i wanted though.

Share this post


Link to post
Share on other sites
If you can guarantee that it's a memory bitmap (like, calling create_memory_bitmap()), your_bitmap->line[y][x] is the fastest way. Otherwise, you'd need to use some form of getpixel().

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!