From: Kartik Thakore Date: Fri, 4 Dec 2009 20:04:13 +0000 (-0500) Subject: Added Image docs X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=sdlgit%2FSDL-Site.git;a=commitdiff_plain;h=944366c3907b734fc9a13e11edf21908fab39225 Added Image docs --- diff --git a/pages/SDL-Image.html-inc b/pages/SDL-Image.html-inc new file mode 100644 index 0000000..46274ad --- /dev/null +++ b/pages/SDL-Image.html-inc @@ -0,0 +1,199 @@ +
+ +

Index

+ +
+ + +

NAME

Top

+
+

SDL::Image - Bindings for the SDL_Image library

+ +
+

DESCRIPTION

Top

+
+

SDL::Image allows you to load many different format of images into memory as an SDL::Surface.

+ +
+

SUPPORTED FORMATS

Top

+
+

The following types are supported:

+
+
* +TGA + TrueVision Targa (MUST have .tga)
+
* +BMP + Windows Bitmap(.bmp)
+
* +PNM + Portable Anymap (.pnm) + .pbm = Portable BitMap (mono) + .pgm = Portable GreyMap (256 greys) + .ppm = Portable PixMap (full color)
+
* +XPM + X11 Pixmap (.xpm) can be #included directly in code + This is NOT the same as XBM(X11 Bitmap) format, which is for monocolor images.
+
* +XCF + GIMP native (.xcf) (XCF = eXperimental Computing Facility?) + This format is always changing, and since there's no library supplied by the GIMP project to load XCF, the loader may frequently fail to load much of any image from an XCF file. It's better to load this in GIMP and convert to a better supported image format.
+
* +PCX + ZSoft IBM PC Paintbrush (.pcx)
+
* +GIF + CompuServe Graphics Interchange Format (.gif)
+
* +JPG + Joint Photographic Experts Group JFIF format (.jpg or .jpeg)
+
* +TIF + Tagged Image File Format (.tif or .tiff)
+
* +LBM + Interleaved Bitmap (.lbm or .iff) FORM : ILBM or PBM(packed bitmap) + HAM6, HAM8, and 24bit types are not supported.
+
* +PNG + Portable Network Graphics (.png) =item *
+
* +XV + ???
+
+ +
+

CATEGORY

Top

+
+

TODO, SDL, Image

+ +
+

METHODS

Top

+
+ +
+

load

+
+
 my $surface = SDL::Image::load( $file );
+
+
+

$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 IMG_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($image, SDL_RLEACCEL, $image->format->colorkey);

+ + + + + +
+

Returns

+
+

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.

+ +
+

load_typed_rw

+
+ +
+

is_[TYPE]

+
+ +
+

load_[TYPE]_rw

+
+ +
+

read_XPM_from_array

+
+ +
+

linked_version

+
+

Provides the version of linked sdl_image library. see SDL::Version

+
	my $version = SDL::Image::linked_version();
+	print $version->major.' '.$version->minor.' '.$version->patch;
+
+
+ +
+

init

+
+

For version SDL_image 1.2.10 and up

+ + + + + + + + +
+

Flags

+
+

bitwise OR'd set of image formats to support by loading a library now. The values you may OR together to pass in are:

+
+
* + IMG_INIT_JPG = 0x00000001
+
* + IMG_INIT_PNG = 0x00000002
+
* + IMG_INIT_TIF = 0x00000004
+
+

Initialize by loading support as indicated by the flags, or at least return success if support is already loaded. You may call this multiple times, which will actually require you to call IMG_Quit just once to clean up. You may call this function with a 0 to retrieve whether support was built-in or not loaded yet. +Note: to load JPG, PNG, and/or TIF images you can call IMG_Init with the right IMG_INIT_* flags OR'd together before you program gets busy, to prevent a later hiccup while it loads the library, and to check that you do have the support that you need before you try and use it. +Note: No initialization is needed nor performed when using the SDL::Image::is_JPG, SDL::Image::is_PNG, and SDL::Image::is_TIF functions. +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

+
+

A bitmask of all the currentl initted image loaders.

+ +
+

Example

+
+
  use SDL::Image;
+  my $flags = IMG_INIT_JPG | IMG_INIT_PNG | IMG_INIT_JPG;
+  my $inited = SDL::Image::init($flags);
+
+
+
+
+
+ +
+

set_error

+
+ +
+

get_error

+
+ +
+
\ No newline at end of file diff --git a/pages/documentation.html-inc b/pages/documentation.html-inc index 52790f8..93d99cc 100644 --- a/pages/documentation.html-inc +++ b/pages/documentation.html-inc @@ -1,2 +1,2 @@
-

Documentation (latest development branch)

Core
thumbSDL- Simple DirectMedia Layer for Perl
Audio
thumbSDL::Audio- SDL Bindings for Audio
Structure
thumbSDL::AudioCVT- Audio Conversion Structure
thumbSDL::AudioSpec- SDL Bindings for structure SDL::AudioSpec
CDROM
thumbSDL::CDROM- SDL Bindings for the CDROM device
Structure
thumbSDL::CD- SDL Bindings for structure SDL_CD
thumbSDL::CDTrack- SDL Bindings for structure SDL_CDTrack
Events
thumbSDL::Events- Bindings to the Events Category in SDL API
Structure
thumbSDL::Event- General event structure
Joystick
thumbSDL::Joystick- SDL Bindings for the Joystick device
Structure
thumbSDL::Mixer::MixChunk- SDL Bindings for structure SDL_MixChunk
thumbSDL::Mixer::MixMusic- SDL Bindings for structure SDL_MixMusic
Mouse
thumbSDL::Mouse- SDL Bindings for the Mouse device
Structure
thumbSDL::Cursor- Mouse cursor structure
Structure
thumbSDL::Version- SDL Bindings for structure SDL_Version
Video
thumbSDL::Video- Bindings to the video category in SDL API
Structure
thumbSDL::Color- Format independent color description
thumbSDL::Overlay- YUV Video overlay
thumbSDL::Palette- Color palette for 8-bit pixel formats
thumbSDL::PixelFormat- Stores surface format information
thumbSDL::Rect- Defines a rectangular area
thumbSDL::Surface- Graphic surface structure.
thumbSDL::VideoInfo- Video Target Information

Cookbook
thumbSDL::Cookbook
thumbSDL::Cookbook::PDL

Extension
thumbSDL::App- a SDL perl extension

Mixer
thumbSDL::Mixer- a SDL perl extension
TODO
Core
MultiThread
thumbSDL::MultiThread- Bindings to the MultiThread category in SDL API
Structure
thumbSDL::RWOps- SDL Bindings to SDL_RWOPs

Tutorials
thumbSDL::Tutorial- introduction to Perl SDL
thumbSDL::Tutorial::Animation
thumbSDL::Tutorial::Images
thumbSDL::Tutorial::LunarLander- a small tutorial on Perl SDL
thumbSDL::Tutorial::Pong- Get started pong
thumbSDL::Tutorial::Tetris- Let's Make Tetris

UNCATEGORIZED
thumbSDL::Font- a SDL perl extension
thumbSDL::Game::Palette- a perl extension
thumbSDL::MPEG- a SDL perl extension
thumbSDL::Music- a perl extension
thumbSDL::OpenGL- a perl extension
thumbSDL::SFont- a perl extension
thumbSDL::SMPEG- a SDL perl extension
thumbSDL::Sound- a perl extension
thumbSDL::TTFont- a SDL perl extension
thumbSDL::Timer- a SDL perl extension for managing timers.
thumbSDL::Tool::Font- a perl extension
thumbSDL::Tool::Graphic
thumbSDL::old-cdrom- a SDL perl extension for managing CD-ROM drives
+

Documentation (latest development branch)

Core
thumbSDL- Simple DirectMedia Layer for Perl
Audio
thumbSDL::Audio- SDL Bindings for Audio
Structure
thumbSDL::AudioCVT- Audio Conversion Structure
thumbSDL::AudioSpec- SDL Bindings for structure SDL::AudioSpec
CDROM
thumbSDL::CDROM- SDL Bindings for the CDROM device
Structure
thumbSDL::CD- SDL Bindings for structure SDL_CD
thumbSDL::CDTrack- SDL Bindings for structure SDL_CDTrack
Events
thumbSDL::Events- Bindings to the Events Category in SDL API
Structure
thumbSDL::Event- General event structure
Joystick
thumbSDL::Joystick- SDL Bindings for the Joystick device
Structure
thumbSDL::Mixer::MixChunk- SDL Bindings for structure SDL_MixChunk
thumbSDL::Mixer::MixMusic- SDL Bindings for structure SDL_MixMusic
Mouse
thumbSDL::Mouse- SDL Bindings for the Mouse device
Structure
thumbSDL::Cursor- Mouse cursor structure
Structure
thumbSDL::Version- SDL Bindings for structure SDL_Version
Video
thumbSDL::Video- Bindings to the video category in SDL API
Structure
thumbSDL::Color- Format independent color description
thumbSDL::Overlay- YUV Video overlay
thumbSDL::Palette- Color palette for 8-bit pixel formats
thumbSDL::PixelFormat- Stores surface format information
thumbSDL::Rect- Defines a rectangular area
thumbSDL::Surface- Graphic surface structure.
thumbSDL::VideoInfo- Video Target Information

Cookbook
thumbSDL::Cookbook
thumbSDL::Cookbook::PDL

Extension
thumbSDL::App- a SDL perl extension

Mixer
thumbSDL::Mixer- a SDL perl extension
TODO
Core
MultiThread
thumbSDL::MultiThread- Bindings to the MultiThread category in SDL API
Structure
thumbSDL::RWOps- SDL Bindings to SDL_RWOPs
Image
thumbSDL::Image- Bindings for the SDL_Image library

Tutorials
thumbSDL::Tutorial- introduction to Perl SDL
thumbSDL::Tutorial::Animation
thumbSDL::Tutorial::Images
thumbSDL::Tutorial::LunarLander- a small tutorial on Perl SDL
thumbSDL::Tutorial::Pong- Get started pong
thumbSDL::Tutorial::Tetris- Let's Make Tetris

UNCATEGORIZED
thumbSDL::Font- a SDL perl extension
thumbSDL::Game::Palette- a perl extension
thumbSDL::MPEG- a SDL perl extension
thumbSDL::Music- a perl extension
thumbSDL::OpenGL- a perl extension
thumbSDL::SFont- a perl extension
thumbSDL::SMPEG- a SDL perl extension
thumbSDL::Sound- a perl extension
thumbSDL::TTFont- a SDL perl extension
thumbSDL::Timer- a SDL perl extension for managing timers.
thumbSDL::Tool::Font- a perl extension
thumbSDL::Tool::Graphic
thumbSDL::old-cdrom- a SDL perl extension for managing CD-ROM drives