Sign in to follow this  
vaneger

Reading color of individual pixels in bitmap(allegro)

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
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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this