1afterimage(1) AfterStep X11 window manager afterimage(1)
2
3
4
6 afterimage - overview of libAfterImage image library libAfterImâ
7 age/libAfterImage
8
10 - generic imaging library originally designed for AfterStep X Window
11 Manager.
12
13
15 libAfterImage is the imaging library implemented for AfterStep
16 X Window Manager. It has been generalized to be suitable for any
17 application in need of robust graphics engine.
18
19 It provides facilities for loading images from files of different
20 formats, compressed in memory storage of images, scaling,
21 tinting/shading, flipping and superimposition of arbitrary number of
22 images over each other. In addition it allows for linear gradients
23 drawing, and antialiased/smoothed text drawing using both FreeType
24 library and X Window fonts.
25
26 Primary goals of this library are to achieve exceptional quality of
27 images and text, making code fast and small at the same time.
28 Additional steps are taken to compensate for screen colordepth
29 limitation, and different error diffusion algorithms are used to
30 provide for smooth images even in low colordepth modes.
31
33 libAfterImage has been implemented as an attempt to address several
34 issues. First one, and most important is that X Window System
35 completely lacks any tools for image manipulation, except for very
36 rudimentary operations. With Introduction of Render extentions in
37 XFree86 4.0 that situation is changing, but still is far from
38 perfect. There need is therefore to implement client side image
39 manipulation. That inturn creates a problem of image data transfer
40 between Server and client.
41
42 To avoid that full-time image storage on the client side is needed.
43 Which is memory extensive. So there appears to be a need for some
44 in-memory compression.
45
46 On the other side there is an image quality issue. Its easy to write
47 a scaling function by simply dropping out or duplicating pixels,
48 but quality is awfull. What is needed is very fast
49 averaging/interpolation code. That brings us to the issue of 8 bits
50 per channel. Add two pixels together and you get overflow. So all the
51 math has to be performed in different colorspace and then converted
52 back. On the other side, such a conversion may discard valuable bits,
53 so some compensation method has to be implemented.
54
55 On the text drawing side of things, there are numerous problems just
56 as well. Native X fonts look ugly as soon as you try to show any
57 decently sized text. That is supposed to be solved with said Render
58 extensions to XFree86, but as experiense has shown, things aren't as
59 easy as it looks, besides one wants his app to run well under any X
60 Server. FreeType library provides a solution, but not always
61 available. Another problem is that if you keep all your images on the
62 client side, you want to draw text on client side as well.
63
64 The solution is to provide transparent interface that could use both
65 X fonts and FreeType, cache glyphs on the client side and possibly
66 perform smoothing of ugly X fonts.
67
68 There is no library solving all this problems in one fell swoop,
69 except for monstrous ones, like ImLib.
70
71 Hence libAfterImage has come to life.
72
74 libAfterStep provides sevarl facilities.
75
76 1. X Visual abstruction layer via ASVisual. This layer handles color
77 management, transfer of data to and from X Server, and other screen
78 related stuff.
79
80 2. Scanline handling facility via ASScanline. ASScanline is the most
81 widely used structure since image handling is implemented on
82 per-scanline basis.
83
84 3. Image storage, trasformation and rendering via ASImage. ASImage
85 provides for generic container used for any image or text
86 manipulation. It incorporates such a robust facilities as in-memory
87 RLE compression, separate channel storage of 4 channels ( Alpha, Red,
88 Green, and Blue ) with 8 bit per channel.
89
90 4. Simplified font handling facility via ASFont and ASFointManager.
91 All the font handling is done using ASFont structure, no matter what
92 type of font is used. Any font supported by X11 and FreeType can be
93 used.
94
95 5. Transparent image file reading for many different formats. Included
96 built-in XPM reading code and XCF ( GIMP's native format ).
97 Overall supported:
98 via external libraries :
99 XPM, JPEG, PNG, TIFF, GIF
100 via built in code :
101 XPM, XCF, PNM, PPM, BMP, ICO, CUR
102 Note that XPM can be supported both via built-in code or via libXpm,
103 depending on compilation configuration.
104 Actuall image file format is autodetected from the file contents -
105 file name extention is not used and can be anything at all.
106
107 6. Image export into many popular file formats. Currently implemented :
108 XPM, JPEG, PNG, GIF. Work is underway to implement support for TIFF,
109 XCF, BMP, ICO.
110
111 7. Image quantization to arbitrary size colormap.
112
113 8. libAfterImage could be used without X window system, which is
114 coninient for such thing as web development. XML Image manipulation
115 tool, that could be used in such activity is included (see ascompose.c)
116
117 9. Image reference counting
118
120 libAfterBase - AfterStep basic functionality library. That Includes
121 Hash tables, file search methods, message output, generic types.
122 However effort has been made to allow for standalone configuration as
123 well. If libAfterBase is not found at compilation time - libAfterImage
124 will use extract from libAfterBase included with libAfterImage.
125
127 Examples
128 API Reference
129
131 Implement support for Targa and PCX image format and maybe some other
132 formats as well.
133
134 Implement complete support for I18N internationalization.
135
136 Implement color<->pixel conversion for all colordepths.
137
139 Sasha Vasko <sasha at aftercode dot net>
140
142 ASView - image loading from the file and displaying in window.
143 ASScale - image loading from file and scaling to arbitrary size.
144 ASTile - image loading from file, tiling and tinting to arbitrary
145 size and color.
146 ASMerge - imgae loading and merging with another image.
147 ASGrad - mutlipoint gradient drawing.
148 ASFlip - image loading from file and rotation.
149 ASText - trexturized semitransparent antialised text drawing.
150
152 API Reference
153
155 Headers :
156 ascmap.h asfont.h asimage.h asvisual.h blender.h export.h
157 import.h transform.h ximage.h
158 Structures :
159 ColorPair
160 ASScanline
161 ASVisual
162 ASImage
163 ASImageManager
164 ASImageBevel
165 ASImageDecoder
166 ASImageOutput
167 ASImageLayer
168 ASGradient
169 ASFontManager
170 ASFont
171 ASGlyph
172 ASGlyphRange
173 ASColormap
174 ASImageExportParams
175 ASVectorPalette
176
177 Functions :
178 ASScanline handling:
179 prepare_scanline(), free_scanline()
180
181 ASVisual initialization :
182 query_screen_visual(), setup_truecolor_visual(),
183 setup_pseudo_visual(), setup_as_colormap(),
184 create_asvisual(), create_asvisual_for_id(),
185 destroy_asvisual()
186
187 ASVisual encoding/decoding :
188 visual2visual_prop(), visual_prop2visual()
189
190 ASVisual convenience functions :
191 create_visual_window(), create_visual_pixmap(),
192 create_visual_ximage(), create_visual_gc()
193
194 Colorspace conversion :
195 rgb2value(), rgb2saturation(), rgb2hue(), rgb2luminance(),
196 rgb2hsv(), rgb2hls(), hsv2rgb(), hls2rgb(),
197 degrees2hue16(), hue162degrees(), normalize_degrees_val()
198
199 Image quantization :
200 colormap_asimage(), destroy_colormap()
201
202 merge_scanline methods :
203 alphablend_scanlines(), allanon_scanlines(),
204 tint_scanlines(), add_scanlines(), sub_scanlines(),
205 diff_scanlines(), darken_scanlines(), lighten_scanlines(),
206 screen_scanlines(), overlay_scanlines(), hue_scanlines(),
207 saturate_scanlines(), value_scanlines(),
208 colorize_scanlines(), dissipate_scanlines().
209
210 ASImage handling :
211 asimage_init(), asimage_start(), create_asimage(),
212 clone_asimage(), destroy_asimage()
213
214 ASImage channel data manipulations :
215 get_asimage_chanmask(), move_asimage_channel(),
216 copy_asimage_channel(), copy_asimage_lines()
217
218 ImageManager Reference counting and managing :
219 create_image_manager(), destroy_image_manager(),
220 store_asimage(), fetch_asimage(), dup_asimage(),
221 release_asimage(), release_asimage_by_name()
222
223 Layers helper functions :
224 init_image_layers(), create_image_layers(),
225 destroy_image_layers()
226
227 Encoding :
228 asimage_add_line(), asimage_add_line_mono(),
229 asimage_print_line()
230
231 Decoding :
232 start_image_decoding(), stop_image_decoding(),
233 asimage_decode_line (), set_decoder_shift(),
234 set_decoder_bevel_geom(), set_decoder_back_color()
235
236 ASImage from scientific data :
237 set_asimage_vector(), colorize_asimage_vector(),
238 create_asimage_from_vector()
239
240 Output :
241 start_image_output(), set_image_output_back_color(),
242 toggle_image_output_direction(), stop_image_output()
243
244 X11 conversions :
245 ximage2asimage(), pixmap2asimage(), asimage2ximage(),
246 asimage2mask_ximage(), asimage2pixmap(), asimage2mask()
247
248 Transformations :
249 scale_asimage(), tile_asimage(), merge_layers(),
250 make_gradient(),
251 flip_asimage(), mirror_asimage(), pad_asimage(),
252 blur_asimage_gauss(), fill_asimage(), adjust_asimage_hsv()
253
254 Import :
255 file2ASImage(), file2pixmap()
256 Export :
257 ASImage2file()
258
259 Text Drawing :
260 create_font_manager(), destroy_font_manager(),
261 open_freetype_font(), open_X11_font(), get_asfont(),
262 release_font(), print_asfont(), print_asglyph(),
263 draw_text(), draw_fancy_text()
264
265
266
2673rd Berkeley Distribution AfterStep v.2.2.6 afterimage(1)