From 13193bfa45f7ccb8bd6a6d6b79ec5fdd4377e4b3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexis=20Laferri=C3=A8re?= Date: Wed, 17 Dec 2014 10:48:00 -0500 Subject: [PATCH] lib/sdl: add access to texture pixels and alpha mask MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Alexis Laferrière --- lib/sdl.nit | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/sdl.nit b/lib/sdl.nit index 26ae459..168f123 100644 --- a/lib/sdl.nit +++ b/lib/sdl.nit @@ -21,6 +21,7 @@ module sdl is end import mnit_display +import c in "C header" `{ #include @@ -244,6 +245,12 @@ extern class SDLImage redef fun height: Int `{ return recv->h; `} fun is_ok: Bool do return not address_is_null + + # Returns a reference to the pixels of the texture + fun pixels: NativeCByteArray `{ return recv->pixels; `} + + # Does this texture has an alpha mask? + fun amask: Bool `{ return recv->format->Amask; `} end # A simple rectangle -- 1.7.9.5