@@ -164,6 +164,11 @@ class Image : public ::Image {
164
164
*/
165
165
static ::Image Cellular (int width, int height, int tileSize) { return ::GenImageCellular (width, height, tileSize); }
166
166
167
+ /* *
168
+ * Get clipboard image content.
169
+ */
170
+ static ::Image GetClipboard () { return ::GetClipboardImage (); }
171
+
167
172
~Image () { Unload (); }
168
173
169
174
Image& operator =(const ::Image& image) {
@@ -208,7 +213,7 @@ class Image : public ::Image {
208
213
*/
209
214
void Load (const std::string& fileName) {
210
215
set (::LoadImage (fileName.c_str ()));
211
- if (!IsReady ()) {
216
+ if (!IsValid ()) {
212
217
throw RaylibException (" Failed to load Image from file: " + fileName);
213
218
}
214
219
}
@@ -222,7 +227,7 @@ class Image : public ::Image {
222
227
*/
223
228
void Load (const std::string& fileName, int width, int height, int format, int headerSize) {
224
229
set (::LoadImageRaw (fileName.c_str (), width, height, format, headerSize));
225
- if (!IsReady ()) {
230
+ if (!IsValid ()) {
226
231
throw RaylibException (" Failed to load Image from file: " + fileName);
227
232
}
228
233
}
@@ -236,7 +241,7 @@ class Image : public ::Image {
236
241
*/
237
242
void Load (const std::string& fileName, int * frames) {
238
243
set (::LoadImageAnim (fileName.c_str (), frames));
239
- if (!IsReady ()) {
244
+ if (!IsValid ()) {
240
245
throw RaylibException (" Failed to load Image from file: " + fileName);
241
246
}
242
247
}
@@ -250,7 +255,7 @@ class Image : public ::Image {
250
255
*/
251
256
void Load (const std::string& fileType, const unsigned char * fileData, int dataSize) {
252
257
set (::LoadImageFromMemory (fileType.c_str (), fileData, dataSize));
253
- if (!IsReady ()) {
258
+ if (!IsValid ()) {
254
259
throw RaylibException (" Failed to load Image data with file type: " + fileType);
255
260
}
256
261
}
@@ -264,7 +269,7 @@ class Image : public ::Image {
264
269
*/
265
270
void Load (const ::Texture2D& texture) {
266
271
set (::LoadImageFromTexture (texture));
267
- if (!IsReady ()) {
272
+ if (!IsValid ()) {
268
273
throw RaylibException (" Failed to load Image from texture." );
269
274
}
270
275
}
@@ -605,6 +610,13 @@ class Image : public ::Image {
605
610
::ImageDrawLineV (this , start, end, color);
606
611
}
607
612
613
+ /* *
614
+ * Description: Draw a line defining thickness within an image
615
+ */
616
+ void DrawLine (::Vector2 start, ::Vector2 end, int thick, ::Color color = {255 , 255 , 255 , 255 }) {
617
+ ImageDrawLineEx (this , start, end, thick, color);
618
+ }
619
+
608
620
void DrawCircle (int centerX, int centerY, int radius, ::Color color = {255 , 255 , 255 , 255 }) {
609
621
::ImageDrawCircle (this , centerX, centerY, radius, color);
610
622
}
@@ -629,6 +641,8 @@ class Image : public ::Image {
629
641
::ImageDrawRectangleLines (this , rec, thick, color);
630
642
}
631
643
644
+ // TODO: Add ImageDrawTriangle()
645
+
632
646
void Draw (const ::Image& src, ::Rectangle srcRec, ::Rectangle dstRec, ::Color tint = {255 , 255 , 255 , 255 }) {
633
647
::ImageDraw (this , src, srcRec, dstRec, tint);
634
648
}
@@ -728,7 +742,19 @@ class Image : public ::Image {
728
742
*
729
743
* @return True or false depending on whether the Image has been loaded.
730
744
*/
731
- bool IsReady () const { return ::IsImageReady (*this ); }
745
+ bool IsValid () const { return ::IsImageValid (*this ); }
746
+
747
+ /* *
748
+ * Create an image from a selected channel of another image (GRAYSCALE)
749
+ */
750
+ ::Image Channel (int selectedChannel) { return ::ImageFromChannel (*this , selectedChannel); }
751
+
752
+ /* *
753
+ * Apply custom square convolution kernel to image
754
+ */
755
+ void KernelConvolution (const float * kernel, int kernelSize) {
756
+ ::ImageKernelConvolution (this , kernel, kernelSize);
757
+ }
732
758
protected:
733
759
void set (const ::Image& image) {
734
760
data = image.data ;
0 commit comments