ScreenShot of an area of the screen

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
xterminhate
Posts: 206
Joined: Thu Sep 01, 2005 9:26 pm
Location: France

ScreenShot of an area of the screen

Post by xterminhate »

I'm using this portion of code to make a screenshot :

Code: Select all

IImage * img = driver->createScreenShot();
std::string filename = "xxx.png"; /// ...cut...
driver->writeImageToFile( img, filename.c_str() );
img->drop();
I would like to write in a PNG file an area of the screen. IImage interface do not allow to clip the image, how can I do ?

Thanks for help.

Xterminhate.
Return to Irrlicht after years... I'm lovin it.
It's hard to be a Man !
Si vis pacem para belum
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

You could use getPixel and setPixel (slow), or you could take CImage.h/cpp from the source directory and use the image copying constructor-

Code: Select all

	//! constructor using a part from another image
	CImage(IImage* imageToCopy,
		const core::position2d<s32>& pos, const core::dimension2d<s32>& size);
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Some more CImage methods will be exposed soon for Irrlicht 1.5. Also this one probably...
xterminhate
Posts: 206
Joined: Thu Sep 01, 2005 9:26 pm
Location: France

Post by xterminhate »

Thanks for your help. :)

Good news about IImage 1.5 !
Return to Irrlicht after years... I'm lovin it.
It's hard to be a Man !
Si vis pacem para belum
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

Yeah I hope there will be functionality to actually create a blank CImage, I'm finding currently it's only possible by creating an actual hardware texture first then copying that to the image, or by manually allocating a block of memory, which can be tricky when you have to consider different colour formats etc.

Cheers
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Post Reply