Resize an image
-
- Posts: 73
- Joined: Thu Apr 05, 2007 7:01 pm
- Location: France
- Contact:
Resize an image
Hi all, i would like to resize an image with Irrlicht but i don't know how to do
I've juste read this topic: http://irrlicht.sourceforge.net/phpBB2/ ... size+image
But istill don't know how to do
Acutally i would like to load an image, and to resize it to display it with the new size, but i don't want the image to be saved.
Is someone can tell me how to do?
Or if it is not possible with Irrlicht, can you tell me how to do generally?
Thanks a lot.
I've juste read this topic: http://irrlicht.sourceforge.net/phpBB2/ ... size+image
But istill don't know how to do
Acutally i would like to load an image, and to resize it to display it with the new size, but i don't want the image to be saved.
Is someone can tell me how to do?
Or if it is not possible with Irrlicht, can you tell me how to do generally?
Thanks a lot.
When you want you can!
Quand on veut on peut!
Quand on veut on peut!
Load a texture and use draw2dimage.
Example:
________
Honda Cbx750 Specifications
Example:
Code: Select all
SaveGameTexture=driver->getTexture("save005.bmp");
driver->draw2DImage(SaveGameTexture, rect<s32>(300,30,620,270), rect<s32>(0,0,640,480));
Honda Cbx750 Specifications
Last edited by LLDD on Sun Feb 20, 2011 2:10 am, edited 1 time in total.
-
- Posts: 73
- Joined: Thu Apr 05, 2007 7:01 pm
- Location: France
- Contact:
The first parameter is the texture you want to draw.The BasheR wrote:Ok, but what does this method do exactly? I read the documentation for this method but i don't exactly understand the meaning of all the parameters
Second parameter is a rectangle on the screen where you want to draw the image.
Third parameter is a rectangle of the portion of your image that will be drawn.
________
Rhode Island Medical Marijuana Dispensary
Last edited by LLDD on Sun Feb 20, 2011 2:11 am, edited 1 time in total.
-
- Posts: 73
- Joined: Thu Apr 05, 2007 7:01 pm
- Location: France
- Contact:
Ok thank, but i would like to use it with transparence so i use it like as following:
But i have this error:
"error: no matching function for call to `irr::video::IVideoDriver::draw2DImage(irr::video::ITexture*&, irr::core::rect<irr::s32>&, irr::core::rect<irr::s32>&, int, irr::video::SColor, bool)'"
So how can i do to use it with SColo and the boolean, but without having this error?
Thanks
Code: Select all
mp_driver->draw2DImage(mp_image, mt_rect_dest[i],
mt_rect[i], 0, SColor(255,255,255,255), true);
"error: no matching function for call to `irr::video::IVideoDriver::draw2DImage(irr::video::ITexture*&, irr::core::rect<irr::s32>&, irr::core::rect<irr::s32>&, int, irr::video::SColor, bool)'"
So how can i do to use it with SColo and the boolean, but without having this error?
Thanks
When you want you can!
Quand on veut on peut!
Quand on veut on peut!
-
- Posts: 73
- Joined: Thu Apr 05, 2007 7:01 pm
- Location: France
- Contact:
I guess that this might be the function you are searching for:
So try something like this:
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;
Code: Select all
SColor colors[4];
for(int i=0; i<4; ++i)
colors[i] = SColor(100,255,255,255);
mp_driver->draw2DImage(mp_image, mt_rect_dest[i], mt_rect[i], 0, colors, true);
-
- Posts: 73
- Joined: Thu Apr 05, 2007 7:01 pm
- Location: France
- Contact:
Thank you that is working, but what have we to initialize colors like this:
Code: Select all
SColor colors[4];
for(int i=0; i<4; ++i)
colors[i] = SColor(100,255,255,255);
When you want you can!
Quand on veut on peut!
Quand on veut on peut!
You can just use:
where 100 is the alpha value and 255,255,255 tells Irrlicht to use the colors of the image without filtering.
Code: Select all
mp_driver->draw2DImage(mp_image, mt_rect_dest[i], mt_rect[i], 0, SColor(100,255,255,255), true);
-
- Posts: 73
- Joined: Thu Apr 05, 2007 7:01 pm
- Location: France
- Contact:
Now I'm confused too. In ivideodriver.h there is also a draw2dimage definition with one SColor. That works fine for me, or am I just lucky?Just read the API documentation for the function. You have to pass an array of four colors which are used as base colors for the four corners of the image. If you use only one color you will get a buffer overrun (which might give you wrong colors or simply a crash).
-
- Posts: 73
- Joined: Thu Apr 05, 2007 7:01 pm
- Location: France
- Contact: