Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

how to stretch bitmap?

Greetings,

I'm still working on my custom transitions, and I almost have it working the way I want. In fact, it works flawlessly, if I create my transition image at the proper size to fill the screen, but one of my games will have a setting in the menu where the player can choose what resolution to play in. Now, as it is, I can set it to use a certain transition graphic depending on the resolution, but I'd rather not have multiple copies of each transition for each resolution. instead, i would like just one of each transition, and stretch it to fit the window in game. Unfortunately, I do not fully understand the description of Bitmap.stretch_blt as it does not give an understandable example. Can someone help me with this?

how do I stretch a 640x480 graphic to 800x600?

Thank you,

Draycos Goldaryn

[EDIT] I forgot to mention, I'm using RMXP [/EDIT]
 
thank you. i had a bit of a problem at first. this is what i tried:
Code:
      @pic.bitmap = Bitmap.new(".\\Graphics\\Transitions\\"+image+".png")

      @pic.bitmap.stretch_blt(Rect.new(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), @pic.bitmap, Rect.new(0, 0, @pic.bitmap.width, @pic.bitmap.height))

 
but nothing showed up at all. Then I tried:
Code:
      bmp = Bitmap.new(".\\Graphics\\Transitions\\"+image+".png")

      @pic.bitmap = bmp

      @pic.bitmap.stretch_blt(Rect.new(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), bmp, Rect.new(0, 0, bmp.width, bmp.height))

 
but it did not stretch the image. then i took one more look at the help file, and tried:
Code:
      bmp = Bitmap.new(".\\Graphics\\Transitions\\"+image+".png")

      @pic.bitmap = Bitmap.new(SCREEN_WIDTH, SCREEN_HEIGHT)

      @pic.bitmap.stretch_blt(Rect.new(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), bmp, Rect.new(0, 0, bmp.width, bmp.height))

 
and it worked! Moral of the story, create a blank bitmap at the size I want, then stretch a bitmap defined elsewhere into the empty one.

Thank you for all your help.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top