|
A5 Bitmap Edges |
James Bunting
Member #30
April 2000
|
When I tile 32x32 pixel bitmaps at 32 pixel intervals I am getting a gap of 1 pixel on the right and lower edge of each bitmap. I am using al_draw_bitmap() ... Is this normal behaviour for A5? Any ideas? |
Edgar Reynaldo
Major Reynaldo
May 2007
|
Are you sure your bitmaps are 32x32? It would be hard to screw that up though.... Are you sure TILE_W and TILE_H are correct as well? That would be hard to screw up too.... al_draw_bitmap only takes x and y, so if the width and height are wrong, then it is either that the bitmap is the wrong size, or you are putting it in the wrong spot. Do you get the same problem with al_draw_scaled_bitmap? My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
James Bunting
Member #30
April 2000
|
Thanks for the input. I worked it out in the end. The tile images were originally imported using al_draw_pixel() which misaligned the pixels. Importing the tiles again using al_put_pixel() fixed it. James |
Edgar Reynaldo
Major Reynaldo
May 2007
|
So did you just not draw all the way to the edge of the source bitmaps then? Anyway, glad it's sorted out. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
James Bunting
Member #30
April 2000
|
Yes. Same loop, same bounds, same code. draw_pixel() shifted all of the pixels to the left -1 and top -1 thus offsetting the bitmap and totally missing the right and bottom lines. The A5 docs state that this function may not put pixels extactly where specified although I just picked up the function by name and did not read the function's manual entry. James |
Matthew Leverton
Supreme Loser
January 1999
|
James Bunting said: The A5 docs state that this function may not put pixels extactly where specified It does draw them exactly where specified, but it may not be where you expect them to be if you don't understand how the graphics in 5.0 work. Pixel centers are at (+0.5,+0.5) so if you use al_draw_pixel() to draw full pixels on an integer grid, you'd need to add 0.5 to the coordinates. |
Dizzy Egg
Member #10,824
March 2009
|
Matthew Leverton said: Pixel centers are at (+0.5,+0.5) so if you use al_draw_pixel() to draw full pixels on an integer grid, you'd need to add 0.5 to the coordinates Why? See, I'm still scared to leave 4.2...
---------------------------------------------------- |
Thomas Fjellstrom
Member #476
June 2000
|
Dizzy Egg said: Why? See, I'm still scared to leave 4.2... That's how the hardware does it. When you render a pixel or a line or what have you with normal accelerated operations, the hardware checks to see if the centre of a pixel is filled before actually filling it. -- |
Elias
Member #358
May 2000
|
And it becomes especially important when you use multisampling. Which can look much better than the old-style pixel-by-pixel look you get in A4. -- |
|