Browse Source

Added Pixmap.Save.

Mark Sibly 9 years ago
parent
commit
feaf8e8074
2 changed files with 13 additions and 0 deletions
  1. 10 0
      modules/std/graphics/pixmap.monkey2
  2. 3 0
      modules/std/std.monkey2

+ 10 - 0
modules/std/graphics/pixmap.monkey2

@@ -400,6 +400,16 @@ Class Pixmap
 		Return New Pixmap( width,height,_format,PixelPtr( x,y ),_pitch )
 		Return New Pixmap( width,height,_format,PixelPtr( x,y ),_pitch )
 	End
 	End
 	
 	
+	#rem monkeydoc Saves the pixmap to a file.
+	
+	The only save format currently suppoted is PNG.
+	
+	#End
+	Method Save:Bool( path:String )
+	
+		Return SavePixmap( Self,path )
+	End
+	
 	#rem monkeydoc Loads a pixmap from a file.
 	#rem monkeydoc Loads a pixmap from a file.
 	
 	
 	@param path The file path.
 	@param path The file path.

+ 3 - 0
modules/std/std.monkey2

@@ -2,6 +2,8 @@
 Namespace std
 Namespace std
 
 
 #Import "<libc.monkey2>"
 #Import "<libc.monkey2>"
+#Import "<stb-image>"
+#Import "<stb-image-write>"
 
 
 #Import "collections/container"
 #Import "collections/container"
 #Import "collections/stack"
 #Import "collections/stack"
@@ -29,6 +31,7 @@ Namespace std
 #Import "graphics/pixelformat"
 #Import "graphics/pixelformat"
 #Import "graphics/pixmap"
 #Import "graphics/pixmap"
 #Import "graphics/pixmaploader"
 #Import "graphics/pixmaploader"
+#Import "graphics/pixmapsaver"
 #Import "graphics/color"
 #Import "graphics/color"
 
 
 #Import "misc/random"
 #Import "misc/random"