Raylib C++  1.0.0
Encapsulates the raylib library
Public Member Functions | List of all members
raylib::image::RlImage Class Reference

The encapsultation of the raylib Image. More...

#include <RlImage.hpp>

Collaboration diagram for raylib::image::RlImage:
Collaboration graph

Public Member Functions

 RlImage (const Image &image)
 Construct a new RlImage object. More...
 
 RlImage (const Image &image, int frameCount)
 Construct a new RlImage object. More...
 
 ~RlImage ()
 Destroy the RlImage object. More...
 
RlImage copy ()
 Create an image duplicate (useful for transformations) More...
 
bool save (const std::string &fileName)
 Export image data to file, returns true on success. More...
 
bool saveAsCode (const std::string &fileName)
 Export image as code file defining an array of bytes, returns true on success. More...
 
RlImage subImage (const Rectangle &rec)
 Create an image from another image piece. More...
 
void changeFormat (int newFormat)
 Convert image data to desired format. More...
 
void toPot (const RlColor &fill)
 Convert image to POT (power-of-two) More...
 
void crop (const Rectangle &crop)
 Crop an image to a defined rectangle. More...
 
void alphaCrop (float threshold)
 Crop image depending on alpha value. More...
 
void alphaClear (const RlColor &color, float threshold)
 Clear alpha channel to desired color. More...
 
void alphaMask (const RlImage &alphaMask)
 Apply alpha mask to image. More...
 
void alphaPremultiply ()
 Premultiply alpha channel. More...
 
void resize (int newWidth, int newHeight)
 Resize image (Bicubic scaling algorithm) More...
 
void resizeNearesetNeighbor (int newWidth, int newHeight)
 Resize image (Nearest-Neighbor scaling algorithm) More...
 
void resizeCanvas (int newWidth, int newHeight, int offsetX, int offsetY, const RlColor &fill)
 Resize canvas and fill with color. More...
 
void mipmaps ()
 Generate all mipmap levels for a provided image. More...
 
void dither (int rBpp, int gBpp, int bBpp, int aBpp)
 Dither image data to 16bpp or lower (Floyd-Steinberg dithering) More...
 
void flipVertical ()
 Flip image vertically. More...
 
void flipHorizontal ()
 Flip image horizontally. More...
 
void rotateClockwise ()
 Rotate image clockwise 90deg. More...
 
void rotateCounterClockwise ()
 Rotate image counter-clockwise 90deg. More...
 
void colorTint (const RlColor &color)
 Modify image color: tint. More...
 
void colorInvert ()
 Modify image color: invert. More...
 
void colorGrayscale ()
 Modify image color: grayscale. More...
 
void colorContrast (float contrast)
 Modify image color: contrast. More...
 
void colorBrightness (int brightness)
 Modify image color: brightness. More...
 
void colorReplace (const RlColor &color, const RlColor &replace)
 Modify image color: replace color. More...
 
std::vector< RlColorloadImageColors ()
 Load color data from image as a Color array (RGBA - 32bit) More...
 
std::vector< RlColorloadImagePalette (int maxPaletteSize)
 Load colors palette from image as a Color array (RGBA - 32bit) More...
 
Rectangle getImageAlphaBorder (float threshold)
 Get image alpha border rectangle. More...
 
RlColor getImageColor (int x, int y)
 Get image pixel color at (x, y) position. More...
 
const Image & getImage () const
 Get the image (const) More...
 
Image & getImage ()
 Get the mutable image. More...
 
const int & getFrameCount () const
 Get the frame count. More...
 

Detailed Description

The encapsultation of the raylib Image.

Constructor & Destructor Documentation

◆ RlImage() [1/2]

raylib::image::RlImage::RlImage ( const Image &  image)
explicit

Construct a new RlImage object.

Parameters
imagethe image

◆ RlImage() [2/2]

raylib::image::RlImage::RlImage ( const Image &  image,
int  frameCount 
)
explicit

Construct a new RlImage object.

Parameters
imagethe image
frameCountthe frame count

◆ ~RlImage()

raylib::image::RlImage::~RlImage ( )

Destroy the RlImage object.

Member Function Documentation

◆ alphaClear()

void raylib::image::RlImage::alphaClear ( const RlColor color,
float  threshold 
)

Clear alpha channel to desired color.

Parameters
colorthe color
thresholdthe threshold
Here is the call graph for this function:

◆ alphaCrop()

void raylib::image::RlImage::alphaCrop ( float  threshold)

Crop image depending on alpha value.

Parameters
thresholdthe threshold

◆ alphaMask()

void raylib::image::RlImage::alphaMask ( const RlImage alphaMask)

Apply alpha mask to image.

Parameters
alphaMaskthe alpha mask

◆ alphaPremultiply()

void raylib::image::RlImage::alphaPremultiply ( )

Premultiply alpha channel.

◆ changeFormat()

void raylib::image::RlImage::changeFormat ( int  newFormat)

Convert image data to desired format.

Parameters
newFormatthe new format

◆ colorBrightness()

void raylib::image::RlImage::colorBrightness ( int  brightness)

Modify image color: brightness.

Parameters
brightnessthe brightness (-255 to 255)

◆ colorContrast()

void raylib::image::RlImage::colorContrast ( float  contrast)

Modify image color: contrast.

Parameters
contrastthe contrast (-100 to 100)

◆ colorGrayscale()

void raylib::image::RlImage::colorGrayscale ( )

Modify image color: grayscale.

◆ colorInvert()

void raylib::image::RlImage::colorInvert ( )

Modify image color: invert.

◆ colorReplace()

void raylib::image::RlImage::colorReplace ( const RlColor color,
const RlColor replace 
)

Modify image color: replace color.

Parameters
colorthe color to replace
replacethe replacement
Here is the call graph for this function:

◆ colorTint()

void raylib::image::RlImage::colorTint ( const RlColor color)

Modify image color: tint.

Parameters
colorthe color
Here is the call graph for this function:

◆ copy()

raylib::image::RlImage raylib::image::RlImage::copy ( )

Create an image duplicate (useful for transformations)

Returns
the copy

◆ crop()

void raylib::image::RlImage::crop ( const Rectangle &  crop)

Crop an image to a defined rectangle.

Parameters
cropthe crop

◆ dither()

void raylib::image::RlImage::dither ( int  rBpp,
int  gBpp,
int  bBpp,
int  aBpp 
)

Dither image data to 16bpp or lower (Floyd-Steinberg dithering)

Parameters
rBppthe r bpp
gBppthe g bpp
bBppthe b bpp
aBppthe a bpp

◆ flipHorizontal()

void raylib::image::RlImage::flipHorizontal ( )

Flip image horizontally.

◆ flipVertical()

void raylib::image::RlImage::flipVertical ( )

Flip image vertically.

◆ getFrameCount()

const int & raylib::image::RlImage::getFrameCount ( ) const

Get the frame count.

Returns
the frame count

◆ getImage() [1/2]

Image& raylib::image::RlImage::getImage ( )

Get the mutable image.

Returns
the image

◆ getImage() [2/2]

Image & raylib::image::RlImage::getImage ( ) const

Get the image (const)

Returns
the image
Here is the caller graph for this function:

◆ getImageAlphaBorder()

Rectangle raylib::image::RlImage::getImageAlphaBorder ( float  threshold)

Get image alpha border rectangle.

Parameters
thresholdthe threshold
Returns
the rectangle

◆ getImageColor()

raylib::RlColor raylib::image::RlImage::getImageColor ( int  x,
int  y 
)

Get image pixel color at (x, y) position.

Parameters
xthe x
ythe y
Returns
the color

◆ loadImageColors()

std::vector< RlColor > raylib::image::RlImage::loadImageColors ( )

Load color data from image as a Color array (RGBA - 32bit)

Returns
the color array

◆ loadImagePalette()

std::vector< RlColor > raylib::image::RlImage::loadImagePalette ( int  maxPaletteSize)

Load colors palette from image as a Color array (RGBA - 32bit)

Parameters
maxPaletteSizethe max palette size
Returns
the color array

◆ mipmaps()

void raylib::image::RlImage::mipmaps ( )

Generate all mipmap levels for a provided image.

◆ resize()

void raylib::image::RlImage::resize ( int  newWidth,
int  newHeight 
)

Resize image (Bicubic scaling algorithm)

Parameters
newWidththe new width
newHeightthe new height

◆ resizeCanvas()

void raylib::image::RlImage::resizeCanvas ( int  newWidth,
int  newHeight,
int  offsetX,
int  offsetY,
const RlColor fill 
)

Resize canvas and fill with color.

Parameters
newWidththe new width
newHeightthe new height
offsetXthe offset x
offsetYthe offset y
fillthe color to fill
Here is the call graph for this function:

◆ resizeNearesetNeighbor()

void raylib::image::RlImage::resizeNearesetNeighbor ( int  newWidth,
int  newHeight 
)

Resize image (Nearest-Neighbor scaling algorithm)

Parameters
newWidththe new width
newHeightthe new height

◆ rotateClockwise()

void raylib::image::RlImage::rotateClockwise ( )

Rotate image clockwise 90deg.

◆ rotateCounterClockwise()

void raylib::image::RlImage::rotateCounterClockwise ( )

Rotate image counter-clockwise 90deg.

◆ save()

bool raylib::image::RlImage::save ( const std::string &  fileName)

Export image data to file, returns true on success.

Parameters
fileNamethe file name
Returns
true if it succeeds, false otherwise

◆ saveAsCode()

bool raylib::image::RlImage::saveAsCode ( const std::string &  fileName)

Export image as code file defining an array of bytes, returns true on success.

Parameters
fileNamethe file name
Returns
true if it succeeds, false otherwise

◆ subImage()

raylib::image::RlImage raylib::image::RlImage::subImage ( const Rectangle &  rec)

Create an image from another image piece.

Parameters
recthe rec
Returns
the image

◆ toPot()

void raylib::image::RlImage::toPot ( const RlColor fill)

Convert image to POT (power-of-two)

Parameters
fillthe fill
Here is the call graph for this function:

The documentation for this class was generated from the following files: