BitmapEffectAtom Class Reference

Base class for all bitmap effect atoms. More...

#include <bfxatom.h>

Inheritance diagram for BitmapEffectAtom:

BitmapEffectBase ListItem CCObject SimpleCCObject BitmapEffectSILT List of all members.

Static Public Member Functions

static void Test (INT32 Value)
 Internal test routine.
static void Test2 (UndoableOperation *Op)

Static Protected Attributes

static INT32 TestValue = 0

Private Member Functions

 CC_DECLARE_DYNCREATE (BitmapEffectAtom)

Detailed Description

Base class for all bitmap effect atoms.

Author:
Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/10/1994
All bitmap effect atoms should be derived from this class

Definition at line 119 of file bfxatom.h.


Member Function Documentation

BitmapEffectAtom::CC_DECLARE_DYNCREATE BitmapEffectAtom   )  [private]
 

void BitmapEffectAtom::Test INT32  Value  )  [static]
 

Internal test routine.

Author:
Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/10/94
Parameters:
a value [INPUTS]
none [OUTPUTS]
Returns:
nothing

Errors: none

See also:
-
A test routine

Definition at line 677 of file bfxatom.cpp.

00678 {
00679     TRACEUSER( "Alex", _T("Value is %d\n"),Value);
00680     // Obtain the current selections
00681     TestValue=Value;
00682 }

void BitmapEffectAtom::Test2 UndoableOperation Op  )  [static]
 

Definition at line 684 of file bfxatom.cpp.

00685 {
00686      
00687     BOOL CarryOn=TRUE;
00688     Range Sel(*(GetApplication()->FindSelection()));
00689 
00690     Node* FirstSelectedNode = Sel.FindFirst(); 
00691     if (FirstSelectedNode != NULL) // No nodes selected so End
00692     {
00693         Node* CurrentNode = FirstSelectedNode;       
00694         Node* NextCurrent; 
00695         
00696         // Do all bitmaps
00697         while ((CurrentNode != NULL) && CarryOn)
00698         {
00699             NextCurrent = Sel.FindNext(CurrentNode);
00700             if  ( (CurrentNode->IsSelected()) && (CurrentNode->GetRuntimeClass() == CC_RUNTIME_CLASS(NodeBitmap)) ) 
00701             {         
00702                 KernelBitmap * pBitmap = ((NodeBitmap *)(CurrentNode))->GetBitmap();
00703                 BitmapInfo BMInfo;
00704                 UINT32 bpp;
00705                 pBitmap->ActualBitmap->GetInfo(&BMInfo);
00706                 bpp=BMInfo.PixelDepth;
00707                 
00708                 TRACEUSER( "Alex", _T("Bitmap found %d bpp\n"),bpp);
00709 
00710                 if ((bpp==32) || TRUE)
00711                 {
00712                     CarryOn = FALSE;
00713                     NodeBitmap *pNodeBitmap = new NodeBitmap;
00714                     if ((pNodeBitmap == NULL) || (!pNodeBitmap->SetUpPath(12,12)))
00715                         return;
00716 
00717                     Spread *pSpread;
00718                     DocCoord Origin;
00719 
00720                     // For now, position Draw objects on 1st page of spread 1
00721                     Node *pNode = (Document::GetSelected())->GetFirstNode()->FindNext()->FindFirstChild();
00722                     while ((pNode != NULL) && (!pNode->IsKindOf(CC_RUNTIME_CLASS(Chapter))))
00723                         pNode = pNode->FindNext();
00724         
00725                     ENSURE(pNode->IsKindOf(CC_RUNTIME_CLASS(Chapter)), 
00726                            "Filter::GetFirstSpread(): Could not find Chapter");
00727                     Chapter *pChapter = (Chapter *) pNode;
00728     
00729                     // pSpread is a child of pChapter
00730                     pSpread = (Spread *) pChapter->FindFirstChild();
00731                     ENSURE(pSpread->IsKindOf(CC_RUNTIME_CLASS(Spread)),
00732                            "Filter::GetFirstSpread(): Could not find Spread");
00733 
00734                     Page *pPage = (Page *) pSpread->FindFirstPageInSpread();
00735                     ENSURE(pPage->IsKindOf(CC_RUNTIME_CLASS(Page)),
00736                            "BaseBitmapFilter::DoImport(): Could not find first Page");
00737         
00738                     // Use bottom left of page as origin
00739                     DocRect PageRect = pPage->GetPageRect();
00740                     Origin = PageRect.lo;
00741     
00742                     KernelBitmap* kb = new KernelBitmap(BMInfo.PixelWidth,BMInfo.PixelHeight,32,100);
00743                     // Get a new bitmap object for this node.
00744                     pNodeBitmap->GetBitmapRef()->Attach(kb);
00745                     if (pNodeBitmap->GetBitmap() != kb)
00746                     {
00747                         // It didn't use the bitmap we gave it, so we can delete it
00748                         delete kb;
00749                     }
00750                         
00751                     ENSURE(pNodeBitmap->GetBitmap()->ActualBitmap != NULL, "No bitmap object found!");
00752                     
00753                     // Import worked - try to add the bitmap object into the tree.
00754                     // First, set the rectangle to the right size for the bitmap...
00755                     BitmapInfo Info;
00756                     pNodeBitmap->GetBitmap()->ActualBitmap->GetInfo(&Info);
00757 
00758                     DocRect BoundsRect;
00759                     BoundsRect.lo = Origin;
00760                     BoundsRect.hi.x = BoundsRect.lo.x + Info.RecommendedWidth;
00761                     BoundsRect.hi.y = BoundsRect.lo.y + Info.RecommendedHeight;
00762 
00763                     // And set this in our bitmap node
00764                     pNodeBitmap->CreateShape(BoundsRect);
00765 
00766                     // Apply some default attrs for the bitmap
00767                     // This Must be done before the NodeBitmap is inserted into the tree
00768                     if (!pNodeBitmap->ApplyDefaultBitmapAttrs(Op))
00769                     {
00770                         return;
00771                     }
00772                     
00773                     // Insert the node, but don't invalidate its region
00774                     if (!Op->DoInsertNewNode(pNodeBitmap, pSpread, FALSE))
00775                     {
00776                         // It didn't work - delete the sub-tree we just created, and report error.
00777                         delete pNodeBitmap;
00778                         return;
00779                     }
00780                                     
00781                     // Invalidate the region
00782                     Op->DoInvalidateNodeRegion(pNodeBitmap, TRUE, FALSE);
00783 
00784                     // Right, now we're going to do some processing...
00785                     BitmapEffectBase * pEffect;
00786 
00787                     pEffect=new /*TestBitmapEffect*/ BitmapEffectSILT;
00788 
00789                     pEffect->SetParameters();
00790                     pEffect->SetSourceImage(pBitmap);
00791                     pEffect->UseDestinationBitmap(pNodeBitmap->GetBitmap());
00792 
00793                     pEffect->Run();
00794 
00795                     pEffect->UseDestinationBitmap(NULL);
00796 
00797                     delete(pEffect);
00798                 }
00799             }
00800             CurrentNode = NextCurrent; 
00801         }
00802 
00803     } 
00804 
00805 //  if (CarryOn) BitmapEffectSILT::RunA();
00806 
00807     return;
00808 }


Member Data Documentation

INT32 BitmapEffectAtom::TestValue = 0 [static, protected]
 

Definition at line 130 of file bfxatom.h.


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