@@ -85,6 +85,14 @@ impl Image {
85
85
self . 0 . data
86
86
}
87
87
88
+ pub fn get_pixel ( & self , x : i32 , y : i32 ) -> Option < Color > {
89
+ if x < 0 || y < 0 || x >= self . width ( ) || y >= self . height ( ) {
90
+ None
91
+ } else {
92
+ unsafe { Some ( ffi:: GetImageColor ( self . 0 , x, y) ) }
93
+ }
94
+ }
95
+
88
96
#[ inline]
89
97
pub fn format ( & self ) -> PixelFormat {
90
98
let i: u32 = self . 0 . format as u32 ;
@@ -438,6 +446,7 @@ impl Image {
438
446
439
447
/// Generates an Image containing a vertical gradient.
440
448
#[ inline]
449
+ <<<<<<< Updated upstream
441
450
pub fn gen_image_gradient_v ( width : i32 , height : i32 , top : Color , bottom : Color ) -> Image {
442
451
unsafe { Image ( ffi:: GenImageGradientV ( width , height , top , bottom ) ) }
443
452
}
@@ -446,6 +455,20 @@ impl Image {
446
455
#[ inline ]
447
456
pub fn gen_image_gradient_h ( width : i32 , height : i32 , left : Color , right : Color ) -> Image {
448
457
unsafe { Image ( ffi:: GenImageGradientH ( width , height , left , right ) ) }
458
+ =======
459
+ pub fn gen_image_gradient_linear (
460
+ width : i32 ,
461
+ height : i32 ,
462
+ direction : i32 ,
463
+ start : Color ,
464
+ end_ : Color ,
465
+ ) -> Image {
466
+ unsafe {
467
+ Image ( ffi:: GenImageGradientLinear (
468
+ width , height , direction , start , end_ ,
469
+ ) )
470
+ }
471
+ >>>>>>> Stashed changes
449
472
}
450
473
451
474
/// Generates an Image containing a radial gradient.
@@ -464,6 +487,25 @@ impl Image {
464
487
}
465
488
}
466
489
490
+ <<<<<<< Updated upstream
491
+ =======
492
+ /// Generate image: square gradient.
493
+ #[ inline ]
494
+ pub fn gen_image_gradient_square (
495
+ width : i32 ,
496
+ height : i32 ,
497
+ density : f32 ,
498
+ inner : Color ,
499
+ outer : Color ,
500
+ ) -> Image {
501
+ unsafe {
502
+ Image ( ffi:: GenImageGradientSquare (
503
+ width , height , density , inner , outer ,
504
+ ) )
505
+ }
506
+ }
507
+
508
+ >>>>>>> Stashed changes
467
509
/// Generates an Image containing a checkerboard pattern.
468
510
#[ inline]
469
511
pub fn gen_image_checked(
0 commit comments