//! adds an image. The returned pointer must not be dropped.
IGUIImage* CGUIEnvironment::addImage(const core::rect<s32>& rectangle, IGUIElement* parent, s32 id, const wchar_t* text)
{
	IGUIImage* img = new CGUIImage(this, parent ? parent : this,
	                               id, rectangle);

	if (text)
		img->setText(text);

	img->drop();
	return img;
}
//! Adds an image element.
IGUIImage* CGUIEnvironment::addImage(video::ITexture* image, core::position2d<s32> pos,
                                     bool useAlphaChannel, IGUIElement* parent, s32 id, const wchar_t* text)
{
	if (!image)
		return 0;

	core::dimension2d<s32> sz = image->getOriginalSize();
	IGUIImage* img = new CGUIImage(this, parent ? parent : this,
	                               id, core::rect<s32>(pos, sz));

	if (text)
		img->setText(text);

	if (useAlphaChannel)
		img->setUseAlphaChannel(true);

	img->setImage(image);

	img->drop();
	return img;
}