Pix » History » Version 18
iri, 03/26/2011 11:04 PM
| 1 | 1 | iri | h1. Pix |
|---|---|---|---|
| 2 | |||
| 3 | Images resources. |
||
| 4 | |||
| 5 | {{toc}} |
||
| 6 | |||
| 7 | 14 | iri | h1. Static image |
| 8 | |||
| 9 | 1 | iri | h2. _gtkPixNew |
| 10 | |||
| 11 | create a new pix object |
||
| 12 | |||
| 13 | Prototype : *fun [Chn P I [I I I]] ObjGtkPix* |
||
| 14 | |||
| 15 | table. |
||
| 16 | |*channel*|Chn|a channel| |
||
| 17 | |*filename*|P|an image filename| |
||
| 18 | |*mode*|I|Mode. Should be at 0.| |
||
| 19 | |*tuple*|[I I I]|the width (or nil to not constraint it),| |
||
| 20 | | | |the height (or nil to not constraint it),| |
||
| 21 | | | |the ratio (1 to keep it)| |
||
| 22 | |||
| 23 | +Return+ : ObjGtkPix : a new pix object or nil if an error occurs |
||
| 24 | |||
| 25 | h2. _gtkPixFree |
||
| 26 | |||
| 27 | Destroys a pix object |
||
| 28 | |||
| 29 | Prototype : *fun [ObjGtkPix] I* |
||
| 30 | |||
| 31 | +Return+ : I : always 0 except if error, it returns nil |
||
| 32 | |||
| 33 | h2. _gtkPixScale |
||
| 34 | |||
| 35 | Scale |
||
| 36 | |||
| 37 | Prototype : *fun [ObjGtkPix I I I I] ObjGtkPix* |
||
| 38 | |||
| 39 | table. |
||
| 40 | |*pix*|ObjGtkPix|a valid pix object| | |
||
| 41 | |*width*|I|the new width| | |
||
| 42 | |*height*|I|the new height| | |
||
| 43 | 2 | iri | |*mode*|I|an algorithm at your choice :|SCOL_GTK_PIX_INTERP_BILINEAR (default) : | |
| 44 | 1 | iri | | | | |SCOL_GTK_PIX_INTERP_NEAREST : | |
| 45 | | | | |SCOL_GTK_PIX_INTERP_TILES : | |
||
| 46 | | | | |SCOL_GTK_PIX_INTERP_HYPER : | |
||
| 47 | 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.| |
| 48 | 1 | iri | |
| 49 | +Return+ : ObjGtkPix : a *new* pix object or nil if an error occurs. |
||
| 50 | |||
| 51 | h2. _gtkPixScaleEx |
||
| 52 | |||
| 53 | Not implemented yet. |
||
| 54 | |||
| 55 | +Return+ : always nil. |
||
| 56 | 3 | iri | |
| 57 | h2. _gtkPixRotate |
||
| 58 | |||
| 59 | Performs a rotation |
||
| 60 | |||
| 61 | Prototype : *fun [ObjGtkPix I I] ObjGtkPix* |
||
| 62 | |||
| 63 | table. |
||
| 64 | 4 | iri | |*pix*|ObjGtkPix|a pix object| |
| 65 | 3 | iri | |*angle*|I|0, 90, 180 or 270 degrees. Others values are ignored| |
| 66 | |*flag*|I|0 if the new pix Scol object is created with the rotated pix| |
||
| 67 | | | |1 if the new pix replaces the pix in the curent pix object _pix_| |
||
| 68 | |||
| 69 | +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 |
||
| 70 | 1 | iri | |
| 71 | 5 | iri | h2. _gtkPixFlip |
| 72 | |||
| 73 | Performs a flip to a pix object |
||
| 74 | |||
| 75 | Prototype : *fun [ObjGtkPix I I] ObjGtkPix* |
||
| 76 | |||
| 77 | table. |
||
| 78 | |*pix*|ObjGtkPix|a pix object| |
||
| 79 | |*flip*|I|SCOL_GTK_PIX_FLIP_HORIZONTAL or SCOL_GTK_PIX_FLIP_VERTICAL. Other value are ignored.| |
||
| 80 | |*flag*|I|0 if the new pix Scol object is created with the flipped pix| |
||
| 81 | | | |1 if the new pix replaces the pix in the curent pix object _pix_| |
||
| 82 | |||
| 83 | +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 |
||
| 84 | |||
| 85 | 6 | iri | h2. _gtkPixAddAlpha |
| 86 | |||
| 87 | Adds an alpha channel to an existing pix object. |
||
| 88 | If the tuple is not nil, then the color specified by it will be assigned zero opacity. |
||
| 89 | For example, if the tuple is equals at [255, 255, 255], all white pixels will become fully transparent. |
||
| 90 | |||
| 91 | Prototype : *fun [ObjGtkPix [I I I] I] ObjGtkPix* |
||
| 92 | |||
| 93 | table. |
||
| 94 | |*pix*|ObjGtkPix|a pix object| |
||
| 95 | |*rgb*|[I I I]|red, green and blue value (0->255). or nil (see above)| |
||
| 96 | |*flag*|I|0 if the new pix Scol object is created with the new pix| |
||
| 97 | | | |1 if the new pix replaces the pix in the curent pix object _pix_| |
||
| 98 | |||
| 99 | +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 |
||
| 100 | |||
| 101 | 7 | iri | h2. _gtkPixCopyArea |
| 102 | |||
| 103 | Copies a rectangular area from _srcpix_ to _destpix_. |
||
| 104 | |||
| 105 | Prototype : *fun [ObjGtkPix I I I I ObjGtkPix I I] ObjGtkPix* |
||
| 106 | |||
| 107 | table. |
||
| 108 | |*srcpix*|ObjGtkPix|a source pix object| |
||
| 109 | |*srcx*|I|x coordinate in _srcpix_| |
||
| 110 | |*srcy*|I|y coordinate in _srcpix_| |
||
| 111 | |*srcwidth*|I|width to copy from _srcpix_| |
||
| 112 | |*srcheight*|I|height to copy from _srcpix_| |
||
| 113 | 8 | iri | |*destpix*|ObjGtkPix|a destination pix object. If nil, a new pix object will be created in the current channel| |
| 114 | 7 | iri | |*destx*|I|x coordinate in _destpix_| |
| 115 | |*desty*|I|y coordinate in _destpix_| |
||
| 116 | |||
| 117 | +Return+ : ObjGtkPix : the destination pix object or nil if error |
||
| 118 | |||
| 119 | 9 | iri | h2. _gtkPixSaturation |
| 120 | |||
| 121 | Modifies the saturation to a pix object |
||
| 122 | |||
| 123 | Prototype : *fun [ObjPixGtk I] ObjGtkPix* |
||
| 124 | |||
| 125 | 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. |
| 126 | 9 | iri | |
| 127 | +Return+ : ObjGtkPix : the same pix object or nil if an error is occured. |
||
| 128 | |||
| 129 | 13 | iri | h2. _gtkPixPixelate |
| 130 | |||
| 131 | Pixelates a pix object. |
||
| 132 | |||
| 133 | TODO. |
||
| 134 | |||
| 135 | 12 | iri | h2. _gtkPixFill |
| 136 | |||
| 137 | Fill a pix object with a given color. |
||
| 138 | |||
| 139 | Prototype : *fun [ObjGtkPix I] ObjGtkPix* |
||
| 140 | |||
| 141 | Value : I : Format is : RRGGBBAA. If pix hasn't an alpha channel, AA is ignored |
||
| 142 | |||
| 143 | +Return+ : ObjGtkPix : the same pix object or nil if an error is occured. |
||
| 144 | 14 | iri | |
| 145 | 16 | iri | h2. _gtkPixGetSize |
| 146 | |||
| 147 | Returns the width and the height of a pix object |
||
| 148 | |||
| 149 | Prototype : *fun [ObjGtkPix] [I I]* |
||
| 150 | |||
| 151 | +Return+ : [I I] : the width and the height or nil if error |
||
| 152 | |||
| 153 | 17 | iri | h2. _gtkPixGetChannels |
| 154 | |||
| 155 | Prototype : *fun [ObjGtkPix] [I I I]* |
||
| 156 | |||
| 157 | +Return+ [I I I] : |
||
| 158 | * the number of channels of the pix object |
||
| 159 | * if the pix object has an alpha channel (1) or not (0) |
||
| 160 | * and the number of bits per color |
||
| 161 | |||
| 162 | 16 | iri | |
| 163 | |||
| 164 | 14 | iri | |
| 165 | |||
| 166 | h1. Animated image |
||
| 167 | |||
| 168 | 18 | iri | The static functions *should not* be used to the animated pix object. |
| 169 | |||
| 170 | 14 | iri | h2. _gtkPixAnimLoad |
| 171 | |||
| 172 | Loads an animated image file. |
||
| 173 | |||
| 174 | Prototype : *fun [Chn P] ObjGtkPix* |
||
| 175 | |||
| 176 | +Return+ : a new pix object or nil if an error occurs. |
||
| 177 | 12 | iri | |
| 178 | 15 | iri | h2. _gtkPixAnimNew |
| 179 | |||
| 180 | Creates a new animated pix from a list of static pix. |
||
| 181 | |||
| 182 | Prototype : *fun [Chn [ObjGtkPix r1] I I I I] ObjGtkPix* |
||
| 183 | |||
| 184 | table. |
||
| 185 | |*channel*|Chn|any channel to create the Scol object| |
||
| 186 | |*list*|[ObjGtkPix r1]|a list of static pix object. These pix must have the same width ad height than the animation, else are ignored| |
||
| 187 | |*width*|I|the width of the animated image| |
||
| 188 | |*height*|I|the height of the animated image| |
||
| 189 | |*rate*|I|the speed of the animation, in frames per second. By default, it's 1| |
||
| 190 | |*loop*|I|1 (default) if the animation should loop indefinitely when it reaches the end, else 0| |
||
| 191 | |||
| 192 | +Return+ ObjGtkPix : a new pix object, or nil if error |
||
| 193 | |||
| 194 | 6 | iri | |
| 195 | 5 | iri | |
| 196 | 1 | iri | |
| 197 | Return [[Api]] |