Pix » History » Version 26
  iri, 03/27/2011 08:49 PM 
  
| 1 | 1 | iri | h1. Pix | 
|---|---|---|---|
| 2 | |||
| 3 | Images resources. | ||
| 4 | |||
| 5 | {{toc}} | ||
| 6 | |||
| 7 | 19 | iri | h2. _gtkPixFree | 
| 8 | |||
| 9 | Destroys a pix object (static or animated) | ||
| 10 | |||
| 11 | Prototype : *fun [ObjGtkPix] I* | ||
| 12 | |||
| 13 | +Return+ : I : always 0 except if error, it returns nil | ||
| 14 | |||
| 15 | 21 | iri | h2. _gtkPixFormats | 
| 16 | |||
| 17 | 23 | iri | Returns a list of all supported pix formats to the current system. | 
| 18 | 24 | iri | On MS Windows, these formats are mostly currently supported : +ani+ (Windows Animated Cursor), +png+ (Portable Network Graphic), +wbmp+ (Wireless Bitmap Image File), +pnm+ (Portable anymap bitmap), +ras+ (Sun Raster Graphic), +xpm+ (X11 Pixmap Graphic), +xbm+ (X BitMap), +tga+ (Targa Graphic), +pcx+ (Paintbrush Bitmap), +icns+ (Mac OS X Icon), +qtif+ (QuickTime Image File), +ico+ (ms windows icon file), +wmf+ (Windows Metafile), +emf+ (Enhanced Windows Metafile), +bmp+ (Bitmap Image), +gif+ (Graphical Interchange Format), +jpeg+ (Joint Photographic Experts Group), +tiff+ (Tagged Image File Format), ... | 
| 19 | 21 | iri | |
| 20 | 22 | iri | Prototype : *fun [] [S r1]* | 
| 21 | 21 | iri | |
| 22 | 25 | iri | h2. _gtkPixMimes | 
| 23 | |||
| 24 | Returns the list of supported mime types. | ||
| 25 | |||
| 26 | Prototype : *fun [] [[S r1] r1]* | ||
| 27 | |||
| 28 | +Return+ : [[S r1] r1] : for each format, returns the list of associated mime types. | ||
| 29 | |||
| 30 | h2. _gtkPixFormatsFull | ||
| 31 | |||
| 32 | Returns infos to all supported pix formats. | ||
| 33 | |||
| 34 | Prototype : *fun [] [[S [S r1] [S r1] S S I] r1]* | ||
| 35 | |||
| 36 | +Return+ : [[S [S r1] [S r1] S S I] r1] : a list of tuples. For each supported pix format, the tuple gives : | ||
| 37 | |||
| 38 | * its name; | ||
| 39 | * the list of supported mime-types; | ||
| 40 | * the list of currently used extensions; | ||
| 41 | * a short description; | ||
| 42 | * its license : "LGPL", "GPL", "QPL", "GPL/QPL", or "other" | ||
| 43 | * its state : get if this format has been disabled (1) or not (0). See _gtkPixFormatDisable below | ||
| 44 | |||
| 45 | 26 | iri | h2. _gtkPixFormatDisable | 
| 46 | |||
| 47 | Disables or enables an image format. | ||
| 48 | If a format is disabled, this format image won't be loaded. | ||
| 49 | |||
| 50 | Prototype : *fun [S I] I* | ||
| 51 | |||
| 52 | table. | ||
| 53 | |*name*|S|the name of the format, e.g. : "jpeg" or "tiff"| | ||
| 54 | |*value*|I|1 to disable, 0 to enable| | ||
| 55 | |||
| 56 | +Return+ : I : the new state or nil if error | ||
| 57 | |||
| 58 | 21 | iri | |
| 59 | 19 | iri | |
| 60 | 14 | iri | h1. Static image | 
| 61 | |||
| 62 | 1 | iri | h2. _gtkPixNew | 
| 63 | |||
| 64 | create a new pix object | ||
| 65 | |||
| 66 | Prototype : *fun [Chn P I [I I I]] ObjGtkPix* | ||
| 67 | |||
| 68 | table. | ||
| 69 | |*channel*|Chn|a channel| | ||
| 70 | |*filename*|P|an image filename| | ||
| 71 | |*mode*|I|Mode. Should be at 0.| | ||
| 72 | |*tuple*|[I I I]|the width (or nil to not constraint it),| | ||
| 73 | | | |the height (or nil to not constraint it),| | ||
| 74 | | | |the ratio (1 to keep it)| | ||
| 75 | |||
| 76 | +Return+ : ObjGtkPix : a new pix object or nil if an error occurs | ||
| 77 | |||
| 78 | h2. _gtkPixScale | ||
| 79 | |||
| 80 | Scale | ||
| 81 | |||
| 82 | Prototype : *fun [ObjGtkPix I I I I] ObjGtkPix* | ||
| 83 | |||
| 84 | table. | ||
| 85 | |*pix*|ObjGtkPix|a valid pix object| | | ||
| 86 | |*width*|I|the new width| | | ||
| 87 | |*height*|I|the new height| | | ||
| 88 | 2 | iri | |*mode*|I|an algorithm at your choice :|SCOL_GTK_PIX_INTERP_BILINEAR (default) : | | 
| 89 | 1 | iri | | | | |SCOL_GTK_PIX_INTERP_NEAREST : | | 
| 90 | | | | |SCOL_GTK_PIX_INTERP_TILES : | | ||
| 91 | | | | |SCOL_GTK_PIX_INTERP_HYPER : | | ||
| 92 | 3 | iri | |*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.| | 
| 93 | 1 | iri | |
| 94 | +Return+ : ObjGtkPix : a *new* pix object or nil if an error occurs. | ||
| 95 | |||
| 96 | h2. _gtkPixScaleEx | ||
| 97 | |||
| 98 | Not implemented yet. | ||
| 99 | |||
| 100 | +Return+ : always nil. | ||
| 101 | 3 | iri | |
| 102 | h2. _gtkPixRotate | ||
| 103 | |||
| 104 | Performs a rotation | ||
| 105 | |||
| 106 | Prototype : *fun [ObjGtkPix I I] ObjGtkPix* | ||
| 107 | |||
| 108 | table. | ||
| 109 | 4 | iri | |*pix*|ObjGtkPix|a pix object| | 
| 110 | 3 | iri | |*angle*|I|0, 90, 180 or 270 degrees. Others values are ignored| | 
| 111 | |*flag*|I|0 if the new pix Scol object is created with the rotated pix| | ||
| 112 | | | |1 if the new pix replaces the pix in the curent pix object _pix_| | ||
| 113 | |||
| 114 | +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 | ||
| 115 | 1 | iri | |
| 116 | 5 | iri | h2. _gtkPixFlip | 
| 117 | |||
| 118 | Performs a flip to a pix object | ||
| 119 | |||
| 120 | Prototype : *fun [ObjGtkPix I I] ObjGtkPix* | ||
| 121 | |||
| 122 | table. | ||
| 123 | |*pix*|ObjGtkPix|a pix object| | ||
| 124 | |*flip*|I|SCOL_GTK_PIX_FLIP_HORIZONTAL or SCOL_GTK_PIX_FLIP_VERTICAL. Other value are ignored.| | ||
| 125 | |*flag*|I|0 if the new pix Scol object is created with the flipped pix| | ||
| 126 | | | |1 if the new pix replaces the pix in the curent pix object _pix_| | ||
| 127 | |||
| 128 | +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 | ||
| 129 | |||
| 130 | 6 | iri | h2. _gtkPixAddAlpha | 
| 131 | |||
| 132 | Adds an alpha channel to an existing pix object. | ||
| 133 | If the tuple is not nil, then the color specified by it will be assigned zero opacity. | ||
| 134 | For example, if the tuple is equals at [255, 255, 255], all white pixels will become fully transparent. | ||
| 135 | |||
| 136 | Prototype : *fun [ObjGtkPix [I I I] I] ObjGtkPix* | ||
| 137 | |||
| 138 | table. | ||
| 139 | |*pix*|ObjGtkPix|a pix object| | ||
| 140 | |*rgb*|[I I I]|red, green and blue value (0->255). or nil (see above)| | ||
| 141 | |*flag*|I|0 if the new pix Scol object is created with the new pix| | ||
| 142 | | | |1 if the new pix replaces the pix in the curent pix object _pix_| | ||
| 143 | |||
| 144 | +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 | ||
| 145 | |||
| 146 | 7 | iri | h2. _gtkPixCopyArea | 
| 147 | |||
| 148 | Copies a rectangular area from _srcpix_ to _destpix_. | ||
| 149 | |||
| 150 | Prototype : *fun [ObjGtkPix I I I I ObjGtkPix I I] ObjGtkPix* | ||
| 151 | |||
| 152 | table. | ||
| 153 | |*srcpix*|ObjGtkPix|a source pix object| | ||
| 154 | |*srcx*|I|x coordinate in _srcpix_| | ||
| 155 | |*srcy*|I|y coordinate in _srcpix_| | ||
| 156 | |*srcwidth*|I|width to copy from _srcpix_| | ||
| 157 | |*srcheight*|I|height to copy from _srcpix_| | ||
| 158 | 8 | iri | |*destpix*|ObjGtkPix|a destination pix object. If nil, a new pix object will be created in the current channel| | 
| 159 | 7 | iri | |*destx*|I|x coordinate in _destpix_| | 
| 160 | |*desty*|I|y coordinate in _destpix_| | ||
| 161 | |||
| 162 | +Return+ : ObjGtkPix : the destination pix object or nil if error | ||
| 163 | |||
| 164 | 9 | iri | h2. _gtkPixSaturation | 
| 165 | |||
| 166 | Modifies the saturation to a pix object | ||
| 167 | |||
| 168 | Prototype : *fun [ObjPixGtk I] ObjGtkPix* | ||
| 169 | |||
| 170 | 11 | iri | 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. | 
| 171 | 9 | iri | |
| 172 | +Return+ : ObjGtkPix : the same pix object or nil if an error is occured. | ||
| 173 | |||
| 174 | 13 | iri | h2. _gtkPixPixelate | 
| 175 | |||
| 176 | Pixelates a pix object. | ||
| 177 | |||
| 178 | TODO. | ||
| 179 | |||
| 180 | 12 | iri | h2. _gtkPixFill | 
| 181 | |||
| 182 | Fill a pix object with a given color. | ||
| 183 | |||
| 184 | Prototype : *fun [ObjGtkPix I] ObjGtkPix* | ||
| 185 | |||
| 186 | Value : I : Format is : RRGGBBAA. If pix hasn't an alpha channel, AA is ignored | ||
| 187 | |||
| 188 | +Return+ : ObjGtkPix : the same pix object or nil if an error is occured. | ||
| 189 | 14 | iri | |
| 190 | 16 | iri | h2. _gtkPixGetSize | 
| 191 | |||
| 192 | Returns the width and the height of a pix object | ||
| 193 | |||
| 194 | Prototype : *fun [ObjGtkPix] [I I]* | ||
| 195 | |||
| 196 | +Return+ : [I I] : the width and the height or nil if error | ||
| 197 | |||
| 198 | 17 | iri | h2. _gtkPixGetChannels | 
| 199 | |||
| 200 | Prototype : *fun [ObjGtkPix] [I I I]* | ||
| 201 | |||
| 202 | +Return+ [I I I] : | ||
| 203 | * the number of channels of the pix object | ||
| 204 | * if the pix object has an alpha channel (1) or not (0) | ||
| 205 | * and the number of bits per color | ||
| 206 | |||
| 207 | 16 | iri | |
| 208 | |||
| 209 | 14 | iri | |
| 210 | |||
| 211 | h1. Animated image | ||
| 212 | |||
| 213 | 18 | iri | The static functions *should not* be used to the animated pix object. | 
| 214 | |||
| 215 | 14 | iri | h2. _gtkPixAnimLoad | 
| 216 | |||
| 217 | Loads an animated image file. | ||
| 218 | |||
| 219 | Prototype : *fun [Chn P] ObjGtkPix* | ||
| 220 | |||
| 221 | +Return+ : a new pix object or nil if an error occurs. | ||
| 222 | 12 | iri | |
| 223 | 15 | iri | h2. _gtkPixAnimNew | 
| 224 | |||
| 225 | Creates a new animated pix from a list of static pix. | ||
| 226 | |||
| 227 | Prototype : *fun [Chn [ObjGtkPix r1] I I I I] ObjGtkPix* | ||
| 228 | |||
| 229 | table. | ||
| 230 | |*channel*|Chn|any channel to create the Scol object| | ||
| 231 | |*list*|[ObjGtkPix r1]|a list of static pix object. These pix must have the same width ad height than the animation, else are ignored| | ||
| 232 | |*width*|I|the width of the animated image| | ||
| 233 | |*height*|I|the height of the animated image| | ||
| 234 | |*rate*|I|the speed of the animation, in frames per second. By default, it's 1| | ||
| 235 | |*loop*|I|1 (default) if the animation should loop indefinitely when it reaches the end, else 0| | ||
| 236 | |||
| 237 | +Return+ ObjGtkPix : a new pix object, or nil if error | ||
| 238 | |||
| 239 | 20 | iri | h2. _gtkPixAnimGetSize | 
| 240 | |||
| 241 | Returns the size of an animated pix object | ||
| 242 | |||
| 243 | Prototype : *fun [ObjGtkPix] [I I]* | ||
| 244 | |||
| 245 | +Return+ [I I] : the width and the height. if error, returns nil. | ||
| 246 | |||
| 247 | h2. _gtkPixAnimGetStatic | ||
| 248 | |||
| 249 | Gets the pix static object if the animated pix object is unanimated | ||
| 250 | |||
| 251 | Prototype : *fun [ObjGtkPix] ObjGtkPix* | ||
| 252 | |||
| 253 | This functions takes to argument an animated pix object (via _gtkPixAnimLoad or _gtkPixAnimNew). | ||
| 254 | If there is *no animation*, then, the functions returns a *new* static pix object. Otherwise, nil is returned. | ||
| 255 | |||
| 256 | |||
| 257 | 6 | iri | |
| 258 | 5 | iri | |
| 259 | 1 | iri | |
| 260 | Return [[Api]] |