Pix » History » Revision 17
Revision 16 (iri, 03/26/2011 10:08 PM) → Revision 17/38 (iri, 03/26/2011 10:58 PM)
h1. Pix
Images resources.
{{toc}}
h1. Static image
h2. _gtkPixNew
create a new pix object
Prototype : *fun [Chn P I [I I I]] ObjGtkPix*
table.
|*channel*|Chn|a channel|
|*filename*|P|an image filename|
|*mode*|I|Mode. Should be at 0.|
|*tuple*|[I I I]|the width (or nil to not constraint it),|
| | |the height (or nil to not constraint it),|
| | |the ratio (1 to keep it)|
+Return+ : ObjGtkPix : a new pix object or nil if an error occurs
h2. _gtkPixFree
Destroys a pix object
Prototype : *fun [ObjGtkPix] I*
+Return+ : I : always 0 except if error, it returns nil
h2. _gtkPixScale
Scale
Prototype : *fun [ObjGtkPix I I I I] ObjGtkPix*
table.
|*pix*|ObjGtkPix|a valid pix object| |
|*width*|I|the new width| |
|*height*|I|the new height| |
|*mode*|I|an algorithm at your choice :|SCOL_GTK_PIX_INTERP_BILINEAR (default) : |
| | | |SCOL_GTK_PIX_INTERP_NEAREST : |
| | | |SCOL_GTK_PIX_INTERP_TILES : |
| | | |SCOL_GTK_PIX_INTERP_HYPER : |
|*flag*|I|if 1, the pix in the pix object _pix_ will be destroyed.|If 0, the pix object _pix_ will be kept and a new pix object will be created.|
+Return+ : ObjGtkPix : a *new* pix object or nil if an error occurs.
h2. _gtkPixScaleEx
Not implemented yet.
+Return+ : always nil.
h2. _gtkPixRotate
Performs a rotation
Prototype : *fun [ObjGtkPix I I] ObjGtkPix*
table.
|*pix*|ObjGtkPix|a pix object|
|*angle*|I|0, 90, 180 or 270 degrees. Others values are ignored|
|*flag*|I|0 if the new pix Scol object is created with the rotated pix|
| | |1 if the new pix replaces the pix in the curent pix object _pix_|
+Return+ : ObjGtkPix : a rotated pix in the (new or same) pix object or the same pix object if the value is bad or nil if an error occurs
h2. _gtkPixFlip
Performs a flip to a pix object
Prototype : *fun [ObjGtkPix I I] ObjGtkPix*
table.
|*pix*|ObjGtkPix|a pix object|
|*flip*|I|SCOL_GTK_PIX_FLIP_HORIZONTAL or SCOL_GTK_PIX_FLIP_VERTICAL. Other value are ignored.|
|*flag*|I|0 if the new pix Scol object is created with the flipped pix|
| | |1 if the new pix replaces the pix in the curent pix object _pix_|
+Return+ : ObjGtkPix : a flipped pix in the (new or same) pix object or the same pix object if the value is bad or nil if an error occurs
h2. _gtkPixAddAlpha
Adds an alpha channel to an existing pix object.
If the tuple is not nil, then the color specified by it will be assigned zero opacity.
For example, if the tuple is equals at [255, 255, 255], all white pixels will become fully transparent.
Prototype : *fun [ObjGtkPix [I I I] I] ObjGtkPix*
table.
|*pix*|ObjGtkPix|a pix object|
|*rgb*|[I I I]|red, green and blue value (0->255). or nil (see above)|
|*flag*|I|0 if the new pix Scol object is created with the new pix|
| | |1 if the new pix replaces the pix in the curent pix object _pix_|
+Return+ : ObjGtkPix : a new pix in the (new or same) pix object or the same pix object if the value is bad or nil if an error occurs
h2. _gtkPixCopyArea
Copies a rectangular area from _srcpix_ to _destpix_.
Prototype : *fun [ObjGtkPix I I I I ObjGtkPix I I] ObjGtkPix*
table.
|*srcpix*|ObjGtkPix|a source pix object|
|*srcx*|I|x coordinate in _srcpix_|
|*srcy*|I|y coordinate in _srcpix_|
|*srcwidth*|I|width to copy from _srcpix_|
|*srcheight*|I|height to copy from _srcpix_|
|*destpix*|ObjGtkPix|a destination pix object. If nil, a new pix object will be created in the current channel|
|*destx*|I|x coordinate in _destpix_|
|*desty*|I|y coordinate in _destpix_|
+Return+ : ObjGtkPix : the destination pix object or nil if error
h2. _gtkPixSaturation
Modifies the saturation to a pix object
Prototype : *fun [ObjPixGtk I] ObjGtkPix*
Value (I) : Between - 100 and 0, saturation is reduced (-> greyscale), between 0 and 100, the saturation is increased (vivid colors). With 0, the saturation is unchanged.
+Return+ : ObjGtkPix : the same pix object or nil if an error is occured.
h2. _gtkPixPixelate
Pixelates a pix object.
TODO.
h2. _gtkPixFill
Fill a pix object with a given color.
Prototype : *fun [ObjGtkPix I] ObjGtkPix*
Value : I : Format is : RRGGBBAA. If pix hasn't an alpha channel, AA is ignored
+Return+ : ObjGtkPix : the same pix object or nil if an error is occured.
h2. _gtkPixGetSize
Returns the width and the height of a pix object
Prototype : *fun [ObjGtkPix] [I I]*
+Return+ : [I I] : the width and the height or nil if error
h2. _gtkPixGetChannels
Prototype : *fun [ObjGtkPix] [I I I]*
+Return+ [I I I] :
* the number of channels of the pix object
* if the pix object has an alpha channel (1) or not (0)
* and the number of bits per color
h1. Animated image
h2. _gtkPixAnimLoad
Loads an animated image file.
Prototype : *fun [Chn P] ObjGtkPix*
+Return+ : a new pix object or nil if an error occurs.
h2. _gtkPixAnimNew
Creates a new animated pix from a list of static pix.
Prototype : *fun [Chn [ObjGtkPix r1] I I I I] ObjGtkPix*
table.
|*channel*|Chn|any channel to create the Scol object|
|*list*|[ObjGtkPix r1]|a list of static pix object. These pix must have the same width ad height than the animation, else are ignored|
|*width*|I|the width of the animated image|
|*height*|I|the height of the animated image|
|*rate*|I|the speed of the animation, in frames per second. By default, it's 1|
|*loop*|I|1 (default) if the animation should loop indefinitely when it reaches the end, else 0|
+Return+ ObjGtkPix : a new pix object, or nil if error
Return [[Api]]