resizing a 2D Image

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
sevans
Posts: 6
Joined: Thu Mar 01, 2007 6:00 am

resizing a 2D Image

Post by sevans »

Hi, I would like to display an image on my GUI. The image is not the correct size all of the time. Is there a way that I can draw this image resized to fit the dimensions i need? The image size is variable so making copies of the 2d image is not an option.

Thanks much,

sevans
jeffm2501
Posts: 9
Joined: Sat Sep 23, 2006 4:07 pm
Location: California, US
Contact:

Post by jeffm2501 »

If you are using IVideoDriver::draw2DImage, it has a version that takes a destRect. You can make that destination rect be any size, and it will be scaled to fit.

Code: Select all

virtual void draw2DImage(video::ITexture* texture, const core::rect<s32>& destRect,
			const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0,
			video::SColor* colors=0, bool useAlphaChannelOfTexture=false) = 0;
JeffM2501
Post Reply