Jump to content
  • Advertisement

Archived

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

Afterlife

How to access points of a memory bitmap's line indivitually (allegro)

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

Edit : by vertical I mean of course horisontal.. I have one pixel line stored in a table like this :
            
unisgned char *temp=(unsigned char *)malloc(sizeof(unsigned char)*bitmap->w); //holds information for

one vertical bitmap line
//

ad = bmp_read_line(bitmap, y); //gets the address to read from

for (int x=0; x<bitmap->w; x+= sizeof(unsigned long))
	*((unsigned long *)&temp[x]) = bmp_read32(ad+x);
  
temp now contains the information of one vertical bitmap line, but now for the accessing part
      
for (int x=0; x<buffer->w; x+=sizeof(unsigned long))
{
	c = makecol(0,(int)((float)y*(256.0/(float)200)),(int)((float)x*(256.0/(float)320))); //a nice color effect

	*((unsigned long *)&temp[x])=c; //replaces temp[x] with the new color

}  
Only problem with that is, is that it only puts the new color to about the fourth of the temp (in the beginning). How do I access one pixel at a time from temp and fill the whole table? I was suggested to try this, but it only affected the colors. It is still drawn only on the left side of the line. :
                
for (int x=0; x<bitmap->w; x += sizeof(unsigned long)) 
{
int c = makecol(0,(int)((float)y*(256.0/(float)200)),(int)((float)x*(256.0/(float)320)));
*((unsigned long *)&temp[x]) = (c << 24) | (c << 16) | (c << 8) | c;
}
      
jeesus this source system is buggy :/ Edited by - Afterlife on October 20, 2001 6:25:09 AM Edited by - Afterlife on October 20, 2001 6:25:50 AM Edited by - Afterlife on October 20, 2001 6:26:42 AM Edited by - Afterlife on October 20, 2001 6:27:53 AM

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!