raylib-cpp
C++ object-oriented wrapper library for raylib.
Image.hpp
1 /*
2 * LICENSE: zlib/libpng
3 *
4 * raylib-cpp is licensed under an unmodified zlib/libpng license, which is an OSI-certified,
5 * BSD-like license that allows static linking with closed source software:
6 *
7 * Copyright (c) 2020 Rob Loach (@RobLoach)
8 *
9 * This software is provided "as-is", without any express or implied warranty. In no event
10 * will the authors be held liable for any damages arising from the use of this software.
11 *
12 * Permission is granted to anyone to use this software for any purpose, including commercial
13 * applications, and to alter it and redistribute it freely, subject to the following restrictions:
14 *
15 * 1. The origin of this software must not be misrepresented; you must not claim that you
16 * wrote the original software. If you use this software in a product, an acknowledgment
17 * in the product documentation would be appreciated but is not required.
18 *
19 * 2. Altered source versions must be plainly marked as such, and must not be misrepresented
20 * as being the original software.
21 *
22 * 3. This notice may not be removed or altered from any source distribution.
23 */
24 
25 #ifndef RAYLIB_CPP_INCLUDE_IMAGE_HPP_
26 #define RAYLIB_CPP_INCLUDE_IMAGE_HPP_
27 
28 #include <string>
29 
30 #include "./raylib.hpp"
31 #include "./raylib-cpp-utils.hpp"
32 
33 namespace raylib {
34 class Image : public ::Image {
35  public:
36  Image(const ::Image& image) {
37  set(image);
38  }
39 
40  Image(const std::string& fileName) {
41  Load(fileName);
42  }
43 
44  Image(const std::string& fileName, int width, int height, int format, int headerSize) {
45  LoadRaw(fileName, width, height, format, headerSize);
46  }
47 
48  Image(const std::string& fileName, int* frames) {
49  LoadAnim(fileName, frames);
50  }
51 
52  Image(const std::string& fileType, const unsigned char* fileData, int dataSize) {
53  LoadFromMemory(fileType, fileData, dataSize);
54  }
55 
56  Image(const ::Texture2D& texture) {
57  set(::GetTextureData(texture));
58  }
59 
60  Image(int width, int height, ::Color color = {255, 255, 255, 255}) {
61  set(::GenImageColor(width, height, color));
62  }
63 
64  Image(const ::Font& font, const std::string& text, float fontSize, float spacing,
65  ::Color tint = {255, 255, 255, 255}) {
66  set(::ImageTextEx(font, text.c_str(), fontSize, spacing, tint));
67  }
68 
69  static ::Image Text(const std::string& text, int fontSize,
70  ::Color color = {255, 255, 255, 255}) {
71  return ::ImageText(text.c_str(), fontSize, color);
72  }
73 
74  static ::Image Text(const ::Font& font, const std::string& text, float fontSize, float spacing,
75  ::Color tint = {255, 255, 255, 255}) {
76  return ::ImageTextEx(font, text.c_str(), fontSize, spacing, tint);
77  }
78 
82  static ::Image GetScreenData() {
83  return ::GetScreenData();
84  }
85 
89  static ::Image Color(int width, int height, ::Color color = {255, 255, 255, 255}) {
90  return ::GenImageColor(width, height, color);
91  }
92 
96  static ::Image GradientV(int width, int height, ::Color top, ::Color bottom) {
97  return ::GenImageGradientV(width, height, top, bottom);
98  }
99 
103  static ::Image GradientH(int width, int height, ::Color left, ::Color right) {
104  return ::GenImageGradientH(width, height, left, right);
105  }
106 
110  static ::Image GradientRadial(int width, int height, float density,
111  ::Color inner, ::Color outer) {
112  return ::GenImageGradientRadial(width, height, density, inner, outer);
113  }
114 
118  static ::Image Checked(int width, int height, int checksX, int checksY,
119  ::Color col1, ::Color col2) {
120  return ::GenImageChecked(width, height, checksX, checksY, col1, col2);
121  }
122 
126  static ::Image WhiteNoise(int width, int height, float factor) {
127  return ::GenImageWhiteNoise(width, height, factor);
128  }
129 
133  static ::Image PerlinNoise(int width, int height, int offsetX, int offsetY,
134  float scale = 1.0f) {
135  return ::GenImagePerlinNoise(width, height, offsetX, offsetY, scale);
136  }
137 
141  static ::Image Cellular(int width, int height, int tileSize) {
142  return ::GenImageCellular(width, height, tileSize);
143  }
144 
145  ~Image() {
146  Unload();
147  }
148 
149  Image& operator=(const ::Image& image) {
150  set(image);
151  return *this;
152  }
153 
157  void Load(const std::string& fileName) {
158  set(::LoadImage(fileName.c_str()));
159  }
160 
164  void LoadRaw(const std::string& fileName, int width, int height, int format, int headerSize) {
165  set(::LoadImageRaw(fileName.c_str(), width, height, format, headerSize));
166  }
167 
171  void LoadAnim(const std::string& fileName, int* frames) {
172  set(::LoadImageAnim(fileName.c_str(), frames));
173  }
174 
179  const std::string& fileType,
180  const unsigned char *fileData,
181  int dataSize) {
182  set(::LoadImageFromMemory(fileType.c_str(), fileData, dataSize));
183  }
184 
188  inline void Unload() {
189  if (data != NULL) {
190  ::UnloadImage(*this);
191  data = NULL;
192  }
193  }
194 
198  inline bool Export(const std::string& fileName) {
199  // TODO(RobLoach): Switch to an invalid loading exception on false.
200  return ::ExportImage(*this, fileName.c_str());
201  }
202 
206  inline bool ExportAsCode(const std::string& fileName) {
207  return ::ExportImageAsCode(*this, fileName.c_str());
208  }
209 
210  GETTERSETTER(void*, Data, data)
211  GETTERSETTER(int, Width, width)
212  GETTERSETTER(int, Height, height)
213  GETTERSETTER(int, Mipmaps, mipmaps)
214  GETTERSETTER(int, Format, format)
215 
219  inline ::Vector2 GetSize() {
220  return {static_cast<float>(width), static_cast<float>(height)};
221  }
222 
226  inline ::Image Copy() {
227  return ::ImageCopy(*this);
228  }
229 
233  inline ::Image FromImage(::Rectangle rec) {
234  return ::ImageFromImage(*this, rec);
235  }
236 
240  inline Image& ToPOT(::Color fillColor) {
241  ::ImageToPOT(this, fillColor);
242  return *this;
243  }
244 
248  inline Image& Format(int newFormat) {
249  ::ImageFormat(this, newFormat);
250  return *this;
251  }
252 
256  inline Image& AlphaMask(const ::Image& alphaMask) {
257  ::ImageAlphaMask(this, alphaMask);
258  return *this;
259  }
260 
264  inline Image& AlphaCrop(float threshold) {
265  ::ImageAlphaCrop(this, threshold);
266  return *this;
267  }
268 
273  ::ImageAlphaPremultiply(this);
274  return *this;
275  }
276 
280  inline Image& Crop(::Rectangle crop) {
281  ::ImageCrop(this, crop);
282  return *this;
283  }
284 
288  inline Image& Crop(::Vector2 size) {
289  return Crop(0, 0, static_cast<int>(size.x), static_cast<int>(size.y));
290  }
291 
295  inline Image& Crop(int offsetX, int offsetY, int newWidth, int newHeight) {
296  ::Rectangle rect{
297  static_cast<float>(offsetX),
298  static_cast<float>(offsetY),
299  static_cast<float>(newWidth),
300  static_cast<float>(newHeight)
301  };
302  ::ImageCrop(this, rect);
303  return *this;
304  }
305 
309  inline Image& Resize(int newWidth, int newHeight) {
310  ::ImageResize(this, newWidth, newHeight);
311  return *this;
312  }
313 
317  inline Image& ResizeNN(int newWidth, int newHeight) {
318  ::ImageResizeNN(this, newWidth, newHeight);
319  return *this;
320  }
321 
325  inline Image& ResizeCanvas(int newWidth, int newHeight, int offsetX, int offsetY,
326  ::Color color = {255, 255, 255, 255}) {
327  ::ImageResizeCanvas(this, newWidth, newHeight, offsetX, offsetY, color);
328  return *this;
329  }
330 
334  inline Image& Mipmaps() {
335  ::ImageMipmaps(this);
336  return *this;
337  }
338 
342  inline Image& Dither(int rBpp, int gBpp, int bBpp, int aBpp) {
343  ::ImageDither(this, rBpp, gBpp, bBpp, aBpp);
344  return *this;
345  }
346 
350  inline Image& FlipVertical() {
351  ::ImageFlipVertical(this);
352  return *this;
353  }
354 
358  inline Image& FlipHorizontal() {
359  ::ImageFlipHorizontal(this);
360  return *this;
361  }
362 
366  inline Image& RotateCW() {
367  ::ImageRotateCW(this);
368  return *this;
369  }
370 
374  inline Image& RotateCCW() {
375  ::ImageRotateCCW(this);
376  return *this;
377  }
378 
382  inline Image& ColorTint(::Color color = {255, 255, 255, 255}) {
383  ::ImageColorTint(this, color);
384  return *this;
385  }
386 
390  inline Image& ColorInvert() {
391  ::ImageColorInvert(this);
392  return *this;
393  }
394 
398  inline Image& ColorGrayscale() {
399  ::ImageColorGrayscale(this);
400  return *this;
401  }
402 
408  inline Image& ColorContrast(float contrast) {
409  ::ImageColorContrast(this, contrast);
410  return *this;
411  }
412 
418  inline Image& ColorBrightness(int brightness) {
419  ::ImageColorBrightness(this, brightness);
420  return *this;
421  }
422 
426  inline Image& ColorReplace(::Color color, ::Color replace) {
427  ::ImageColorReplace(this, color, replace);
428  return *this;
429  }
430 
436  inline Rectangle GetAlphaBorder(float threshold) const {
437  return ::GetImageAlphaBorder(*this, threshold);
438  }
439 
443  inline Image& ClearBackground(::Color color = {0, 0, 0, 255}) {
444  ::ImageClearBackground(this, color);
445  return *this;
446  }
447 
451  inline Image& DrawPixel(int posX, int posY, ::Color color = {255, 255, 255, 255}) {
452  ::ImageDrawPixel(this, posX, posY, color);
453  return *this;
454  }
455 
456  inline Image& DrawPixel(::Vector2 position, ::Color color = {255, 255, 255, 255}) {
457  ::ImageDrawPixelV(this, position, color);
458  return *this;
459  }
460 
461  inline Image& DrawLine(int startPosX, int startPosY, int endPosX, int endPosY,
462  ::Color color = {255, 255, 255, 255}) {
463  ::ImageDrawLine(this, startPosX, startPosY, endPosX, endPosY, color);
464  return *this;
465  }
466 
467  inline Image& DrawLine(::Vector2 start, ::Vector2 end, ::Color color = {255, 255, 255, 255}) {
468  ::ImageDrawLineV(this, start, end, color);
469  return *this;
470  }
471 
472  inline Image& DrawCircle(int centerX, int centerY, int radius,
473  ::Color color = {255, 255, 255, 255}) {
474  ::ImageDrawCircle(this, centerX, centerY, radius, color);
475  return *this;
476  }
477 
478  inline Image& DrawCircle(::Vector2 center, int radius,
479  ::Color color = {255, 255, 255, 255}) {
480  ::ImageDrawCircleV(this, center, radius, color);
481  return *this;
482  }
483 
484  inline Image& DrawRectangle(int posX, int posY, int width, int height,
485  ::Color color = {255, 255, 255, 255}) {
486  ::ImageDrawRectangle(this, posX, posY, width, height, color);
487  return *this;
488  }
489 
490  inline Image& DrawRectangle(Vector2 position, Vector2 size,
491  ::Color color = {255, 255, 255, 255}) {
492  ::ImageDrawRectangleV(this, position, size, color);
493  return *this;
494  }
495 
496  inline Image& DrawRectangle(::Rectangle rec, ::Color color = {255, 255, 255, 255}) {
497  ::ImageDrawRectangleRec(this, rec, color);
498  return *this;
499  }
500 
501  inline Image& DrawRectangleLines(::Rectangle rec, int thick,
502  ::Color color = {255, 255, 255, 255}) {
503  ::ImageDrawRectangleLines(this, rec, thick, color);
504  return *this;
505  }
506 
507  inline Image& Draw(const ::Image& src, ::Rectangle srcRec, ::Rectangle dstRec,
508  ::Color tint = {255, 255, 255, 255}) {
509  ::ImageDraw(this, src, srcRec, dstRec, tint);
510  return *this;
511  }
512 
513  inline Image& DrawText(const std::string& text, ::Vector2 position, int fontSize,
514  ::Color color = {255, 255, 255, 255}) {
515  ::ImageDrawText(this,
516  text.c_str(),
517  static_cast<int>(position.x),
518  static_cast<int>(position.y),
519  fontSize,
520  color);
521  return *this;
522  }
523 
524  inline Image& DrawText(const std::string& text, int x, int y, int fontSize,
525  ::Color color = {255, 255, 255, 255}) {
526  ::ImageDrawText(this, text.c_str(), x, y, fontSize, color);
527  return *this;
528  }
529 
530  inline Image& DrawText(const ::Font& font, const std::string& text, ::Vector2 position,
531  float fontSize, float spacing, ::Color tint = {255, 255, 255, 255}) {
532  ::ImageDrawTextEx(this, font, text.c_str(), position, fontSize, spacing, tint);
533  return *this;
534  }
535 
539  inline ::Color* LoadColors() {
540  return ::LoadImageColors(*this);
541  }
542 
546  inline ::Color* LoadPalette(int maxPaletteSize, int *colorsCount) {
547  return ::LoadImagePalette(*this, maxPaletteSize, colorsCount);
548  }
549 
553  inline ::Texture2D LoadTexture() {
554  return ::LoadTextureFromImage(*this);
555  }
556 
560  inline operator ::Texture2D() {
561  return LoadTexture();
562  }
563 
564  protected:
565  inline void set(const ::Image& image) {
566  data = image.data;
567  width = image.width;
568  height = image.height;
569  mipmaps = image.mipmaps;
570  format = image.format;
571  }
572 };
573 } // namespace raylib
574 
575 #endif // RAYLIB_CPP_INCLUDE_IMAGE_HPP_
raylib::Image::Dither
Image & Dither(int rBpp, int gBpp, int bBpp, int aBpp)
Dither image data to 16bpp or lower (Floyd-Steinberg dithering)
Definition: Image.hpp:342
raylib
Provides all the classes associated with raylib-cpp.
Definition: AudioDevice.hpp:31
raylib::Image::LoadPalette
inline ::Color * LoadPalette(int maxPaletteSize, int *colorsCount)
Load colors palette from image as a Color array (RGBA - 32bit)
Definition: Image.hpp:546
raylib::Image::ColorBrightness
Image & ColorBrightness(int brightness)
Modify image color: brightness.
Definition: Image.hpp:418
raylib::Image::WhiteNoise
::Image WhiteNoise(int width, int height, float factor)
Generate image: white noise.
Definition: Image.hpp:126
raylib::LoadImage
static inline ::Image LoadImage(const std::string &fileName)
Definition: Functions.hpp:216
raylib::LoadImageRaw
static inline ::Image LoadImageRaw(const std::string &fileName, int width, int height, int format, int headerSize)
Definition: Functions.hpp:220
raylib::Image::GradientRadial
::Image GradientRadial(int width, int height, float density, ::Color inner, ::Color outer)
Generate image: radial gradient.
Definition: Image.hpp:110
raylib::Image::Image
Image(const std::string &fileType, const unsigned char *fileData, int dataSize)
Definition: Image.hpp:52
raylib::Image::~Image
~Image()
Definition: Image.hpp:145
raylib::Image::Image
Image(int width, int height, ::Color color={255, 255, 255, 255})
Definition: Image.hpp:60
raylib::Image::ToPOT
Image & ToPOT(::Color fillColor)
Convert image to POT (power-of-two)
Definition: Image.hpp:240
raylib::LoadImageFromMemory
static inline ::Image LoadImageFromMemory(const std::string &fileType, const unsigned char *fileData, int dataSize)
Definition: Functions.hpp:230
raylib::Image::DrawCircle
Image & DrawCircle(::Vector2 center, int radius, ::Color color={255, 255, 255, 255})
Definition: Image.hpp:478
raylib::Image::Format
Image & Format(int newFormat)
Convert image data to desired format.
Definition: Image.hpp:248
raylib::Image::Draw
Image & Draw(const ::Image &src, ::Rectangle srcRec, ::Rectangle dstRec, ::Color tint={255, 255, 255, 255})
Definition: Image.hpp:507
raylib::Image::Copy
inline ::Image Copy()
Create an image duplicate (useful for transformations)
Definition: Image.hpp:226
raylib::Image::Crop
Image & Crop(::Vector2 size)
Crop an image to a new given width and height based on a vector.
Definition: Image.hpp:288
raylib::Image::ColorInvert
Image & ColorInvert()
Modify image color: invert.
Definition: Image.hpp:390
raylib::Image::ColorGrayscale
Image & ColorGrayscale()
Modify image color: grayscale.
Definition: Image.hpp:398
raylib::Image
Definition: Image.hpp:34
raylib::Image::Crop
Image & Crop(::Rectangle crop)
Crop an image to area defined by a rectangle.
Definition: Image.hpp:280
raylib::Image::Image
Image(const std::string &fileName)
Definition: Image.hpp:40
raylib::LoadImageAnim
static inline ::Image LoadImageAnim(const std::string &fileName, int *frames)
Definition: Functions.hpp:226
raylib::Image::DrawText
Image & DrawText(const std::string &text, int x, int y, int fontSize, ::Color color={255, 255, 255, 255})
Definition: Image.hpp:524
raylib::Image::GetSize
inline ::Vector2 GetSize()
Retrieve the width and height of the image.
Definition: Image.hpp:219
raylib::Image::DrawPixel
Image & DrawPixel(::Vector2 position, ::Color color={255, 255, 255, 255})
Definition: Image.hpp:456
raylib::Image::Text
::Image Text(const ::Font &font, const std::string &text, float fontSize, float spacing, ::Color tint={255, 255, 255, 255})
Definition: Image.hpp:74
raylib::Image::DrawLine
Image & DrawLine(int startPosX, int startPosY, int endPosX, int endPosY, ::Color color={255, 255, 255, 255})
Definition: Image.hpp:461
raylib::Image::RotateCCW
Image & RotateCCW()
Rotate image counter-clockwise 90deg.
Definition: Image.hpp:374
raylib::Image::DrawCircle
Image & DrawCircle(int centerX, int centerY, int radius, ::Color color={255, 255, 255, 255})
Definition: Image.hpp:472
raylib::Image::Image
Image(const ::Font &font, const std::string &text, float fontSize, float spacing, ::Color tint={255, 255, 255, 255})
Definition: Image.hpp:64
raylib::Image::ExportAsCode
bool ExportAsCode(const std::string &fileName)
Export image as code file defining an array of bytes, returns true on success.
Definition: Image.hpp:206
raylib::Image::DrawRectangle
Image & DrawRectangle(Vector2 position, Vector2 size, ::Color color={255, 255, 255, 255})
Definition: Image.hpp:490
raylib::Image::FlipVertical
Image & FlipVertical()
Flip image vertically.
Definition: Image.hpp:350
raylib::Image::ColorContrast
Image & ColorContrast(float contrast)
Modify image color: contrast.
Definition: Image.hpp:408
raylib::Image::DrawText
Image & DrawText(const std::string &text, ::Vector2 position, int fontSize, ::Color color={255, 255, 255, 255})
Definition: Image.hpp:513
raylib::Image::LoadColors
inline ::Color * LoadColors()
Load color data from image as a Color array (RGBA - 32bit)
Definition: Image.hpp:539
raylib::Image::GetScreenData
::Image GetScreenData()
Get pixel data from screen buffer and return an Image (screenshot)
Definition: Image.hpp:82
raylib::Image::PerlinNoise
::Image PerlinNoise(int width, int height, int offsetX, int offsetY, float scale=1.0f)
Generate image: perlin noise.
Definition: Image.hpp:133
raylib::Image::LoadRaw
void LoadRaw(const std::string &fileName, int width, int height, int format, int headerSize)
Load image from RAW file data.
Definition: Image.hpp:164
raylib::Image::operator=
Image & operator=(const ::Image &image)
Definition: Image.hpp:149
raylib::Image::DrawRectangle
Image & DrawRectangle(::Rectangle rec, ::Color color={255, 255, 255, 255})
Definition: Image.hpp:496
raylib::Image::DrawLine
Image & DrawLine(::Vector2 start, ::Vector2 end, ::Color color={255, 255, 255, 255})
Definition: Image.hpp:467
raylib::Image::AlphaPremultiply
Image & AlphaPremultiply()
Premultiply alpha channel.
Definition: Image.hpp:272
raylib::Image::Crop
Image & Crop(int offsetX, int offsetY, int newWidth, int newHeight)
Crop an image to area defined by a rectangle.
Definition: Image.hpp:295
raylib::Image::LoadFromMemory
void LoadFromMemory(const std::string &fileType, const unsigned char *fileData, int dataSize)
Load image from memory buffer, fileType refers to extension: i.e.
Definition: Image.hpp:178
raylib::Image::ResizeCanvas
Image & ResizeCanvas(int newWidth, int newHeight, int offsetX, int offsetY, ::Color color={255, 255, 255, 255})
Resize canvas and fill with color.
Definition: Image.hpp:325
raylib::Image::DrawPixel
Image & DrawPixel(int posX, int posY, ::Color color={255, 255, 255, 255})
Draw pixel within an image.
Definition: Image.hpp:451
raylib::Image::Mipmaps
Image & Mipmaps()
Generate all mipmap levels for a provided image.
Definition: Image.hpp:334
raylib::Image::Text
::Image Text(const std::string &text, int fontSize, ::Color color={255, 255, 255, 255})
Definition: Image.hpp:69
raylib::Image::Image
Image(const std::string &fileName, int width, int height, int format, int headerSize)
Definition: Image.hpp:44
raylib::Image::Export
bool Export(const std::string &fileName)
Export image data to file, returns true on success.
Definition: Image.hpp:198
raylib::Rectangle
Definition: Rectangle.hpp:33
raylib::Vector2
Definition: Vector2.hpp:37
raylib::Image::GradientV
::Image GradientV(int width, int height, ::Color top, ::Color bottom)
Generate image: vertical gradient.
Definition: Image.hpp:96
raylib::Image::DrawRectangleLines
Image & DrawRectangleLines(::Rectangle rec, int thick, ::Color color={255, 255, 255, 255})
Definition: Image.hpp:501
raylib::Image::ColorTint
Image & ColorTint(::Color color={255, 255, 255, 255})
Modify image color: tint.
Definition: Image.hpp:382
raylib::Image::GetAlphaBorder
Rectangle GetAlphaBorder(float threshold) const
Get image alpha border rectangle.
Definition: Image.hpp:436
raylib::Color
Definition: Color.hpp:35
raylib::Image::GradientH
::Image GradientH(int width, int height, ::Color left, ::Color right)
Generate image: horizontal gradient.
Definition: Image.hpp:103
raylib::Image::set
void set(const ::Image &image)
Definition: Image.hpp:565
raylib::Image::Checked
::Image Checked(int width, int height, int checksX, int checksY, ::Color col1, ::Color col2)
Generate image: checked.
Definition: Image.hpp:118
raylib::Image::LoadAnim
void LoadAnim(const std::string &fileName, int *frames)
Load image sequence from file (frames appended to image.data).
Definition: Image.hpp:171
raylib::Image::Load
void Load(const std::string &fileName)
Load image from file into CPU memory (RAM)
Definition: Image.hpp:157
raylib::Image::Image
Image(const std::string &fileName, int *frames)
Definition: Image.hpp:48
raylib::Image::Color
::Image Color(int width, int height, ::Color color={255, 255, 255, 255})
Generate image: plain color.
Definition: Image.hpp:89
raylib::Image::AlphaCrop
Image & AlphaCrop(float threshold)
Crop image depending on alpha value.
Definition: Image.hpp:264
raylib::Image::Resize
Image & Resize(int newWidth, int newHeight)
Resize and image to new size.
Definition: Image.hpp:309
raylib::Image::Image
Image(const ::Texture2D &texture)
Definition: Image.hpp:56
raylib::Image::Unload
void Unload()
Unload image from CPU memory (RAM)
Definition: Image.hpp:188
raylib::Image::FlipHorizontal
Image & FlipHorizontal()
Flip image horizontally.
Definition: Image.hpp:358
raylib::Image::FromImage
inline ::Image FromImage(::Rectangle rec)
Create an image from another image piece.
Definition: Image.hpp:233
raylib::Image::LoadTexture
inline ::Texture2D LoadTexture()
Load texture from image data.
Definition: Image.hpp:553
raylib::Image::ResizeNN
Image & ResizeNN(int newWidth, int newHeight)
Resize and image to new size using Nearest-Neighbor scaling algorithm.
Definition: Image.hpp:317
raylib::Image::Cellular
::Image Cellular(int width, int height, int tileSize)
Generate image: cellular algorithm.
Definition: Image.hpp:141
raylib::Image::Image
Image(const ::Image &image)
Definition: Image.hpp:36
raylib::Image::DrawText
Image & DrawText(const ::Font &font, const std::string &text, ::Vector2 position, float fontSize, float spacing, ::Color tint={255, 255, 255, 255})
Definition: Image.hpp:530
raylib::Image::DrawRectangle
Image & DrawRectangle(int posX, int posY, int width, int height, ::Color color={255, 255, 255, 255})
Definition: Image.hpp:484
raylib::Image::ClearBackground
Image & ClearBackground(::Color color={0, 0, 0, 255})
Clear image background with given color.
Definition: Image.hpp:443
raylib::Image::RotateCW
Image & RotateCW()
Rotate image clockwise 90deg.
Definition: Image.hpp:366
raylib::Image::AlphaMask
Image & AlphaMask(const ::Image &alphaMask)
Apply alpha mask to image.
Definition: Image.hpp:256
raylib::Image::ColorReplace
Image & ColorReplace(::Color color, ::Color replace)
Modify image color: replace color.
Definition: Image.hpp:426