Pix » History » Version 28
iri, 03/29/2011 10:00 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 | 27 | iri | h2. _gtkPixGetInfo |
59 | |||
60 | Returns some informations on an image file (typically before load it). |
||
61 | |||
62 | Prototype : *fun [P] [I I [S S I]]* |
||
63 | |||
64 | table. |
||
65 | |*name*|P|a read referenced file| |
||
66 | |||
67 | +Return+ : [I I [S S I]] : |
||
68 | * the width of the image |
||
69 | * the height of the image |
||
70 | ** the name of the format (jpeg, tiff,png, gif, ...) |
||
71 | ** the license of the format |
||
72 | ** the state of the format : 1 if disabled, else 0 |
||
73 | |||
74 | If the format is not recognized or if an error is occured, the function returns nil. |
||
75 | 21 | iri | |
76 | 19 | iri | |
77 | 14 | iri | h1. Static image |
78 | |||
79 | 1 | iri | h2. _gtkPixNew |
80 | |||
81 | 28 | iri | create a new pix object from a file |
82 | 1 | iri | |
83 | Prototype : *fun [Chn P I [I I I]] ObjGtkPix* |
||
84 | |||
85 | table. |
||
86 | |*channel*|Chn|a channel| |
||
87 | |*filename*|P|an image filename| |
||
88 | |*mode*|I|Mode. Should be at 0.| |
||
89 | |*tuple*|[I I I]|the width (or nil to not constraint it),| |
||
90 | | | |the height (or nil to not constraint it),| |
||
91 | | | |the ratio (1 to keep it)| |
||
92 | |||
93 | +Return+ : ObjGtkPix : a new pix object or nil if an error occurs |
||
94 | 28 | iri | |
95 | h2. _gtkPixSaveW |
||
96 | |||
97 | Saves a pix object to a physical file. |
||
98 | |||
99 | Prototype : *fun [ObjGtkPix W S [[S S] r1]] ObjGtkPix* |
||
100 | |||
101 | table. |
||
102 | |*pix*|ObjGtkPix|a valid pix object. Can not be nil.| |
||
103 | |*filename*|W|a write-referenced file. Can not be nil.| |
||
104 | |*format*|S|a file format to save the pix format; e.g. "tiff", "jpeg",.... If nil, the format will be "png" by default.| |
||
105 | |*options*|[[S S] r1]|a list of options. Can be nil to get the default values (the most currently case). Otherwise, see below.| |
||
106 | |||
107 | +Return+ : ObjGtkPix : the same pix object or nil if an error occurs. The log file and/or the console could give an error message. |
||
108 | |||
109 | *Options* can be either some parameters given to the saver or parameters given to a file. +Note that all parameters couldn't be supported+. |
||
110 | * If the format is "jpeg", an option can be the quality. In this case, _options_ could be @["quality" "85"]@. The value of "quality" should be in the range [0;100]. |
||
111 | * If the format is "png", the "compression" option is usually set, e.g. @["compression" "9"]@, value should be in the range [0;9]. You could find more informations "here":http://www.w3.org/TR/PNG/ and typically in this "section":http://www.w3.org/TR/PNG/#11textinfo |
||
112 | * If the format is "tiff", the algorithm of the compression is set by "compression" option : 1 : no compression, 2 : CCITT modified Huffman RLE (aka Huffman method), 5 : Lempel-Ziv & Welch (aka LZW method), 7 : JPEG DCT compression (aka JPEG method), 8 : Deflate compression (as recognized by Adobe), etc ... (e.g. ["compression" "5"]). More codecs, codes numbers and informations in _tiff.h_ : "libtiff":ftp://ftp.remotesensing.org/pub/libtiff/. For the others options, you can read the tags table in the "TIFF 6.0 Specification Coverage":http://www.libtiff.org/support.html |
||
113 | * If the format is "ico", the depth is set by "depth" option : ["depth" "16"]. Value can be 16, 24 or 32. If the options "x_hot" and "y_hot" are presents with any valids values then the result will be a "cur" file instead of an "ico" file. |
||
114 | * ICC color profiles can also be embedded into PNG and TIFF images. The "icc-profile" option should be the complete ICC profile encoded into base64. Use the Scol function "_getpack" and "base64encode" to get this content. |
||
115 | * More options, others formats, read the doc :) |
||
116 | 1 | iri | |
117 | h2. _gtkPixScale |
||
118 | |||
119 | Scale |
||
120 | |||
121 | Prototype : *fun [ObjGtkPix I I I I] ObjGtkPix* |
||
122 | |||
123 | table. |
||
124 | |*pix*|ObjGtkPix|a valid pix object| | |
||
125 | |*width*|I|the new width| | |
||
126 | |*height*|I|the new height| | |
||
127 | 2 | iri | |*mode*|I|an algorithm at your choice :|SCOL_GTK_PIX_INTERP_BILINEAR (default) : | |
128 | 1 | iri | | | | |SCOL_GTK_PIX_INTERP_NEAREST : | |
129 | | | | |SCOL_GTK_PIX_INTERP_TILES : | |
||
130 | | | | |SCOL_GTK_PIX_INTERP_HYPER : | |
||
131 | 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.| |
132 | 1 | iri | |
133 | +Return+ : ObjGtkPix : a *new* pix object or nil if an error occurs. |
||
134 | |||
135 | h2. _gtkPixScaleEx |
||
136 | |||
137 | Not implemented yet. |
||
138 | |||
139 | +Return+ : always nil. |
||
140 | 3 | iri | |
141 | h2. _gtkPixRotate |
||
142 | |||
143 | Performs a rotation |
||
144 | |||
145 | Prototype : *fun [ObjGtkPix I I] ObjGtkPix* |
||
146 | |||
147 | table. |
||
148 | 4 | iri | |*pix*|ObjGtkPix|a pix object| |
149 | 3 | iri | |*angle*|I|0, 90, 180 or 270 degrees. Others values are ignored| |
150 | |*flag*|I|0 if the new pix Scol object is created with the rotated pix| |
||
151 | | | |1 if the new pix replaces the pix in the curent pix object _pix_| |
||
152 | |||
153 | +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 |
||
154 | 1 | iri | |
155 | 5 | iri | h2. _gtkPixFlip |
156 | |||
157 | Performs a flip to a pix object |
||
158 | |||
159 | Prototype : *fun [ObjGtkPix I I] ObjGtkPix* |
||
160 | |||
161 | table. |
||
162 | |*pix*|ObjGtkPix|a pix object| |
||
163 | |*flip*|I|SCOL_GTK_PIX_FLIP_HORIZONTAL or SCOL_GTK_PIX_FLIP_VERTICAL. Other value are ignored.| |
||
164 | |*flag*|I|0 if the new pix Scol object is created with the flipped pix| |
||
165 | | | |1 if the new pix replaces the pix in the curent pix object _pix_| |
||
166 | |||
167 | +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 |
||
168 | |||
169 | 6 | iri | h2. _gtkPixAddAlpha |
170 | |||
171 | Adds an alpha channel to an existing pix object. |
||
172 | If the tuple is not nil, then the color specified by it will be assigned zero opacity. |
||
173 | For example, if the tuple is equals at [255, 255, 255], all white pixels will become fully transparent. |
||
174 | |||
175 | Prototype : *fun [ObjGtkPix [I I I] I] ObjGtkPix* |
||
176 | |||
177 | table. |
||
178 | |*pix*|ObjGtkPix|a pix object| |
||
179 | |*rgb*|[I I I]|red, green and blue value (0->255). or nil (see above)| |
||
180 | |*flag*|I|0 if the new pix Scol object is created with the new pix| |
||
181 | | | |1 if the new pix replaces the pix in the curent pix object _pix_| |
||
182 | |||
183 | +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 |
||
184 | |||
185 | 7 | iri | h2. _gtkPixCopyArea |
186 | |||
187 | Copies a rectangular area from _srcpix_ to _destpix_. |
||
188 | |||
189 | Prototype : *fun [ObjGtkPix I I I I ObjGtkPix I I] ObjGtkPix* |
||
190 | |||
191 | table. |
||
192 | |*srcpix*|ObjGtkPix|a source pix object| |
||
193 | |*srcx*|I|x coordinate in _srcpix_| |
||
194 | |*srcy*|I|y coordinate in _srcpix_| |
||
195 | |*srcwidth*|I|width to copy from _srcpix_| |
||
196 | |*srcheight*|I|height to copy from _srcpix_| |
||
197 | 8 | iri | |*destpix*|ObjGtkPix|a destination pix object. If nil, a new pix object will be created in the current channel| |
198 | 7 | iri | |*destx*|I|x coordinate in _destpix_| |
199 | |*desty*|I|y coordinate in _destpix_| |
||
200 | |||
201 | +Return+ : ObjGtkPix : the destination pix object or nil if error |
||
202 | |||
203 | 9 | iri | h2. _gtkPixSaturation |
204 | |||
205 | Modifies the saturation to a pix object |
||
206 | |||
207 | Prototype : *fun [ObjPixGtk I] ObjGtkPix* |
||
208 | |||
209 | 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. |
210 | 9 | iri | |
211 | +Return+ : ObjGtkPix : the same pix object or nil if an error is occured. |
||
212 | |||
213 | 13 | iri | h2. _gtkPixPixelate |
214 | |||
215 | Pixelates a pix object. |
||
216 | |||
217 | TODO. |
||
218 | |||
219 | 12 | iri | h2. _gtkPixFill |
220 | |||
221 | Fill a pix object with a given color. |
||
222 | |||
223 | Prototype : *fun [ObjGtkPix I] ObjGtkPix* |
||
224 | |||
225 | Value : I : Format is : RRGGBBAA. If pix hasn't an alpha channel, AA is ignored |
||
226 | |||
227 | +Return+ : ObjGtkPix : the same pix object or nil if an error is occured. |
||
228 | 14 | iri | |
229 | 16 | iri | h2. _gtkPixGetSize |
230 | |||
231 | Returns the width and the height of a pix object |
||
232 | |||
233 | Prototype : *fun [ObjGtkPix] [I I]* |
||
234 | |||
235 | +Return+ : [I I] : the width and the height or nil if error |
||
236 | |||
237 | 17 | iri | h2. _gtkPixGetChannels |
238 | |||
239 | Prototype : *fun [ObjGtkPix] [I I I]* |
||
240 | |||
241 | +Return+ [I I I] : |
||
242 | * the number of channels of the pix object |
||
243 | * if the pix object has an alpha channel (1) or not (0) |
||
244 | * and the number of bits per color |
||
245 | |||
246 | 16 | iri | |
247 | |||
248 | 14 | iri | |
249 | |||
250 | h1. Animated image |
||
251 | |||
252 | 18 | iri | The static functions *should not* be used to the animated pix object. |
253 | |||
254 | 14 | iri | h2. _gtkPixAnimLoad |
255 | |||
256 | Loads an animated image file. |
||
257 | |||
258 | Prototype : *fun [Chn P] ObjGtkPix* |
||
259 | |||
260 | +Return+ : a new pix object or nil if an error occurs. |
||
261 | 12 | iri | |
262 | 15 | iri | h2. _gtkPixAnimNew |
263 | |||
264 | Creates a new animated pix from a list of static pix. |
||
265 | |||
266 | Prototype : *fun [Chn [ObjGtkPix r1] I I I I] ObjGtkPix* |
||
267 | |||
268 | table. |
||
269 | |*channel*|Chn|any channel to create the Scol object| |
||
270 | |*list*|[ObjGtkPix r1]|a list of static pix object. These pix must have the same width ad height than the animation, else are ignored| |
||
271 | |*width*|I|the width of the animated image| |
||
272 | |*height*|I|the height of the animated image| |
||
273 | |*rate*|I|the speed of the animation, in frames per second. By default, it's 1| |
||
274 | |*loop*|I|1 (default) if the animation should loop indefinitely when it reaches the end, else 0| |
||
275 | |||
276 | +Return+ ObjGtkPix : a new pix object, or nil if error |
||
277 | |||
278 | 20 | iri | h2. _gtkPixAnimGetSize |
279 | |||
280 | Returns the size of an animated pix object |
||
281 | |||
282 | Prototype : *fun [ObjGtkPix] [I I]* |
||
283 | |||
284 | +Return+ [I I] : the width and the height. if error, returns nil. |
||
285 | |||
286 | h2. _gtkPixAnimGetStatic |
||
287 | |||
288 | Gets the pix static object if the animated pix object is unanimated |
||
289 | |||
290 | Prototype : *fun [ObjGtkPix] ObjGtkPix* |
||
291 | |||
292 | This functions takes to argument an animated pix object (via _gtkPixAnimLoad or _gtkPixAnimNew). |
||
293 | If there is *no animation*, then, the functions returns a *new* static pix object. Otherwise, nil is returned. |
||
294 | |||
295 | |||
296 | 6 | iri | |
297 | 5 | iri | |
298 | 1 | iri | |
299 | Return [[Api]] |