Programming Guide: Custom Transform Objects

# Programming Guide

## Custom Transform Objects

OpenDoc transform objects provide powerful transformational capabilities that are sufficient for most 2-dimensional drawing. With transforms, you can not only position your graphical objects, but you can also easily scale, rotate, and skew them. You can combine the operations of frame-internal transforms with those of facet-external transforms to achieve sophisticated effects with a minimum of code.

If you need to extend the power of transform objects even further, you can obtain the extra capability most efficiently by creating your own transform subclass. If you need to provide for nonlinear transformations (such as curved projections or sophisticated perspective effects), you can implement them as new methods and as overrides to the methods of ODBaseTransform, the superclass of ODTransform.

If you subclass ODBaseTransform, you must override at least the following methods:

Copy | InvertPoint | Reset
CopyFrom | InvertShape | TransformPoint
GetMatrix | PostCompose | TransformPoints
GetMATRIXLF | PreCompose | TransformShape
HasMatrix | ReadFrom | WriteTo
Invert |  |

Your GetMatrix and GetMATRIXLF methods must throw the exception ODErrTransformErr. Your HasMatrix method must return kODFalse. Other methods should perform tasks appropriate to your transform.

For more information on matrices and transformations in two-dimensional drawing, you can consult any standard computer-graphics textbook, such as Computer Graphics Principles and Practice 2nd ed., by Foley, vanDam, Feiner, and Hughes (Addison-Wesley, 1990).

[ Top | Previous | Next | Contents | Index | Documentation Homepage ]