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

Started by
-1 comments, last by Afterlife 22 years, 6 months ago
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
------------------------------If there be no heaven,may there atleast be a hell.-------------------------------Afterlife-

This topic is closed to new replies.

Advertisement