afterimage.h

Go to the documentation of this file.
00001 #ifndef LIB_AFTERIMAGE_H_HEADER_INCLUDED
00002 #define LIB_AFTERIMAGE_H_HEADER_INCLUDED
00003 
00004 /* the follwoing files has to be included in user app to get access to
00005  * libAfterImage functionality.
00006  */
00007 #include "afterbase.h"
00008 #include "asvisual.h"
00009 #include "blender.h"
00010 #include "asimage.h"
00011 #include "imencdec.h"
00012 #include "ascmap.h"
00013 #undef HAVE_FREETYPE
00014 #include "asfont.h"
00015 #include "ximage.h"
00016 #include "transform.h"
00017 #include "asimagexml.h"
00018 #include "import.h"
00019 #include "export.h"
00020 #include "pixmap.h"
00021 #include "char2uni.h"
00022 
00023 /****h* libAfterImage/libAfterImage
00024  * NAME
00025  * libAfterImage - generic imaging library originally designed for 
00026  * AfterStep X Window Manager.
00027  *
00028  * PURPOSE
00029  * libAfterImage is the imaging library implemented for AfterStep
00030  * X Window Manager. It has been generalized to be suitable for any
00031  * application in need of robust graphics engine.
00032  *
00033  * It provides facilities for loading images from files of different
00034  * formats, compressed in memory storage of images, scaling,
00035  * tinting/shading, flipping and superimposition of arbitrary number of
00036  * images over each other. In addition it allows for linear gradients
00037  * drawing, and antialiased/smoothed text drawing using both  FreeType
00038  * library and X Window fonts.
00039  *
00040  * Primary goals of this library are to achieve exceptional quality of
00041  * images and text, making code fast and small at the same time.
00042  * Additional steps are taken to compensate for screen colordepth
00043  * limitation, and different error diffusion algorithms are used to
00044  * provide for smooth images even in low colordepth modes.
00045  *
00046  * HISTORY
00047  * libAfterImage has been implemented as an attempt to address several
00048  * issues. First one, and most important is that X Window System
00049  * completely lacks any tools for image manipulation, except for very
00050  * rudimentary operations. With Introduction of Render extentions in
00051  * XFree86 4.0 that situation is changing, but still is far from
00052  * perfect. There need is therefore to implement client side image
00053  * manipulation. That inturn creates a problem of image data transfer
00054  * between Server and client.
00055  *
00056  * To avoid that full-time image storage on the client side is needed.
00057  * Which is memory extensive. So there appears to be a need for some
00058  * in-memory compression.
00059  *
00060  * On the other side there is an image quality issue. Its easy to write
00061  * a scaling function by simply dropping out or duplicating pixels,
00062  * but quality is awfull. What is needed is very fast
00063  * averaging/interpolation code. That brings us to the issue of 8 bits
00064  * per channel. Add two pixels together and you get overflow. So all the
00065  * math has to be performed in different colorspace and then converted
00066  * back. On the other side, such a conversion may discard valuable bits,
00067  * so some compensation method has to be implemented.
00068  *
00069  * On the text drawing side of things, there are numerous problems just
00070  * as well. Native X fonts look ugly as soon as you try to show any
00071  * decently sized text. That is supposed to be solved with said Render
00072  * extensions to XFree86, but as experiense has shown, things aren't as
00073  * easy as it looks, besides one wants his app to run well under any X
00074  * Server. FreeType library provides a solution, but not always
00075  * available. Another problem is that if you keep all your images on the
00076  * client side, you want to draw text on client side as well.
00077  *
00078  * The solution is to provide transparent interface that could use both
00079  * X fonts and FreeType, cache glyphs on the client side and possibly
00080  * perform smoothing of ugly X fonts.
00081  *
00082  * There is no library solving all this problems in one fell swoop,
00083  * except for monstrous ones, like ImLib.
00084  *
00085  * Hence libAfterImage has come to life.
00086  *
00087  * DESCRIPTION
00088  * libAfterStep provides sevarl facilities.
00089  *
00090  * 1. X Visual abstruction layer via ASVisual. This layer handles color
00091  * management, transfer of data to and from X Server, and other screen
00092  * related stuff.
00093  *
00094  * 2. Scanline handling facility via ASScanline. ASScanline is the most
00095  * widely used structure since image handling is implemented on
00096  * per-scanline basis.
00097  *
00098  * 3. Image storage, trasformation and rendering via ASImage. ASImage
00099  * provides for generic container used for any image or text
00100  * manipulation. It incorporates such a robust facilities as in-memory
00101  * RLE compression, separate channel storage of 4 channels ( Alpha, Red,
00102  * Green, and Blue ) with 8 bit per channel.
00103  *
00104  * 4. Simplified font handling facility via ASFont and ASFointManager.
00105  * All the font handling is done using ASFont structure, no matter what
00106  * type of font is used. Any font supported by X11 and FreeType can be
00107  * used.
00108  *
00109  * 5. Transparent image file reading for many different formats. Included
00110  * built-in XPM reading code and XCF ( GIMP's native format ).
00111  * Overall supported:
00112  * via external libraries :
00113  * XPM, JPEG, PNG, TIFF, GIF
00114  * via built in code :
00115  * XPM, XCF, PNM, PPM, BMP, ICO, CUR
00116  * Note that XPM can be supported both via built-in code or via libXpm,
00117  * depending on compilation configuration.
00118  * Actuall image file format is autodetected from the file contents -
00119  * file name extention is not used and can be anything at all.
00120  *
00121  * 6. Image export into many popular file formats. Currently implemented :
00122  * XPM, JPEG, PNG, GIF. Work is underway to implement support for TIFF,
00123  * XCF, BMP, ICO.
00124  *
00125  * 7. Image quantization to arbitrary size colormap.
00126  *
00127  * 8. libAfterImage could be used without X window system, which is
00128  * coninient for such thing as web development. XML Image manipulation
00129  * tool, that could be used in such activity is included (see ascompose.c)
00130  *
00131  * 9. Image reference counting
00132  *
00133  * USES
00134  * libAfterBase - AfterStep basic functionality library. That Includes
00135  * Hash tables, file search methods, message output, generic types.
00136  * However effort has been made to allow for standalone configuration as
00137  * well. If libAfterBase is not found at compilation time - libAfterImage
00138  * will use extract from libAfterBase included with libAfterImage.
00139  *
00140  * SEE ALSO
00141  * Examples
00142  * API Reference
00143  *
00144  * TODO
00145  * Implement support for Targa and PCX image format and maybe some other
00146  * formats as well.
00147  *
00148  * Implement complete support for I18N internationalization.
00149  *
00150  * Implement color<->pixel conversion for all colordepths.
00151  *
00152  * AUTHOR
00153  * Sasha Vasko <sasha at aftercode dot net>
00154  *********/
00155 /****h* libAfterImage/Examples
00156  * EXAMPLE
00157  * ASView  - image loading from the file and displaying in window.
00158  * ASScale - image loading from file and scaling to arbitrary size.
00159  * ASTile  - image loading from file, tiling and tinting to arbitrary
00160  *           size and color.
00161  * ASMerge - imgae loading and merging with another image.
00162  * ASGrad  - mutlipoint gradient drawing.
00163  * ASFlip  - image loading from file and rotation.
00164  * ASText  - trexturized semitransparent antialised text drawing.
00165  *
00166  * SEE ALSO
00167  * API Reference
00168  ******/
00169 /****h* libAfterImage/API Reference
00170  * CHILDREN
00171  * Headers :
00172  *          ascmap.h asfont.h asimage.h asvisual.h blender.h export.h
00173  *          import.h transform.h ximage.h
00174  * Structures :
00175  *          ColorPair
00176  *          ASScanline
00177  *          ASVisual
00178  *          ASImage
00179  *          ASImageManager
00180  *          ASImageBevel
00181  *          ASImageDecoder
00182  *          ASImageOutput
00183  *          ASImageLayer
00184  *          ASGradient
00185  *          ASFontManager
00186  *          ASFont
00187  *          ASGlyph
00188  *          ASGlyphRange
00189  *          ASColormap
00190  *          ASImageExportParams
00191  *          ASVectorPalette
00192  *
00193  * Functions :
00194  *   ASScanline handling:
00195  *          prepare_scanline(), free_scanline()
00196  *
00197  *   ASVisual initialization :
00198  *          query_screen_visual(), setup_truecolor_visual(),
00199  *          setup_pseudo_visual(), setup_as_colormap(),
00200  *          create_asvisual(), create_asvisual_for_id(),
00201  *          destroy_asvisual()
00202  *
00203  *   ASVisual encoding/decoding :
00204  *          visual2visual_prop(), visual_prop2visual()
00205  *
00206  *   ASVisual convenience functions :
00207  *          create_visual_window(), create_visual_pixmap(),
00208  *          create_visual_ximage(), create_visual_gc()
00209  *
00210  *   Colorspace conversion :
00211  *          rgb2value(), rgb2saturation(), rgb2hue(), rgb2luminance(),
00212  *          rgb2hsv(), rgb2hls(), hsv2rgb(), hls2rgb(),
00213  *          degrees2hue16(), hue162degrees(), normalize_degrees_val()
00214  *
00215  *   Image quantization :
00216  *          colormap_asimage(), destroy_colormap()
00217  *
00218  *   merge_scanline methods :
00219  *          alphablend_scanlines(), allanon_scanlines(),
00220  *          tint_scanlines(), add_scanlines(), sub_scanlines(),
00221  *          diff_scanlines(), darken_scanlines(), lighten_scanlines(),
00222  *          screen_scanlines(), overlay_scanlines(), hue_scanlines(),
00223  *          saturate_scanlines(), value_scanlines(),
00224  *          colorize_scanlines(), dissipate_scanlines().
00225  *
00226  *   ASImage handling :
00227  *          asimage_init(), asimage_start(), create_asimage(),
00228  *          clone_asimage(), destroy_asimage()
00229  *
00230  *   ASImage channel data manipulations :
00231  *          get_asimage_chanmask(), move_asimage_channel(),
00232  *          copy_asimage_channel(), copy_asimage_lines()
00233  *
00234  *   ImageManager Reference counting and managing :
00235  *          create_image_manager(), destroy_image_manager(),
00236  *          store_asimage(), fetch_asimage(), dup_asimage(),
00237  *          release_asimage(), release_asimage_by_name()
00238  *
00239  *   Layers helper functions :
00240  *          init_image_layers(), create_image_layers(),
00241  *          destroy_image_layers()
00242  *
00243  *   Encoding :
00244  *          asimage_add_line(), asimage_add_line_mono(),
00245  *          asimage_print_line()
00246  *
00247  *   Decoding :
00248  *          start_image_decoding(), stop_image_decoding(),
00249  *          asimage_decode_line (), set_decoder_shift(),
00250  *          set_decoder_bevel_geom(), set_decoder_back_color()
00251  *
00252  *   ASImage from scientific data :
00253  *          set_asimage_vector(), colorize_asimage_vector(),
00254  *          create_asimage_from_vector()
00255  *
00256  *   Output :
00257  *          start_image_output(), set_image_output_back_color(),
00258  *          toggle_image_output_direction(), stop_image_output()
00259  *
00260  *   X11 conversions :
00261  *          ximage2asimage(), pixmap2asimage(), asimage2ximage(),
00262  *          asimage2mask_ximage(), asimage2pixmap(), asimage2mask()
00263  *
00264  *   Transformations :
00265  *          scale_asimage(), tile_asimage(), merge_layers(), 
00266  *                      make_gradient(),
00267  *          flip_asimage(), mirror_asimage(), pad_asimage(),
00268  *          blur_asimage_gauss(), fill_asimage(), adjust_asimage_hsv()
00269  *
00270  *   Import :
00271  *          file2ASImage(), file2pixmap()
00272  *   Export :
00273  *              ASImage2file()
00274  *
00275  *   Text Drawing :
00276  *          create_font_manager(), destroy_font_manager(),
00277  *          open_freetype_font(), open_X11_font(), get_asfont(),
00278  *          release_font(), print_asfont(), print_asglyph(),
00279  *          draw_text(), draw_fancy_text()
00280  *********/
00281 #endif  /* AFTERIMAGE_H_HEADER_INCLUDED */
00282 

Generated on Tue Jul 5 14:13:25 2011 for ROOT_528-00b_version by  doxygen 1.5.1