Пример #1
0
////////////////////////////////////////////////////////////
/// Get a read-only pointer to the array of pixels of an image (8 bits integers RGBA)
/// Array size is sfImage_GetWidth() x sfImage_GetHeight() x 4
/// This pointer becomes invalid if you reload or resize the image
////////////////////////////////////////////////////////////
const sfUint8* sfImage_GetPixelsPtr(sfImage* Image)
{
    CSFML_CALL_RETURN(Image, GetPixelsPtr(), NULL);
}
Пример #2
0
bool cImage::SaveToFile( const std::string& filepath, const EE_SAVE_TYPE& Format ) {
	bool Res = false;

	std::string fpath( FileSystem::FileRemoveFileName( filepath ));

	if ( !FileSystem::IsDirectory( fpath ) )
		FileSystem::MakeDir( fpath );

	if ( NULL != mPixels && 0 != mWidth && 0 != mHeight && 0 != mChannels ) {
		if ( SAVE_TYPE_JPG != Format ) {
			Res = 0 != ( SOIL_save_image ( filepath.c_str(), Format, (Int32)mWidth, (Int32)mHeight, mChannels, GetPixelsPtr() ) );
		} else {
			jpge::params params;
			params.m_quality = JpegQuality();
			Res = jpge::compress_image_to_jpeg_file( filepath.c_str(), mWidth, mHeight, mChannels, GetPixelsPtr(), params);
		}
	}

	return Res;
}