/*!
\b parameters:

\arg \b pNewSurface             Pointer to a new surface object
\arg \b pName                   Name of the file that contains the image
\arg \b pBlockSize              Width of the blocks
\arg \b pType                   Type of surface (see ::IND_Type)
\arg \b pQuality                Quality of surface (see ::IND_Quality)
\arg <b>pR, pG, pB</b>          Color from which the colorkey will be applied, this areas will become transparent.

\b Operation:

This function returns 1 (true) if the parameter surface object exists and it is added satisfactory
to the manager loading the image directly from a file. This method is useful for creating scrolls because we
can specify the width of the block. Blocks outside the viewport will be automatically discarded.

Graphic formats supported (Thanks to http://openil.sourceforge.net):
bmp, png, tga, jpg and pcx.
*/
bool IND_SurfaceManager::add(IND_Surface    *pNewSurface,
                             char            *pName,
                             int             pBlockSize,
                             IND_Type        pType,
                             IND_Quality     pQuality,
                             BYTE pR,
                             BYTE pG,
                             BYTE pB) {
	// Image loading
	IND_Image *mNewImage = new IND_Image;
	if (!_imageManager->add(mNewImage, pName))
		return 0;

	// Color key
	mNewImage->setAlpha(pR, pG, pB);

	// Surface creation
	if (!addMain(pNewSurface, mNewImage, pBlockSize, pBlockSize, pType, pQuality)) {
		_imageManager->remove(mNewImage);
		return 0;
	}

	// Free image
	_imageManager->remove(mNewImage);

	return 1;
}
/*!
\b parameters:

\arg \b pNewSurface             Pointer to a new surface object
\arg \b pImage                  Pointer to a  ::IND_Image object
\arg \b pBlockSize              Width of the blocks.
\arg \b pType                   Type of surface (see ::IND_Type)
\arg \b pQuality                Quality of surface (see ::IND_Quality)

\b Operation:

This function returns 1 (true) if the parameter surface object exists and it is added
to the manager loading the image directly from a file. This method is useful for creating scrolls because we
can specify the width of the block. Blocks outside the viewport will be automatically discarded.
*/
bool IND_SurfaceManager::add(IND_Surface    *pNewSurface,
                             IND_Image       *pImage,
                             int             pBlockSize,
                             IND_Type        pType,
                             IND_Quality     pQuality) {
	if (!addMain(pNewSurface, pImage, pBlockSize, pBlockSize, pType, pQuality))
		return 0;

	return 1;
}
/*!
\b parameters:

\arg \b pNewSurface             Pointer to a new surface object
\arg \b pImage                  Pointer to a ::IND_Image object
\arg \b pType                   Type of surface (see ::IND_Type)
\arg \b pQuality                Quality of surface (see ::IND_Quality)

\b Operation:

This function returns 1 (true) if the parameter surface object exists and it is added
to the manager, loading the image directly from a ::IND_Image object.
*/
bool IND_SurfaceManager::add(IND_Surface    *pNewSurface,
                             IND_Image       *pImage,
                             IND_Type        pType,
                             IND_Quality     pQuality) {
	// Surface creation
	if (!addMain(pNewSurface, pImage, 0, 0, pType, pQuality))
		return 0;

	return 1;
}
Пример #4
0
void CmdAdd::ExecuteIntern() {
	if (checkSizeGreater(3)) {
		// Try casting of second argument to Path
		try {
			const Path path(getArgument(1)); // Number in path are one-based

			addToGroup(path);
		} catch (const PathNotValidException & ex){
			const Path path(Helpers::convertToString(specification->size() + 1)); // Number in path are one-based

			addMain(path);
		}
	}
}
/*!
\b parameters:

\arg \b pNewSurface             Pointer to a new surface object
\arg \b pName                   Name of the file that contains the image
\arg \b pBlockSize              Width of the blocks
\arg \b pType                   Type of surface (see ::IND_Type)
\arg \b pQuality                Quality of surface (see ::IND_Quality)

\b Operation:

This function returns 1 (true) if the parameter surface object exists and it is added satisfactory
to the manager loading the image directly from a file. This method is useful for creating scrolls because we
can specify the width of the block. Blocks outside the viewport will be automatically discarded.

Graphic formats supported (Thanks to http://openil.sourceforge.net):
bmp, png, tga, jpg and pcx.
*/
bool IND_SurfaceManager::add(IND_Surface    *pNewSurface,
                             char            *pName,
                             int             pBlockSize,
                             IND_Type        pType,
                             IND_Quality     pQuality) {
	IND_Image *mNewImage = new IND_Image;
	if (!_imageManager->add(mNewImage, pName))
		return 0;

	if (!addMain(pNewSurface, mNewImage, pBlockSize, pBlockSize, pType, pQuality))
		return 0;

	_imageManager->remove(mNewImage);

	return 1;
}
/*!
\b parameters:

\arg \b pNewSurface             Pointer to a new surface object
\arg \b pName                   Name of the file that contains the image
\arg \b pType                   Type of surface (see ::IND_Type)
\arg \b pQuality                Quality of the surface (see ::IND_Quality)

\b Operation:

This function returns 1 (true) if the parameter surface object exists and it is added
by loading the image directly from the file.

Graphic formats supported (Thanks to http://openil.sourceforge.net):
bmp, png, tga, jpg and pcx.
*/
bool IND_SurfaceManager::add(IND_Surface    *pNewSurface,
                             char            *pName,
                             IND_Type        pType,
                             IND_Quality     pQuality) {
	// Loads the image
	IND_Image *mNewImage = new IND_Image();
	if (!_imageManager->add(mNewImage, pName))
		return 0;

	// Surface creation
	if (!addMain(pNewSurface, mNewImage, 0, 0, pType, pQuality)) {
		_imageManager->remove(mNewImage);
		return 0;
	}

	// Free image
	_imageManager->remove(mNewImage);

	return 1;
}