@@ -85,6 +85,14 @@ impl Image {
8585 self . 0 . data
8686 }
8787
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+
8896 #[ inline]
8997 pub fn format ( & self ) -> PixelFormat {
9098 let i: u32 = self . 0 . format as u32 ;
@@ -438,6 +446,7 @@ impl Image {
438446
439447 /// Generates an Image containing a vertical gradient.
440448 #[ inline]
449+ <<<<<<< Updated upstream
441450 pub fn gen_image_gradient_v ( width : i32 , height : i32 , top : Color , bottom : Color ) -> Image {
442451 unsafe { Image ( ffi:: GenImageGradientV ( width , height , top , bottom ) ) }
443452 }
@@ -446,6 +455,20 @@ impl Image {
446455 #[ inline ]
447456 pub fn gen_image_gradient_h ( width : i32 , height : i32 , left : Color , right : Color ) -> Image {
448457 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
449472 }
450473
451474 /// Generates an Image containing a radial gradient.
@@ -464,6 +487,25 @@ impl Image {
464487 }
465488 }
466489
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
467509 /// Generates an Image containing a checkerboard pattern.
468510 #[ inline]
469511 pub fn gen_image_checked(
0 commit comments