lib/mnit: introduce `blit_scaled`
authorJean Privat <jean@pryen.org>
Sat, 7 Jun 2014 03:04:52 +0000 (23:04 -0400)
committerJean Privat <jean@pryen.org>
Mon, 9 Jun 2014 19:20:45 +0000 (15:20 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

lib/mnit_display.nit

index 66689ed..f04dadc 100644 (file)
@@ -61,6 +61,17 @@ interface Drawable
        # Draw image on self, for top left position
        fun blit( image: I, x, y: Int ) is abstract
 
+       # Draw image on self, for top left position but scaled
+       # the width and height of the target rectangle is specified
+       fun blit_scaled(image: Image, x, y, w, h: Int)
+       do
+               var fx = x.to_f
+               var fy = y.to_f
+               var fx2 = fx + w.to_f
+               var fy2 = fy + h.to_f
+               blit_stretched(image, fx, fy, fx, fy2, fx2, fy2, fx2, fy)
+       end
+
        # Draw image, centered at position
        fun blit_centered( image: I, x, y: Int ) is abstract