Archived

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

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

This topic is 6177 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

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

1. 1
2. 2
frob
20
3. 3
Rutin
17
4. 4
5. 5

• 13
• 10
• 9
• 18
• 9
• Forum Statistics

• Total Topics
632555
• Total Posts
3007035

×