AffineTransform.h

Go to the documentation of this file.
00001 #ifndef JAVA_AWT_GEOM_AFFINETRANSFORM_H
00002 #define JAVA_AWT_GEOM_AFFINETRANSFORM_H 1
00003 
00004 #ifndef JAVA_AWT_GEOM_POINT2D_H
00005 #include <java_awt_geom/Point2D.h>
00006 #endif /* JAVA_AWT_GEOM_POINT2D_H */
00007 #ifndef JAVA_AWT_SPEC
00008 #include <java_awt/Spec.h>
00009 #endif /* JAVA_AWT_SPEC */
00010 
00011 namespace java {
00012   namespace awt {
00013     
00014     class Shape;
00015 
00016     namespace geom {
00017 
00040       class JAVA_AWT_SPEC AffineTransform : virtual public Object {
00041 
00042       public:
00043 
00044         enum AFFINE_TYPE {
00045 
00046           /*
00047            * This constant is only useful for the cached type field.
00048            * It indicates that the type has been decached and must be recalculated.
00049            */
00050           TYPE_UNKNOWN = -1,
00051 
00070           TYPE_IDENTITY = 0,
00071 
00087           TYPE_TRANSLATION = 1,
00088 
00106           TYPE_UNIFORM_SCALE = 2,
00107 
00125           TYPE_GENERAL_SCALE = 4,
00126 
00132           TYPE_MASK_SCALE = (TYPE_UNIFORM_SCALE | TYPE_GENERAL_SCALE),
00133 
00151           TYPE_QUADRANT_ROTATION = 8,
00152 
00171           TYPE_GENERAL_ROTATION = 16,
00172 
00178           TYPE_MASK_ROTATION = (TYPE_QUADRANT_ROTATION | TYPE_GENERAL_ROTATION),
00179 
00196           TYPE_GENERAL_TRANSFORM = 32,
00197 
00222           TYPE_FLIP = 64,
00223           /* NOTE: TYPE_FLIP was added after GENERAL_TRANSFORM was in public
00224            * circulation and the flag bits could no longer be conveniently
00225            * renumbered without introducing binary incompatibility in outside
00226            * code.
00227            */
00228 
00229         };
00230 
00235         AffineTransform();
00236 
00244         AffineTransform
00245           (jdouble m00, jdouble m10,
00246            jdouble m01, jdouble m11,
00247            jdouble m02, jdouble m12);
00248 
00261         AffineTransform(const Array<double>& flatmatrix);
00262 
00278         static AffineTransform getTranslateInstance(jdouble tx, jdouble ty);
00279 
00294         static AffineTransform getRotateInstance(jdouble theta);
00295 
00326         static AffineTransform getRotateInstance(jdouble theta, jdouble x, jdouble y);
00327 
00343         static AffineTransform getScaleInstance(jdouble sx, jdouble sy);
00344 
00360         static AffineTransform getShearInstance(jdouble shx, jdouble shy);
00361 
00385         virtual jint getType();
00386 
00427         virtual jdouble getDeterminant() const;
00428 
00447         virtual void getMatrix(Array<jdouble>& flatmatrix) const;
00448 
00456         virtual jdouble getScaleX() const;
00457 
00465         virtual jdouble getScaleY() const;
00466 
00474         virtual jdouble getShearX() const;
00475 
00483         virtual jdouble getShearY() const;
00484 
00492         virtual jdouble getTranslateX() const;
00493 
00501         virtual jdouble getTranslateY() const;
00502 
00517         virtual void translate(jdouble tx, jdouble ty);
00518 
00532         virtual void rotate(jdouble theta);
00533 
00555         virtual void rotate(jdouble theta, jdouble x, jdouble y);
00556 
00571         virtual void scale(jdouble sx, jdouble sy);
00572 
00587         virtual void shear(jdouble shx, jdouble shy);
00588 
00592         virtual void setToIdentity();
00593 
00607         virtual void setToTranslation(jdouble tx, jdouble ty);
00608 
00621         virtual void setToRotation(jdouble theta);
00622 
00649         virtual void setToRotation(jdouble theta, jdouble x, jdouble y);
00650 
00664         virtual void setToScale(jdouble sx, jdouble sy);
00665 
00679         virtual void setToShear(jdouble shx, jdouble shy);
00680 
00687         virtual void setTransform(const AffineTransform& t);
00688 
00695         virtual void setTransform
00696           (jdouble m00, jdouble m10,
00697            jdouble m01, jdouble m11,
00698            jdouble m02, jdouble m12);
00699 
00720         virtual void concatenate(const AffineTransform& t);
00721 
00745         virtual void preConcatenate(const AffineTransform& t);
00746 
00768         AffineTransform createInverse() const;
00769 
00787         virtual Point2D& transform(const Point2D& ptSrc, Ref<Point2D>& ptDst) const;
00788 
00809         virtual void transform
00810           (const Array<jdouble>& srcPts, jint srcOff,
00811            Array<jdouble>& dstPts, jint dstOff, jint numPts) const;
00812 
00831         virtual Point2D& inverseTransform(const Point2D& ptSrc, Ref<Point2D>& ptDst) const;
00832 
00856         virtual void inverseTransform
00857           (const Array<jdouble>& srcPts, jint srcOff,
00858            Array<jdouble>& dstPts, jint dstOff, jint numPts) const;
00859 
00884         virtual Point2D& deltaTransform(const Point2D& ptSrc, Ref<Point2D>& ptDst) const;
00885 
00916         virtual void deltaTransform
00917           (const Array<jdouble>& srcPts, jint srcOff,
00918            Array<jdouble>& dstPts, jint dstOff, jint numPts) const;
00919 
00929         virtual Ref<Shape> createTransformedShape(const Ref<Shape>& pSrc) const;
00930 
00937         virtual String toString() const;
00938 
00945         virtual jboolean isIdentity();
00946 
00951         virtual jint hashCode() const;
00952 
00962         virtual jboolean equals(const Object& obj) const;
00963 
00964       protected:
00965 
00972         jdouble m00;
00973 
00980         jdouble m10;
00981 
00988         jdouble m01; 
00989 
00996         jdouble m11; 
00997 
01004         jdouble m02;
01005 
01012         jdouble m12;
01013 
01022         jint state;
01023 
01024       private:
01025 
01039         jint type;
01040 
01041         AffineTransform
01042           (jdouble m00, jdouble m10,
01043            jdouble m01, jdouble m11,
01044            jdouble m02, jdouble m12,
01045            jint state);
01046 
01047         void updateState();
01048 
01049         REGISTER_MEMBERS;
01050 
01051       };
01052 
01053     } // namespace geom
01054   } // namespace awt
01055 } // namespace java
01056 
01057 #endif /* JAVA_AWT_GEOM_AFFINETRANSFORM_H */

Generated on Fri May 16 11:54:42 2008 for CrossPlatformJavaLikeC++API by  doxygen 1.5.3