CDRTransformConvertor4 Class Reference

#include <cdrfiltr.h>

Inheritance diagram for CDRTransformConvertor4:

CDRTransformConvertor List of all members.

Public Member Functions

BOOL Init (ADDR Data, INT32 Size)
 intialises this convertor
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)
 converts a envelope from position N
BOOL GetExtrude (cdrExtrudeInfo *Info, UINT32 n)
 converts a matrix from position N

Private Member Functions

 CC_DECLARE_MEMDUMP (CDRTransformConvertor4)

Private Attributes

cdrfTransformV4Trans
ADDR List
INT32 ListSize

Detailed Description

Definition at line 1030 of file cdrfiltr.h.


Member Function Documentation

CDRTransformConvertor4::CC_DECLARE_MEMDUMP CDRTransformConvertor4   )  [private]
 

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

converts a envelope from position N

Author:
Ben_Summers (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/05/95
Parameters:
pointer to a pointer to a nodepath to fill in, a docrect for the orignial BBox [INPUTS] and the position
Returns:
a transform type
See also:
CDRFilter

Implements CDRTransformConvertor.

Definition at line 4491 of file cdrfiltr.cpp.

04492 {
04493     if(n >= CDRDATA_WORD(Trans->NTransforms))
04494         return FALSE;
04495 
04496     cdrfTransformHeader *Hdr;
04497     WORD *Offsets = (WORD *)(((ADDR)Trans) + Trans->OffsetsStart);
04498 
04499     // run through to this entry counting the number of entries before this one
04500     INT32 EnvelopesSoFar = 0;
04501     for(UINT32 l = 0; l <= n; l++)
04502     {
04503         Hdr = (cdrfTransformHeader *)(cdrfTransformHeader *)(((ADDR)Trans) + Offsets[l]);
04504 
04505         // increment the number of envelopes so far...
04506         if(CDRDATA_WORD(Hdr->Type) == cdrfTRANSFORMTYPE_ENVELOPE)
04507             EnvelopesSoFar++;
04508     }
04509 
04510     ERROR2IF(EnvelopesSoFar <= 0, FALSE, "No envelopes found!");
04511     
04512     // OK, convert this entry...
04513     if(!ConvertEnvelopeBBox((ADDR)Hdr, OriginalBBox, Corners))
04514         return FALSE;
04515 
04516     if(!ConvertEnvelopePath(List, ListSize, EnvelopesSoFar - 1, P))
04517         return FALSE;
04518 
04519     return TRUE;
04520 }

BOOL CDRTransformConvertor4::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 4214 of file cdrfiltr.cpp.

04215 {
04216     if(n >= Trans->NTransforms)
04217         return FALSE;
04218 
04219     WORD *Offsets = (WORD *)(((ADDR)Trans) + Trans->OffsetsStart);
04220     cdrfTransformHeader *Hdr = (cdrfTransformHeader *)(((ADDR)Trans) + Offsets[n]);
04221 
04222     return ConvertExtrudeInfo((cdrfTransformExtrude *)Hdr, Info);
04223 }

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

converts a matrix from position N

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

Implements CDRTransformConvertor.

Definition at line 4044 of file cdrfiltr.cpp.

04045 {
04046     if(n >= Trans->NTransforms)
04047         return FALSE;
04048 
04049     WORD *Offsets = (WORD *)(((ADDR)Trans) + Trans->OffsetsStart);
04050     cdrfTransformHeader *Hdr = (cdrfTransformHeader *)(((ADDR)Trans) + Offsets[n]);
04051 
04052     ERROR3IF(Hdr->Type != cdrfTRANSFORMTYPE_MATRIX, "GetMatrix called for a non matrix trfd entry");
04053 
04054     // unsigned word pointer
04055     WORD *TDataUS = (WORD *)(Hdr + 1);
04056     // signed word pointer
04057     SWORD *TDataS = (SWORD *)(Hdr + 1);
04058     // signed dword pointer
04059     SDWORD *TDDataS = (SDWORD *)(Hdr + 1);
04060 
04061     // convert the matrix - an interesting mix of 16.16 fixed point values and a
04062     // signed double word translation vector
04063     M->a = (FLOAT8)CDRDATA_SWORD(TDataS[1]) + ((FLOAT8)CDRDATA_WORD(TDataUS[0]) / 0xffff);
04064     M->b = (FLOAT8)CDRDATA_SWORD(TDataS[3]) + ((FLOAT8)CDRDATA_WORD(TDataUS[2]) / 0xffff);
04065     M->c = (FLOAT8)(CDRDATA_DSWORD(TDDataS[2]) * CDRCOORDS_TO_MILLIPOINTS);
04066     M->d = (FLOAT8)CDRDATA_SWORD(TDataS[7]) + ((FLOAT8)CDRDATA_WORD(TDataUS[6]) / 0xffff);
04067     M->e = (FLOAT8)CDRDATA_SWORD(TDataS[9]) + ((FLOAT8)CDRDATA_WORD(TDataUS[8]) / 0xffff);
04068     M->f = (FLOAT8)(CDRDATA_DSWORD(TDDataS[5]) * CDRCOORDS_TO_MILLIPOINTS);
04069 
04070     return TRUE;
04071 }

UINT32 CDRTransformConvertor4::GetNTransforms  )  [inline, virtual]
 

Implements CDRTransformConvertor.

Definition at line 1036 of file cdrfiltr.h.

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

BOOL CDRTransformConvertor4::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 4015 of file cdrfiltr.cpp.

04016 {
04017     if(n >= Trans->NTransforms)
04018         return FALSE;
04019 
04020     WORD *Offsets = (WORD *)(((ADDR)Trans) + Trans->OffsetsStart);
04021     cdrfTransformHeader *Hdr = (cdrfTransformHeader *)(((ADDR)Trans) + Offsets[n]);
04022 
04023     ERROR3IF(Hdr->Type != cdrfTRANSFORMTYPE_PERSPECTIVE, "GetPerspective called for a non matrix trfd entry");
04024 
04025     cdrfPerspectiveEntry *Per = (cdrfPerspectiveEntry *)Hdr;
04026 
04027     return ConvertPerspective(P, &  Per->Trans);
04028 }

CDRTransformType CDRTransformConvertor4::GetTransformType UINT32  n  )  [virtual]
 

gets a transform type from an trfd chunk

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

Implements CDRTransformConvertor.

Definition at line 3844 of file cdrfiltr.cpp.

03845 {
03846     if(n >= CDRDATA_WORD(Trans->NTransforms))
03847         return CDRTRANSFORMTYPE_UNKNOWN;
03848 
03849     WORD *Offsets = (WORD *)(((ADDR)Trans) + CDRDATA_WORD(Trans->OffsetsStart));
03850     cdrfTransformHeader *Hdr = (cdrfTransformHeader *)(((ADDR)Trans) + CDRDATA_WORD(Offsets[n]));
03851 
03852     switch(CDRDATA_WORD(Hdr->Type))
03853     {
03854         case cdrfTRANSFORMTYPE_MATRIX:
03855             return CDRTRANSFORMTYPE_MATRIX;
03856             break;
03857         
03858         case cdrfTRANSFORMTYPE_PERSPECTIVE:
03859             return CDRTRANSFORMTYPE_PERSPECTIVE;
03860             break;
03861         
03862 #ifdef CDR_DOEXTRUDE
03863         case cdrfTRANSFORMTYPE_EXTRUDE:
03864             return CDRTRANSFORMTYPE_EXTRUDE;
03865             break;
03866 #endif
03867 
03868         case cdrfTRANSFORMTYPE_ENVELOPE:
03869             return CDRTRANSFORMTYPE_ENVELOPE;
03870             break;
03871                     
03872         default:
03873             TRACEUSER( "Ben", _T("[] Unknown v4 transform type\n"));
03874             break;
03875     }
03876 
03877     return CDRTRANSFORMTYPE_UNKNOWN;
03878 }

BOOL CDRTransformConvertor4::Init ADDR  Data,
INT32  Size
[virtual]
 

intialises this convertor

Author:
Ben_Summers (Xara Group Ltd) <camelotdev@xara.com>
Date:
06/06/95
Parameters:
pointer to trfl list and it's size [INPUTS]
Returns:
whether the contents are OK
See also:
CDRFilter

Implements CDRTransformConvertor.

Definition at line 3766 of file cdrfiltr.cpp.

03767 {
03768     List = Data;
03769     ListSize = Size;
03770  
03771     ADDR TransformData;
03772 
03773     if(!RIFFFile::FindChunkWithinListContents(List, ListSize, cdrT_trfd, 0, &TransformData, 0))
03774         return 0;
03775 
03776     Trans = (cdrfTransformV4 *)TransformData;
03777  
03778     return TRUE;
03779  }


Member Data Documentation

ADDR CDRTransformConvertor4::List [private]
 

Definition at line 1044 of file cdrfiltr.h.

INT32 CDRTransformConvertor4::ListSize [private]
 

Definition at line 1045 of file cdrfiltr.h.

cdrfTransformV4* CDRTransformConvertor4::Trans [private]
 

Definition at line 1043 of file cdrfiltr.h.


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