Good day,
I'm trying to put text on image and execute the following code:
loadPicture() returns the bitmap, and I see that contents.blt() should modify the window bitmap, but for some reason drawTextEx overwrites the changes.
What am I doing wrong? Maybe is there anybody solved a similar problem?
Thank you!
I'm trying to put text on image and execute the following code:
JavaScript:
function createTextPicture(text) {
const tempWindow = new Window_Base(new Rectangle());
const size = tempWindow.textSizeEx(text);
tempWindow.padding = 0;
tempWindow.move(0, 0, 500,500);
tempWindow.createContents();
let img = ImageManager.loadPicture('1');
const pw = img.width;
const ph = img.height;
tempWindow.contents.blt(img, pw, ph, pw, ph, pw, ph);
tempWindow.drawTextEx(text, 400, 400, 0);
const bitmap = tempWindow.contents;
tempWindow.contents = null;
tempWindow.destroy();
bitmap.mzkp_isTextPicture = true;
return bitmap;
}
loadPicture() returns the bitmap, and I see that contents.blt() should modify the window bitmap, but for some reason drawTextEx overwrites the changes.
What am I doing wrong? Maybe is there anybody solved a similar problem?
Thank you!