NativeRenderRegion Class Reference

The render region class for the native file save. More...

#include <nativeps.h>

Inheritance diagram for NativeRenderRegion:

CamelotEPSRenderRegion ArtWorksEPSRenderRegion EPSRenderRegion VectorFileRenderRegion RenderRegion ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 NativeRenderRegion (DocRect ClipRect, Matrix ConvertMatrix, FIXED16 ViewScale)
 Constructor for the Native Save/Load filter render region.
virtual void ConditionalSuicide (void)
 Causes the object to commit suicide. This is to get around using a few if IS_A calls elsewhere in Camelot.
void GetRenderRegionCaps (RRCaps *pCaps)
 This function allows render regions to admit to what they can and can not render. This allows other areas of the program to come in and help render regions out in some situations, if they are unable to render everything. eg. an OSRenderRegion can not render transparancy.
void GetValidPathAttributes ()
 See CamelotEPSRenderRegion::GetValidPathAttributes. This version checks and handles special native features.
void GetValidTransparencyAttributes ()
virtual void GetValidTextAttributes ()
 Output Native file compatible text attribute tokens.
virtual BOOL RenderChar (WCHAR ch, Matrix *pMatrix)
virtual BOOL WantsGrids ()
 This function is designed to help with the rendering of grids, as they are not always wanted (eg xara eps). If your class of render region does not want grids to appear, then overide this function and get it to return FALSE. The default behaviour is to return TRUE, which will allow grids to render if they want to.
virtual void OutputFillColour ()
 Used to output fill colours (in any colour model). Since the CorelXara pre-1.5 format can only cope with CMYK colours (not RGB ones), we export the colour as CMYK, regardless of the colour model used.
virtual void OutputStrokeColour ()
 Used to output stroke colours (in any colour model). Since the CorelXara pre-1.5 format can only cope with CMYK colours (not RGB ones), we export the colour in CMYK format, regardless of the colour model used..
virtual BOOL OutputGradFillColours (DocColour *StartCol, DocColour *EndCol, ColourContext *pContext)
 Used to output gradient fill colours, using the CMYK clour model. This is necessary, as the standard EPS export uses RGB colours for gradient fills, which pre-1.5 CorelXara doesn't understand.

Protected Member Functions

virtual BOOL WriteProlog (KernelDC *)
 Over-ride the routines defined by CamelotEPSRenderRegion - we don't need any PostScript prolog in ART files.
virtual BOOL WriteSetup (KernelDC *)
 Over-ride the routines defined by CamelotEPSRenderRegion - we don't need any PostScript setup in ART files.
virtual BOOL WriteFileVersion (KernelDC *)
 This allows the filter to save out a comment line giving file version information. In this Native format version we actually write out the current file version information.
virtual BOOL WriteCompressionState (KernelDC *)
 In this native file saving class version we save out the compression status of this file with other useful compression type information. We also start compressing the data from this point onwards.
virtual BOOL WriteEndCompressionState (KernelDC *)
 This is called once everything has been output and before we fix the EPS header. In this baseclass version we do nothing as compression would be a very bad thing.

Protected Attributes

BOOL CompressionInitedOk

Detailed Description

The render region class for the native file save.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/12/94

Definition at line 217 of file nativeps.h.


Constructor & Destructor Documentation

NativeRenderRegion::NativeRenderRegion DocRect  ClipRect,
Matrix  ConvertMatrix,
FIXED16  ViewScale
 

Constructor for the Native Save/Load filter render region.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/12/94
Parameters:
ClipRect - The rectangle to use as the clip rect for the rendering [INPUTS] ConvertMatrix - the rendering matrix ViewScale - the scale to render at

Definition at line 1704 of file nativeps.cpp.

01704                                                                                                 :
01705                     CamelotEPSRenderRegion(ClipRect, ConvertMatrix, ViewScale)
01706 {
01707     CreatorString = _T("Xara Studio (Native) ") CAMELOT_VERSION_STRING;
01708 
01709     // Flag that we have not started up the compressor ok by default.
01710     CompressionInitedOk = FALSE;
01711 }


Member Function Documentation

void NativeRenderRegion::ConditionalSuicide void   )  [virtual]
 

Causes the object to commit suicide. This is to get around using a few if IS_A calls elsewhere in Camelot.

Author:
Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/2/00
Parameters:
- [INPUTS]
Returns:
-

Reimplemented from CamelotEPSRenderRegion.

Definition at line 1726 of file nativeps.cpp.

01727 {
01728     // Delete the object.
01729     delete this;
01730 }

void NativeRenderRegion::GetRenderRegionCaps RRCaps pCaps  )  [virtual]
 

This function allows render regions to admit to what they can and can not render. This allows other areas of the program to come in and help render regions out in some situations, if they are unable to render everything. eg. an OSRenderRegion can not render transparancy.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/4/95
Parameters:
pCaps - The details about what types of thing this render region can render [OUTPUTS]

Reimplemented from CamelotEPSRenderRegion.

Definition at line 1746 of file nativeps.cpp.

01747 {
01748     // We can do everything mate cos we're fabby.
01749     pCaps->CanDoAll();
01750 }

void NativeRenderRegion::GetValidPathAttributes  )  [virtual]
 

See CamelotEPSRenderRegion::GetValidPathAttributes. This version checks and handles special native features.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/5/95
See also:
EPSRenderRegion::GetValidPathAttributes

Reimplemented from CamelotEPSRenderRegion.

Definition at line 1810 of file nativeps.cpp.

01811 {
01812     KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
01813 
01814     // Find out what this render region can do.
01815     RRCaps Caps;
01816     GetRenderRegionCaps(&Caps);
01817 
01818     if (SetLastOutputAttribute(ATTR_STARTARROW))
01819     {
01820         // Start arrow head
01821         StartArrowAttribute *pArrow =           
01822             (StartArrowAttribute *) CurrentAttrs[ATTR_STARTARROW].pAttr;
01823 
01824         TRACEUSER( "Will", _T("Outputing Start Arrow, ID=%d\n"),pArrow->StartArrow.GetArrowID());
01825 
01826         if (pArrow->StartArrow.GetArrowID() >= 0)
01827         {
01828             pDC->OutputValue((INT32)pArrow->StartArrow.GetArrowID());
01829             pDC->OutputReal((pArrow->StartArrow.GetArrowWidth()).MakeDouble());
01830             pDC->OutputReal((pArrow->StartArrow.GetArrowHeight()).MakeDouble());
01831 
01832             pDC->OutputToken(_T("csah"));
01833             pDC->OutputNewLine();
01834         }
01835     }
01836 
01837     if (SetLastOutputAttribute(ATTR_ENDARROW))
01838     {
01839         // End arrow head
01840         EndArrowAttribute *pArrow =             
01841             (EndArrowAttribute *) CurrentAttrs[ATTR_ENDARROW].pAttr;
01842 
01843         TRACEUSER( "Will", _T("Outputing End Arrow, ID=%d\n"),pArrow->EndArrow.GetArrowID());
01844 
01845         if (pArrow->EndArrow.GetArrowID() >= 0)
01846         {
01847             pDC->OutputValue((INT32)pArrow->EndArrow.GetArrowID());
01848             pDC->OutputReal((pArrow->EndArrow.GetArrowWidth()).MakeDouble());
01849             pDC->OutputReal((pArrow->EndArrow.GetArrowHeight()).MakeDouble());
01850 
01851             pDC->OutputToken(_T("ceah"));
01852             pDC->OutputNewLine();
01853         }
01854     }
01855 
01856     if (SetLastOutputAttribute(ATTR_DASHPATTERN))
01857     {
01858         // Get dash pattern
01859         DashPatternAttribute *pDash =           
01860             (DashPatternAttribute *) CurrentAttrs[ATTR_DASHPATTERN].pAttr;
01861 
01862         TRACEUSER( "Will", _T("Outputing Dash Pattern, ID=%d\n"),pDash->DashPattern.GetDashID());
01863 
01864         pDC->OutputValue((INT32)pDash->DashPattern.GetDashID());
01865         pDC->OutputToken(_T("cdp"));
01866         pDC->OutputNewLine();
01867     }
01868 
01869     // Now do transparency fills
01870     GetValidTransparencyAttributes();
01871 
01872     // Handle usual pens/brushes
01873     CamelotEPSRenderRegion::GetValidPathAttributes();
01874 }

void NativeRenderRegion::GetValidTextAttributes  )  [virtual]
 

Output Native file compatible text attribute tokens.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/05/95

Reimplemented from EPSRenderRegion.

Definition at line 2148 of file nativeps.cpp.

02149 {
02150     KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
02151 
02152     /* In native format documents we output 
02153         fontname            = <fontname> ctf
02154         fontsize            = <mp size> ctp
02155         bold                = <0|1> ctb
02156         italic              = <0|1> cti
02157         sub/superscript     = <abs mp rise> <abs mp pointsize> cts
02158         linespacing         = <absolute linespace> <0> ctls
02159                               <proportional linespace> <1> ctls
02160         
02161         all other styles are output by the baseclass
02162     */
02163 
02164     if (SetLastOutputAttribute(ATTR_TXTFONTTYPEFACE))
02165     {
02166         TxtFontTypefaceAttribute* pFontAttr = (TxtFontTypefaceAttribute*)CurrentAttrs[ATTR_TXTFONTTYPEFACE].pAttr;
02167         if (pFontAttr)
02168         {
02169             String_64 OutputFont;
02170             FontClass Class;
02171 
02172             CachedFontItem* pItem = FONTMANAGER->GetCachedFont(pFontAttr->HTypeface);
02173             ERROR3IF(pItem==NULL,"Cannot find the cached font in GetValidTextAttributes");
02174             OutputFont = *(pItem->GetFontName());
02175             Class = pItem->GetFontClass();
02176 
02177             // If we are not outputting true type fonts we need to output an
02178             // extension token to say, the next ctf on the input stream should be
02179             // treated as a FontClass type of font. This allows us to load back
02180             // ATM fonts which have the same name as true type fonts.
02181             if (Class!=FC_TRUETYPE)
02182             {
02183                 pDC->OutputValue((INT32)EOTAG_FONTTYPE);
02184                 pDC->OutputToken(_T("cso"));
02185                 pDC->OutputValue((INT32)Class);
02186                 pDC->OutputToken(_T("cftf"));
02187                 pDC->OutputToken(_T("ceo"));
02188                 pDC->OutputNewLine();
02189             }
02190 
02191             /*BOOL ok =*/ FONTMANAGER->GetFontName(pFontAttr->HTypeface, OutputFont);
02192             OutputFont.SwapChar(' ','-');
02193 
02194             pDC->OutputToken((TCHAR *)OutputFont);
02195             pDC->OutputToken(_T("ctf"));
02196             pDC->OutputNewLine();
02197 
02198             if ((pFontAttr->IsBold) || (pFontAttr->IsItalic))
02199             {
02200                 // font flags a bold or italic substyle.
02201 
02202                 pDC->OutputValue((INT32)EOTAG_FONTFLAGS);
02203                 pDC->OutputToken(_T("cso"));
02204                 pDC->OutputNewLine();
02205                 pDC->OutputToken(_T("cfft"));
02206                 pDC->OutputNewLine();
02207                 pDC->OutputToken(_T("ceo"));
02208                 pDC->OutputNewLine();
02209 
02210                 pDC->OutputValue((INT32) pFontAttr->IsBold);
02211                 pDC->OutputToken(_T("ctb"));
02212                 pDC->OutputNewLine();
02213 
02214                 pDC->OutputValue((INT32) pFontAttr->IsItalic);
02215                 pDC->OutputToken(_T("cti"));
02216                 pDC->OutputNewLine();
02217             }
02218         }
02219     }
02220 
02221     if (SetLastOutputAttribute(ATTR_TXTFONTSIZE))
02222     {
02223         // Output the fontsize next
02224         pDC->OutputValue(RR_TXTFONTSIZE());
02225         pDC->OutputToken(_T("ctp"));
02226         pDC->OutputNewLine();
02227     }        
02228 
02229     if (SetLastOutputAttribute(ATTR_TXTBOLD))
02230     {
02231         // read the bold attribute value explicitly (dont use RR_TXTBOLD)
02232         BOOL Bold = ( (TxtBoldAttribute*)(CurrentAttrs[ATTR_TXTBOLD].pAttr) )->BoldOn; 
02233         pDC->OutputValue((INT32)Bold);
02234         pDC->OutputToken(_T("ctb"));
02235         pDC->OutputNewLine();
02236     }        
02237 
02238     if (SetLastOutputAttribute(ATTR_TXTITALIC))
02239     {
02240         // read the italic attribute value explicitly (dont use RR_TXTITALIC)
02241         BOOL Italic =  ( (TxtItalicAttribute*)(CurrentAttrs[ATTR_TXTITALIC].pAttr) )->ItalicOn;
02242         pDC->OutputValue((INT32)Italic);
02243         pDC->OutputToken(_T("cti"));
02244         pDC->OutputNewLine();
02245     }       
02246 
02247     if (SetLastOutputAttribute(ATTR_TXTSCRIPT))
02248     {
02249         TxtScriptAttribute* pScript = RR_TXTSCRIPT();
02250 
02251         double FontSize = (double)RR_TXTFONTSIZE();         // in millipoints
02252         double offset = (pScript->Offset).MakeDouble();
02253         double size = (pScript->Size).MakeDouble();
02254 
02255         MILLIPOINT rise = (MILLIPOINT)(FontSize*offset);    // rise in millipoints
02256         MILLIPOINT ptsize = (MILLIPOINT)(FontSize*size);    // pointsize in millipoints
02257         pDC->OutputValue(rise);
02258         pDC->OutputValue(ptsize);
02259         pDC->OutputToken(_T("cts"));
02260         pDC->OutputNewLine();
02261     }
02262 
02263     // output proportional or none proportional line spacing
02264     if (SetLastOutputAttribute(ATTR_TXTLINESPACE))
02265     {
02266         TxtLineSpaceAttribute* pLineSpace = (TxtLineSpaceAttribute*)(CurrentAttrs[ATTR_TXTLINESPACE].pAttr);
02267 
02268         // There are some rules for reading the linespacing value which I shall divulge
02269         // If IsARatio is true then use the proportinal linespacing value.
02270         // else use the absolute linespacing
02271         // However if the absolute linespacing is zero, then we MUST use the proportional
02272         // linespacing. Eeek!
02273         // ie it is an error if (absolute==0 && !IsARatio()) which we will check for here
02274 
02275         if (!pLineSpace->IsARatio())
02276         {
02277             INT32 LineSpace = pLineSpace->Value;
02278             ERROR3IF(LineSpace==0, "Absolute line spacing is zero yet IsARatio() is FALSE, in GetValidTextAttributes()");
02279             pDC->OutputValue(LineSpace);
02280             pDC->OutputValue((INT32)0);
02281         }
02282         else
02283         {
02284             double Ratio = (pLineSpace->Ratio).MakeDouble();
02285             pDC->OutputFloat(Ratio,4);
02286             pDC->OutputValue((INT32)1);      
02287         }
02288 
02289         pDC->OutputToken(_T("ctls"));
02290         pDC->OutputNewLine();
02291     }
02292 
02293 
02294     // Handle all other types
02295     EPSRenderRegion::GetValidTextAttributes();
02296 }

void NativeRenderRegion::GetValidTransparencyAttributes  ) 
 

Definition at line 1877 of file nativeps.cpp.

01878 {
01879     // Find out what this render region can do.
01880     RRCaps Caps;
01881     GetRenderRegionCaps(&Caps);
01882 
01883     // Can we do transparency?
01884     if (!Caps.Transparency)
01885         // No - so don't do anything
01886         return;
01887 
01888     KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
01889 
01890     if (SetLastOutputAttribute(ATTR_STROKETRANSP))
01891     {
01892         // Now do the line transparency
01893         StrokeTranspAttribute *pAttr = 
01894             (StrokeTranspAttribute *) CurrentAttrs[ATTR_STROKETRANSP].pAttr;
01895 
01896         UINT32 Transp = *pAttr->GetStartTransp();
01897         UINT32 TranspType = pAttr->GetTranspType();
01898         
01899         TRACEUSER( "Will", _T("Outputing Line transp, Val=%d, Type=%d\n"),Transp, TranspType);
01900 
01901         // Output transparency level
01902         pDC->OutputValue((UINT32) Transp);
01903         // Output transparency type...
01904         pDC->OutputValue((UINT32) TranspType);
01905 
01906         pDC->OutputToken(_T("cst"));
01907         pDC->OutputNewLine();
01908     }
01909 
01910     if (SetLastOutputAttribute(ATTR_TRANSPFILLGEOMETRY))
01911     {
01912         // Now do the transparent fill geometry
01913         TranspFillAttribute *pFillAttr = 
01914             (TranspFillAttribute *) CurrentAttrs[ATTR_TRANSPFILLGEOMETRY].pAttr;
01915 
01916         // Get the transparency information
01917         UINT32 *StartTransp,
01918              *EndTransp,
01919              TranspType,
01920              FillType = TRANSPFILL_NONE;
01921 
01922         TranspType = pFillAttr->GetTranspType();        //pPaintMode->m_PaintingMode;
01923         ENSURE((TranspType >= 1) && (TranspType <= 3), "Bad transparency type!");       // Deliberately restrictive?
01924 
01925         StartTransp = pFillAttr->GetStartTransp();
01926         ENSURE((StartTransp == NULL) || ((*StartTransp >= 0) && (*StartTransp <= 255)), 
01927                "Bad start transparency level!");
01928 
01929         // Get the correct brush - may be a grad fill.
01930         if (pFillAttr->IsKindOf(CC_RUNTIME_CLASS(FlatTranspFillAttribute)))
01931         {
01932             // Check special case for 'no transparency' (0% transparent and type 1)
01933             if (((*StartTransp) != 0) || (TranspType != TT_Mix))
01934                 FillType = TRANSPFILL_FLAT;
01935         }
01936         else if (pFillAttr->IsKindOf(CC_RUNTIME_CLASS(GradTranspFillAttribute)) && 
01937                  !pFillAttr->IsKindOf(CC_RUNTIME_CLASS(BitmapTranspFillAttribute)) )
01938         {
01939             // Output the start and end points of the grad fill
01940             DocCoord *Point;
01941             Point = pFillAttr->GetStartPoint();
01942             pDC->OutputCoord(*Point);
01943             Point = pFillAttr->GetEndPoint();
01944             pDC->OutputCoord(*Point);
01945 
01946             // Output the fill type
01947             if (pFillAttr->IsKindOf(CC_RUNTIME_CLASS(LinearTranspFillAttribute)))
01948             {
01949                 DocCoord* Start = pFillAttr->GetStartPoint();
01950                 DocCoord* End   = pFillAttr->GetEndPoint();
01951                 DocCoord* End2  = pFillAttr->GetEndPoint2();
01952 
01953                 if (AreLinesPerpendicular(Start, End, End2))
01954                 {
01955                     TRACEUSER( "Will", _T("Exporting Simple Transp Linear Fill\n"));
01956                     FillType = TRANSPFILL_LINEAR;
01957                 }
01958                 else
01959                 {
01960                     TRACEUSER( "Will", _T("Exporting New Style Transp Linear Fill\n"));
01961                     pDC->OutputCoord(*pFillAttr->GetEndPoint2());
01962                     FillType = TRANSPFILL_NEWLINEAR;
01963                 }
01964             }
01965             else if (pFillAttr->IsKindOf(CC_RUNTIME_CLASS(RadialTranspFillAttribute)))
01966             {
01967                 // Is it circular or elliptical?
01968                 RadialTranspFillAttribute *pRadialFillAttr = 
01969                     (RadialTranspFillAttribute *) pFillAttr;
01970 
01971                 if (pRadialFillAttr->IsElliptical())
01972                 {
01973                     // Elliptical fill - output the second end point.
01974                     Point = pRadialFillAttr->GetEndPoint2();
01975                     pDC->OutputCoord(*Point);
01976                     FillType = TRANSPFILL_ELLIPTICAL;
01977                 }
01978                 else
01979                 {
01980                     // Circular fill
01981                     FillType = TRANSPFILL_CIRCULAR;
01982                 }
01983             }
01984             else if (pFillAttr->IsKindOf(CC_RUNTIME_CLASS(ConicalTranspFillAttribute)))
01985             {
01986                 FillType = TRANSPFILL_CONICAL;
01987             }
01988             else
01989             {
01990                 // Unknown fill type - fall back to basic attributes.
01991                 ERROR3("Unsupported grad fill encountered while exporting");
01992                 EPSRenderRegion::GetValidPathAttributes();
01993                 return;
01994             }
01995 
01996         }
01997         else if (pFillAttr->IsKindOf(CC_RUNTIME_CLASS(FractalTranspFillAttribute)) &&
01998                  Caps.BitmapFills)
01999         {
02000             // Fractal fill - output fractal fill command...
02001             FractalTranspFillAttribute *pFractalFill = (FractalTranspFillAttribute *) pFillAttr;
02002 
02003             // Save the coords of the fill mesh
02004             pDC->OutputCoord(pFractalFill->StartPoint);
02005             pDC->OutputCoord(pFractalFill->EndPoint);
02006             pDC->OutputCoord(pFractalFill->EndPoint2);
02007 
02008             // Save the fractal parameters out.
02009             pDC->OutputValue(pFractalFill->Seed);
02010             pDC->OutputReal(pFractalFill->Graininess.MakeDouble());
02011             pDC->OutputReal(pFractalFill->Gravity.MakeDouble());
02012             pDC->OutputReal(pFractalFill->Squash.MakeDouble());
02013 
02014             // And now the DPI of the fractal bitmap
02015             UINT32 DPI = pFractalFill->GetFractalDPI();
02016             pDC->OutputValue(DPI);
02017 
02018             // And now the 'tileable' flag
02019             pDC->OutputValue((INT32) (pFractalFill->GetTileable()));
02020 
02021             // Always Fractal type 1 at present
02022             pDC->OutputToken(_T("1"));
02023 
02024             TRACEUSER( "Will", _T("Exporting new fractal transp\n"));
02025             
02026             // This is a fractal fill
02027             FillType = TRANSPFILL_NEWFRACTAL;
02028         }
02029         else if (pFillAttr->IsKindOf(CC_RUNTIME_CLASS(NoiseTranspFillAttribute)))
02030         {
02031             FillType = TRANSPFILL_NONE;
02032         }
02033         else if (pFillAttr->IsKindOf(CC_RUNTIME_CLASS(BitmapTranspFillAttribute)) &&
02034                  Caps.BitmapFills)
02035         {
02036             // Texture fill - output texture fill command:
02037 //          BitmapFillAttribute *pBitmapFill = (BitmapFillAttribute *) pFillAttr;
02038 
02039             // Output the 3 fill points...
02040             DocCoord *Point;
02041             Point = pFillAttr->GetStartPoint();
02042             pDC->OutputCoord(*Point);
02043             Point = pFillAttr->GetEndPoint();
02044             pDC->OutputCoord(*Point);
02045             Point = pFillAttr->GetEndPoint2();
02046             pDC->OutputCoord(*Point);
02047 
02048             TRACEUSER( "Will", _T("Exporting new bitmap transp\n"));
02049 
02050             // This is a texture fill
02051             FillType = TRANSPFILL_NEWTEXTURE;
02052         }
02053         else
02054         {
02055             ERROR3("Illegal transparency fill type!");
02056         }
02057 
02058         // Output transparency levels...
02059         if (FillType != TRANSPFILL_NONE)
02060         {
02061             if ((FillType != TRANSPFILL_TEXTURE) && (FillType != TRANSPFILL_FRACTAL))
02062             {
02063                 // Output first transparency level
02064                 pDC->OutputValue((UINT32) (*StartTransp));
02065 
02066                 // Output second transparency level if there is one.
02067                 switch (FillType)
02068                 {
02069                     case TRANSPFILL_LINEAR:
02070                     case TRANSPFILL_ELLIPTICAL:
02071                     case TRANSPFILL_CIRCULAR:
02072                     case TRANSPFILL_CONICAL:
02073                     case TRANSPFILL_NEWLINEAR:
02074                     case TRANSPFILL_NEWTEXTURE:
02075                     case TRANSPFILL_NEWFRACTAL:
02076                         EndTransp = pFillAttr->GetEndTransp();
02077                         ENSURE((*EndTransp >= 0) && (*EndTransp <= 255), 
02078                                "Bad end transparency level!");
02079                         pDC->OutputValue((UINT32) (*EndTransp));
02080                         break;
02081 
02082                     default:
02083                         // This is a valid situation - no second transparency level.
02084                         break;
02085                 }
02086             }
02087 
02088             // Output transparency type...
02089             pDC->OutputValue((UINT32) TranspType);
02090         
02091         }
02092         
02093         // Output transparency fill type
02094         pDC->OutputValue((UINT32) FillType);
02095     
02096         // Output the transparent fill token
02097         pDC->OutputToken(_T("cxt"));
02098         pDC->OutputNewLine();
02099 
02100         // If this is a bitmap-based transprency fill, output the bitmap
02101         if ((FillType == TRANSPFILL_TEXTURE || FillType == TRANSPFILL_NEWTEXTURE) &&
02102              Caps.BitmapFills)
02103         {
02104             BitmapTranspFillAttribute *pBitmapFill = (BitmapTranspFillAttribute *) pFillAttr;
02105             ExportDC *pExportDC = (ExportDC *) pDC;
02106 
02107             if (pBitmapFill->GetBitmap())
02108                 pExportDC->GetParentFilter()->ExportBitmap(*pBitmapFill->GetBitmap());
02109         }
02110     }
02111 
02112     if (SetLastOutputAttribute(ATTR_TRANSPFILLMAPPING))
02113     {
02114         // Now do the chromatic fill mapping
02115         TranspFillMappingAttribute *pFillAttr = 
02116             (TranspFillMappingAttribute *) CurrentAttrs[ATTR_TRANSPFILLMAPPING].pAttr;
02117 
02118         // Get the correct mapping
02119         INT32 MappingType = pFillAttr->Repeat;
02120         ERROR3IF((MappingType < 1) || (MappingType > 3), "Illegal fill mapping value!");
02121         
02122         // Output fill mapping
02123         pDC->OutputValue((UINT32) MappingType);
02124 
02125         // Allow for future extension of fill mappings. 
02126         pDC->OutputToken(_T("0"));
02127 
02128         // Output the fill mapping token
02129         pDC->OutputToken(_T("cxmt"));
02130         pDC->OutputNewLine();
02131     }
02132 }

void NativeRenderRegion::OutputFillColour void   )  [virtual]
 

Used to output fill colours (in any colour model). Since the CorelXara pre-1.5 format can only cope with CMYK colours (not RGB ones), we export the colour as CMYK, regardless of the colour model used.

Author:
Chris_Gallimore (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/01/01

Reimplemented from CamelotEPSRenderRegion.

Definition at line 2539 of file nativeps.cpp.

02540 {
02541     OutputFillCMYKColour ();
02542 }

BOOL NativeRenderRegion::OutputGradFillColours DocColour StartCol,
DocColour EndCol,
ColourContext pContext
[virtual]
 

Used to output gradient fill colours, using the CMYK clour model. This is necessary, as the standard EPS export uses RGB colours for gradient fills, which pre-1.5 CorelXara doesn't understand.

Author:
Chris_Gallimore (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/01/01
Parameters:
See CamelotEPSRenderRegion (they're identical) [INPUTS]

Reimplemented from CamelotEPSRenderRegion.

Definition at line 2576 of file nativeps.cpp.

02577 {
02578     KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
02579     bool outputNames = FALSE;
02580 
02581     if ((StartCol->FindParentIndexedColour() == NULL) &&
02582         (EndCol->FindParentIndexedColour() == NULL))
02583     {
02584         // Neither colour is named...use unnamed colour syntax.
02585         outputNames = FALSE;
02586     }
02587     else
02588     {
02589         // One or two of the colours are named, so use the named colour syntax.
02590         outputNames = TRUE;
02591     }
02592 
02593     // Start writing stuff to the EPS file.
02594     PColourCMYK CMYK;
02595 
02596     // Write out the start colour
02597     StartCol->GetCMYKValue (pContext, &CMYK);
02598     pDC->OutputColour (&CMYK);
02599 
02600     if (outputNames)
02601     {
02602         // Write out the name
02603         pDC->OutputColourName (StartCol);
02604 
02605         // Write out the tint value. This isn't actually used at the moment, but is left 
02606         //  for possible future expansion
02607         pDC->OutputValue ((INT32)0);
02608     }
02609 
02610     // And the End colour.
02611     EndCol->GetCMYKValue (pContext, &CMYK);
02612     pDC->OutputColour (&CMYK);
02613 
02614     if (outputNames)
02615     {
02616         // Write out the name
02617         pDC->OutputColourName (EndCol);
02618 
02619         // Write out the tint value. This isn't actually used at the moment, but is left 
02620         //  for possible future expansion
02621         pDC->OutputValue ((INT32)0);
02622     }
02623 
02624     // Return TRUE for no names used, FALSE for names used.
02625     return (!outputNames);
02626 }

void NativeRenderRegion::OutputStrokeColour  )  [virtual]
 

Used to output stroke colours (in any colour model). Since the CorelXara pre-1.5 format can only cope with CMYK colours (not RGB ones), we export the colour in CMYK format, regardless of the colour model used..

Author:
Chris_Gallimore (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/01/01

Reimplemented from CamelotEPSRenderRegion.

Definition at line 2557 of file nativeps.cpp.

02558 {
02559     OutputStrokeCMYKColour ();
02560 }

BOOL NativeRenderRegion::RenderChar WCHAR  ch,
Matrix pMatrix
[virtual]
 

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/05/95
Parameters:
ch - unicode value of TCHAR [INPUTS] pMatrix - matrix specifying transforms to place TCHAR correctly in document
Returns:
FALSE if fails

Reimplemented from CamelotEPSRenderRegion.

Definition at line 2312 of file nativeps.cpp.

02313 {
02314     // If we are not drawing complex shapes and this shape is, then return
02315     if ((!RenderComplexShapes) && (TestForComplexShape(&Caps)))
02316         return TRUE;
02317 
02318     ERROR2IF(   this==NULL,FALSE,"RenderRegion::RenderChar() - this==NULL");
02319     ERROR2IF(pMatrix==NULL,FALSE,"RenderRegion::RenderChar() - pMatrix==NULL");
02320 
02321 #if EXPORT_TEXT
02322     // Check for changed attributes
02323     GetValidPathAttributes();
02324     GetValidTextAttributes();
02325 
02326     KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
02327 
02328     INT32 CharOut = (INT32)ch;
02329     INT32 NumCodes = 1;
02330     pDC->OutputValue(CharOut);
02331     pDC->OutputValue(NumCodes);
02332     pDC->OutputToken(_T("ctx"));
02333     pDC->OutputNewLine();
02334 
02335 #else
02336     // just do what RenderRegion::RenderChar() would do!
02337 
02338     // create the TCHAR's path
02339     Path* pCharPath=CreateCharPath(ch,pMatrix);
02340     if (pCharPath==NULL)
02341         return FALSE;
02342 
02343     // draw path using current attibutes in render region
02344     if (pCharPath->GetNumCoords()!=0)
02345         DrawPath(pCharPath);
02346 
02347     // clean up
02348     delete pCharPath;
02349 #endif
02350 
02351     return TRUE;
02352 }

BOOL NativeRenderRegion::WantsGrids  )  [virtual]
 

This function is designed to help with the rendering of grids, as they are not always wanted (eg xara eps). If your class of render region does not want grids to appear, then overide this function and get it to return FALSE. The default behaviour is to return TRUE, which will allow grids to render if they want to.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/12/95
Returns:
TRUE

Reimplemented from EPSRenderRegion.

Definition at line 2521 of file nativeps.cpp.

02522 {
02523     return TRUE;
02524 }

BOOL NativeRenderRegion::WriteCompressionState KernelDC pDC  )  [protected, virtual]
 

In this native file saving class version we save out the compression status of this file with other useful compression type information. We also start compressing the data from this point onwards.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/05/95
Parameters:
pDC - the device context to output to. [INPUTS]
- [OUTPUTS]
Returns:
TRUE if ok; FALSE if error (e.g. file/disk error or printer driver error)
See also:
EPSRenderRegion::WriteSetup

Reimplemented from EPSRenderRegion.

Definition at line 2401 of file nativeps.cpp.

02402 {
02403 TRACEUSER( "Neville", _T("WriteCompressionState\n"));
02404 
02405     // If the preference is set then compress the file, otherwise do nothing
02406     if (CamelotNativeEPSFilter::GetNativeCompression())
02407     {
02408         // Get a pointer to the CCDiskFile object
02409         EPSExportDC *pEPSDC = (EPSExportDC *) pDC;
02410         if (pEPSDC == NULL || ExportFile == NULL)
02411             return FALSE;
02412 
02413         // First, see if we have enough memory to start up the compression system
02414         BOOL Ok = pEPSDC->ExportFile->InitCompression();
02415         // If this fails then don't try anything
02416         if (!Ok)
02417         {
02418             // Flag that we have not started up the compressor ok.
02419             // Do not try and save out the end compression tokens.
02420             CompressionInitedOk = FALSE;
02421 
02422             return FALSE;
02423         }
02424 
02425         // Flag that we have started up the compressor ok.
02426         // We can write out the end compression bits
02427         CompressionInitedOk = TRUE;
02428 
02429         // Could require some compression here...
02430         pDC->OutputToken(_T("%%Compression: "));
02431         // The compression type that we are using.
02432         pDC->OutputToken(_T("0 "));
02433         pDC->OutputNewLine();
02434         // Output an extra line to sync to 
02435         pDC->OutputToken(_T("%%Compression info:"));
02436 
02437         // Write a very simple .gz header:
02438         // Just output the two magic numbers plus a status word plus a flags word
02439         // We must output text rather than numbers and must never output LF or CR in the
02440         // middle as this will screw the lexer
02441         double StreamVersion = GZipFile::GetStreamVersionNo();
02442         TCHAR buf[300];
02443         camSprintf(buf, _T(" %.2fD"), StreamVersion);   // version in form 0.92 followed by D for deflated
02444         pDC->OutputToken(buf);
02445 TRACEUSER( "Neville", _T("WriteCompressionState wrote version %.2f\n"),StreamVersion); 
02446         pDC->OutputNewLine();
02447 
02448         // Now that we have written out compression token to say that this is a compressed file,
02449         // start up the file compression.
02450         // This will write out some useful data such as compressed file version
02451         pEPSDC->ExportFile->SetCompression(TRUE);
02452     }
02453 
02454     return TRUE;
02455 }

BOOL NativeRenderRegion::WriteEndCompressionState KernelDC pDC  )  [protected, virtual]
 

This is called once everything has been output and before we fix the EPS header. In this baseclass version we do nothing as compression would be a very bad thing.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/05/95
Parameters:
pDC - the device context to output to. [INPUTS]
- [OUTPUTS]
Returns:
TRUE if ok; FALSE if error (e.g. file/disk error or printer driver error)
See also:
EPSRenderRegion::WriteSetup

Reimplemented from EPSRenderRegion.

Definition at line 2475 of file nativeps.cpp.

02476 {
02477 TRACEUSER( "Neville", _T("WriteEndCompressionState\n"));
02478 
02479     // If the preference is set then compress the file, otherwise do nothing
02480     // Check though that the compressor started up ok.
02481     if (CamelotNativeEPSFilter::GetNativeCompression() && CompressionInitedOk)
02482     {
02483         // Could require some compression ending here...
02484         pDC->OutputToken(_T("%%EndCompression: "));
02485         pDC->OutputNewLine();
02486         // Output an extra line to sync to 
02487         pDC->OutputToken(_T("%%EndCompressionInfo: "));
02488         pDC->OutputNewLine();
02489 
02490         // Now that we have written out compression token to say that this is a compressed file,
02491         // start up the file compression.
02492         // This will output some useful data such as a crc check and amoutn written
02493         // Get a pointer to the CCDiskFile object
02494         EPSExportDC *pEPSDC = (EPSExportDC *) pDC;
02495         if (pEPSDC && ExportFile)
02496             pEPSDC->ExportFile->SetCompression(FALSE);
02497     }
02498     
02499     return TRUE;
02500 }

BOOL NativeRenderRegion::WriteFileVersion KernelDC pDC  )  [protected, virtual]
 

This allows the filter to save out a comment line giving file version information. In this Native format version we actually write out the current file version information.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/05/95
Parameters:
pDC - the device context to output to. [INPUTS]
- [OUTPUTS]
Returns:
TRUE if ok; FALSE if error (e.g. file/disk error)
See also:
EPSRenderRegion::WriteSetup

Reimplemented from EPSRenderRegion.

Definition at line 2371 of file nativeps.cpp.

02372 {
02373     // Buffer used to build up the file version comment.
02374     TCHAR buf[50];
02375 
02376     // Output the current file version in the format 1.00 for NativeFileVersion 100
02377     camSprintf(buf, _T("%%%%File version: %.2f"), WriteNativeVersion);
02378     pDC->OutputToken(buf);
02379     pDC->OutputNewLine();
02380 
02381     return TRUE;
02382 }

BOOL NativeRenderRegion::WriteProlog KernelDC pDC  )  [protected, virtual]
 

Over-ride the routines defined by CamelotEPSRenderRegion - we don't need any PostScript prolog in ART files.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/04/95
Parameters:
pDC - the device context to output to. [INPUTS]
- [OUTPUTS]
Returns:
TRUE if ok; FALSE if error (e.g. file/disk error or printer driver error)
See also:
EPSRenderRegion::WriteSetup

Reimplemented from CamelotEPSRenderRegion.

Definition at line 1769 of file nativeps.cpp.

01770 {
01771     // No PostScript procedure defns here...
01772     return TRUE;
01773 }

BOOL NativeRenderRegion::WriteSetup KernelDC pDC  )  [protected, virtual]
 

Over-ride the routines defined by CamelotEPSRenderRegion - we don't need any PostScript setup in ART files.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/04/95
Parameters:
pDC - the device context to output to. [INPUTS]
- [OUTPUTS]
Returns:
TRUE if ok; FALSE if error (e.g. file/disk error or printer driver error)
See also:
NativeRenderRegion::WriteSetup

Reimplemented from CamelotEPSRenderRegion.

Definition at line 1791 of file nativeps.cpp.

01792 {
01793     // No PostScript setup code here...
01794     return TRUE;
01795 }


Member Data Documentation

BOOL NativeRenderRegion::CompressionInitedOk [protected]
 

Definition at line 240 of file nativeps.h.


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