![]() |
|
This thread is locked; no one can reply to it.
![]() ![]() |
1
2
|
Bitmap Draw Stacking |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
SiegeLord said: Lastly, there is a function to simplify this process a bit: ALLEGRO_TRANSFORM T; al_build_transform(&T, this->getX() + this->width / 2, this->getY() + this->height / 2, this->getScale(), this->getScale(), this->getRotation()); al_use_transform(&T); al_draw_bitmap(bmp, -this->width / 2, -this->height / 2, 0, 0);
It's missing the first translation, that's all. So it actually wouldn't work, because al_build_transform sets the identity first. 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 |
Trent Gamblin
Member #261
April 2000
![]() |
Elias said: Why don't we have an al_draw_rotated_scaled_bitmap_region function? The function name is long, yes - and you can do the same thing with transformations. But we have all the other variants for doing it in a single function call so why not this? I think it would be good, too. It's a fairly common thing to want to do, so it's a reasonable thing to add. If it weren't for the new test cases needed I could add it tomorrow. I haven't looked at adding test cases yet so I have no idea if it's a big deal. I might try it anyway if I remember this thread... but that's not a promise.
|
SiegeLord
Member #7,827
October 2006
![]() |
Edgar Reynaldo said: It's missing the first translation, that's all. No, it's not. As my diagram showed, it got transfered to the coordinates passed to al_draw_bitmap: ALLEGRO_TRANSFORM T; al_build_transform(&T, this->getX() + this->width / 2, this->getY() + this->height / 2, this->getScale(), this->getScale(), this->getRotation()); al_use_transform(&T);
"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18 |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
Wouldn't you have to modify the final translation in al_draw_bitmap to account for the scaling performed in al_build_transform though? And what about the rotation? It's scaled, then rotated about its top left corner, which is not what you want. 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 |
SiegeLord
Member #7,827
October 2006
![]() |
Edgar Reynaldo said: final translation in al_draw_bitmap The translation in al_draw_bitmap is applied first, and then it is transformed using the current transformation. Doing it the other way wouldn't make any sense (it would make it clunky to use the transformations for a camera system, for example). "For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18 |
Elias
Member #358
May 2000
|
Trent Gamblin said: I think it would be good, too. It's a fairly common thing to want to do, so it's a reasonable thing to add. If it weren't forithe new test cases needed I could add it tomorrow. I haven't looked at adding test cases yet so I have no idea if it's a big deal. I might try it anyway if I remember this thread... but that'snot a promise.
I can also add it, just could have been that there's a reason against. -- |
|
1
2
|