rechbmp.cpp

Go to the documentation of this file.
00001 // $Id: rechbmp.cpp 1688 2006-08-10 12:05:20Z gerry $
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 
00099 // Implementation of the bitmap record handler class of the v2 file format
00100 
00101 #include "camtypes.h"
00102 
00103 #include "rechbmp.h"    // BitmapRecordHandler for importing bitmaps from v2 native/web files
00104 #include "bmpcomp.h"    // Document bitmap component, handles import of bitmaps
00105 //#include "camfiltr.h" // BaseCamelotFilter - version 2 native filter - in camtypes.h [AUTOMATICALLY REMOVED]
00106 #include "cxfile.h"     // CXaraFile file handling class for version 2 native filter 
00107 #include "cxftags.h"    // TAG_DEFINEBITMAP_**** 
00108 //#include "sgliboil.h" // Wav stuff
00109 //#include "cxfrec.h"       // The main record handling class - in camtypes.h [AUTOMATICALLY REMOVED]
00110 
00111 //#include "bitmap.h"       // KernelBitmap - in camtypes.h [AUTOMATICALLY REMOVED]
00112 #include "nodebmp.h"    // NodeBitmap
00113 //#include "impbmp.h"       // ImportedBitmaps
00114 
00115 DECLARE_SOURCE("$Revision: 1688 $");
00116 
00117 // Declare smart memory handling in Debug builds
00118 #define new CAM_DEBUG_NEW
00119 
00120 // An implement to match the Declare in the .h file.
00121 CC_IMPLEMENT_DYNAMIC(BitmapRecordHandler,CamelotRecordHandler);
00122 
00123 //#if NEW_NATIVE_FILTER // New native filters, only available to those who need them at present
00124 
00125 /********************************************************************************************
00126 
00127 >   virtual BOOL BitmapRecordHandler::BeginImport()
00128 
00129     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00130     Created:    11/6/96
00131     Inputs:     -
00132     Returns:    TRUE if ok
00133                 FALSE otherwise
00134     Purpose:    Initialises the bitmap record handler
00135     Errors:     -
00136     SeeAlso:    -
00137 
00138 ********************************************************************************************/
00139 
00140 BOOL BitmapRecordHandler::BeginImport()
00141 {
00142     pBmpComponent = GetBitmapDocComponent();
00143 
00144     return (pBmpComponent != NULL);
00145 }
00146 
00147 /********************************************************************************************
00148 
00149 >   virtual UINT32* BitmapRecordHandler::GetTagList()
00150 
00151     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00152     Created:    11/6/96
00153     Inputs:     -
00154     Returns:    Ptr to a list of tag values, terminated by CXFRH_TAG_LIST_END
00155     Purpose:    Provides the record handler system with a list of records handled by this
00156                 handler
00157     SeeAlso:    -
00158 
00159 ********************************************************************************************/
00160 
00161 UINT32* BitmapRecordHandler::GetTagList()
00162 {
00163     static UINT32 TagList[] = {TAG_NODE_BITMAP, TAG_NODE_CONTONEDBITMAP,
00164                               TAG_DEFINEBITMAP_BMP, TAG_DEFINEBITMAP_GIF, TAG_DEFINEBITMAP_JPEG,
00165                               TAG_DEFINEBITMAP_PNG, TAG_DEFINEBITMAP_BMPZIP, TAG_DEFINESOUND_WAV,
00166                               TAG_DEFINEBITMAP_JPEG8BPP,
00167                               TAG_PREVIEWBITMAP_BMP, TAG_PREVIEWBITMAP_GIF, TAG_PREVIEWBITMAP_JPEG,
00168                               TAG_PREVIEWBITMAP_PNG, TAG_PREVIEWBITMAP_TIFFLZW,
00169                               TAG_DEFINEBITMAP_XPE,
00170                               CXFRH_TAG_LIST_END};
00171 
00172     return (UINT32*)&TagList;
00173 }
00174 
00175 /********************************************************************************************
00176 
00177 >   virtual BOOL BitmapRecordHandler::IsStreamed(UINT32 Tag)
00178 
00179     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00180     Created:    19/6/96
00181     Inputs:     The tag of the record
00182     Returns:    TRUE if this is a streamed record
00183                 FALSE otherwise
00184     Purpose:    Function to find out if the record is streamed or not.
00185     Errors:     -
00186     SeeAlso:    -
00187 
00188 ********************************************************************************************/
00189 
00190 BOOL BitmapRecordHandler::IsStreamed(UINT32 Tag)
00191 {
00192     // We handle both types so check what we need to do by the tag we have been given
00193     BOOL Streamed = FALSE;
00194     switch (Tag)
00195     {
00196         case TAG_NODE_BITMAP:
00197         case TAG_NODE_CONTONEDBITMAP:
00198         case TAG_DEFINEBITMAP_XPE:
00199             // These are not streamed records.
00200             Streamed = FALSE;
00201             break;
00202         case TAG_PREVIEWBITMAP_BMP:
00203         case TAG_PREVIEWBITMAP_GIF:
00204         case TAG_PREVIEWBITMAP_JPEG:
00205         case TAG_PREVIEWBITMAP_PNG:
00206         case TAG_PREVIEWBITMAP_TIFFLZW:
00207         case TAG_DEFINEBITMAP_BMP:
00208         case TAG_DEFINEBITMAP_GIF:
00209         case TAG_DEFINEBITMAP_JPEG:
00210         case TAG_DEFINEBITMAP_PNG:
00211         case TAG_DEFINEBITMAP_BMPZIP:
00212         case TAG_DEFINESOUND_WAV:
00213         case TAG_DEFINEBITMAP_JPEG8BPP:
00214             // These are streamed records.
00215             Streamed = TRUE;
00216             break;
00217         default:
00218             Streamed = FALSE;
00219             ERROR3_PF(("BitmapRecordHandler::IsStreamed I don't handle records with the tag (%d)\n", Tag));
00220             break;
00221     }
00222 
00223     return Streamed;
00224 }
00225 
00226 /********************************************************************************************
00227 
00228 >   virtual BOOL BitmapRecordHandler::HandleRecord(CXaraFileRecord* pCXaraFileRecord)
00229 
00230     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00231     Created:    11/6/96
00232     Inputs:     pCXaraFileRecord = ptr to record to handle
00233     Returns:    TRUE if handled successfuly
00234                 FALSE otherwise
00235     Purpose:    Handles the given record.
00236     SeeAlso:    -
00237 
00238 ********************************************************************************************/
00239 
00240 BOOL BitmapRecordHandler::HandleRecord(CXaraFileRecord* pCXaraFileRecord)
00241 {
00242     ERROR2IF(pCXaraFileRecord == NULL,FALSE,"BitmapRecordHandler::HandleRecord pCXaraFileRecord is NULL");
00243 
00244     BOOL ok = TRUE;
00245 
00246     INT32 Tag = pCXaraFileRecord->GetTag();
00247     switch (Tag)
00248     {
00249         case TAG_NODE_BITMAP:
00250         {
00251             // Load in that node bitmap 
00252             ok = HandleNodeBitmap(pCXaraFileRecord, Tag);
00253             break;
00254         }
00255         case TAG_NODE_CONTONEDBITMAP:
00256         {
00257             // Load in that node contone bitmap 
00258             ok = HandleNodeBitmap(pCXaraFileRecord, Tag);
00259             break;
00260         }
00261         case TAG_DEFINEBITMAP_XPE:
00262         {
00263             // Load in the empty place marker for a XPE processed bitmap
00264             ok = HandleXPEBitmapPlaceHolder(pCXaraFileRecord, Tag);
00265             break;
00266         }
00267         
00268         default:
00269             ok = FALSE;
00270             ERROR3_PF(("BitmapRecordHandler::HandleRecord I don't handle records with the tag (%d)\n", Tag));
00271             break;
00272     }
00273 
00274     return ok;
00275 }
00276 
00277 /********************************************************************************************
00278 
00279 >   virtual BOOL BitmapRecordHandler::HandleStreamedRecord(CXaraFile * pCXFile, UINT32 Tag,UINT32 Size,UINT32 RecordNumber)
00280 
00281     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00282     Created:    19/6/96
00283     Inputs:     pCXFile = access to the CXaraFile class
00284                 Tag  = the tag value
00285                 Size = size of record
00286                 RecordNumber = the record number in the file
00287     Returns:    TRUE if handled ok
00288                 FALSE otherwise
00289     Purpose:    This is the bitmap streamed record handler. It handles the loading of bitmap
00290                 definitions.
00291     Errors:     -
00292     SeeAlso:    -
00293 
00294 ********************************************************************************************/
00295 
00296 BOOL BitmapRecordHandler::HandleStreamedRecord(CXaraFile * pCXFile, UINT32 Tag,UINT32 Size,UINT32 RecordNumber)
00297 {
00298     ERROR2IF(pCXFile == NULL,FALSE,"BitmapRecordHandler::HandleStreamedRecord pCXFile is NULL");
00299 
00300     BOOL ok = TRUE;
00301 
00302     switch (Tag)
00303     {
00304         case TAG_PREVIEWBITMAP_BMP:
00305         case TAG_PREVIEWBITMAP_GIF:
00306         case TAG_PREVIEWBITMAP_JPEG:
00307         case TAG_PREVIEWBITMAP_PNG:
00308         case TAG_PREVIEWBITMAP_TIFFLZW:
00309         {
00310             // We don't require it so just throw it away.
00311             TRACEUSER( "Neville", _T("BitmapRecordHandler::HandleStreamedRecord PREVIEWBITMAP\n"));
00312             // Note the current position in the file
00313             // Get the underlying file stream class, CCFile, that we are using to load the file
00314             CCLexFile* pFile = pCXFile->GetCCFile();
00315             if (pFile)
00316             {
00317                 // Move on by the size of the data in this record
00318                 FilePos pos = pFile->tellIn(); 
00319                 pFile->seekIn(pos + Size);
00320             }
00321             break;
00322         }
00323         case TAG_DEFINEBITMAP_BMP:
00324         case TAG_DEFINEBITMAP_GIF:
00325         case TAG_DEFINEBITMAP_JPEG:
00326         case TAG_DEFINEBITMAP_PNG:
00327         case TAG_DEFINEBITMAP_BMPZIP:
00328         case TAG_DEFINEBITMAP_JPEG8BPP:
00329             // Ask the bitmap document component class to import that bitmap for us
00330             if (pBmpComponent)
00331             {
00332                 TRACEUSER( "Neville", _T("BitmapRecordHandler::HandleStreamedRecord DEFINEBITMAP\n"));
00333                 ok = pBmpComponent->LoadBitmapDefinition(this, pCXFile, Tag, Size, RecordNumber);
00334             }
00335             else
00336                 ERROR3("BitmapRecordHandler::HandleStreamedRecord no pBmpComponent");
00337             break;
00338 
00339         case TAG_DEFINESOUND_WAV:
00340 #if !defined(EXCLUDE_FROM_RALPH) && !defined(EXCLUDE_FROM_XARALX)
00341             TRACEUSER( "Neville", _T("BitmapRecordHandler::HandleStreamedRecord DEFINESOUND\n"));
00342             ok = SGLibOil::LoadSoundDefinition(this, pCXFile, Tag, Size, RecordNumber);
00343 #endif
00344             break;
00345 
00346         default:
00347             ok = FALSE;
00348             ERROR3_PF(("BitmapRecordHandler::HandleStreamedRecord I don't handle records with the tag (%d)\n", Tag));
00349             break;
00350     }
00351 
00352     return ok;
00353 }
00354 
00355 /********************************************************************************************
00356 
00357 >   virtual BOOL    BitmapRecordHandler::HandleNodeBitmap(CXaraFileRecord* pCXaraFileRecord, INT32 Tag)
00358 
00359     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00360     Created:    19/6/96
00361     Inputs:     pCXaraFileRecord    = baseclass record handler
00362                 Tag                 = record tag
00363     Returns:    -
00364     Purpose:    This handles the loading and creation of node bitmaps on receiving the 
00365                 correct records from the main record handler.
00366     Errors:     -
00367     SeeAlso:    -
00368 
00369 ********************************************************************************************/
00370 
00371 BOOL BitmapRecordHandler::HandleNodeBitmap(CXaraFileRecord* pCXaraFileRecord, INT32 Tag)
00372 {
00373     ERROR2IF(pCXaraFileRecord == NULL,FALSE,"BitmapRecordHandler::HandleNodeBitmap pCXaraFileRecord is NULL");
00374 
00375     BOOL ok = TRUE;
00376 
00377     // Create a NodeBitmap ready for our use
00378     NodeBitmap * pNodeBmp = NULL;
00379     pNodeBmp = new NodeBitmap;
00380     if ((pNodeBmp == NULL) || (!pNodeBmp->SetUpPath(12,12)))
00381         return FALSE;
00382 
00383     // --------------------------------
00384     // Get details for that node bitmap 
00385     // Sort out reading the coordinates for the 4 corners of the rectangle
00386     // And apply them to the NodeBitmap
00387     DocCoord Parallel[4];       // 4 coords to represent the parallelogram that the shape fits in
00388     INT32 i;
00389     for (i = 0; i < 4; i++)
00390     {
00391         if (ok) ok = pCXaraFileRecord->ReadCoord(&Parallel[i]);
00392         pNodeBmp->Parallel[i] = Parallel[i];
00393     }
00394 
00395     // Put them into the path.
00396     pNodeBmp->InkPath.InsertMoveTo(Parallel[0]);
00397 
00398     for (i = 1; i <= 3; i++)
00399         pNodeBmp->InkPath.InsertLineTo(Parallel[i]);
00400 
00401     pNodeBmp->InkPath.InsertLineTo(Parallel[0]);
00402     pNodeBmp->InkPath.CloseSubPath();
00403 
00404     // ---------------------------------
00405     // Read in the details on the bitmap
00406     INT32 BitmapRecordRef = 0;
00407     if (ok) ok = pCXaraFileRecord->ReadINT32(&BitmapRecordRef);
00408     if (BitmapRecordRef == 0)
00409         return FALSE;
00410 
00411     KernelBitmap * pBitmap = NULL;
00412     pBitmap = GetReadBitmapReference(BitmapRecordRef);
00413     if (pBitmap == NULL)
00414         return FALSE;
00415 
00416     // Attach the bitmap to the NodeBitmap
00417     pNodeBmp->GetBitmapRef()->Attach(pBitmap, NULL); //GetDocument());
00418 
00419     pNodeBmp->InvalidateBoundingRect();
00420     if (ok) ok = InsertNode(pNodeBmp);
00421 
00422     // ---------------------------------------------
00423     // Sort out the contoning to be either on or off
00424     INT32 StartColourRecordRef = 0;
00425     INT32 EndColourRecordRef = 0;
00426     switch (Tag)
00427     {
00428         case TAG_NODE_CONTONEDBITMAP:
00429         {
00430             // Get the colour details for that contoned node bitmap 
00431             if (ok) ok = pCXaraFileRecord->ReadINT32(&StartColourRecordRef);
00432             if (ok) ok = pCXaraFileRecord->ReadINT32(&EndColourRecordRef);
00433             
00434             DocColour * pStartColour = new DocColour;
00435             if (pStartColour && ok)
00436                 ok = GetDocColour(StartColourRecordRef, pStartColour);
00437             pNodeBmp->SetStartColour(pStartColour);
00438             delete pStartColour;
00439 
00440             DocColour * pEndColour = new DocColour;
00441             if (pEndColour && ok)
00442                 ok = GetDocColour(EndColourRecordRef, pEndColour);
00443             pNodeBmp->SetEndColour(pEndColour);
00444             delete pEndColour;
00445             break;
00446         }
00447 
00448         case TAG_NODE_BITMAP:
00449         {
00450             // Plain old node bitmap so just set up the plain colours
00451             pNodeBmp->SetStartColour(NULL);
00452             pNodeBmp->SetEndColour(NULL);
00453             break;
00454         }
00455 
00456         default:
00457             ok = FALSE;
00458             ERROR3_PF(("BitmapRecordHandler::HandleNodeBitmap I don't handle records with the tag (%d)\n", Tag));
00459             break;
00460     }
00461 
00462     return ok;
00463 }
00464 
00465 
00466 /********************************************************************************************
00467 
00468 >   virtual BOOL    BitmapRecordHandler::HandleXPEBitmapPlaceHolder(CXaraFileRecord* pCXaraFileRecord, INT32 Tag)
00469 
00470     Author:     Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
00471     Created:    02/02/2004
00472     Inputs:     pCXaraFileRecord    = baseclass record handler
00473                 Tag                 = record tag
00474     Returns:    -
00475     Purpose:    This handles the loading and creation of kernel bitmaps to be filled in
00476                 subsequently by XPE bitmap properties.
00477     Errors:     -
00478     SeeAlso:    -
00479 
00480 ********************************************************************************************/
00481 
00482 BOOL BitmapRecordHandler::HandleXPEBitmapPlaceHolder(CXaraFileRecord* pCXaraFileRecord, INT32 Tag)
00483 {
00484     ERROR2IF(pCXaraFileRecord == NULL, FALSE,
00485                 "BitmapRecordHandler::HandleXPEBitmapPlaceHolder pCXaraFileRecord is NULL");
00486 
00487     BOOL ok = TRUE;
00488 
00489     // First get the name of the bitmap and other details stored in the record
00490 //  String_256 BitmapName;
00491 //  if (ok) ok = pCXaraFileRecord->ReadUnicode(&BitmapName);
00492 
00493     // Check that the Filter existed
00494     KernelBitmap* pBitmap = NULL;
00495 
00496     // We have no filter present to load it. In the case of RALPH and even in Camelot,
00497     // the best course of action will be to use a default bitmap instead.
00498     // In the case of Camelot, warn the user that this has happened.
00499     pBitmap = KernelBitmap::MakeKernelBitmap(NULL, NULL, TRUE);
00500 
00501     // Set the bitmap name
00502 //  pBitmap->ActualBitmap->SetName(BitmapName);
00503 
00504     // If have a genuine bitmap then add it to the loaded list
00505     // If the bitmap is null then the reference will use the default instead.
00506     if (pBitmap != NULL)
00507     {
00508         PORTNOTETRACE("other","HandleXPEBitmapPlaceHolder - Removed ImportedBitmaps usage");
00509 #ifndef EXCLUDE_FROM_XARALX
00510         pBmpComponent->GetImportList()->AddBitmap(pBitmap, pCXaraFileRecord->GetRecordNumber());
00511 #endif
00512     }
00513 
00514     return ok;
00515 }
00516 
00517 
00518 /********************************************************************************************
00519 
00520 >   virtual void BitmapRecordHandler::GetRecordDescriptionText(CXaraFileRecord* pRecord,StringBase* pStr)
00521 
00522     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00523     Created:    12/6/96
00524     Inputs:     pRecord = ptr to a record
00525                 pStr = ptr to string to update
00526     Returns:    -
00527     Purpose:    This provides descriptions for the define bitmap records.
00528     Errors:     -
00529     SeeAlso:    -
00530 
00531 ********************************************************************************************/
00532 
00533 #ifdef XAR_TREE_DIALOG
00534 void BitmapRecordHandler::GetRecordDescriptionText(CXaraFileRecord* pRecord, StringBase* pStr)
00535 {
00536     if (pStr == NULL || pRecord == NULL)
00537         return;
00538 
00539     // Call base class first
00540     // This outputs the tag and size
00541     CamelotRecordHandler::GetRecordDescriptionText(pRecord,pStr);
00542 
00543     UINT32 Tag = pRecord->GetTag();
00544     BOOL ok = TRUE;
00545     TCHAR s[340];
00546     INT32 RecordNumber = pRecord->GetRecordNumber();
00547 
00548     // If define bitmap records then read in the bitmap name
00549     String_256 BmpName; 
00550     String_256 BitmapDetails; 
00551     if (Tag >= TAG_DEFINEBITMAP_BMP && Tag <= TAG_DEFINEBITMAP_BMPZIP)
00552     {
00553         if (ok) ok = pRecord->ReadUnicode(&BmpName);//BmpName, BmpName.MaxLength());
00554         if (BmpName.Length() == 0)
00555             BmpName = _T("Unnamed\r\n\r\n");
00556         else
00557         {
00558             BitmapDetails = _T("Bitmap name:- ");
00559             BitmapDetails += BmpName;
00560             BitmapDetails += _T("\r\n\r\n");
00561         }
00562     }
00563 
00564     INT32 BitmapRecordRef = 0;
00565     INT32 StartColourRecordRef = 0;
00566     INT32 EndColourRecordRef = 0;
00567     DocCoord Parallel[4];       // 4 coords to represent the parallelogram that the shape fits in
00568     switch (Tag)
00569     {
00570     // Node bitmap records
00571         case TAG_NODE_BITMAP:
00572         {
00573             // Show details for that node bitmap
00574             if (ok) ok = pRecord->ReadCoord(&Parallel[0]);
00575             if (ok) ok = pRecord->ReadCoord(&Parallel[1]);
00576             if (ok) ok = pRecord->ReadCoord(&Parallel[2]);
00577             if (ok) ok = pRecord->ReadCoord(&Parallel[3]);
00578             if (ok) ok = pRecord->ReadINT32(&BitmapRecordRef);
00579             (*pStr) += _T("Node bitmap\r\n\r\n");
00580             camSprintf(s,_T("Bitmap reference : %d\r\n\r\n"),BitmapRecordRef);
00581             (*pStr) += s;
00582             (*pStr) += _T("\tNum\tX Coord\tY Coord\r\n");
00583             for (INT32 i = 0; i < 4; i++)
00584             {
00585                 camSprintf(s,_T("\t%d\t%d\t%d\r\n"),i,Parallel[i].x,Parallel[i].y);
00586                 (*pStr) += s;
00587             }
00588             break;
00589         }
00590         case TAG_NODE_CONTONEDBITMAP:
00591         {
00592             // Show details for that contoned node bitmap 
00593             if (ok) ok = pRecord->ReadCoord(&Parallel[0]);
00594             if (ok) ok = pRecord->ReadCoord(&Parallel[1]);
00595             if (ok) ok = pRecord->ReadCoord(&Parallel[2]);
00596             if (ok) ok = pRecord->ReadCoord(&Parallel[3]);
00597             if (ok) ok = pRecord->ReadINT32(&BitmapRecordRef);
00598             if (ok) ok = pRecord->ReadINT32(&StartColourRecordRef);
00599             if (ok) ok = pRecord->ReadINT32(&EndColourRecordRef);
00600             camSprintf(s,_T("Node contoned bitmap\r\n\r\n"));
00601             (*pStr) += s;
00602             camSprintf(s,_T("Bitmap reference :\t %d\r\n\r\n"),BitmapRecordRef);
00603             (*pStr) += s;
00604             camSprintf(s,_T("Start colour reference :\t %d\r\n\r\n"),StartColourRecordRef);
00605             (*pStr) += s;
00606             camSprintf(s,_T("End colour reference :\t %d\r\n\r\n"),EndColourRecordRef);
00607             (*pStr) += s;
00608             camSprintf(s,_T("\tNum\tX Coord\tY Coord\r\n"));
00609             (*pStr) += s;
00610             for (INT32 i = 0; i < 4; i++)
00611             {
00612                 camSprintf(s,_T("\t%d\t%d\t%d\r\n"),i,Parallel[i].x,Parallel[i].y);
00613                 (*pStr) += s;
00614             }
00615             break;
00616         }
00617     // Preview bitmap records
00618         case TAG_PREVIEWBITMAP_BMP:
00619             (*pStr) += _T("Preview bitmap type BMP\r\n\r\n");
00620             break;
00621         case TAG_PREVIEWBITMAP_GIF:
00622             (*pStr) += _T("Preview bitmap type GIF\r\n\r\n");
00623             break;
00624         case TAG_PREVIEWBITMAP_JPEG:
00625             (*pStr) += _T("Preview bitmap type JPEG\r\n\r\n");
00626             break;
00627         case TAG_PREVIEWBITMAP_PNG:
00628             (*pStr) += _T("Preview bitmap type PNG\r\n\r\n");
00629             break;
00630         case TAG_PREVIEWBITMAP_TIFFLZW:
00631             (*pStr) += _T("Preview bitmap type TIFF LZW\r\n\r\n");
00632             break;
00633     
00634     // Define bitmap records
00635         case TAG_DEFINEBITMAP_BMP:
00636             camSprintf(s,_T("Define BMP bitmap reference %d\r\n\r\n"),RecordNumber);
00637             (*pStr) += s;
00638             (*pStr) += BitmapDetails;
00639             break;
00640         case TAG_DEFINEBITMAP_GIF:
00641             camSprintf(s,_T("Define GIF bitmap reference %d\r\n\r\n"),RecordNumber);
00642             (*pStr) += s;
00643             (*pStr) += BitmapDetails;
00644             break;
00645         case TAG_DEFINEBITMAP_JPEG:
00646             camSprintf(s,_T("Define JPEG bitmap reference %d\r\n\r\n"),RecordNumber);
00647             (*pStr) += s;
00648             (*pStr) += BitmapDetails;
00649             break;
00650         case TAG_DEFINEBITMAP_PNG:
00651             camSprintf(s,_T("Define PNG bitmap reference %d\r\n\r\n"),RecordNumber);
00652             (*pStr) += s;
00653             (*pStr) += BitmapDetails;
00654             break;
00655         case TAG_DEFINEBITMAP_BMPZIP:
00656             camSprintf(s,_T("Define zipped BMP bitmap reference %d\r\n\r\n"),RecordNumber);
00657             (*pStr) += s;
00658             (*pStr) += BitmapDetails;
00659             break;
00660         case TAG_DEFINEBITMAP_JPEG8BPP:
00661         {
00662             camSprintf(s,_T("Define 8bpp JPEG bitmap reference %d\r\n\r\n"),RecordNumber);
00663             (*pStr) += s;
00664             (*pStr) += BitmapDetails;
00665             BYTE Entries = 0;
00666             if (ok) ok = pRecord->ReadBYTE(&Entries);
00667             camSprintf(s,_T("Palette entries %d\r\n\r\n"),Entries + 1);
00668             (*pStr) += s;
00669             break;
00670         }
00671         default:
00672             (*pStr) += _T("Unknown type of bitmap record\r\n");
00673             break;
00674     }
00675 
00676     return;
00677 }
00678 #endif // XAR_TREE_DIALOG
00679 
00680 //#endif // NEW_NATIVE_FILTER
00681 

Generated on Sat Nov 10 03:46:41 2007 for Camelot by  doxygen 1.4.4