CUSTOMIZE 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. This file describes possible customizations of the libxmi library. Please
  2. read the file README first; it describes what libxmi does.
  3. 1. If desired, modify the default definition of `miPixel' in ./xmi.h by
  4. defining the MI_PIXEL_TYPE preprocessor symbol at compile time. Each
  5. point in a miPaintedSet is painted with a miPixel, but what a miPixel
  6. is, is up to you. By default it is an `unsigned int', but it could be
  7. another integer type, a floating point type, a structure, a union...
  8. That would be arranged by defining MI_PIXEL_TYPE. If MI_PIXEL_TYPE is a
  9. structure or a union, the macro MI_SAME_PIXEL(), which tests two
  10. miPixels for equality, should be redefined too.
  11. 2. If desired, define the macro MI_DEFAULT_MERGE2_PIXEL() also. As
  12. explained in ./xmi.h, by default, miCopyPaintedSetToCanvas() uses the
  13. Painter's Algorithm (a source pixel replaces a destination pixel). That
  14. may be altered programatically by invoking miSetPixelMerge2(). But at
  15. installation time, the default behavior may be altered too, by defining
  16. the macro MI_DEFAULT_MERGE2_PIXEL(new, source, dest). For example, if
  17. the miPixel datatype is defined to include an alpha component as well as
  18. color components, a change would be called for.
  19. 3. The same, for the macro MI_DEFAULT_MERGE3_PIXEL(). This macro is used
  20. when a "texture" pixel is available as part of a miCanvas, and must be
  21. taken into account, besides the source pixel and the destination pixel
  22. already on the miCanvas.
  23. 4. If desired, customize the definition of the `drawable' contained within
  24. an miCanvas by defining the symbol MI_CANVAS_DRAWABLE_TYPE. If this is
  25. not defined, the drawable will be an miPixmap. If you define
  26. MI_CANVAS_DRAWABLE_TYPE, you will also need to define the accessor
  27. macros MI_GET_CANVAS_DRAWABLE_PIXEL(pCanvas, x, y, pixel) and
  28. MI_SET_CANVAS_DRAWABLE_PIXEL(pCanvas, x, y, pixel). The macro
  29. MI_GET_CANVAS_DRAWABLE_BOUNDS(pCanvas, xleft, ytop, xright, ybottom)
  30. should be defined too. See ./xmi.h.
  31. Actually, if you are interested only in the first stage of the graphics
  32. pipeline, i.e., the painting of pixels in a miPaintedSet by the eight
  33. drawing functions in the core API, only modification #1 above is relevant.
  34. A miPaintedSet is an opaque object, but by looking at the function
  35. miCopyPaintedSetToCanvas() in the file mi_canvas.c, you should be able to
  36. see how it is laid out. It would be trivial to write your own function
  37. that copies pixels out of a miPaintedSet, i.e., to rewrite the second stage
  38. of the graphics pipeline from scratch in a completely customized way.