Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » [A5] Exempt Bitmap from Transform

This thread is locked; no one can reply to it. rss feed Print
[A5] Exempt Bitmap from Transform
Eric Johnson
Member #14,841
January 2013
avatar

Hi there. I'm using a run-of-the-mill transform that doubles the scale of the display.

void Routines::stretchDisplay(const int stretch_amount) {

  ALLEGRO_TRANSFORM transform;

  al_identity_transform(&transform);

  // Prepare to stretch the display by the given amount
  al_scale_transform(&transform, stretch_amount, stretch_amount);

  // Apply stretch
  al_use_transform(&transform);

  // EXAMPLE use: Routines.stretchDisplay(2); This doubles the scale (duh)
}

What I'd like to do is exempt a particular bitmap from said transform; everything but X bitmap would be scaled. Would you mind pointing me in the right directory in achieving this? Thank you kindly. 8-)

Thomas Fjellstrom
Member #476
June 2000
avatar

You can temporarily store that transform using al_store_state, set up an identity or ortho transform, use that, draw the bitmap, and then restore the state after.

There may be another way, but I think that works.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Peter Wang
Member #23
April 2000

Another fun thing to do is create a sub-bitmap, which would have an independent transform.

Go to: