RMMV I cannot extend a picture / bitmap.

Orenix

Warper
Member
Joined
May 28, 2016
Messages
3
Reaction score
4
First Language
French
Primarily Uses
Hey! I am developing a plugin for my project that displays a screen of where the player is saving.

Depending on the screen resolution, I need to enlarge or shrink this image.

The reduction is done without any problem with the code below. On the other hand, as soon as I try to enlarge, even by 1%, the image is not displayed.

Anyone know why?

JavaScript:
Window_SaveInfo.prototype.updateCountdown = function() {
  if (this._countdown > 0) {
    this._countdown -= 1;
    if (this._countdown <= 0) this.refreshPic();
  }
};

Window_SaveInfo.prototype.refreshPic = function() {
  if (this._countdown > 0) return;
    var id = this.savefileId();
  this.drawPicture("Save" + id, 0, 370);
};


Window_SaveInfo.prototype.drawPicture = function(pictureName, x, y) {
    var bitmap = ImageManager.loadPicture(pictureName);
    var testx = (1640 / bitmap.width);
    var testy = (496 / bitmap.height);
    var pw = (testx * bitmap.width);
    var ph = (testy * bitmap.height);
    var sx = 0;
    var sy = 0;
    this.contents.blt(bitmap, sx, sy, pw, ph, x, y);
    if (bitmap.width <= 0 && this._countdown <= 0) {
    this._countdown = 5;
    this.refreshPic();
    }
};
Thanks for your help !
 

ShadowDragon

Veteran
Veteran
Joined
Oct 8, 2018
Messages
2,895
Reaction score
1,029
First Language
Dutch
Primarily Uses
RMMV
this line probably dont work correctly, while you use testx and testy

this.contents.blt(bitmap, sx, sy, pw, ph, x, y);

I think if you want to scale it correctly, use (Graphics.boxWidth - X) / Y;

X for the pixels, and Y to divide it to fit, depending if its in the window or not.
if the image become to large than the window, it's either cut off, or not visible.
 

Orenix

Warper
Member
Joined
May 28, 2016
Messages
3
Reaction score
4
First Language
French
Primarily Uses
Sorry but I couldn't get it to work with your code, the result was the same as mine.

However, I found a solution!

I went from

this.contents.blt (bitmap, sx, sy, pw, ph, x, y,);

at

this.contents.blt (bitmap, sx, sy, pw, ph, x, y, w, h);
w and h being the final values of the resize.

Thank you anyway for your help!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.

Forum statistics

Threads
105,868
Messages
1,017,083
Members
137,583
Latest member
write2dgray
Top