![]() |
CRM64Pro GDK v0.14.0
A free cross-platform game development kit built on top of SDL 3.0
|
Image Object class.
Public Member Functions | |
| bool | info (Sint32 iMode=0) override |
| Request Image object information. | |
| const string & | getName () const override |
| Get the name. | |
| Uint32 | getID () const override |
| Get the ID. | |
| bool | assignSurface (SDL_Surface *pSurf, Sint32 iOwnership=0) |
| Assign a SDL_Surface to this image. | |
| Sint32 | setOwner (Sint32 iOwner) |
| Set the owner of this image. | |
| Sint32 | getOwner () const |
| Get the owner of this image. | |
| Sint32 | optimize (Sint32 idScreen=0) |
| Optimize the image for rendering on screens in the most efficient way. | |
| bool | rebuild () |
| Rebuild texture(s). | |
| Sint32 | render (Sint32 idRes=0, SDL_FRect *rSrc=nullptr, SDL_FRect *rDst=nullptr) |
| Render the image. | |
| Sint32 | renderEx (const double dAngle, const SDL_FPoint *poCenter=nullptr, const SDL_FlipMode rf=SDL_FLIP_NONE, Sint32 idRes=0, SDL_FRect *rSrc=nullptr, SDL_FRect *rDst=nullptr) |
| Render the image with extended attributes: can rotate and flip the image. | |
| Sint32 | applyFilter (eImageFilter eFilter, Sint32 iValue=0) |
| Apply a filter to this image. | |
| bool | setBlendMode (SDL_BlendMode bmValue) |
| Set the alpha blending mode. | |
| SDL_BlendMode | getBlendMode () |
| Get blend mode used for rendering this image. | |
| bool | setAlphaMod (Sint32 iAlpha) |
| Set the alpha modulation value. | |
| Sint32 | getAlphaMod () const |
| Get alpha modulation used for rendering this image. | |
| bool | setColorMod (Uint8 iR, Uint8 iG, Uint8 iB) |
| Set the color modulation value. | |
| Sint32 | getColorMod (Uint8 &iR, Uint8 &iG, Uint8 &iB) |
| Get color modulation used for rendering this image. | |
| Sint32 | setColorKey (Sint16 iR=-1, Sint16 iG=-1, Sint16 iB=-1) |
| Set colorkey used for rendering this image. | |
| Sint32 | getColorKey (Sint16 &iR, Sint16 &iG, Sint16 &iB) |
| Get colorkey used for rendering this image. | |
| SDL_Surface * | getSurface () |
| Get the source surface of this image. | |
| Sint32 | findTex (Sint32 &iIndex, SDL_Texture *&pTex, Sint32 &idScreen) |
| Get the texture for each screen of this image. | |
| bool | saveToBMP (const string &sFile="") |
| Export the image to a BMP file. | |
| bool | saveToPNG (const string &sFile="") |
| Save the image to an external PNG file. | |
| Sint32 | save (const string &sCDCFile, const string &sResourceName="") |
| Save the image to a CDC file. | |
| Sint32 | save (const Sint32 idCDC, const string &sResourceName="") |
| Save the image to a CDC file. | |
|
override |
Request Image object information.
Writes information to the default log.
| iMode | unused for the time being. |
|
override |
Get the name.
|
override |
Get the ID.
| bool CRM64Pro::Image::assignSurface | ( | SDL_Surface * | pSurf, |
| Sint32 | iOwnership = 0 ) |
Assign a SDL_Surface to this image.
Used for loading the source surface to images created with ImageMgr::create().
| pSurf | SDL_Surface pointer. |
| iOwnership | 0 (default) creates an internal copy (original can be freed), any other value takes ownership (do not free if call succeeds). |
| Sint32 CRM64Pro::Image::setOwner | ( | Sint32 | iOwner | ) |
Set the owner of this image.
| iOwner | Owner of the image. |
| Sint32 CRM64Pro::Image::getOwner | ( | ) | const |
Get the owner of this image.
| Sint32 CRM64Pro::Image::optimize | ( | Sint32 | idScreen = 0 | ) |
Optimize the image for rendering on screens in the most efficient way.
| idScreen | a valid screen handle used to convert the image to the same format as the screen. The screen must be initialized. |
| bool CRM64Pro::Image::rebuild | ( | ) |
Rebuild texture(s).
This method will rebuild any existing texture and it is used when the source surface is modified and the textures have to be "in-sync".
| Sint32 CRM64Pro::Image::render | ( | Sint32 | idRes = 0, |
| SDL_FRect * | rSrc = nullptr, | ||
| SDL_FRect * | rDst = nullptr ) |
Render the image.
| idRes | a valid screen or image handle. Default uses the default screen. |
| rSrc | the source SDL_FRect structure or nullptr for the entire image. Default nullptr. |
| rDst | the destination SDL_FRect structure or nullptr to match rSrc. Can stretch or shrink the image. Default nullptr. |
| Sint32 CRM64Pro::Image::renderEx | ( | const double | dAngle, |
| const SDL_FPoint * | poCenter = nullptr, | ||
| const SDL_FlipMode | rf = SDL_FLIP_NONE, | ||
| Sint32 | idRes = 0, | ||
| SDL_FRect * | rSrc = nullptr, | ||
| SDL_FRect * | rDst = nullptr ) |
Render the image with extended attributes: can rotate and flip the image.
| dAngle | angle in degrees for the rotation. |
| poCenter | SDL_FPoint pointer indicating the rotation center. Default nullptr rotates around rDst.w/2 and rDst.h/2. |
| rf | "SDL_FlipMode" value for flipping actions. |
| idRes | a valid screen or image handle. Default uses the default screen. |
| rSrc | the source SDL_FRect structure or nullptr for the entire image. Default nullptr. |
| rDst | the destination SDL_FRect structure or nullptr to match rSrc. Can stretch or shrink. Default nullptr. |
| Sint32 CRM64Pro::Image::applyFilter | ( | eImageFilter | eFilter, |
| Sint32 | iValue = 0 ) |
Apply a filter to this image.
Works on stand-alone and parent images; children cannot apply a filter. As the image is shared between parent and children, applying a filter to a parent affects all children.
| eFilter | Check ::eImageFilter enum for details. |
| iValue | adjustable value for some filters. |
| bool CRM64Pro::Image::setBlendMode | ( | SDL_BlendMode | bmValue | ) |
Set the alpha blending mode.
| bmValue | the SDL_BlendMode to use for blending. |
| SDL_BlendMode CRM64Pro::Image::getBlendMode | ( | ) |
Get blend mode used for rendering this image.
| bool CRM64Pro::Image::setAlphaMod | ( | Sint32 | iAlpha | ) |
Set the alpha modulation value.
| iAlpha | the alpha value. Ranges from 255 (opaque) to 0 (fully transparent). |
| Sint32 CRM64Pro::Image::getAlphaMod | ( | ) | const |
Get alpha modulation used for rendering this image.
| bool CRM64Pro::Image::setColorMod | ( | Uint8 | iR, |
| Uint8 | iG, | ||
| Uint8 | iB ) |
Set the color modulation value.
| iR | the red color value. |
| iG | the green color value. |
| iB | the blue color value. |
| Sint32 CRM64Pro::Image::getColorMod | ( | Uint8 & | iR, |
| Uint8 & | iG, | ||
| Uint8 & | iB ) |
Get color modulation used for rendering this image.
| iR | red color component value from 0 to 255. |
| iG | green color component value from 0 to 255. |
| iB | blue color component value from 0 to 255. |
| Sint32 CRM64Pro::Image::setColorKey | ( | Sint16 | iR = -1, |
| Sint16 | iG = -1, | ||
| Sint16 | iB = -1 ) |
Set colorkey used for rendering this image.
Colorkey can only be modified on stand-alone images. Internally emulated using blending modes; if already set, it is not modified, otherwise SDL_BLENDMODE_BLEND is set.
| iR | red color component (0-255). Negative value disables colorkey. |
| iG | green color component (0-255). Negative value disables colorkey. |
| iB | blue color component (0-255). Negative value disables colorkey. |
| Sint32 CRM64Pro::Image::getColorKey | ( | Sint16 & | iR, |
| Sint16 & | iG, | ||
| Sint16 & | iB ) |
Get colorkey used for rendering this image.
| iR | red color component (0-255). Negative means colorkey is disabled. |
| iG | green color component (0-255). Negative means colorkey is disabled. |
| iB | blue color component (0-255). Negative means colorkey is disabled. |
| SDL_Surface * CRM64Pro::Image::getSurface | ( | ) |
Get the source surface of this image.
| Sint32 CRM64Pro::Image::findTex | ( | Sint32 & | iIndex, |
| SDL_Texture *& | pTex, | ||
| Sint32 & | idScreen ) |
Get the texture for each screen of this image.
| iIndex | pointer to an integer containing 0 for find the first texture or the iIndex value of previous calls to this method. |
| pTex | pointer to a SDL_Texture, nullptr when no texture is present. |
| idScreen | pointer to the screen handle for which the texture is, when no texture is present it is set to -1. |
| bool CRM64Pro::Image::saveToBMP | ( | const string & | sFile = "" | ) |
Export the image to a BMP file.
If the BMP file already exists, it will be overwritten.
| sFile | string containing [directory]+filename+[extension]. Ideally should have .bmp extension. Directory separators '\' and '/' are supported. |
| bool CRM64Pro::Image::saveToPNG | ( | const string & | sFile = "" | ) |
Save the image to an external PNG file.
If the PNG file already exists, it will be overwritten.
| sFile | string containing [directory]+filename+[extension]. Ideally should have .png extension. Directory separators '\' and '/' are supported. |
| Sint32 CRM64Pro::Image::save | ( | const string & | sCDCFile, |
| const string & | sResourceName = "" ) |
Save the image to a CDC file.
| sCDCFile | string containing [directory]+filename+[extension]. Directory separators '\' and '/' are supported. |
| sResourceName | Optional resource name to use in the CDC. If empty (default), uses the Image object's internal name. |
| Sint32 CRM64Pro::Image::save | ( | const Sint32 | idCDC, |
| const string & | sResourceName = "" ) |
Save the image to a CDC file.
| idCDC | CDC id. |
| sResourceName | Optional resource name to use in the CDC. If empty (default), uses the Image object's internal name. |