[Solved] scale an image drawed by draw2Dimage method

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
stefbuet
Competition winner
Posts: 495
Joined: Sun Dec 09, 2007 4:13 pm
Location: france

[Solved] scale an image drawed by draw2Dimage method

Post by stefbuet »

Hi,

I'm currently using the draw2DImage method from irr 1.4.2 however I would like to change the size of the image displayed instead of repeating it more times to complete the rectangle to fill...
I managed with some randomly values to change the scale Y of an image but it was really randomly, when I added 50px to the rectangle source, the image source size scaled up, but when adding 49 or 51, nothing.
So, is there a way to change images sizes with this method, or with another ?

Thank,

Stef.
Last edited by stefbuet on Fri Dec 26, 2008 12:33 pm, edited 1 time in total.
Aelis440
Posts: 52
Joined: Sun Oct 05, 2008 8:45 pm

Post by Aelis440 »

If you're using Visual Studio 2005, you want the 2nd overloaded draw2dImage function (2 / 4), it should read something like this

Code: Select all

driver->draw2DImage(background, rect<s32>(leftX1, leftY1, bottomX2, bottomY2), rect<s32>(0, 0, bottomWidth, totalHeight), 0, 0, true);
-Where background is your image

-the first rect is your preferred "size"

-the second rect is the dimensions of your image (the actual dimensions, you can see this in details view of windows explorer or a photo editing program like Photoshop). For instance, if your image was 342 x 831, that rect should read, "rect<s32>(0, 0, 342, 831)".

-you probably don't care about the 4th parameter unless you want do so some clipping,

-the 5th paramater is an SColor, you probably dont want that either since you are using an image

-and the last paramter is whether or not the image should use alpha (careful though, this is not standard alpha like in .tga files. If you want more explanation of this just ask)
stefbuet
Competition winner
Posts: 495
Joined: Sun Dec 09, 2007 4:13 pm
Location: france

Post by stefbuet »

Hi,
I didn't see that all draw2DImage hadn't same first parameters. I thought in all there fonction the second parameter was a position<s32> but looking closer I saw it was a rect :)
Thank :wink:
Post Reply