1 #ifndef RAYLIB_CPP_IMAGE_HPP_ 2 #define RAYLIB_CPP_IMAGE_HPP_ 22 Image(
const std::string& fileName) {
26 LoadEx(pixels, width, height);
28 Image(
void* data,
int width,
int height,
int format) {
29 LoadPro(data, width, height, format);
31 Image(
const std::string& fileName,
int width,
int height,
int format,
int headerSize) {
32 LoadRaw(fileName, width, height, format, headerSize);
35 set(::GetTextureData(texture));
38 set(::GenImageColor(width, height, color));
42 return ::ImageText(text.c_str(), fontSize, color);
46 return ::ImageTextEx(font, text.c_str(), fontSize, spacing, tint);
54 return ::GenImageColor(width, height, color);
58 return ::GenImageGradientV(width, height, top, bottom);
62 return ::GenImageGradientH(width, height, left, right);
66 return ::GenImageGradientRadial(width, height, density, inner, outer);
70 return ::GenImageChecked(width, height, checksX, checksY, col1, col2);
74 return ::GenImageWhiteNoise(width, height, factor);
78 return ::GenImagePerlinNoise(width, height, offsetX, offsetY, scale);
82 return ::GenImageCellular(width, height, tileSize);
102 height = image.height;
103 mipmaps = image.mipmaps;
104 format = image.format;
107 void Load(
const std::string& fileName) {
108 set(::LoadImage(fileName.c_str()));
112 set(::LoadImageEx(pixels, width, height));
115 void LoadPro(
void* data,
int width,
int height,
int format) {
116 set(::LoadImagePro(data, width, height, format));
119 void LoadRaw(
const std::string& fileName,
int width,
int height,
int format,
int headerSize) {
120 set(::LoadImageRaw(fileName.c_str(), width, height, format, headerSize));
124 ::UnloadImage(*
this);
128 ::ExportImage(*
this, fileName.c_str());
132 ::ExportImageAsCode(*
this, fileName.c_str());
136 GETTERSETTER(
void*,Data,data)
137 GETTERSETTER(
int,Width,width)
138 GETTERSETTER(
int,Height,height)
143 return ::ImageCopy(*
this);
146 return ::ImageFromImage(*
this, rec);
150 ::ImageToPOT(
this, fillColor);
155 ::ImageFormat(
this, newFormat);
160 ::ImageAlphaMask(
this, alphaMask);
165 ::ImageAlphaCrop(
this, threshold);
170 ::ImageAlphaPremultiply(
this);
175 ::ImageCrop(
this, crop);
179 ::ImageResize(
this, newWidth, newHeight);
183 ::ImageResizeNN(
this, newWidth, newHeight);
187 ::ImageResizeCanvas(
this, newWidth, newHeight, offsetX, offsetY, color);
191 ::ImageMipmaps(
this);
195 ::ImageDither(
this, rBpp, gBpp, bBpp, aBpp);
200 ::ImageFlipVertical(
this);
204 ::ImageFlipHorizontal(
this);
209 ::ImageRotateCW(
this);
213 ::ImageRotateCCW(
this);
217 ::ImageColorTint(
this, color);
221 ::ImageColorInvert(
this);
225 ::ImageColorGrayscale(
this);
229 ::ImageColorContrast(
this, contrast);
233 ::ImageColorBrightness(
this, brightness);
237 ::ImageColorReplace(
this, color, replace);
242 return ::ImageExtractPalette(*
this, maxPaletteSize, extractCount);
246 return ::GetImageAlphaBorder(*
this, threshold);
250 ::ImageClearBackground(
this, color);
255 ::ImageDrawPixel(
this, posX, posY, color);
260 ::ImageDrawPixelV(
this, position, color);
265 ::ImageDrawLine(
this, startPosX, startPosY, endPosX, endPosY, color);
270 ::ImageDrawLineV(
this, start, end, color);
275 ::ImageDrawCircle(
this, centerX, centerY, radius, color);
280 ::ImageDrawCircleV(
this, center, radius, color);
284 ::ImageDrawRectangle(
this, posX, posY, width, height, color);
288 ::ImageDrawRectangleV(
this, position, size, color);
292 ::ImageDrawRectangleRec(
this, rec, color);
296 ::ImageDrawRectangleLines(
this, rec, thick, color);
300 ::ImageDraw(
this, src, srcRec, dstRec, tint);
305 ::ImageDrawText(
this, position, text.c_str(), fontSize, color);
309 ::ImageDrawTextEx(
this, position, font, text.c_str(), fontSize, spacing, color);
314 return ::GetImageData(*
this);
318 return ::GetImageDataNormalized(*
this);
321 return ::LoadTextureFromImage(*
this);
Image & DrawPixel(::Vector2 position, ::Color color)
Image & ColorContrast(float contrast)
Image(const std::string &fileName, int width, int height, int format, int headerSize)
Image & operator=(const ::Image &image)
Image & ColorTint(::Color color=WHITE)
static Image GenGradientRadial(int width, int height, float density, Color inner, Color outer)
static Image GetScreenData()
static Image Text(std::string text, int fontSize, Color color)
static Image GenPerlinNoise(int width, int height, int offsetX, int offsetY, float scale)
Image & ResizeCanvas(int newWidth, int newHeight, int offsetX, int offsetY, Color color)
void Load(const std::string &fileName)
Image & operator=(const Image &image)
Image & DrawText(::Vector2 position, ::Font font, const std::string &text, float fontSize, float spacing, ::Color color=WHITE)
Image & DrawCircle(int centerX, int centerY, int radius, ::Color color)
static Image Text(Font font, std::string text, float fontSize, float spacing, Color tint)
Image & Resize(int newWidth, int newHeight)
Image & DrawLine(::Vector2 start, ::Vector2 end, ::Color color)
Image & DrawRectangle(::Rectangle rec, ::Color color=WHITE)
Image & ColorBrightness(int brightness)
Image & AlphaMask(Image alphaMask)
Image & Export(const std::string &fileName)
static Image GenChecked(int width, int height, int checksX, int checksY, Color col1, Color col2)
Image(::Color *pixels, int width, int height)
Rectangle GetAlphaBorder(float threshold)
Image & AlphaCrop(float threshold)
Image & Draw(::Image &src, ::Rectangle srcRec, ::Rectangle dstRec, ::Color tint=WHITE)
static Image GenCellular(int width, int height, int tileSize)
Image & ResizeNN(int newWidth, int newHeight)
Image(int width, int height, Color color=raylib::Color::RayWhite)
static Image GenGradientV(int width, int height, Color top, Color bottom)
Image(::Texture2D texture)
static Image GenColor(int width, int height, Color color)
Image & ColorReplace(::Color color, ::Color replace)
Image FromImage(::Rectangle rec)
Image & ToPOT(Color fillColor)
Image(void *data, int width, int height, int format)
Image & DrawRectangle(Vector2 position, Vector2 size, ::Color color=WHITE)
Image & Dither(int rBpp, int gBpp, int bBpp, int aBpp)
Image & ExportAsCode(const std::string &fileName)
inline ::Color * ExtractPalette(int maxPaletteSize, int *extractCount)
static Image GenGradientH(int width, int height, Color left, Color right)
void LoadEx(::Color *pixels, int width, int height)
inline ::Vector4 * GetImageDataNormalized()
void LoadPro(void *data, int width, int height, int format)
static Image GenWhiteNoise(int width, int height, float factor)
Provides all the classes associated with raylib-cpp.
inline ::Color * GetImageData()
Image & DrawText(::Vector2 position, const std::string &text, int fontSize, ::Color color=WHITE)
Image & Format(int newFormat)
void LoadRaw(const std::string &fileName, int width, int height, int format, int headerSize)
Image & DrawRectangle(int posX, int posY, int width, int height, ::Color color=WHITE)
Image & Crop(::Rectangle crop)
Image(const std::string &fileName)
Image & DrawRectangleLines(::Rectangle rec, int thick, ::Color color)
Image & DrawLine(int startPosX, int startPosY, int endPosX, int endPosY, ::Color color)
Image & AlphaPremultiply()
Image & DrawPixel(int posX, int posY, ::Color color)
Image & ClearBackground(::Color color=WHITE)
Image & DrawCircle(::Vector2 center, int radius, ::Color color)