X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pages%2FSDL-Image.html-inc;h=8faed1e8612c2a1b88b165f507866c763cbb212b;hb=505f308d8b092747da8b2f5e9781475a1f06dfe8;hp=e4b8c650c0c59cd65fcb07e22493e292004f2a2c;hpb=5241ab5e791c291066d7f734a49c7fda9bf287b9;p=sdlgit%2FSDL-Site.git diff --git a/pages/SDL-Image.html-inc b/pages/SDL-Image.html-inc index e4b8c65..8faed1e 100644 --- a/pages/SDL-Image.html-inc +++ b/pages/SDL-Image.html-inc @@ -7,38 +7,48 @@
SDL, Image
+Image
$file Image file name to load a surface from.
-Load file for use as an image in a new SDL::Surface. This actually calls IMG_LoadTyped_RW
the binded function to SDL::Image::load_typed_rw, with the file extension used as the type string. This can load all supported image files, including TGA as long as the filename ends with ".tga". It is best to call this outside of event loops, and rather keep the loaded images around until you are really done with them, as disk speed and image conversion to a surface is not that speedy.
-Note: If the image format loader requires initialization, it will attempt to do that the first time it is needed if you have not already called SDL::Image::init to load support for your image format.
-Note: If the image format supports a transparent pixel, SDL::Image will set the colorkey for the surface. You can enable RLE acceleration on the surface afterwards by calling:
-SDL::Video::set_color_key
Load file for use as an image in a new SDL::Surface. This actually calls IMG_LoadTyped_RW
the binded function to SDL::Image::load_typed_rw, with the file extension used as the type string. This can load all supported image files, including TGA as long as the filename ends with ".tga". It is best to call this outside of event loops, and rather keep the loaded images around until you are really done with them, as disk speed and image conversion to a surface is not that speedy.
+Note: If the image format loader requires initialization, it will attempt to do that the first time it is needed if you have not already called SDL::Image::init to load support for your image format.
+Note: If the image format supports a transparent pixel, SDL::Image will set the colorkey for the surface. You can enable RLE acceleration on the surface afterwards by calling:
+SDL::Video::set_color_key
my $image = SDL::Image::load( $some_png_file ); SDL::Video::set_color_key($image, SDL_RLEACCEL, $image->format->colorkey);-
An image as a SDL::Surface. NULL is returned on errors, such as no support built for the image, or a file reading error. Use SDL::get_error to get cause of error.
+An image as a SDL::Surface. NULL is returned on errors, such as no support built for the image, or a file reading error. Use SDL::get_error to get cause of error.
The source SDL::RWops as a pointer. The image is loaded from this.
use SDL; use SDL::RWOps; use SDL::Image; @@ -206,9 +220,9 @@ Note: If the image format supports a transparent pixel, RETURNS -The image as a new SDL::Surface. NULL is returned on errors. -++Return
++The image as a new SDL::Surface. NULL is returned on errors.
is_[TYPE]
@@ -229,7 +243,16 @@ The image as a new SDL::Surface. NULL is returneis_XPM is_XV -These functions take a SDL::RWOps as a parameter.
+These functions take a SDL::RWOps as a parameter.
+ +Return
+++1 if the image is a valid [TYPE] and the [TYPE] format support is compiled into SDL_image. 0 is returned otherwise.
+ +Example
+-use SDL::RWOps; use SDL::Image; @@ -237,17 +260,9 @@ The image as a new SDL::Surface. NULL is returne print "Image is BMP" if ( SDL::is_BMP ); - - -RETURN
--1 if the image is a valid [TYPE] and the [TYPE] format support is compiled into SDL_image. 0 is returned otherwise.
- -load_[TYPE]_rw
-Specific loader for known formats:
@@ -266,16 +281,16 @@ The image as a new SDL::Surface. NULL is returneload_XPM_rw load_XV_rw -These functions take a SDL::RWop as a parameter
+These functions take a SDL::RWop as a parameter
RETURN
--The image as a new SDL::Surface. NULL is returned on errors, like if the [TYPE] is not supported, or a read error.
+Return
++-The image as a new SDL::Surface. NULL is returned on errors, like if the [TYPE] is not supported, or a read error.
Example
-+Example
+-use SDL; use SDL::RWOps; use SDL::Image; @@ -297,13 +312,13 @@ The image as a new SDL::Surface. NULL is returneThis functions takes the reference of an array in the valid @XPM format. Also the $width of the XPM image.
RETURNS
--The image as a new SDL::Surface. NULL is returned on errors, like if XPM is not supported, or a read error.
+Return
++-The image as a new SDL::Surface. NULL is returned on errors, like if XPM is not supported, or a read error.
EXAMPLE
-+Example
+my @XPM= ( '30 30 9 1', ' c #FFFFFF', @@ -357,7 +372,16 @@ The image as a new SDL::Surface. NULL is returnelinked_version
-+Provides the version of linked sdl_image library. see SDL::Version
+Provides the version of linked sdl_image library.
+ +Return
+++Returns a SDL::Version object
+ +Example
+-my $version = SDL::Image::linked_version(); print $version->major.' '.$version->minor.' '.$version->patch; @@ -383,13 +407,13 @@ Note: No initialization is needed nor performed when using the SDL::Image::is_JP Note: this function does not always set the error string, so do not depend on SDL::Image::get_error being meaningful all the time.Return
-+Return
+-A bitmask of all the currently inited image loaders.
Example
-+Example
+\ No newline at end of fileuse SDL::Image; my $flags = IMG_INIT_JPG | IMG_INIT_PNG | IMG_INIT_JPG; my $inited = SDL::Image::init($flags); @@ -400,7 +424,11 @@ Note: this function does not always set the error string, so do not depend on SDquit
+For version SDL_image 1.2.10 and up
-This function cleans up all dynamically loaded library handles, freeing memory. If support is required again it will be initialized again, either by SDL::Image::init or loading an image with dynamic support required. You may call this function when SDL::Image::load functions are no longer needed for the JPG, PNG, and TIF image formats. You only need to call this function once, no matter how many times SDL::Image::init was called.
+This function cleans up all dynamically loaded library handles, freeing memory. If support is required again it will be initialized again, either by SDL::Image::init or loading an image with dynamic support required. You may call this function when SDL::Image::load functions are no longer needed for the JPG, PNG, and TIF image formats. You only need to call this function once, no matter how many times SDL::Image::init was called.
+ +Example
+use SDL::Image; SDL::Image::init(IMG_INIT_JPG); #loads JPG support SDL::Image::load("file.png"); #loads PNG support @@ -411,17 +439,17 @@ Note: this function does not always set the error string, so do not depend on SDset_error
-Same as SDL::set_error
+Same as SDL::set_error
get_error
-Same as SDL::get_error
+Same as SDL::get_error
SEE ALSO