swfshape.cpp

Go to the documentation of this file.
00001 // $Id: swfshape.cpp 1282 2006-06-09 09:46:49Z alex $
00002 /* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE
00003 ================================XARAHEADERSTART===========================
00004  
00005                Xara LX, a vector drawing and manipulation program.
00006                     Copyright (C) 1993-2006 Xara Group Ltd.
00007        Copyright on certain contributions may be held in joint with their
00008               respective authors. See AUTHORS file for details.
00009 
00010 LICENSE TO USE AND MODIFY SOFTWARE
00011 ----------------------------------
00012 
00013 This file is part of Xara LX.
00014 
00015 Xara LX is free software; you can redistribute it and/or modify it
00016 under the terms of the GNU General Public License version 2 as published
00017 by the Free Software Foundation.
00018 
00019 Xara LX and its component source files are distributed in the hope
00020 that it will be useful, but WITHOUT ANY WARRANTY; without even the
00021 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00022 See the GNU General Public License for more details.
00023 
00024 You should have received a copy of the GNU General Public License along
00025 with Xara LX (see the file GPL in the root directory of the
00026 distribution); if not, write to the Free Software Foundation, Inc., 51
00027 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00028 
00029 
00030 ADDITIONAL RIGHTS
00031 -----------------
00032 
00033 Conditional upon your continuing compliance with the GNU General Public
00034 License described above, Xara Group Ltd grants to you certain additional
00035 rights. 
00036 
00037 The additional rights are to use, modify, and distribute the software
00038 together with the wxWidgets library, the wxXtra library, and the "CDraw"
00039 library and any other such library that any version of Xara LX relased
00040 by Xara Group Ltd requires in order to compile and execute, including
00041 the static linking of that library to XaraLX. In the case of the
00042 "CDraw" library, you may satisfy obligation under the GNU General Public
00043 License to provide source code by providing a binary copy of the library
00044 concerned and a copy of the license accompanying it.
00045 
00046 Nothing in this section restricts any of the rights you have under
00047 the GNU General Public License.
00048 
00049 
00050 SCOPE OF LICENSE
00051 ----------------
00052 
00053 This license applies to this program (XaraLX) and its constituent source
00054 files only, and does not necessarily apply to other Xara products which may
00055 in part share the same code base, and are subject to their own licensing
00056 terms.
00057 
00058 This license does not apply to files in the wxXtra directory, which
00059 are built into a separate library, and are subject to the wxWindows
00060 license contained within that directory in the file "WXXTRA-LICENSE".
00061 
00062 This license does not apply to the binary libraries (if any) within
00063 the "libs" directory, which are subject to a separate license contained
00064 within that directory in the file "LIBS-LICENSE".
00065 
00066 
00067 ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS
00068 ----------------------------------------------
00069 
00070 Subject to the terms of the GNU Public License (see above), you are
00071 free to do whatever you like with your modifications. However, you may
00072 (at your option) wish contribute them to Xara's source tree. You can
00073 find details of how to do this at:
00074   http://www.xaraxtreme.org/developers/
00075 
00076 Prior to contributing your modifications, you will need to complete our
00077 contributor agreement. This can be found at:
00078   http://www.xaraxtreme.org/developers/contribute/
00079 
00080 Please note that Xara will not accept modifications which modify any of
00081 the text between the start and end of this header (marked
00082 XARAHEADERSTART and XARAHEADEREND).
00083 
00084 
00085 MARKS
00086 -----
00087 
00088 Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara
00089 designs are registered or unregistered trademarks, design-marks, and/or
00090 service marks of Xara Group Ltd. All rights in these marks are reserved.
00091 
00092 
00093       Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK.
00094                         http://www.xara.com/
00095 
00096 =================================XARAHEADEREND============================
00097  */
00098 #include "camtypes.h"
00099 //#include "paths.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00100 #include "swfexpdc.h"
00101 #include "swfshape.h"
00102 
00103 #define new CAM_DEBUG_NEW
00104 
00105 /********************************************************************************************
00106 
00107 >   FlashShapeRecord::FlashShapeRecord ( void )
00108 
00109     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00110     Created:    12/10/99
00111     Inputs:     -
00112     Returns:    -
00113     Purpose:    Default constructor. Ensure that all the variables are set to values
00114                 that won't cause problems.
00115 
00116 ********************************************************************************************/
00117 
00118 FlashShapeRecord::FlashShapeRecord ( void )
00119 {
00120     // Generate initial settings.
00121     DocCoord DefaultPosition ( 0, 0 );
00122     FlashColour White;
00123     DocRect DefaultBounds ( 0, 0, 0, 0 );
00124 
00125     // Set up the line values.
00126     White.Red = White.Green = White.Blue = 255;
00127     White.Alpha = 0;
00128 
00129     mLineColour = White;
00130     mLineWidth = 0;
00131 
00132     mShapeID = 0;
00133     mBitmapID = 0;
00134 
00135     mBitmapHeight = 0;
00136     mBitmapWidth = 0;
00137 
00138     mNumberColours = 0;
00139 
00140     mStartPoint = DefaultPosition;
00141     mEndPoint = DefaultPosition;
00142     mEndPoint2 = DefaultPosition;
00143 
00144     mIsCircular = FALSE;
00145 
00146     // By setting mFill to be FLASH_FLAT_FILL, I can make the transparency and fill
00147     // handling code in the FlashRenderRegion (swfrndr.cpp) symmetrical, because I
00148     // can always assume that a non-processed fill is a flat fill, and therefore can
00149     // be over-written by any style that is being applied.
00150     mFill = FLASH_FLAT_FILL;
00151 
00152     // Set the colour array to be blank.
00153     for ( INT32 i = 0; i < SWF_MAX_COLOURS; i++ )
00154     {
00155         mColours [i] = White;
00156         mRatios [i] = 0;
00157     }
00158 
00159     // And for the bounding box.
00160     mBoundingBox = DefaultBounds;
00161 
00162     mNumberCoords = 0;
00163 
00164     // Initialise all pointers to NULL.
00165     mpNext = NULL;
00166     mpCoordArray = NULL;
00167     mpPathVerbs = NULL;
00168 
00169     mInvalidSizeFound = FALSE;
00170 }
00171 
00172 /********************************************************************************************
00173 
00174 >   FlashShapeRecord::~FlashShapeRecord ()
00175 
00176     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00177     Created:    12/10/99
00178     Inputs:     -
00179     Returns:    -
00180     Purpose:    Default destructor.
00181 
00182 ********************************************************************************************/
00183 
00184 FlashShapeRecord::~FlashShapeRecord ()
00185 {
00186     // Delete the coordinate and verb arrays.
00187     delete [] mpCoordArray;
00188     delete [] mpPathVerbs;
00189 
00190     mpNext = NULL;
00191 }
00192 
00193 /********************************************************************************************
00194 
00195 >   FlashShapeRecord* FlashShapeRecord::GetNext ( void )
00196 
00197     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00198     Created:    12/10/99
00199     Inputs:     -
00200     Returns:    A pointer to the next item in the list.
00201     Purpose:    Gets a pointer to the next item in the list.
00202 
00203 ********************************************************************************************/
00204 
00205 FlashShapeRecord* FlashShapeRecord::GetNext ( void )
00206 {
00207     return mpNext;
00208 }
00209 
00210 /********************************************************************************************
00211 
00212 >   void FlashShapeRecord::SetNext ( FlashShapeRecord *pNext )
00213 
00214     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00215     Created:    12/10/99
00216     Inputs:     pNext - A pointer to a FlashShapeRecord.
00217     Returns:    void
00218     Purpose:    Sets mpNext (the pointer to the next item in the list) to the
00219                 FlashShapeRecord pointed to by pNext.
00220 
00221 ********************************************************************************************/
00222 
00223 void FlashShapeRecord::SetNext ( FlashShapeRecord *pNext )
00224 {
00225     mpNext = pNext;
00226 }
00227 
00228 /********************************************************************************************
00229 
00230 >   FlashShapeRecord* FlashShapeRecord::AddNext ( void )
00231 
00232     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00233     Created:    12/10/99
00234     Inputs:     -
00235     Returns:    A pointer to the next item in the list.
00236     Purpose:    Creates a new item, adds it to the list after this node, and returns a
00237                 pointer to this item.
00238 
00239 ********************************************************************************************/
00240 
00241 FlashShapeRecord* FlashShapeRecord::AddNext ( void )
00242 {
00243     mpNext = new FlashShapeRecord;
00244 
00245     return mpNext;
00246 }
00247 
00248 /********************************************************************************************
00249 
00250 >   void FlashShapeRecord::SetPath ( DocCoord *pPath,
00251                                      PathVerb *pVerbs,
00252                                      INT32 NumberCoords )
00253 
00254     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00255     Created:    10/12/99
00256     Inputs:     -
00257     Returns:    pPath           - A pointer to a path array.
00258                 pVerbs          - A pointer to a verb array.
00259                 NumberCoords    - The number of entries in the arrays.
00260     Purpose:    Gets a pointer to mpCoordArray.
00261 
00262 ********************************************************************************************/
00263 
00264 void FlashShapeRecord::SetPath ( DocCoord *pPath,
00265                                  PathVerb *pVerbs,
00266                                  INT32 NumberCoords )
00267 {
00268     // Step 1:  Ensure that the pointers passed in are valid.
00269     ASSERT ( ( pPath != NULL ) && ( pVerbs != NULL ) );
00270 
00271     // Step 2:  Set up the member variables.
00272     mNumberCoords   = NumberCoords;
00273     mpCoordArray    = new DocCoord [ ( UINT32 ) mNumberCoords ];
00274     mpPathVerbs     = new PathVerb [ ( UINT32 ) mNumberCoords ];
00275 
00276     // Step 3:  Ensure that the arrays have been created.
00277     ASSERT ( ( mpCoordArray != NULL ) && ( mpPathVerbs != NULL ) );
00278 
00279     // Step 4:  Copy the values from pPath and pVerbs into mpCoordArray and mpPathVerbs.
00280     for ( INT32 i = 0; i < mNumberCoords; i++ )
00281     {
00282         mpCoordArray [i]    = pPath [i];
00283         mpPathVerbs [i]     = pVerbs [i];
00284     }
00285 }
00286 
00287 /********************************************************************************************
00288 
00289 >   DocCoord* FlashShapeRecord::GetCoords ( void )
00290 
00291     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00292     Created:    12/10/99
00293     Inputs:     -
00294     Returns:    A pointer to the co-ordinate array mpCoordArray.
00295     Purpose:    Gets a pointer to mpCoordArray.
00296 
00297 ********************************************************************************************/
00298 
00299 DocCoord* FlashShapeRecord::GetCoords ( void )
00300 {
00301     return mpCoordArray;
00302 }
00303 
00304 
00305 /********************************************************************************************
00306 
00307 >   PathVerb* FlashShapeRecord::GetVerbs ( void )
00308 
00309     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00310     Created:    12/10/99
00311     Inputs:     -
00312     Returns:    A pointer to the path descriptor array mpPathVerbs.
00313     Purpose:    Gets a pointer to mpPathVerbs.
00314 
00315 ********************************************************************************************/
00316 
00317 PathVerb* FlashShapeRecord::GetVerbs ( void )
00318 {
00319     return mpPathVerbs;
00320 }
00321 
00322 /********************************************************************************************
00323 
00324 >   INT32 FlashShapeRecord::GetNumberCoords ( void )
00325 
00326     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00327     Created:    12/10/99
00328     Inputs:     -
00329     Returns:    The number of entries in the co-ordinate and verb arrays.
00330     Purpose:    Gets the value of mNumberCoords.
00331 
00332 ********************************************************************************************/
00333 
00334 INT32 FlashShapeRecord::GetNumberCoords ( void )
00335 {
00336     return mNumberCoords;
00337 }
00338 
00339 /********************************************************************************************
00340 
00341 >   void FlashShapeRecord::SetLineWidth ( WORD Width )
00342 
00343     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00344     Created:    12/10/99
00345     Inputs:     Width - The width of the line.
00346     Returns:    -
00347     Purpose:    Sets the line width.
00348 
00349 ********************************************************************************************/
00350 
00351 void FlashShapeRecord::SetLineWidth ( INT32 Width )
00352 {
00353     mLineWidth = ( WORD ) ( Width / FLASH_SCALE );
00354 }
00355 
00356 /********************************************************************************************
00357 
00358 >   WORD FlashShapeRecord::GetLineWidth ( void )
00359 
00360     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00361     Created:    12/10/99
00362     Inputs:     -
00363     Returns:    The line width.
00364     Purpose:    Get's the width of the current line.
00365 
00366 ********************************************************************************************/
00367 
00368 WORD FlashShapeRecord::GetLineWidth ( void )
00369 {
00370     return mLineWidth;
00371 }
00372 
00373 /********************************************************************************************
00374 
00375 >   void FlashShapeRecord::SetLineColour ( DocColour *pColour,
00376                                            UINT32 *pAlpha )
00377 
00378     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00379     Created:    12/10/99
00380     Inputs:     Colour - A FlashColour value for the line.
00381     Returns:    -
00382     Purpose:    Sets the line's colour.
00383 
00384 ********************************************************************************************/
00385 
00386 void FlashShapeRecord::SetLineColour ( DocColour *pColour,
00387                                        UINT32 *pAlpha )
00388 {
00389     INT32 lRed, lGreen, lBlue;
00390 
00391     // Extract the colour value from DocColour.
00392     pColour->GetRGBValue ( &lRed, &lGreen, &lBlue );
00393 
00394     // And cast it into the record as an RGB triplet of BYTEs.
00395     mLineColour.Red     = ( BYTE ) lRed;
00396     mLineColour.Green   = ( BYTE ) lGreen;
00397     mLineColour.Blue    = ( BYTE ) lBlue;
00398 
00399     mLineColour.Alpha   = 255 - ( BYTE ) *pAlpha;
00400 }
00401 
00402 /********************************************************************************************
00403 
00404 >   FlashColour FlashShapeRecord::GetLineColour ( void )
00405 
00406     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00407     Created:    12/10/99
00408     Inputs:     -
00409     Returns:    The colour of the line surrounding the shape.
00410     Purpose:    Gets the current line colour.
00411 
00412 ********************************************************************************************/
00413 
00414 FlashColour FlashShapeRecord::GetLineColour ( void )
00415 {
00416     return mLineColour;
00417 }
00418 
00419 /********************************************************************************************
00420 
00421 >   void FlashShapeRecord::SetBoundingBox ( const DocRect &Bounds )
00422 
00423     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00424     Created:    12/10/99
00425     Inputs:     Bounds - A DocRect containing the bounds of a path.
00426     Returns:    -
00427     Purpose:    Sets the bounding rectangle of the shape.
00428 
00429 ********************************************************************************************/
00430 
00431 void FlashShapeRecord::SetBoundingBox ( const DocRect &Bounds )
00432 {
00433     CheckValidExportSize (Bounds);
00434     mBoundingBox = Bounds;
00435 }
00436 
00437 /********************************************************************************************
00438 
00439 >   DocRect FlashShapeRecord::GetBoundingBox ( void )
00440 
00441     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00442     Created:    12/10/99
00443     Inputs:     -
00444     Returns:    The shape's bounding box.
00445     Purpose:    Returns the shape's bounding box.
00446 
00447 ********************************************************************************************/
00448 
00449 DocRect FlashShapeRecord::GetBoundingBox ( void )
00450 {
00451     return mBoundingBox;
00452 }
00453 
00454 /********************************************************************************************
00455 
00456 >   WORD FlashShapeRecord::GetShapeID ( void )
00457 
00458     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00459     Created:    22/10/99
00460     Inputs:     -
00461     Returns:    WORD - The value of mShapeID.
00462     Purpose:    Gets the ID for this Shape record.
00463 
00464 ********************************************************************************************/
00465 
00466 WORD FlashShapeRecord::GetShapeID ( void )
00467 {
00468     return mShapeID;
00469 }
00470 
00471 /********************************************************************************************
00472 
00473 >   void FlashShapeRecord::SetShapeID ( WORD ShapeID )
00474 
00475     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00476     Created:    22/10/99
00477     Inputs:     WORD - The ID value to be set.
00478     Returns:    -
00479     Purpose:    Sets the value of mShapeID.
00480 
00481 ********************************************************************************************/
00482 
00483 void FlashShapeRecord::SetShapeID ( WORD ShapeID )
00484 {
00485     mShapeID = ShapeID;
00486 }
00487 
00488 /********************************************************************************************
00489 
00490 >   WORD FlashShapeRecord::GetBitmapID ( void )
00491 
00492     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00493     Created:    16/11/99
00494     Inputs:     -
00495     Returns:    WORD - The value of mBitmapID.
00496     Purpose:    Gets the ID for the bitmap record being used..
00497 
00498 ********************************************************************************************/
00499 
00500 WORD FlashShapeRecord::GetBitmapID ( void )
00501 {
00502     return mBitmapID;
00503 }
00504 
00505 /********************************************************************************************
00506 
00507 >   void FlashShapeRecord::SetBitmapID ( WORD BitmapID )
00508 
00509     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00510     Created:    16/11/99
00511     Inputs:     WORD - The ID value to be set.
00512     Returns:    -
00513     Purpose:    Sets the value of mBitmapID.
00514 
00515 ********************************************************************************************/
00516 
00517 void FlashShapeRecord::SetBitmapID ( WORD BitmapID )
00518 {
00519     mBitmapID = BitmapID;
00520 }
00521 
00522 /********************************************************************************************
00523 
00524 >   void FlashShapeRecord::SetStartPoint ( const DocCoord &Point )
00525 
00526     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00527     Created:    25/11/99
00528     Inputs:     DocCoord - The coordinate value to be set.
00529     Returns:    -
00530     Purpose:    Sets the value of mStartPoint, which is the start point for a fill.
00531 
00532 ********************************************************************************************/
00533 
00534 void FlashShapeRecord::SetStartPoint ( const DocCoord &Point )
00535 {
00536     mStartPoint = Point;
00537 }
00538 
00539 /********************************************************************************************
00540 
00541 >   void FlashShapeRecord::SetEndPoint ( const DocCoord &Point )
00542 
00543     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00544     Created:    25/11/99
00545     Inputs:     DocCoord - The coordinate value to be set.
00546     Returns:    -
00547     Purpose:    Sets the value of mEndPoint, which is the end point for a fill.
00548 
00549 ********************************************************************************************/
00550 
00551 void FlashShapeRecord::SetEndPoint ( const DocCoord &Point )
00552 {
00553     mEndPoint = Point;
00554 }
00555 
00556 /********************************************************************************************
00557 
00558 >   void FlashShapeRecord::SetEndPoint2 ( const DocCoord &Point )
00559 
00560     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00561     Created:    25/11/99
00562     Inputs:     DocCoord - The coordinate value to be set.
00563     Returns:    -
00564     Purpose:    Sets the value of mEndPoint2, which is another point required for a fill.
00565 
00566 ********************************************************************************************/
00567 
00568 void FlashShapeRecord::SetEndPoint2 ( const DocCoord &Point )
00569 {
00570     mEndPoint2 = Point;
00571 }
00572 
00573 /********************************************************************************************
00574 
00575 >   DocCoord FlashShapeRecord::GetStartPoint ( void )
00576 
00577     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00578     Created:    25/11/99
00579     Inputs:     -
00580     Returns:    DocCoord - The value of mStartPoint.
00581     Purpose:    Gets the start point of a complex fill.
00582 
00583 ********************************************************************************************/
00584 
00585 DocCoord FlashShapeRecord::GetStartPoint ( void )
00586 {
00587     return mStartPoint;
00588 }
00589 
00590 /********************************************************************************************
00591 
00592 >   DocCoord FlashShapeRecord::GetEndPoint ( void )
00593 
00594     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00595     Created:    25/11/99
00596     Inputs:     -
00597     Returns:    DocCoord - The value of mEndPoint.
00598     Purpose:    Gets the end point of a complex fill.
00599 
00600 ********************************************************************************************/
00601 
00602 DocCoord FlashShapeRecord::GetEndPoint ( void )
00603 {
00604     return mEndPoint;
00605 }
00606 
00607 /********************************************************************************************
00608 
00609 >   DocCoord FlashShapeRecord::GetEndPoint2 ( void )
00610 
00611     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00612     Created:    25/11/99
00613     Inputs:     -
00614     Returns:    DocCoord - The value of mEndPoint2.
00615     Purpose:    Gets the second end point of a complex fill.
00616 
00617 ********************************************************************************************/
00618 
00619 DocCoord FlashShapeRecord::GetEndPoint2 ( void )
00620 {
00621     return mEndPoint2;
00622 }
00623 
00624 /********************************************************************************************
00625 
00626 >   void FlashShapeRecord::SetColour ( DocColour *pColour,
00627                                        UINT32 FillTransparency,
00628                                        BYTE Ratio,
00629                                        UINT32 Index )
00630 
00631     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00632     Created:    25/11/99
00633     Inputs:     Colour - The colour of the fill.
00634                 Transparency - The Camelot transparency value.
00635                 Ratio - The distance ( 0 - 255 ) along the fill vector.
00636                 Index - The number of the colour.
00637     Returns:    -
00638     Purpose:    Fills in the colour values for the fill.
00639 
00640 ********************************************************************************************/
00641 
00642 void FlashShapeRecord::SetColour ( DocColour *pColour,
00643                                    UINT32 FillTransparency,
00644                                    BYTE Ratio,
00645                                    UINT32 Index )
00646 {
00647     if ( Index < SWF_MAX_COLOURS )
00648     {
00649         // Convert the Camelot colour into a Flash colour.
00650         INT32 lRed, lGreen, lBlue;
00651 
00652         // Extract the colour value from DocColour.
00653         pColour->GetRGBValue ( &lRed, &lGreen, &lBlue );
00654 
00655         // And cast it into the record as an RGB triplet of BYTEs.
00656         mColours [ Index ].Red      = ( BYTE ) lRed;
00657         mColours [ Index ].Green    = ( BYTE ) lGreen;
00658         mColours [ Index ].Blue = ( BYTE ) lBlue;
00659         mColours [ Index ].Alpha = 255 - ( BYTE) FillTransparency;
00660 
00661         mRatios [ Index ] = Ratio;
00662 
00663         // Record how many colours have been used to date.
00664         if ( Index >= mNumberColours )
00665             mNumberColours = ( BYTE ) ( Index + 1 );
00666     }
00667 }
00668 
00669 /********************************************************************************************
00670 
00671 >   FlashColour FlashShapeRecord::GetColour ( UINT32 i )
00672 
00673     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00674     Created:    25/11/99
00675     Inputs:     UINT32 - An index into the array.
00676     Returns:    FlashColour - The value of mColours [i].
00677     Purpose:    Gets the given colour from a fill.
00678 
00679 ********************************************************************************************/
00680 
00681 FlashColour FlashShapeRecord::GetColour ( UINT32 i )
00682 {
00683     if ( i < mNumberColours )
00684         return mColours [i];
00685     else
00686         return mColours [mNumberColours - 1];
00687 }
00688 
00689 /********************************************************************************************
00690 
00691 >   BYTE FlashShapeRecord::GetRatio ( UINT32 i )
00692 
00693     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00694     Created:    25/11/99
00695     Inputs:     UINT32 - An index into the array.
00696     Returns:    BYTE - The value of mRatios [i].
00697     Purpose:    Gets the given ratio from a fill.
00698 
00699 ********************************************************************************************/
00700 
00701 BYTE FlashShapeRecord::GetRatio ( UINT32 i )
00702 {
00703     if ( i < mNumberColours )
00704         return mRatios [i];
00705     else
00706         return mRatios [mNumberColours - 1];
00707 }
00708 
00709 /********************************************************************************************
00710 
00711 >   BYTE FlashShapeRecord::GetNumberColours ( void )
00712 
00713     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00714     Created:    25/11/99
00715     Inputs:     -
00716     Returns:    DocCoord - The value of mNumberColours.
00717     Purpose:    Gets the number of colours within a complex fill.
00718 
00719 ********************************************************************************************/
00720 
00721 BYTE FlashShapeRecord::GetNumberColours ( void )
00722 {
00723     return mNumberColours;
00724 }
00725 
00726 /********************************************************************************************
00727 
00728 >   void FlashShapeRecord::SetFill ( BYTE FillType )
00729 
00730     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00731     Created:    25/11/99
00732     Inputs:     BYTE - The fill style to be used.
00733     Returns:    -
00734     Purpose:    Sets the fill style for this shape.
00735 
00736 ********************************************************************************************/
00737 
00738 void FlashShapeRecord::SetFill ( BYTE FillType )
00739 {
00740     mFill = FillType;
00741 }
00742 
00743 /********************************************************************************************
00744 
00745 >   BYTE FlashShapeRecord::GetFill ( void )
00746 
00747     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00748     Created:    25/11/99
00749     Inputs:     -
00750     Returns:    Fill - The flash fill style.
00751     Purpose:    Gets the fill style (mFill).
00752 
00753 ********************************************************************************************/
00754 
00755 BYTE FlashShapeRecord::GetFill ( void )
00756 {
00757     return mFill;
00758 }
00759 
00760 /********************************************************************************************
00761 
00762 >   void FlashShapeRecord::SetIsCircular ( BOOL IsCircular )
00763 
00764     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00765     Created:    26/11/99
00766     Inputs:     BOOL - Is the path circular or elliptical?
00767     Returns:    -
00768     Purpose:    Sets whether or not the path is basically circular.
00769 
00770 ********************************************************************************************/
00771 
00772 void FlashShapeRecord::SetIsCircular ( BOOL IsCircular )
00773 {
00774     mIsCircular = IsCircular;
00775 }
00776 
00777 /********************************************************************************************
00778 
00779 >   BOOL FlashShapeRecord::GetIsCircular ( void )
00780 
00781     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00782     Created:    26/11/99
00783     Inputs:     -
00784     Returns:    mIsCircular - Is the path circular or elliptical.
00785     Purpose:    Gets the shape's roundness (mIsCircular).
00786 
00787 ********************************************************************************************/
00788 
00789 BOOL FlashShapeRecord::GetIsCircular ( void )
00790 {
00791     return mIsCircular;
00792 }
00793 
00794 /********************************************************************************************
00795 
00796 >   void FlashShapeRecord::SetBitmapWidth ( INT32 Width )
00797 
00798     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00799     Created:    26/11/99
00800     Inputs:     INT32 - The width of the bitmap.
00801     Returns:    -
00802     Purpose:    Sets the value of mBitmapWidth.
00803 
00804 ********************************************************************************************/
00805 
00806 void FlashShapeRecord::SetBitmapWidth ( INT32 Width )
00807 {
00808     mBitmapWidth = Width;
00809 }
00810 
00811 /********************************************************************************************
00812 
00813 >   INT32 FlashShapeRecord::GetBitmapWidth ( void )
00814 
00815     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00816     Created:    26/11/99
00817     Inputs:     -
00818     Returns:    mBitmapWidth - The width of the bitmap.
00819     Purpose:    Gets the width of the bitmap being used as the fill.
00820 
00821 ********************************************************************************************/
00822 
00823 INT32 FlashShapeRecord::GetBitmapWidth ( void )
00824 {
00825     return mBitmapWidth;
00826 }
00827 
00828 /********************************************************************************************
00829 
00830 >   void FlashShapeRecord::SetBitmapHeight ( INT32 Height )
00831 
00832     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00833     Created:    26/11/99
00834     Inputs:     INT32 - The height of the bitmap.
00835     Returns:    -
00836     Purpose:    Sets the value of mBitmapHeight.
00837 
00838 ********************************************************************************************/
00839 
00840 void FlashShapeRecord::SetBitmapHeight ( INT32 Height )
00841 {
00842     mBitmapHeight = Height;
00843 }
00844 
00845 /********************************************************************************************
00846 
00847 >   INT32 FlashShapeRecord::GetBitmapHeight ( void )
00848 
00849     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00850     Created:    26/11/99
00851     Inputs:     -
00852     Returns:    mBitmapHeight - The height of the bitmap.
00853     Purpose:    Gets the Height of the bitmap being used as the fill.
00854 
00855 ********************************************************************************************/
00856 
00857 INT32 FlashShapeRecord::GetBitmapHeight ( void )
00858 {
00859     return mBitmapHeight;
00860 }
00861 
00862 /********************************************************************************************
00863 
00864 >   void FlashShapeRecord::RemoveLines ( void )
00865 
00866     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00867     Created:    17/12/99
00868     Inputs:     -
00869     Returns:    -
00870     Purpose:    Removes the edge lines from an output by setting their width to 0, and making
00871                 them transparent.
00872 
00873 ********************************************************************************************/
00874 
00875 void FlashShapeRecord::RemoveLines ( void )
00876 {
00877     mLineColour.Alpha = 0;
00878     mLineWidth = 0;
00879 }
00880 
00881 
00882 /********************************************************************************************
00883 
00884 >   void FlashShapeRecord::CheckValidExportSize ( const DocRect & Bounds )
00885 
00886     Author:     Chris_Gallimore (Xara Group Ltd) <camelotdev@xara.com>
00887     Created:    18/1/01
00888     Inputs:     Bounds - a bounding box for the object being checked
00889     Returns:    BOOL - True if the object is within the maximum bounds,
00890                      - False if it isn't
00891     Purpose:    Determines whether an object's bounding box is smaller than the maximum size 
00892                 that Flash can cope with. If the object exceeds this, it can still be exported,
00893                 but may cause black blocks to be drawn around the valid objects in the file, 
00894                 when it is viewed.
00895 
00896 ********************************************************************************************/
00897 
00898 BOOL FlashShapeRecord::CheckValidExportSize (const DocRect & Bounds)
00899 {
00900     BOOL valid = FALSE;
00901     INT32 scaledHeight;
00902     INT32 scaledWidth;
00903 
00904     // calculate the height and width of the objects in pixels.
00905     scaledHeight = (Bounds.Height ()) / 750;
00906     scaledWidth  = (Bounds.Width ()) / 750;
00907 
00908     // If both the height and the width are less than the maximum, then the size is valid,
00909     //  If one is greater, then the bounds are invalid, and this may cause black blocks to be 
00910     //  shown.
00911     if ((scaledHeight < SWF_MAX_PIXEL_DIMENSION) &&
00912         (scaledWidth  < SWF_MAX_PIXEL_DIMENSION))
00913     {
00914         valid = TRUE;
00915     }
00916     else
00917     {
00918         mInvalidSizeFound = TRUE;
00919         valid = FALSE;
00920     }
00921 
00922     return valid;
00923 }
00924 
00925 
00926 /********************************************************************************************
00927 
00928 >   BOOL FlashShapeRecord::WasInvalidSizeFound ()
00929 
00930     Author:     Chris_Gallimore (Xara Group Ltd) <camelotdev@xara.com>
00931     Created:    18/1/01
00932     Returns:    BOOL - True if an object with an invalid size has been detected,
00933                      - False if it hasn't
00934     Purpose:    Shows whether the export has detected an object with an invalid size.
00935 
00936 ********************************************************************************************/
00937 
00938 BOOL FlashShapeRecord::WasInvalidSizeFound ()
00939 {
00940     return mInvalidSizeFound;
00941 }
00942 

Generated on Sat Nov 10 03:47:07 2007 for Camelot by  doxygen 1.4.4