CDRTransformConvertor3 Class Reference

#include <cdrfiltr.h>

Inheritance diagram for CDRTransformConvertor3:

CDRTransformConvertor List of all members.

Public Member Functions

BOOL Init (ADDR Data, INT32 Size)
UINT32 GetNTransforms ()
CDRTransformType GetTransformType (UINT32 n)
 gets a transform type from an trfd chunk
BOOL GetMatrix (cdrMatrix *M, UINT32 n)
 converts a matrix from position N
BOOL GetPerspective (cdrPerspective *P, UINT32 n)
 converts a perspective from position N
BOOL GetEnvelope (Path **P, DocRect *OriginalBBox, INT32 *Corners, UINT32 n)
BOOL GetExtrude (cdrExtrudeInfo *Info, UINT32 n)
 converts a matrix from position N

Private Member Functions

 CC_DECLARE_MEMDUMP (CDRTransformConvertor3)

Private Attributes

cdrfTransformV3Trans

Detailed Description

Definition at line 1048 of file cdrfiltr.h.


Member Function Documentation

CDRTransformConvertor3::CC_DECLARE_MEMDUMP CDRTransformConvertor3   )  [private]
 

BOOL CDRTransformConvertor3::GetEnvelope Path **  P,
DocRect OriginalBBox,
INT32 *  Corners,
UINT32  n
[virtual]
 

Implements CDRTransformConvertor.

Definition at line 4539 of file cdrfiltr.cpp.

04540 {
04541     if(n >= CDRDATA_WORD(Trans->NTransforms))
04542         return FALSE;
04543 
04544     cdrfTransformEntryV3 *En = (cdrfTransformEntryV3 *)(Trans + 1);
04545     BYTE *Data = ((BYTE *)Trans) + En[n].Offset;
04546 
04547     // make a pointer to the interesting data
04548     cdrfTransformEnvelopeV3 *Env = (cdrfTransformEnvelopeV3 *)Data;
04549 
04550     // convert the original bbox
04551     INT32 x0, y0, y1, x1;
04552     x0 = CDRDATA_SWORD(Env->Ox0) * CDRCOORDS_TO_MILLIPOINTS;
04553     y0 = CDRDATA_SWORD(Env->Oy0) * CDRCOORDS_TO_MILLIPOINTS;
04554     x1 = CDRDATA_SWORD(Env->Ox1) * CDRCOORDS_TO_MILLIPOINTS;
04555     y1 = CDRDATA_SWORD(Env->Oy1) * CDRCOORDS_TO_MILLIPOINTS;
04556 
04557     if(x0 > x1)
04558     {
04559         INT32 t = x1;
04560         x1 = x0;
04561         x0 = t;
04562     }
04563     
04564     if(y0 > y1)
04565     {
04566         INT32 t = y1;
04567         y1 = y0;
04568         y0 = t;
04569     }
04570 
04571     OriginalBBox->lo.x = x0;
04572     OriginalBBox->lo.y = y0;
04573     OriginalBBox->hi.x = x1;
04574     OriginalBBox->hi.y = y1;
04575 
04576     // get the coords
04577     DocCoord Co[ENVV3_NCOORDS];
04578     INT32 l;
04579     for(l = 0; l < ENVV3_NCOORDS; l++)
04580     {
04581         Co[l].x = CDRDATA_SWORD(Env->Coords[l].X) * CDRCOORDS_TO_MILLIPOINTS;
04582         Co[l].y = CDRDATA_SWORD(Env->Coords[l].Y) * CDRCOORDS_TO_MILLIPOINTS;
04583     }
04584 
04585     // create the path
04586     Path *pShape = new Path;
04587     if(pShape == 0 || (!pShape->Initialise()))
04588     {   
04589         delete pShape;
04590         return FALSE;
04591     }
04592 
04593     // position the new elements at the beginning of the path
04594     pShape->FindStartOfPath();
04595 
04596     // make a nice shape out of the corners
04597     if(!pShape->InsertMoveTo(Co[0]))
04598         return FALSE;
04599     for(INT32 c = 1; c < ENVV3_NCOORDS; c += 3)
04600     {                     
04601         if(!pShape->InsertCurveTo(Co[c], Co[c + 1], Co[c + 2]))
04602             return FALSE;
04603     }
04604     if(!pShape->CloseSubPath())
04605         return FALSE;
04606     
04607     *P = pShape;
04608 
04609     // fill in the corners
04610     Corners[0] = 0;
04611     Corners[1] = 6;
04612     Corners[2] = 12;
04613     Corners[3] = 18;
04614 
04615     return TRUE;
04616 }

BOOL CDRTransformConvertor3::GetExtrude cdrExtrudeInfo Info,
UINT32  n
[virtual]
 

converts a matrix from position N

Author:
Ben_Summers (Xara Group Ltd) <camelotdev@xara.com>
Date:
08/01/96
Parameters:
extrude info to convert to, transform number [INPUTS]
Returns:
a transform type
See also:
CDRFilter

Implements CDRTransformConvertor.

Definition at line 4136 of file cdrfiltr.cpp.

04137 {
04138     if(n >= CDRDATA_WORD(Trans->NTransforms))
04139         return FALSE;
04140 
04141     cdrfTransformEntryV3 *En = (cdrfTransformEntryV3 *)(Trans + 1);
04142     cdrfTransformExtrudeV3 *Data = (cdrfTransformExtrudeV3 *)(((BYTE *)Trans) + En[n].Offset);
04143 
04144     Info->Trans.cf11 = (FLOAT8)CDRDATA_SWORD(Data->cf11b) + ((FLOAT8)CDRDATA_WORD(Data->cf11a) / 0xffff);
04145     Info->Trans.cf12 = (FLOAT8)CDRDATA_SWORD(Data->cf12b) + ((FLOAT8)CDRDATA_WORD(Data->cf12a) / 0xffff);
04146     Info->Trans.cf13 = (FLOAT8)CDRDATA_SWORD(Data->cf13b) + ((FLOAT8)CDRDATA_WORD(Data->cf13a) / 0xffff);
04147     Info->Trans.cf21 = (FLOAT8)CDRDATA_SWORD(Data->cf21b) + ((FLOAT8)CDRDATA_WORD(Data->cf21a) / 0xffff);
04148     Info->Trans.cf22 = (FLOAT8)CDRDATA_SWORD(Data->cf22b) + ((FLOAT8)CDRDATA_WORD(Data->cf22a) / 0xffff);
04149     Info->Trans.cf23 = (FLOAT8)CDRDATA_SWORD(Data->cf23b) + ((FLOAT8)CDRDATA_WORD(Data->cf23a) / 0xffff);
04150     Info->Trans.cf31 = (FLOAT8)CDRDATA_SWORD(Data->cf31b) + ((FLOAT8)CDRDATA_WORD(Data->cf31a) / 0xffff);
04151     Info->Trans.cf32 = (FLOAT8)CDRDATA_SWORD(Data->cf32b) + ((FLOAT8)CDRDATA_WORD(Data->cf32a) / 0xffff);
04152     Info->Trans.cf33 = (FLOAT8)CDRDATA_SWORD(Data->cf33b) + ((FLOAT8)CDRDATA_WORD(Data->cf33a) / 0xffff);
04153     Info->Trans.cf41 = (FLOAT8)CDRDATA_FLOAT4(Data->f41);
04154     Info->Trans.cf42 = (FLOAT8)CDRDATA_FLOAT4(Data->f42);
04155     Info->Trans.cf43 = (FLOAT8)CDRDATA_FLOAT4(Data->f43);
04156 
04157     Info->Camera.x = CDRDATA_SWORD(Data->Cx) * CDRCOORDS_TO_MILLIPOINTS;
04158     Info->Camera.y = CDRDATA_SWORD(Data->Cy) * CDRCOORDS_TO_MILLIPOINTS;
04159     Info->Camera.z = CDRDATA_DWORD(Data->Cz) * CDRCOORDS_TO_MILLIPOINTS;
04160 
04161     return TRUE;
04162 }

BOOL CDRTransformConvertor3::GetMatrix cdrMatrix M,
UINT32  n
[virtual]
 

converts a matrix from position N

Author:
Ben_Summers (Xara Group Ltd) <camelotdev@xara.com>
Date:
03/04/95
Parameters:
matrix to convert into, transform number [INPUTS]
Returns:
a transform type
See also:
CDRFilter

Implements CDRTransformConvertor.

Definition at line 4263 of file cdrfiltr.cpp.

04264 {
04265     if(n >= CDRDATA_WORD(Trans->NTransforms))
04266         return FALSE;
04267 
04268     cdrfTransformEntryV3 *En = (cdrfTransformEntryV3 *)(Trans + 1);
04269     BYTE *Data = ((BYTE *)Trans) + En[n].Offset;
04270 
04271     // unsigned word pointer
04272     WORD *TDataUS = (WORD *)Data;
04273     // signed word pointer
04274     SWORD *TDataS = (SWORD *)Data;
04275     // signed dword pointer
04276     SDWORD *TDDataS = (SDWORD *)Data;
04277 
04278     // convert the matrix - an interesting mix of 16.16 fixed point values and a
04279     // signed double word translation vector
04280     M->a = (FLOAT8)CDRDATA_SWORD(TDataS[1]) + ((FLOAT8)CDRDATA_WORD(TDataUS[0]) / 0xffff);
04281     M->b = (FLOAT8)CDRDATA_SWORD(TDataS[3]) + ((FLOAT8)CDRDATA_WORD(TDataUS[2]) / 0xffff);
04282     M->c = (FLOAT8)(CDRDATA_DSWORD(TDDataS[2]) * CDRCOORDS_TO_MILLIPOINTS);
04283     M->d = (FLOAT8)CDRDATA_SWORD(TDataS[7]) + ((FLOAT8)CDRDATA_WORD(TDataUS[6]) / 0xffff);
04284     M->e = (FLOAT8)CDRDATA_SWORD(TDataS[9]) + ((FLOAT8)CDRDATA_WORD(TDataUS[8]) / 0xffff);
04285     M->f = (FLOAT8)(CDRDATA_DSWORD(TDDataS[5]) * CDRCOORDS_TO_MILLIPOINTS);
04286 
04287     return TRUE;
04288 }

UINT32 CDRTransformConvertor3::GetNTransforms  )  [inline, virtual]
 

Implements CDRTransformConvertor.

Definition at line 1054 of file cdrfiltr.h.

01054 {return CDRDATA_WORD(Trans->NTransforms);};

BOOL CDRTransformConvertor3::GetPerspective cdrPerspective P,
UINT32  n
[virtual]
 

converts a perspective from position N

Author:
Ben_Summers (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/05/95
Parameters:
perspective to convert into, transform number [INPUTS]
Returns:
a transform type
See also:
CDRFilter

Implements CDRTransformConvertor.

Definition at line 4304 of file cdrfiltr.cpp.

04305 {
04306     if(n >= CDRDATA_WORD(Trans->NTransforms))
04307         return FALSE;
04308 
04309     cdrfTransformEntryV3 *En = (cdrfTransformEntryV3 *)(Trans + 1);
04310     BYTE *Data = ((BYTE *)Trans) + En[n].Offset;
04311 
04312     return ConvertPerspective(P, (cdrfPerspectiveTransform *)Data);
04313 }

CDRTransformType CDRTransformConvertor3::GetTransformType UINT32  n  )  [virtual]
 

gets a transform type from an trfd chunk

Author:
Ben_Summers (Xara Group Ltd) <camelotdev@xara.com>
Date:
03/04/95
Parameters:
transform number [INPUTS]
Returns:
a transform type
See also:
CDRFilter

Implements CDRTransformConvertor.

Definition at line 4087 of file cdrfiltr.cpp.

04088 {
04089     if(n >= CDRDATA_WORD(Trans->NTransforms))
04090         return CDRTRANSFORMTYPE_UNKNOWN;
04091 
04092     cdrfTransformEntryV3 *En = (cdrfTransformEntryV3 *)(Trans + 1);
04093 
04094     switch(CDRDATA_WORD(En[n].Type))
04095     {
04096         case cdrfTRANSFORMTYPE_MATRIX_V3:
04097             return CDRTRANSFORMTYPE_MATRIX;
04098             break;
04099         
04100         case cdrfTRANSFORMTYPE_PERSPECTIVE_V3:
04101             return CDRTRANSFORMTYPE_PERSPECTIVE;
04102             break;
04103         
04104         case cdrfTRANSFORMTYPE_ENVELOPE_V3:
04105             return CDRTRANSFORMTYPE_ENVELOPE;
04106             break;
04107         
04108 #ifdef CDR_DOEXTRUDE
04109         case cdrfTRANSFORMTYPE_EXTRUDE_V3:
04110             return CDRTRANSFORMTYPE_EXTRUDE;
04111             break;
04112 #endif
04113 
04114         default:
04115             TRACEUSER( "Ben", _T("[] Unknown v3 transform type %x\n"), En[n].Type);
04116             break;
04117     }
04118 
04119     return CDRTRANSFORMTYPE_UNKNOWN;
04120 }

BOOL CDRTransformConvertor3::Init ADDR  Data,
INT32  Size
[inline, virtual]
 

Implements CDRTransformConvertor.

Definition at line 1053 of file cdrfiltr.h.

01053 {Trans = (cdrfTransformV3 *)Data; return TRUE;};


Member Data Documentation

cdrfTransformV3* CDRTransformConvertor3::Trans [private]
 

Definition at line 1061 of file cdrfiltr.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:52:21 2007 for Camelot by  doxygen 1.4.4