raylib-cpp
C++ object-oriented wrapper library for raylib.
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
raylib::Image Class Reference

Image type, bpp always RGBA (32bit) More...

#include <Image.hpp>

Public Member Functions

 Image (const ::Font &font, const std::string_view text, float fontSize, float spacing, ::Color tint={255, 255, 255, 255})
 
 Image (const ::Image &image)
 
 Image (const ::Texture2D &texture)
 Load an image from the given file. More...
 
 Image (const Image &other)
 
 Image (const std::string_view fileName)
 Load an image from the given file. More...
 
 Image (const std::string_view fileName, int *frames)
 Load an animation image from the given file. More...
 
 Image (const std::string_view fileName, int width, int height, int format, int headerSize=0)
 Load a raw image from the given file, with the provided width, height, and formats. More...
 
 Image (const std::string_view fileName, std::span< int > frames)
 Load an animation image from the given file. More...
 
 Image (const std::string_view fileType, const unsigned char *fileData, int dataSize)
 Load an image from the given file. More...
 
 Image (const std::string_view text, int fontSize, ::Color color={255, 255, 255, 255})
 
 Image (Image &&other)
 
 Image (int width, int height, ::Color color={255, 255, 255, 255})
 
 Image (void *data=nullptr, int width=0, int height=0, int mipmaps=1, int format=PIXELFORMAT_UNCOMPRESSED_R8G8B8A8)
 
ImageAlphaClear (::Color color, float threshold)
 Clear alpha channel to desired color. More...
 
ImageAlphaCrop (float threshold)
 Crop image depending on alpha value. More...
 
ImageAlphaMask (const ::Image &alphaMask)
 Apply alpha mask to image. More...
 
ImageAlphaPremultiply ()
 Premultiply alpha channel. More...
 
ImageClearBackground (::Color color={0, 0, 0, 255})
 Clear image background with given color. More...
 
ImageColorBrightness (int brightness)
 Modify image color: brightness. More...
 
ImageColorContrast (float contrast)
 Modify image color: contrast. More...
 
ImageColorGrayscale ()
 Modify image color: grayscale. More...
 
ImageColorInvert ()
 Modify image color: invert. More...
 
ImageColorReplace (::Color color, ::Color replace)
 Modify image color: replace color. More...
 
ImageColorTint (::Color color={255, 255, 255, 255})
 Modify image color: tint. More...
 
::Image Copy () const
 Create an image duplicate (useful for transformations) More...
 
ImageCrop (::Rectangle crop)
 Crop an image to area defined by a rectangle. More...
 
ImageCrop (::Vector2 size)
 Crop an image to a new given width and height based on a vector. More...
 
ImageCrop (int newWidth, int newHeight)
 Crop an image to a new given width and height. More...
 
ImageCrop (int offsetX, int offsetY, int newWidth, int newHeight)
 Crop an image to area defined by a rectangle. More...
 
ImageDither (int rBpp, int gBpp, int bBpp, int aBpp)
 Dither image data to 16bpp or lower (Floyd-Steinberg dithering) More...
 
void Draw (const ::Image &src, ::Rectangle srcRec, ::Rectangle dstRec, ::Color tint={255, 255, 255, 255})
 
void DrawCircle (::Vector2 center, int radius, ::Color color={255, 255, 255, 255})
 
void DrawCircle (int centerX, int centerY, int radius, ::Color color={255, 255, 255, 255})
 
void DrawLine (::Vector2 start, ::Vector2 end, ::Color color={255, 255, 255, 255})
 
void DrawLine (int startPosX, int startPosY, int endPosX, int endPosY, ::Color color={255, 255, 255, 255})
 
void DrawPixel (::Vector2 position, ::Color color={255, 255, 255, 255})
 
void DrawPixel (int posX, int posY, ::Color color={255, 255, 255, 255})
 Draw pixel within an image. More...
 
void DrawRectangle (::Rectangle rec, ::Color color={255, 255, 255, 255})
 
void DrawRectangle (int posX, int posY, int width, int height, ::Color color={255, 255, 255, 255})
 
void DrawRectangle (Vector2 position, Vector2 size, ::Color color={255, 255, 255, 255})
 
void DrawRectangleLines (::Rectangle rec, int thick=1, ::Color color={255, 255, 255, 255})
 
void DrawText (const ::Font &font, const char *text, ::Vector2 position, float fontSize, float spacing, ::Color tint={255, 255, 255, 255})
 
void DrawText (const ::Font &font, const std::string_view text, ::Vector2 position, float fontSize, float spacing, ::Color tint={255, 255, 255, 255})
 
void DrawText (const char *text, ::Vector2 position, int fontSize, ::Color color={255, 255, 255, 255})
 
void DrawText (const char *text, int x, int y, int fontSize, ::Color color={255, 255, 255, 255})
 
void DrawText (const std::string_view text, ::Vector2 position, int fontSize, ::Color color={255, 255, 255, 255})
 
void DrawText (const std::string_view text, int x, int y, int fontSize, ::Color color={255, 255, 255, 255})
 
void Export (const std::string_view fileName) const
 Export image data to file, returns true on success. More...
 
void ExportAsCode (const std::string_view fileName) const
 Export image as code file defining an array of bytes, returns true on success. More...
 
unsigned char * ExportToMemory (const char *fileType, int *fileSize)
 Export image to memory buffer. More...
 
unsigned char * ExportToMemory (const std::string_view fileType, std::span< int > fileSize)
 
ImageFlipHorizontal ()
 Flip image horizontally. More...
 
ImageFlipVertical ()
 Flip image vertically. More...
 
ImageFormat (int newFormat)
 Convert image data to desired format. More...
 
::Image FromImage (::Rectangle rec) const
 Create an image from another image piece. More...
 
Rectangle GetAlphaBorder (float threshold) const
 Get image alpha border rectangle. More...
 
raylib::Color GetColor (::Vector2 position) const
 Get image pixel color at vector position. More...
 
raylib::Color GetColor (int x=0, int y=0) const
 Get image pixel color at (x, y) position. More...
 
void * GetData () const
 Retrieves the data value for the object. More...
 
int GetFormat () const
 Retrieves the format value for the object. More...
 
int GetHeight () const
 Retrieves the height value for the object. More...
 
int GetMipmaps () const
 Retrieves the mipmaps value for the object. More...
 
int GetPixelDataSize () const
 Returns the pixel data size based on the current image. More...
 
::Vector2 GetSize () const
 Retrieve the width and height of the image. More...
 
int GetWidth () const
 Retrieves the width value for the object. More...
 
bool IsReady () const
 Retrieve whether or not the Image has been loaded. More...
 
void Load (const ::Texture2D &texture)
 Load an image from the given file. More...
 
void Load (const std::string_view fileName)
 Load image from file into CPU memory (RAM) More...
 
void Load (const std::string_view fileName, int *frames)
 Load image sequence from file (frames appended to image.data). More...
 
void Load (const std::string_view fileName, int width, int height, int format, int headerSize)
 Load image from RAW file data. More...
 
void Load (const std::string_view fileName, std::span< int > frames)
 Load image sequence from file (frames appended to image.data). More...
 
void Load (const std::string_view fileType, const std::span< unsigned char > fileData)
 Load image from memory buffer, fileType refers to extension: i.e. More...
 
void Load (const std::string_view fileType, const unsigned char *fileData, int dataSize)
 Load image from memory buffer, fileType refers to extension: i.e. More...
 
::ColorLoadColors () const
 Load color data from image as a Color array (RGBA - 32bit) More...
 
::ColorLoadPalette (int maxPaletteSize, int *colorsCount) const
 Load colors palette from image as a Color array (RGBA - 32bit) More...
 
::Texture2D LoadTexture () const
 Load texture from image data. More...
 
ImageMipmaps ()
 Generate all mipmap levels for a provided image. More...
 
 operator::Texture2D ()
 Loads a texture from the image data. More...
 
Imageoperator= (const ::Image &image)
 
Imageoperator= (const Image &other)
 
Imageoperator= (Image &&other) noexcept
 
ImageResize (int newWidth, int newHeight)
 Resize and image to new size. More...
 
ImageResizeCanvas (int newWidth, int newHeight, int offsetX=0, int offsetY=0, ::Color color={255, 255, 255, 255})
 Resize canvas and fill with color. More...
 
ImageResizeNN (int newWidth, int newHeight)
 Resize and image to new size using Nearest-Neighbor scaling algorithm. More...
 
ImageRotate (Degree degrees)
 Rotate image by input angle in degrees (-359 to 359) More...
 
ImageRotateCCW ()
 Rotate image counter-clockwise 90deg. More...
 
ImageRotateCW ()
 Rotate image clockwise 90deg. More...
 
void SetHeight (int height, int offsetX=0, int offsetY=0, ::Color fill={255, 255, 255, 255})
 Set the height of the image canvas. More...
 
void SetWidth (int width, int offsetX=0, int offsetY=0, ::Color fill={255, 255, 255, 255})
 Set the width of the image canvas. More...
 
ImageToPOT (::Color fillColor)
 Convert image to POT (power-of-two) More...
 
void Unload ()
 Unload image from CPU memory (RAM) More...
 
void UnloadColors (::Color *colors) const
 Unload color data loaded with LoadImageColors() More...
 
void UnloadPalette (::Color *colors) const
 Unload colors palette loaded with LoadImagePalette() More...
 

Static Public Member Functions

::Image Cellular (int width, int height, int tileSize)
 Generate image: cellular algorithm. More...
 
::Image Checked (int width, int height, int checksX, int checksY, ::Color col1={255, 255, 255, 255}, ::Color col2={0, 0, 0, 255})
 Generate image: checked. More...
 
::Image Color (int width, int height, ::Color color={255, 255, 255, 255})
 Generate image: plain color. More...
 
static int GetPixelDataSize (int width, int height, int format=PIXELFORMAT_UNCOMPRESSED_R32G32B32A32)
 Get pixel data size in bytes for certain format. More...
 
::Image GradientLinear (int width, int height, int direction, ::Color start, ::Color end)
 Generate image: linear gradient. More...
 
::Image GradientRadial (int width, int height, float density, ::Color inner, ::Color outer)
 Generate image: radial gradient. More...
 
::Image LoadFromScreen ()
 Get pixel data from screen buffer and return an Image (screenshot) More...
 
::Image Text (const ::Font &font, const std::string_view text, float fontSize, float spacing, ::Color tint={255, 255, 255, 255})
 
::Image Text (const std::string_view text, int fontSize, ::Color color={255, 255, 255, 255})
 
::Image WhiteNoise (int width, int height, float factor)
 Generate image: white noise. More...
 

Protected Member Functions

void set (const ::Image &image)
 

Detailed Description

Image type, bpp always RGBA (32bit)

Data stored in CPU memory (RAM)

Definition at line 19 of file Image.hpp.

Constructor & Destructor Documentation

◆ Image() [1/13]

raylib::Image::Image ( void *  data = nullptr,
int  width = 0,
int  height = 0,
int  mipmaps = 1,
int  format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 
)
inline

Definition at line 21 of file Image.hpp.

◆ Image() [2/13]

raylib::Image::Image ( const ::Image &  image)
inline

Definition at line 29 of file Image.hpp.

◆ Image() [3/13]

raylib::Image::Image ( const std::string_view  fileName)
inline

Load an image from the given file.

Exceptions
raylib::RaylibExceptionThrown if the image failed to load from the file.
See also
Load()

Definition at line 40 of file Image.hpp.

References Load().

◆ Image() [4/13]

raylib::Image::Image ( const std::string_view  fileName,
int  width,
int  height,
int  format,
int  headerSize = 0 
)
inline

Load a raw image from the given file, with the provided width, height, and formats.

Exceptions
raylib::RaylibExceptionThrown if the image failed to load from the file.
See also
LoadRaw()

Definition at line 51 of file Image.hpp.

References Load().

◆ Image() [5/13]

raylib::Image::Image ( const std::string_view  fileName,
int *  frames 
)
inline

Load an animation image from the given file.

Exceptions
raylib::RaylibExceptionThrown if the image failed to load from the file.
See also
LoadAnim()

Definition at line 62 of file Image.hpp.

References Load().

◆ Image() [6/13]

raylib::Image::Image ( const std::string_view  fileName,
std::span< int >  frames 
)
inline

Load an animation image from the given file.

Exceptions
raylib::RaylibExceptionThrown if the image failed to load from the file.
See also
LoadAnim()

Definition at line 73 of file Image.hpp.

References Load().

◆ Image() [7/13]

raylib::Image::Image ( const std::string_view  fileType,
const unsigned char *  fileData,
int  dataSize 
)
inline

Load an image from the given file.

Exceptions
raylib::RaylibExceptionThrown if the image failed to load from the file.

Definition at line 82 of file Image.hpp.

References Load().

◆ Image() [8/13]

raylib::Image::Image ( const ::Texture2D texture)
inline

Load an image from the given file.

Exceptions
raylib::RaylibExceptionThrown if the image failed to load from the file.

Definition at line 91 of file Image.hpp.

References Load().

◆ Image() [9/13]

raylib::Image::Image ( int  width,
int  height,
::Color  color = {255, 255, 255, 255} 
)
inline

Definition at line 95 of file Image.hpp.

◆ Image() [10/13]

raylib::Image::Image ( const std::string_view  text,
int  fontSize,
::Color  color = {255, 255, 255, 255} 
)
inline

Definition at line 99 of file Image.hpp.

◆ Image() [11/13]

raylib::Image::Image ( const ::Font &  font,
const std::string_view  text,
float  fontSize,
float  spacing,
::Color  tint = {255, 255, 255, 255} 
)
inline

Definition at line 103 of file Image.hpp.

◆ Image() [12/13]

raylib::Image::Image ( const Image other)
inline

Definition at line 108 of file Image.hpp.

◆ Image() [13/13]

raylib::Image::Image ( Image &&  other)
inline

Definition at line 112 of file Image.hpp.

◆ ~Image()

raylib::Image::~Image ( )
inline

Definition at line 183 of file Image.hpp.

Member Function Documentation

◆ AlphaClear()

Image & raylib::Image::AlphaClear ( ::Color  color,
float  threshold 
)
inline

Clear alpha channel to desired color.

Definition at line 446 of file Image.hpp.

◆ AlphaCrop()

Image & raylib::Image::AlphaCrop ( float  threshold)
inline

Crop image depending on alpha value.

Definition at line 438 of file Image.hpp.

◆ AlphaMask()

Image & raylib::Image::AlphaMask ( const ::Image &  alphaMask)
inline

Apply alpha mask to image.

Definition at line 454 of file Image.hpp.

◆ AlphaPremultiply()

Image & raylib::Image::AlphaPremultiply ( )
inline

Premultiply alpha channel.

Definition at line 462 of file Image.hpp.

◆ Cellular()

::Image raylib::Image::Cellular ( int  width,
int  height,
int  tileSize 
)
inlinestatic

Generate image: cellular algorithm.

Bigger tileSize means bigger cells

Definition at line 179 of file Image.hpp.

◆ Checked()

::Image raylib::Image::Checked ( int  width,
int  height,
int  checksX,
int  checksY,
::Color  col1 = {255, 255, 255, 255},
::Color  col2 = {0, 0, 0, 255} 
)
inlinestatic

Generate image: checked.

Definition at line 164 of file Image.hpp.

◆ ClearBackground()

Image & raylib::Image::ClearBackground ( ::Color  color = {0, 0, 0, 255})
inline

Clear image background with given color.

Definition at line 656 of file Image.hpp.

◆ Color()

::Image raylib::Image::Color ( int  width,
int  height,
::Color  color = {255, 255, 255, 255} 
)
inlinestatic

Generate image: plain color.

Definition at line 142 of file Image.hpp.

◆ ColorBrightness()

Image & raylib::Image::ColorBrightness ( int  brightness)
inline

Modify image color: brightness.

Parameters
brightnessBrightness values between -255 and 255

Definition at line 617 of file Image.hpp.

◆ ColorContrast()

Image & raylib::Image::ColorContrast ( float  contrast)
inline

Modify image color: contrast.

Parameters
contrastContrast values between -100 and 100

Definition at line 607 of file Image.hpp.

◆ ColorGrayscale()

Image & raylib::Image::ColorGrayscale ( )
inline

Modify image color: grayscale.

Definition at line 597 of file Image.hpp.

◆ ColorInvert()

Image & raylib::Image::ColorInvert ( )
inline

Modify image color: invert.

Definition at line 589 of file Image.hpp.

◆ ColorReplace()

Image & raylib::Image::ColorReplace ( ::Color  color,
::Color  replace 
)
inline

Modify image color: replace color.

Definition at line 625 of file Image.hpp.

◆ ColorTint()

Image & raylib::Image::ColorTint ( ::Color  color = {255, 255, 255, 255})
inline

Modify image color: tint.

Definition at line 581 of file Image.hpp.

◆ Copy()

::Image raylib::Image::Copy ( ) const
inline

Create an image duplicate (useful for transformations)

Definition at line 400 of file Image.hpp.

◆ Crop() [1/4]

Image & raylib::Image::Crop ( ::Rectangle  crop)
inline

Crop an image to area defined by a rectangle.

Definition at line 430 of file Image.hpp.

Referenced by Crop().

◆ Crop() [2/4]

Image & raylib::Image::Crop ( ::Vector2  size)
inline

Crop an image to a new given width and height based on a vector.

Definition at line 477 of file Image.hpp.

References Crop().

◆ Crop() [3/4]

Image & raylib::Image::Crop ( int  newWidth,
int  newHeight 
)
inline

Crop an image to a new given width and height.

Definition at line 470 of file Image.hpp.

References Crop().

◆ Crop() [4/4]

Image & raylib::Image::Crop ( int  offsetX,
int  offsetY,
int  newWidth,
int  newHeight 
)
inline

Crop an image to area defined by a rectangle.

Definition at line 484 of file Image.hpp.

◆ Dither()

Image & raylib::Image::Dither ( int  rBpp,
int  gBpp,
int  bBpp,
int  aBpp 
)
inline

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

Definition at line 531 of file Image.hpp.

◆ Draw()

void raylib::Image::Draw ( const ::Image &  src,
::Rectangle  srcRec,
::Rectangle  dstRec,
::Color  tint = {255, 255, 255, 255} 
)
inline

Definition at line 710 of file Image.hpp.

◆ DrawCircle() [1/2]

void raylib::Image::DrawCircle ( ::Vector2  center,
int  radius,
::Color  color = {255, 255, 255, 255} 
)
inline

Definition at line 686 of file Image.hpp.

◆ DrawCircle() [2/2]

void raylib::Image::DrawCircle ( int  centerX,
int  centerY,
int  radius,
::Color  color = {255, 255, 255, 255} 
)
inline

Definition at line 681 of file Image.hpp.

◆ DrawLine() [1/2]

void raylib::Image::DrawLine ( ::Vector2  start,
::Vector2  end,
::Color  color = {255, 255, 255, 255} 
)
inline

Definition at line 677 of file Image.hpp.

◆ DrawLine() [2/2]

void raylib::Image::DrawLine ( int  startPosX,
int  startPosY,
int  endPosX,
int  endPosY,
::Color  color = {255, 255, 255, 255} 
)
inline

Definition at line 672 of file Image.hpp.

◆ DrawPixel() [1/2]

void raylib::Image::DrawPixel ( ::Vector2  position,
::Color  color = {255, 255, 255, 255} 
)
inline

Definition at line 668 of file Image.hpp.

◆ DrawPixel() [2/2]

void raylib::Image::DrawPixel ( int  posX,
int  posY,
::Color  color = {255, 255, 255, 255} 
)
inline

Draw pixel within an image.

Definition at line 664 of file Image.hpp.

◆ DrawRectangle() [1/3]

void raylib::Image::DrawRectangle ( ::Rectangle  rec,
::Color  color = {255, 255, 255, 255} 
)
inline

Definition at line 701 of file Image.hpp.

◆ DrawRectangle() [2/3]

void raylib::Image::DrawRectangle ( int  posX,
int  posY,
int  width,
int  height,
::Color  color = {255, 255, 255, 255} 
)
inline

Definition at line 691 of file Image.hpp.

◆ DrawRectangle() [3/3]

void raylib::Image::DrawRectangle ( Vector2  position,
Vector2  size,
::Color  color = {255, 255, 255, 255} 
)
inline

Definition at line 696 of file Image.hpp.

◆ DrawRectangleLines()

void raylib::Image::DrawRectangleLines ( ::Rectangle  rec,
int  thick = 1,
::Color  color = {255, 255, 255, 255} 
)
inline

Definition at line 705 of file Image.hpp.

◆ DrawText() [1/6]

void raylib::Image::DrawText ( const ::Font &  font,
const char *  text,
::Vector2  position,
float  fontSize,
float  spacing,
::Color  tint = {255, 255, 255, 255} 
)
inline

Definition at line 750 of file Image.hpp.

◆ DrawText() [2/6]

void raylib::Image::DrawText ( const ::Font &  font,
const std::string_view  text,
::Vector2  position,
float  fontSize,
float  spacing,
::Color  tint = {255, 255, 255, 255} 
)
inline

Definition at line 745 of file Image.hpp.

◆ DrawText() [3/6]

void raylib::Image::DrawText ( const char *  text,
::Vector2  position,
int  fontSize,
::Color  color = {255, 255, 255, 255} 
)
inline

Definition at line 715 of file Image.hpp.

◆ DrawText() [4/6]

void raylib::Image::DrawText ( const char *  text,
int  x,
int  y,
int  fontSize,
::Color  color = {255, 255, 255, 255} 
)
inline

Definition at line 740 of file Image.hpp.

◆ DrawText() [5/6]

void raylib::Image::DrawText ( const std::string_view  text,
::Vector2  position,
int  fontSize,
::Color  color = {255, 255, 255, 255} 
)
inline

Definition at line 725 of file Image.hpp.

◆ DrawText() [6/6]

void raylib::Image::DrawText ( const std::string_view  text,
int  x,
int  y,
int  fontSize,
::Color  color = {255, 255, 255, 255} 
)
inline

Definition at line 735 of file Image.hpp.

◆ Export()

void raylib::Image::Export ( const std::string_view  fileName) const
inline

Export image data to file, returns true on success.

Exceptions
raylib::RaylibExceptionThrown if the image failed to load from the file.

Definition at line 338 of file Image.hpp.

◆ ExportAsCode()

void raylib::Image::ExportAsCode ( const std::string_view  fileName) const
inline

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

Exceptions
raylib::RaylibExceptionThrown if the image failed to load from the file.

Definition at line 360 of file Image.hpp.

◆ ExportToMemory() [1/2]

unsigned char * raylib::Image::ExportToMemory ( const char *  fileType,
int *  fileSize 
)
inline

Export image to memory buffer.

Definition at line 347 of file Image.hpp.

◆ ExportToMemory() [2/2]

unsigned char * raylib::Image::ExportToMemory ( const std::string_view  fileType,
std::span< int >  fileSize 
)
inline

Definition at line 351 of file Image.hpp.

◆ FlipHorizontal()

Image & raylib::Image::FlipHorizontal ( )
inline

Flip image horizontally.

Definition at line 547 of file Image.hpp.

◆ FlipVertical()

Image & raylib::Image::FlipVertical ( )
inline

Flip image vertically.

Definition at line 539 of file Image.hpp.

◆ Format()

Image & raylib::Image::Format ( int  newFormat)
inline

Convert image data to desired format.

Definition at line 414 of file Image.hpp.

◆ FromImage()

::Image raylib::Image::FromImage ( ::Rectangle  rec) const
inline

Create an image from another image piece.

Definition at line 407 of file Image.hpp.

◆ GetAlphaBorder()

Rectangle raylib::Image::GetAlphaBorder ( float  threshold) const
inline

Get image alpha border rectangle.

Parameters
thresholdThreshold is defined as a percentatge: 0.0f -> 1.0f

Definition at line 635 of file Image.hpp.

◆ GetColor() [1/2]

raylib::Color raylib::Image::GetColor ( ::Vector2  position) const
inline

Get image pixel color at vector position.

Definition at line 649 of file Image.hpp.

◆ GetColor() [2/2]

raylib::Color raylib::Image::GetColor ( int  x = 0,
int  y = 0 
) const
inline

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

Definition at line 642 of file Image.hpp.

◆ GetData()

void * raylib::Image::GetData ( ) const
inline

Retrieves the data value for the object.

Returns
The data value of the object.

Definition at line 366 of file Image.hpp.

◆ GetFormat()

int raylib::Image::GetFormat ( ) const
inline

Retrieves the format value for the object.

Returns
The format value of the object.

Definition at line 370 of file Image.hpp.

◆ GetHeight()

int raylib::Image::GetHeight ( ) const
inline

Retrieves the height value for the object.

Returns
The height value of the object.

Definition at line 368 of file Image.hpp.

◆ GetMipmaps()

int raylib::Image::GetMipmaps ( ) const
inline

Retrieves the mipmaps value for the object.

Returns
The mipmaps value of the object.

Definition at line 369 of file Image.hpp.

◆ GetPixelDataSize() [1/2]

int raylib::Image::GetPixelDataSize ( ) const
inline

Returns the pixel data size based on the current image.

Returns
The pixel data size of the image.

Definition at line 811 of file Image.hpp.

◆ GetPixelDataSize() [2/2]

static int raylib::Image::GetPixelDataSize ( int  width,
int  height,
int  format = PIXELFORMAT_UNCOMPRESSED_R32G32B32A32 
)
inlinestatic

Get pixel data size in bytes for certain format.

Definition at line 802 of file Image.hpp.

◆ GetSize()

::Vector2 raylib::Image::GetSize ( ) const
inline

Retrieve the width and height of the image.

Definition at line 393 of file Image.hpp.

◆ GetWidth()

int raylib::Image::GetWidth ( ) const
inline

Retrieves the width value for the object.

Returns
The width value of the object.

Definition at line 367 of file Image.hpp.

◆ GradientLinear()

::Image raylib::Image::GradientLinear ( int  width,
int  height,
int  direction,
::Color  start,
::Color  end 
)
inlinestatic

Generate image: linear gradient.

Definition at line 149 of file Image.hpp.

◆ GradientRadial()

::Image raylib::Image::GradientRadial ( int  width,
int  height,
float  density,
::Color  inner,
::Color  outer 
)
inlinestatic

Generate image: radial gradient.

Definition at line 156 of file Image.hpp.

◆ IsReady()

bool raylib::Image::IsReady ( ) const
inline

Retrieve whether or not the Image has been loaded.

Returns
True or false depending on whether the Image has been loaded.

Definition at line 820 of file Image.hpp.

Referenced by Load().

◆ Load() [1/7]

void raylib::Image::Load ( const ::Texture2D texture)
inline

Load an image from the given file.

Exceptions
raylib::RaylibExceptionThrown if the image animation to load from the file.
See also
::LoadImageFromTexture()

Definition at line 316 of file Image.hpp.

References IsReady().

◆ Load() [2/7]

void raylib::Image::Load ( const std::string_view  fileName)
inline

Load image from file into CPU memory (RAM)

Exceptions
raylib::RaylibExceptionThrown if the image failed to load from the file.
See also
LoadImage()

Definition at line 227 of file Image.hpp.

References IsReady().

Referenced by Image().

◆ Load() [3/7]

void raylib::Image::Load ( const std::string_view  fileName,
int *  frames 
)
inline

Load image sequence from file (frames appended to image.data).

Exceptions
raylib::RaylibExceptionThrown if the image animation to load from the file.
See also
LoadImageAnim()

Definition at line 255 of file Image.hpp.

References IsReady().

◆ Load() [4/7]

void raylib::Image::Load ( const std::string_view  fileName,
int  width,
int  height,
int  format,
int  headerSize 
)
inline

Load image from RAW file data.

Exceptions
raylib::RaylibExceptionThrown if the image failed to load from the file.
See also
LoadImageRaw()

Definition at line 241 of file Image.hpp.

References IsReady().

◆ Load() [5/7]

void raylib::Image::Load ( const std::string_view  fileName,
std::span< int >  frames 
)
inline

Load image sequence from file (frames appended to image.data).

Exceptions
raylib::RaylibExceptionThrown if the image animation to load from the file.
See also
LoadImageAnim()

Definition at line 269 of file Image.hpp.

References IsReady().

◆ Load() [6/7]

void raylib::Image::Load ( const std::string_view  fileType,
const std::span< unsigned char >  fileData 
)
inline

Load image from memory buffer, fileType refers to extension: i.e.

"png".

Exceptions
raylib::RaylibExceptionThrown if the image animation to load from the file.
See also
LoadImageFromMemory()

Definition at line 300 of file Image.hpp.

References IsReady().

◆ Load() [7/7]

void raylib::Image::Load ( const std::string_view  fileType,
const unsigned char *  fileData,
int  dataSize 
)
inline

Load image from memory buffer, fileType refers to extension: i.e.

"png".

Exceptions
raylib::RaylibExceptionThrown if the image animation to load from the file.
See also
LoadImageFromMemory()

Definition at line 283 of file Image.hpp.

References IsReady().

◆ LoadColors()

::Color * raylib::Image::LoadColors ( ) const
inline

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

Definition at line 758 of file Image.hpp.

◆ LoadFromScreen()

::Image raylib::Image::LoadFromScreen ( )
inlinestatic

Get pixel data from screen buffer and return an Image (screenshot)

Definition at line 135 of file Image.hpp.

◆ LoadPalette()

::Color * raylib::Image::LoadPalette ( int  maxPaletteSize,
int *  colorsCount 
) const
inline

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

Definition at line 765 of file Image.hpp.

◆ LoadTexture()

::Texture2D raylib::Image::LoadTexture ( ) const
inline

Load texture from image data.

Definition at line 786 of file Image.hpp.

Referenced by operator::Texture2D().

◆ Mipmaps()

Image & raylib::Image::Mipmaps ( )
inline

Generate all mipmap levels for a provided image.

Definition at line 523 of file Image.hpp.

◆ operator::Texture2D()

raylib::Image::operator::Texture2D ( )
inline

Loads a texture from the image data.

See also
LoadTexture()

Definition at line 795 of file Image.hpp.

References LoadTexture().

◆ operator=() [1/3]

Image & raylib::Image::operator= ( const ::Image &  image)
inline

Definition at line 187 of file Image.hpp.

◆ operator=() [2/3]

Image & raylib::Image::operator= ( const Image other)
inline

Definition at line 192 of file Image.hpp.

◆ operator=() [3/3]

Image & raylib::Image::operator= ( Image &&  other)
inlinenoexcept

Definition at line 203 of file Image.hpp.

◆ Resize()

Image & raylib::Image::Resize ( int  newWidth,
int  newHeight 
)
inline

Resize and image to new size.

Definition at line 498 of file Image.hpp.

◆ ResizeCanvas()

Image & raylib::Image::ResizeCanvas ( int  newWidth,
int  newHeight,
int  offsetX = 0,
int  offsetY = 0,
::Color  color = {255, 255, 255, 255} 
)
inline

Resize canvas and fill with color.

Definition at line 514 of file Image.hpp.

◆ ResizeNN()

Image & raylib::Image::ResizeNN ( int  newWidth,
int  newHeight 
)
inline

Resize and image to new size using Nearest-Neighbor scaling algorithm.

Definition at line 506 of file Image.hpp.

◆ Rotate()

Image & raylib::Image::Rotate ( Degree  degrees)
inline

Rotate image by input angle in degrees (-359 to 359)

Note
Only works with integer values, float values will be truncated!

Definition at line 557 of file Image.hpp.

◆ RotateCCW()

Image & raylib::Image::RotateCCW ( )
inline

Rotate image counter-clockwise 90deg.

Definition at line 573 of file Image.hpp.

◆ RotateCW()

Image & raylib::Image::RotateCW ( )
inline

Rotate image clockwise 90deg.

Definition at line 565 of file Image.hpp.

◆ set()

void raylib::Image::set ( const ::Image &  image)
inlineprotected

Definition at line 825 of file Image.hpp.

◆ SetHeight()

void raylib::Image::SetHeight ( int  height,
int  offsetX = 0,
int  offsetY = 0,
::Color  fill = {255, 255, 255, 255} 
)
inline

Set the height of the image canvas.

See also
ResizeCanvas

Definition at line 386 of file Image.hpp.

◆ SetWidth()

void raylib::Image::SetWidth ( int  width,
int  offsetX = 0,
int  offsetY = 0,
::Color  fill = {255, 255, 255, 255} 
)
inline

Set the width of the image canvas.

See also
ResizeCanvas

Definition at line 377 of file Image.hpp.

◆ Text() [1/2]

::Image raylib::Image::Text ( const ::Font &  font,
const std::string_view  text,
float  fontSize,
float  spacing,
::Color  tint = {255, 255, 255, 255} 
)
inlinestatic

Definition at line 127 of file Image.hpp.

◆ Text() [2/2]

::Image raylib::Image::Text ( const std::string_view  text,
int  fontSize,
::Color  color = {255, 255, 255, 255} 
)
inlinestatic

Definition at line 122 of file Image.hpp.

◆ ToPOT()

Image & raylib::Image::ToPOT ( ::Color  fillColor)
inline

Convert image to POT (power-of-two)

Definition at line 422 of file Image.hpp.

◆ Unload()

void raylib::Image::Unload ( )
inline

Unload image from CPU memory (RAM)

Definition at line 326 of file Image.hpp.

◆ UnloadColors()

void raylib::Image::UnloadColors ( ::Color colors) const
inline

Unload color data loaded with LoadImageColors()

Definition at line 772 of file Image.hpp.

◆ UnloadPalette()

void raylib::Image::UnloadPalette ( ::Color colors) const
inline

Unload colors palette loaded with LoadImagePalette()

Definition at line 779 of file Image.hpp.

◆ WhiteNoise()

::Image raylib::Image::WhiteNoise ( int  width,
int  height,
float  factor 
)
inlinestatic

Generate image: white noise.

Definition at line 172 of file Image.hpp.