#include <fillattr2.h>
Inheritance diagram for AttrBitmapFill:
Public Member Functions | |
AttrBitmapFill () | |
AttrBitmapFill (Node *ContextNode, AttachNodeDirection Direction, BOOL Locked=FALSE, BOOL Mangled=FALSE, BOOL Marked=FALSE, BOOL Selected=FALSE) | |
virtual void | Transform (TransformBase &) |
Changes the Dpi of this bitmap by scaling the fill control points.Transform a grad fill attribute by moving the start and end points. | |
virtual BOOL | CanTransform () |
Indicate that this attribute can be transformed. | |
virtual void | TransformSelectedControlPoints (TransformBase &, BOOL *isARampBlob=NULL) |
Transform a grad fill attribute by moving the selected control points. | |
virtual AttributeValue * | GetAttributeValue ()=0 |
virtual void | RenderFillBlobs (RenderRegion *pRender) |
virtual void | RenderFillMesh (RenderRegion *, DocCoord *, BOOL *, INT32 NumControlPoints=0) |
virtual void | OnControlDrag (DocCoord, FillControl &, ClickModifiers) |
virtual void | SetAspectRatio (double Ratio) |
virtual void | DrawEndBlobs () |
Draws the blobs on the ends of the fill arrows. | |
virtual FillControl | CheckForControlHit (DocCoord &) |
Check to see if a click was on a Fill Control Point. | |
virtual BOOL | ChangeControlTransp (AttrTranspChange *) |
Applies a colour to selected Fill Control Points. | |
virtual BOOL | ChangeControlColour (AttrColourChange *) |
Applies a colour to selected Fill Control Points. | |
virtual DocRect | GetBlobBoundingRect () |
Calculates the bounding rectangle of the attrs blobs.This should always be calculated on the fly as the view scale can change without the attr knowing, giving an incorrect result. | |
virtual BOOL | HidingNode () |
This virtual function is called whenever the node is hidden. It allows the node do things like 'optimise' itself to use less memory or send a message to let others know it is being hidden etc. | |
virtual BOOL | ShowingNode () |
This virtual function is called whenever the node is re-shown after being Hidden. It allows the node to reconstruct itself if it was optimised or send a message to let others know it is back etc. | |
virtual FillControl | TestColourDrop (AttrColourDrop *) |
Check to see which colour will be changed if dropped at this point. | |
virtual BOOL | IsABitmapFill () const |
Virtual function for determining if the node is an attribute. | |
virtual BOOL | IsAGradFill () const |
Virtual function for determining if the node is an attribute. | |
virtual KernelBitmap * | EnumerateBitmaps (UINT32 Count) |
Find out what bitmaps, if any, are used by this node. | |
virtual double | GetEffectiveBitmapMinDPI (KernelBitmap *pBitmap) |
Returns the minimum effective dpi this bitmap is used at. | |
virtual BOOL | ReplaceBitmap (KernelBitmap *pOrigBitmap, KernelBitmap *pNewBitmap) |
virtual BOOL | NeedsForceToSimpleMapping () |
virtual BOOL | NeedsToRenderAtEachBrushStroke () const |
So that don't have to keep re-rendering attributes whilst drawing a brush, this identifies whether or not the attribute need to be rendered at each step, e.g. radial fills. | |
virtual BOOL | IsTypeExtendible () const |
virtual DocRect | ValidateExtend (const ExtendParams &ExtParams) |
Determine whether applying an extend to this Node is a reversible process. | |
virtual void | Extend (const ExtendParams &ExtParams) |
Perform an extend operation on this fill node. | |
virtual void | TransformTranslateObject (const ExtendParams &ExtParams) |
Translate this bitmap fill, according to the offsets and flags defined in ExtParams, and a reference centre, defined by NodeRenderable::FindExtendCentre(). This function does nothing unless ExtParams uses X_EXTEND or Y_EXTEND. | |
virtual INT32 | GetNumberOfControlPoints () |
virtual NodeAttribute * | GetOtherAttrToApply (BOOL *IsMutate) |
Some attributes require a secondary atribute to be changed when they are changed. This routine obtains a pointer to the secondary attribute to apply. | |
Protected Member Functions | |
virtual void | ValidateAttributeValue () |
Makes sure the Coords of the Fill are sensible. Defaults to natural size of the bitmap. | |
BOOL | CopyNodeContents (AttrBitmapFill *NodeCopy) |
This method copies the node's contents to the node pointed to by NodeCopy. |
Definition at line 1804 of file fillattr2.h.
|
Definition at line 1809 of file fillattr2.h. 01809 : AttrFillGeometry() {}
|
|
Definition at line 1810 of file fillattr2.h. 01815 : 01816 AttrFillGeometry(ContextNode, Direction, Locked, Mangled, Marked, Selected) {}
|
|
Indicate that this attribute can be transformed.
Reimplemented from NodeRenderable. Reimplemented in AttrFractalFill. Definition at line 13997 of file fillattr.cpp. 13998 { 13999 return TRUE; 14000 }
|
|
Applies a colour to selected Fill Control Points.
Reimplemented from AttrFillGeometry. Reimplemented in AttrBitmapColourFill, and AttrTextureColourFill. Definition at line 1835 of file fillattr2.h. 01835 { return FALSE; }
|
|
Applies a colour to selected Fill Control Points.
Reimplemented from AttrFillGeometry. Reimplemented in AttrBitmapTranspFill, and AttrTextureTranspFill. Definition at line 1834 of file fillattr2.h. 01834 { return FALSE; }
|
|
Check to see if a click was on a Fill Control Point.
Reimplemented from AttrFillGeometry. Reimplemented in AttrTextureColourFill, and AttrTextureTranspFill. Definition at line 14041 of file fillattr.cpp. 14042 { 14043 #if !defined(EXCLUDE_FROM_RALPH) 14044 if (!GetApplication()->GetBlobManager()->GetCurrentInterest().Fill || !IsVisible()) 14045 return FILLCONTROL_NULL; 14046 14047 // Set up a default, that indicates not control points hit 14048 FillControl HitControl = FILLCONTROL_NULL; 14049 DocRect BlobRect; 14050 14051 DocCoord StartPoint = *GetStartPoint(); 14052 DocCoord EndPoint = *GetEndPoint(); 14053 DocCoord EndPoint2 = *GetEndPoint2(); 14054 14055 // Bodge Alert !! 14056 14057 // Bitmap fills have a complicated control point system. 14058 // The actual control points needed for rendering are the Bottom Left, 14059 // Top Left, and Bottom Right points of the bitmap. But on screen the 14060 // points seen and moved are the Centre, Middle Right, and Middle Top. 14061 // So we need to convert the click points into vitual points before 14062 // we do the hit test. 14063 14064 DocCoord CentrePoint; 14065 DocCoord Drag2Blob; 14066 DocCoord Drag3Blob; 14067 14068 GetBitmapVirtualPoints(StartPoint, EndPoint, EndPoint2, 14069 &CentrePoint, &Drag2Blob, &Drag3Blob); 14070 14071 // Get the rectangle around the Centre Control Point 14072 (Camelot.GetBlobManager())->GetBlobRect(CentrePoint, &BlobRect); 14073 // See if the Click Position is within the rectangle 14074 if ( BlobRect.ContainsCoord(ClickPos) ) 14075 HitControl = FILLCONTROL_STARTPOINT; 14076 14077 // Get the rectangle around the First End Point 14078 (Camelot.GetBlobManager())->GetBlobRect(Drag2Blob, &BlobRect); 14079 // See if the Click Position is within the rectangle 14080 if ( BlobRect.ContainsCoord(ClickPos) ) 14081 HitControl = FILLCONTROL_ENDPOINT; 14082 14083 // Get the rectangle around the Second End Point 14084 (Camelot.GetBlobManager())->GetBlobRect(Drag3Blob, &BlobRect); 14085 // See if the Click Position is within the rectangle 14086 if ( BlobRect.ContainsCoord(ClickPos) ) 14087 HitControl = FILLCONTROL_SECONDARYPOINT; 14088 14089 return HitControl; 14090 #else 14091 return FILLCONTROL_NULL; 14092 #endif 14093 }
|
|
This method copies the node's contents to the node pointed to by NodeCopy.
Definition at line 14015 of file fillattr.cpp. 14016 { 14017 ERROR2IF(NodeCopy == NULL, FALSE, "NULL pointer in AttrBitmapFill::CopyNodeContents!"); 14018 14019 AttrFillGeometry::CopyNodeContents( NodeCopy ); 14020 14021 // Copy contents specific to derived class here 14022 return TRUE; 14023 }
|
|
Draws the blobs on the ends of the fill arrows.
Reimplemented from AttrFillGeometry. Definition at line 14544 of file fillattr.cpp. 14545 { 14546 #if !defined(EXCLUDE_FROM_RALPH) 14547 Node *pNode = this; 14548 while ((pNode != NULL) && !pNode->IsKindOf(CC_RUNTIME_CLASS(Spread))) 14549 pNode = pNode->FindParent(); 14550 14551 if (pNode == NULL) 14552 return; // We're not really in the tree 14553 14554 Spread* pSpread = (Spread*)pNode; 14555 14556 DocRect Bounds = GetBlobBoundingRect(); 14557 14558 DocCoord Start = *GetStartPoint(); 14559 DocCoord End = *GetEndPoint(); 14560 DocCoord End2 = *GetEndPoint2(); 14561 14562 GetBitmapVirtualPoints(Start, End, End2, 14563 &Start, &End, &End2); 14564 14565 RenderRegion* pRender = DocView::RenderOnTop(&Bounds, pSpread, UnclippedEOR); 14566 while (pRender) 14567 { 14568 // Draw a blob at the start point 14569 if (IsSelected(FILLCONTROL_STARTPOINT)) 14570 { 14571 // Draw Selected Blob 14572 // pRender->SetLineColour(COLOUR_SELECTEDBLOB); 14573 pRender->SetLineColour(COLOUR_NONE); 14574 pRender->SetFillColour(COLOUR_SELECTEDBLOB); 14575 pRender->DrawBlob(Start, BT_SELECTED); 14576 } 14577 else 14578 { 14579 // Draw Unselected Blob 14580 // pRender->SetLineColour(COLOUR_UNSELECTEDBLOB); 14581 pRender->SetLineColour(COLOUR_NONE); 14582 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB); 14583 pRender->DrawBlob(Start, BT_UNSELECTED); 14584 } 14585 14586 // Draw a blob at the end point 14587 if (IsSelected(FILLCONTROL_ENDPOINT)) 14588 { 14589 // Draw Selected Blob 14590 // pRender->SetLineColour(COLOUR_SELECTEDBLOB); 14591 pRender->SetLineColour(COLOUR_NONE); 14592 pRender->SetFillColour(COLOUR_SELECTEDBLOB); 14593 pRender->DrawBlob(End, BT_SELECTED); 14594 pRender->DrawBlob(End2, BT_SELECTED); 14595 } 14596 else 14597 { 14598 // Draw Unselected Blob 14599 // pRender->SetLineColour(COLOUR_UNSELECTEDBLOB); 14600 pRender->SetLineColour(COLOUR_NONE); 14601 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB); 14602 pRender->DrawBlob(End, BT_UNSELECTED); 14603 pRender->DrawBlob(End2, BT_UNSELECTED); 14604 } 14605 14606 // Get the Next render region 14607 pRender = DocView::GetNextOnTop(&Bounds); 14608 } 14609 14610 // Bodge to stop fill meshes EOR each other out. 14611 AttrFillGeometry::LastRenderedMesh = NULL; 14612 #endif 14613 }
|
|
Find out what bitmaps, if any, are used by this node.
This function supports nodes that use more than one bitmap - you call this function repeatedly and keep incrementing the Count parameter that you pass in each time by 1. You should stop calling it when it returns NULL, as this indicates that no more bitmaps are used by this node. Count should start off as 0 for the first call. Note that this function can (and often will) return NULL for the first call, as many nodes don't use bitmaps, obviously.
Reimplemented from Node. Definition at line 5599 of file fillattr.cpp. 05600 { 05601 if (IsAFractalFill()) 05602 return NULL; 05603 05604 if (Count == 0) 05605 return GetBitmap(); 05606 05607 return NULL; 05608 }
|
|
Perform an extend operation on this fill node.
Reimplemented from AttrFillGeometry. Definition at line 14664 of file fillattr.cpp. 14665 { 14666 // a bitmap fill's behaviour depends upon what it is applied to: 14667 // non-path with EXTEND :: do nothing - its parent will transform it correctly. 14668 // path node with EXTEND :: translate itself; remember that its parent has moved 14669 // its centre by ExtParams.doccOffset already. 14670 // any node with STRETCH :: we need to unstretch ourself... 14671 // it is assumed here, though this may not always be true, that the fill's parent node 14672 // is the node to which it is applied. 14673 Node* pParent = FindParent(); 14674 if (pParent != NULL) 14675 if (pParent->IsNodePath() || pParent->IsCompound()) 14676 TransformTranslateObject(ExtParams); 14677 14678 // if we are asked to stretch, we must first undo any stretch which was done to us by the 14679 // node we are applied to. then we must translate ourself, so that we maintain our place, 14680 // relative to the centre of the button. 14681 14682 14683 // we do all of this because this is what would be expected for a texture on a button. 14684 // the texture should _not_ stretch if the button stretches, but _should_ move around 14685 // with the button. 14686 // if the button stretches and moves, we arbitrarily decided that the fill should remain 14687 // in the same position relative to the scale-reference coord of the button - see 14688 // definition of ExtendParams for details. 14689 ExtendParams eps = ExtParams; 14690 eps.xscale = 1 / eps.xscale; // 14691 eps.yscale = 1 / eps.yscale; // ie, 'undo the stretch, but leave 14692 eps.doccScaleStart = ExtParams.doccScaleEnd; // us where the stretch put us." 14693 eps.doccScaleEnd = ExtParams.doccScaleEnd; // 14694 TransformStretchObject(eps); 14695 }
|
|
Implements AttrFillGeometry. Implemented in AttrBitmapColourFill, AttrBitmapTranspFill, AttrTextureColourFill, AttrFractalColourFill, AttrNoiseColourFill, AttrTextureTranspFill, AttrFractalTranspFill, and AttrNoiseTranspFill. |
|
Calculates the bounding rectangle of the attrs blobs.This should always be calculated on the fly as the view scale can change without the attr knowing, giving an incorrect result.
Reimplemented from AttrFillGeometry. Definition at line 14460 of file fillattr.cpp. 14461 { 14462 #if !defined(EXCLUDE_FROM_RALPH) 14463 // Optimisation. If there is currently no interest in Fill Blobs 14464 // and this fill is not being Dragged (Fill blobs are turned off during 14465 // a fill drag), then we needn't bother doing anything. 14466 if ( (!GetApplication()->GetBlobManager()->GetCurrentInterest(TRUE).Fill || !IsVisible()) && DraggedFill != this ) 14467 return DocRect(0,0, 0,0); 14468 14469 // Get the Start and End Points 14470 DocCoord StartPoint = *GetStartPoint(); 14471 DocCoord EndPoint = *GetEndPoint(); 14472 DocCoord EndPoint2 = *GetEndPoint2(); 14473 14474 // Work out the Virtual Coords 14475 GetBitmapVirtualPoints(StartPoint, EndPoint, EndPoint2, 14476 &StartPoint, &EndPoint, &EndPoint2); 14477 14478 // Make a dummy bounds from just the Start Point 14479 DocRect BoundingRect(StartPoint, StartPoint); 14480 14481 if (DraggedFill == this) 14482 { 14483 // This fill is being dragged, so we have to include the Parallelagram 14484 // bounding rect as well 14485 DocRect StartBlobRect; 14486 DocRect EndBlobRect; 14487 DocRect DragRect = GetParallelagramBounds(StartPoint, EndPoint, EndPoint2); 14488 14489 // Get the Bounding rect of Blobs on each of the ends 14490 (Camelot.GetBlobManager())->GetBlobRect(DragRect.lo, &StartBlobRect); 14491 (Camelot.GetBlobManager())->GetBlobRect(DragRect.hi, &EndBlobRect); 14492 14493 // Now include the Bottom Left and Top Right of each blob in the Bounds. 14494 // We have to do it like this to make sure that the DocRect's coords 14495 // are valid. ie. The Hi's are Higher than the Lo's. 14496 BoundingRect.IncludePoint(StartBlobRect.lo); 14497 BoundingRect.IncludePoint(StartBlobRect.hi); 14498 BoundingRect.IncludePoint(EndBlobRect.lo); 14499 BoundingRect.IncludePoint(EndBlobRect.hi); 14500 } 14501 else 14502 { 14503 // We're not being dragged, so just calc the bounds of the Start and End Blobs 14504 DocRect StartBlobRect; 14505 DocRect EndBlobRect; 14506 DocRect End2BlobRect; 14507 14508 // Get the Bounding rect of the Fill Line, including the Blobs on the ends 14509 (Camelot.GetBlobManager())->GetBlobRect(StartPoint, &StartBlobRect); 14510 (Camelot.GetBlobManager())->GetBlobRect(EndPoint, &EndBlobRect); 14511 (Camelot.GetBlobManager())->GetBlobRect(EndPoint2, &End2BlobRect); 14512 14513 // Now include the Bottom Left and Top Right of each blob in the Bounds. 14514 // We have to do it like this to make sure that the DocRect's coords 14515 // are valid. ie. The Hi's are Higher than the Lo's. 14516 BoundingRect.IncludePoint(StartBlobRect.lo); 14517 BoundingRect.IncludePoint(StartBlobRect.hi); 14518 BoundingRect.IncludePoint(EndBlobRect.lo); 14519 BoundingRect.IncludePoint(EndBlobRect.hi); 14520 BoundingRect.IncludePoint(End2BlobRect.lo); 14521 BoundingRect.IncludePoint(End2BlobRect.hi); 14522 } 14523 14524 IncludeArrowHead(&BoundingRect, StartPoint, EndPoint); 14525 IncludeArrowHead(&BoundingRect, StartPoint, EndPoint2); 14526 14527 // and return it 14528 return BoundingRect; 14529 #else 14530 return DocRect(0,0,0,0); 14531 #endif 14532 }
|
|
Returns the minimum effective dpi this bitmap is used at.
Reimplemented from Node. Definition at line 5656 of file fillattr.cpp. 05657 { 05658 if (!IsAFractalFill() && GetBitmap() == pBitmap) 05659 { 05660 // Do we have a valid bitmap ? 05661 OILBitmap *OilBM = pBitmap->ActualBitmap; 05662 if (OilBM != NULL) 05663 { 05664 BitmapInfo Info; 05665 OilBM->GetInfo(&Info); 05666 05667 // Get the Width of the Bitmap in Pixels 05668 INT32 PixWidth = Info.PixelWidth; 05669 INT32 PixHeight = Info.PixelHeight; 05670 05671 DocCoord Start(*GetStartPoint()); 05672 DocCoord End(*GetEndPoint()); 05673 DocCoord End2(*GetEndPoint2()); 05674 05675 // Get the Width of the Bitmap in Millipoints 05676 INT32 Width = INT32(Start.Distance(End)); 05677 INT32 Height = INT32(Start.Distance(End2)); 05678 05679 // Use doubles so that we can round up as well as down. This improves 05680 // the dpi calculated. 05681 double HDpi = 0; 05682 double VDpi = 0; 05683 05684 if (Width > 0) 05685 HDpi = ((double)PixWidth * 72000.0)/(double)Width; 05686 05687 if (Height > 0) 05688 VDpi = ((double)PixHeight * 72000.0)/(double)Height; 05689 05690 // Use the smaller of the two dpi values 05691 if (HDpi < VDpi) 05692 return(HDpi); 05693 else 05694 return(VDpi); 05695 } 05696 } 05697 05698 return(1e9); 05699 }
|
|
Reimplemented from AttrFillGeometry. Definition at line 1869 of file fillattr2.h.
|
|
Some attributes require a secondary atribute to be changed when they are changed. This routine obtains a pointer to the secondary attribute to apply.
Reimplemented from NodeAttribute. Reimplemented in AttrFractalFill. Definition at line 5715 of file fillattr.cpp. 05716 { 05717 ERROR3IF(IsMutate == NULL, "NULL flag pointer passed to GetOtherAttrToApply"); 05718 05719 // A bitmap fill change also needs to set the mapping to repeating .... 05720 05721 NodeAttribute* OtherAttr = NULL; 05722 05723 if (GetAttributeType() == CC_RUNTIME_CLASS(AttrFillGeometry)) 05724 { 05725 OtherAttr = new AttrFillMappingLinear; 05726 } 05727 else 05728 { 05729 OtherAttr = new AttrTranspFillMappingLinear; 05730 } 05731 05732 if (OtherAttr == NULL) 05733 { 05734 return (NULL); 05735 } 05736 05737 ((AttrFillMappingLinear*) OtherAttr)->SetRepeat(RT_Repeating); 05738 05739 *IsMutate = FALSE; 05740 05741 return OtherAttr; 05742 }
|
|
This virtual function is called whenever the node is hidden. It allows the node do things like 'optimise' itself to use less memory or send a message to let others know it is being hidden etc.
Reimplemented from Node. Reimplemented in AttrFractalFill. Definition at line 13787 of file fillattr.cpp. 13788 { 13789 // Call the base class first 13790 if (!AttrFillGeometry::HidingNode()) 13791 return FALSE; 13792 13793 GetBitmapRef()->RemoveFromTree(); 13794 13795 return TRUE; 13796 }
|
|
Virtual function for determining if the node is an attribute.
Reimplemented from NodeAttribute. Reimplemented in AttrBitmapColourFill. Definition at line 1844 of file fillattr2.h. 01844 { return TRUE; }
|
|
Virtual function for determining if the node is an attribute.
Reimplemented from NodeAttribute. Definition at line 1845 of file fillattr2.h. 01845 { return TRUE; }
|
|
Reimplemented from AttrFillGeometry. Definition at line 1860 of file fillattr2.h. 01860 { return TRUE; }
|
|
Reimplemented from AttrFillGeometry. Definition at line 1851 of file fillattr2.h. 01851 { return(FALSE); }
|
|
So that don't have to keep re-rendering attributes whilst drawing a brush, this identifies whether or not the attribute need to be rendered at each step, e.g. radial fills.
Reimplemented from NodeAttribute. Definition at line 1853 of file fillattr2.h. 01853 { return FALSE;}
|
|
Reimplemented from AttrFillGeometry. Reimplemented in AttrTextureColourFill, and AttrTextureTranspFill. Definition at line 14108 of file fillattr.cpp. 14109 { 14110 #if !defined(EXCLUDE_FROM_RALPH) 14111 // Get the current Control Point Positions 14112 DocCoord StartPoint = *GetStartPoint(); 14113 DocCoord EndPoint = *GetEndPoint(); 14114 DocCoord EndPoint2 = *GetEndPoint2(); 14115 14116 DocCoord CentrePoint; 14117 DocCoord Drag2Blob; 14118 DocCoord Drag3Blob; 14119 14120 // Bodge Alert !! 14121 14122 // Bitmap fills have a complicated control point system. 14123 // The actual control points needed for rendering are the Bottom Left, 14124 // Top Left, and Bottom Right points of the bitmap. But on screen the 14125 // points seen and moved are the Centre, Middle Right, and Middle Top. 14126 // So we need to convert the click points into vitual points before 14127 // we start dragging them about. 14128 14129 GetBitmapVirtualPoints(StartPoint, EndPoint, EndPoint2, 14130 &CentrePoint, &Drag2Blob, &Drag3Blob); 14131 14132 INT32 dx, dy; 14133 14134 // Which control is being dragged ? 14135 switch (DragControl) 14136 { 14137 case FILLCONTROL_STARTPOINT: 14138 14139 // They're dragging the Centre Point 14140 dx = CentrePoint.x - Pos.x; 14141 dy = CentrePoint.y - Pos.y; 14142 // Move the other points relative 14143 Drag2Blob.translate(-dx, -dy); 14144 Drag3Blob.translate(-dx, -dy); 14145 CentrePoint = Pos; 14146 break; 14147 14148 case FILLCONTROL_ENDPOINT: 14149 14150 // If the Constrain key is down then constrain the Angle of the 14151 // point, relative to the centre position. 14152 if (ClickMods.Constrain) 14153 DocView::ConstrainToAngle(CentrePoint, &Pos); 14154 14155 if (ClickMods.Adjust) 14156 { 14157 // Shift is pressed, so lock the aspect ratio of the bitmap mesh 14158 double OldLen = CentrePoint.Distance(Drag2Blob); 14159 double NewLen = CentrePoint.Distance(Pos); 14160 double Ratio = 1.0; 14161 14162 if (OldLen == 0) 14163 Ratio = 0; 14164 else 14165 Ratio = NewLen/OldLen; 14166 14167 // Calculate the new point based on the aspect ratio 14168 Drag3Blob = 14169 MakeLineAtAngle(CentrePoint, Pos, 90, INT32(CentrePoint.Distance(Drag3Blob) * Ratio)); 14170 } 14171 14172 Drag2Blob = Pos; 14173 break; 14174 14175 case FILLCONTROL_SECONDARYPOINT: 14176 14177 // If the Constrain key is down then constrain the Angle of the 14178 // point, relative to the centre position. 14179 if (ClickMods.Constrain) 14180 DocView::ConstrainToAngle(CentrePoint, &Pos); 14181 14182 if (ClickMods.Adjust) 14183 { 14184 // Shift is pressed, so lock the aspect ratio of the bitmap mesh 14185 double OldLen = CentrePoint.Distance(Drag3Blob); 14186 double NewLen = CentrePoint.Distance(Pos); 14187 double Ratio = 1.0; 14188 14189 if (OldLen == 0) 14190 Ratio = 0; 14191 else 14192 Ratio = NewLen/OldLen; 14193 14194 // Calculate the new point based on the aspect ratio 14195 Drag2Blob = 14196 MakeLineAtAngle(CentrePoint, Pos, -90, INT32(CentrePoint.Distance(Drag2Blob) * Ratio)); 14197 } 14198 14199 Drag3Blob = Pos; 14200 break; 14201 } 14202 14203 // Now we have to convert the Virtual Coords back into real 14204 // bitmap control points. 14205 TRACEUSER( "Mike", _T("Centre at %d,%d\n"), CentrePoint.x, CentrePoint.y); 14206 14207 GetBitmapRealPoints(CentrePoint, Drag2Blob, Drag3Blob, 14208 &StartPoint, &EndPoint, &EndPoint2); 14209 14210 // Store the new points back in the Fill 14211 SetStartPoint(&StartPoint); 14212 SetEndPoint(&EndPoint); 14213 SetEndPoint2(&EndPoint2); 14214 #endif 14215 }
|
|
Reimplemented from AttrFillGeometry. Reimplemented in AttrBitmapColourFill, AttrBitmapTranspFill, AttrTextureColourFill, and AttrTextureTranspFill. Definition at line 1825 of file fillattr2.h.
|
|
Reimplemented from AttrFillGeometry. Reimplemented in AttrBitmapColourFill, AttrBitmapTranspFill, AttrTextureColourFill, and AttrTextureTranspFill. Definition at line 14356 of file fillattr.cpp. 14359 { 14360 #if !defined(EXCLUDE_FROM_RALPH) 14361 DocCoord StartPoint = ControlPoints[FILLCONTROL_STARTPOINT]; 14362 DocCoord EndPoint = ControlPoints[FILLCONTROL_ENDPOINT]; 14363 14364 if (StartPoint == EndPoint) 14365 return; 14366 14367 if (SelState == NULL) 14368 { 14369 // If no selection state passed in, then assume 14370 // all the points are deselected 14371 BOOL Selected[NUMCONTROLPOINTS]; 14372 for (INT32 i=0; i< NumControlPoints; i++) 14373 { 14374 Selected[i] = FALSE; 14375 } 14376 SelState = Selected; 14377 } 14378 14379 DocCoord EndPoint2 = ControlPoints[FILLCONTROL_SECONDARYPOINT]; 14380 14381 DocCoord Start; 14382 DocCoord End; 14383 DocCoord End2; 14384 14385 // Work out the Virtual positions of the Bitmap Controls 14386 GetBitmapVirtualPoints(StartPoint, EndPoint, EndPoint2, 14387 &Start, &End, &End2); 14388 14389 // Remember what attributes were here before 14390 pRender->SaveContext(); 14391 14392 // Get the current blob size in Doc Units 14393 INT32 BlobSize = (Camelot.GetBlobManager())->GetBlobSize(); 14394 14395 // Calculate the Arrow on the End of the Line 14396 Path ArrowPath; 14397 ArrowPath.Initialise(); 14398 DocCoord LineEnd; 14399 MakeMeshArrow(&ArrowPath, Start, End, &LineEnd); 14400 14401 // Calculate the Arrow on the End of the Line2 14402 Path ArrowPath2; 14403 ArrowPath2.Initialise(); 14404 DocCoord LineEnd2; 14405 MakeMeshArrow(&ArrowPath2, Start, End2, &LineEnd2); 14406 14407 // Set the line colours etc as we need them 14408 pRender->SetLineWidth(0); 14409 pRender->SetLineColour(COLOUR_UNSELECTEDBLOB); 14410 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB); 14411 14412 // First Draw the Line 14413 pRender->SetLineWidth(BlobSize/4); 14414 pRender->DrawLine(Start, LineEnd); 14415 14416 // Draw the secondary line 14417 pRender->DrawLine(Start, LineEnd2); 14418 14419 // Render an Arrow at the end of the line 14420 pRender->SetLineWidth(0); 14421 pRender->SetLineColour(COLOUR_NONE); 14422 pRender->DrawPath(&ArrowPath); 14423 14424 // and on the end of the secondary line 14425 pRender->DrawPath(&ArrowPath2); 14426 14427 if (DraggedFill == this) 14428 { 14429 // If we are being dragged then draw a Parallelgram to 14430 // show the shape of the bitmap 14431 pRender->SetLineColour(COLOUR_SELECTEDBLOB); 14432 pRender->SetFillColour(COLOUR_NONE); 14433 14434 Path ParaPath; 14435 ParaPath.Initialise(); 14436 MakeMeshParallelagram(&ParaPath, Start, End, End2); 14437 14438 // Draw the parallelagram 14439 pRender->DrawPath(&ParaPath); 14440 } 14441 14442 // Put all the old attributes back 14443 pRender->RestoreContext(); 14444 #endif 14445 }
|
|
Reimplemented from Node. Definition at line 5625 of file fillattr.cpp. 05626 { 05627 if (!IsAFractalFill()) 05628 { 05629 if (GetBitmap() == pOrigBitmap) 05630 { 05631 BitmapFillAttribute* pVal = (BitmapFillAttribute*)GetAttributeValue(); 05632 if (pVal) 05633 pVal->GetBitmapRef()->Attach(pNewBitmap); 05634 05635 return(TRUE); 05636 } 05637 } 05638 05639 return FALSE; 05640 }
|
|
Reimplemented from AttrFillGeometry. Reimplemented in AttrFractalFill. Definition at line 14217 of file fillattr.cpp. 14218 { 14219 #if !defined(EXCLUDE_FROM_RALPH) 14220 // Get the current Control Point Positions 14221 DocCoord StartPoint = *GetStartPoint(); 14222 DocCoord EndPoint = *GetEndPoint(); 14223 DocCoord EndPoint2 = *GetEndPoint2(); 14224 14225 DocCoord CentrePoint; 14226 DocCoord Drag2Blob; 14227 DocCoord Drag3Blob; 14228 14229 GetBitmapVirtualPoints(StartPoint, EndPoint, EndPoint2, 14230 &CentrePoint, &Drag2Blob, &Drag3Blob); 14231 14232 Drag3Blob = MakeLineAtAngle(CentrePoint, 14233 Drag2Blob, 14234 90, 14235 INT32(CentrePoint.Distance(Drag2Blob) * Ratio) 14236 ); 14237 14238 GetBitmapRealPoints(CentrePoint, Drag2Blob, Drag3Blob, 14239 &StartPoint, &EndPoint, &EndPoint2); 14240 14241 // Store the new points back in the Fill 14242 SetStartPoint(&StartPoint); 14243 SetEndPoint(&EndPoint); 14244 SetEndPoint2(&EndPoint2); 14245 #endif 14246 }
|
|
This virtual function is called whenever the node is re-shown after being Hidden. It allows the node to reconstruct itself if it was optimised or send a message to let others know it is back etc.
Reimplemented from Node. Reimplemented in AttrFractalFill. Definition at line 13814 of file fillattr.cpp. 13815 { 13816 // Call the base class first 13817 if (!AttrFillGeometry::ShowingNode()) 13818 return FALSE; 13819 13820 GetBitmapRef()->AddtoTree(); 13821 13822 return TRUE; 13823 }
|
|
Check to see which colour will be changed if dropped at this point.
Reimplemented from AttrFillGeometry. Definition at line 5569 of file fillattr.cpp. 05570 { 05571 return AttrFillGeometry::TestColourDrop(ColDrop); 05572 }
|
|
Changes the Dpi of this bitmap by scaling the fill control points.Transform a grad fill attribute by moving the start and end points.
Reimplemented from NodeRenderable. Reimplemented in AttrFractalFill. Definition at line 13920 of file fillattr.cpp. 13921 { 13922 if ( Trans.TransFills ) 13923 { 13924 Trans.Transform( GetStartPoint(), 1); 13925 Trans.Transform( GetEndPoint(), 1); 13926 Trans.Transform( GetEndPoint2(), 1); 13927 Trans.Transform( GetEndPoint3(), 1); 13928 13929 // ValidateAttributeValue(); 13930 } 13931 }
|
|
Transform a grad fill attribute by moving the selected control points.
Reimplemented from AttrFillGeometry. Definition at line 13945 of file fillattr.cpp. 13946 { 13947 #if !defined(EXCLUDE_FROM_RALPH) 13948 if ( Trans.TransFills ) 13949 { 13950 ClickModifiers ClickMods; /* = ClickModifiers::GetClickModifiers();*/ 13951 ClickMods.Adjust = TRUE; 13952 13953 DocCoord StartPoint = *GetStartPoint(); 13954 DocCoord EndPoint = *GetEndPoint(); 13955 DocCoord EndPoint2 = *GetEndPoint2(); 13956 13957 DocCoord CentrePoint; 13958 DocCoord Drag2Blob; 13959 DocCoord Drag3Blob; 13960 13961 GetBitmapVirtualPoints(StartPoint, EndPoint, EndPoint2, 13962 &CentrePoint, &Drag2Blob, &Drag3Blob); 13963 13964 if (GetStartPoint() && IsSelected(FILLCONTROL_STARTPOINT)) 13965 { 13966 Trans.Transform( &CentrePoint, 1); 13967 13968 FillControl Start = FILLCONTROL_STARTPOINT; 13969 13970 OnControlDrag(CentrePoint, Start, ClickMods); 13971 } 13972 13973 if (GetEndPoint() && IsSelected(FILLCONTROL_ENDPOINT)) 13974 { 13975 Trans.Transform( &Drag2Blob, 1); 13976 13977 FillControl End = FILLCONTROL_ENDPOINT; 13978 13979 OnControlDrag(Drag2Blob, End, ClickMods); 13980 } 13981 } 13982 #endif 13983 }
|
|
Translate this bitmap fill, according to the offsets and flags defined in ExtParams, and a reference centre, defined by NodeRenderable::FindExtendCentre(). This function does nothing unless ExtParams uses X_EXTEND or Y_EXTEND.
See also: The Extender class; FindExtendCentre(). Reimplemented from AttrFillGeometry. Definition at line 14718 of file fillattr.cpp. 14719 { 14720 DocCoord doccCentre = FindExtendCentre(); 14721 14722 // x-extension - we move the whole Node; behaviour determined by its centre. 14723 if (ExtParams.fExtendFlags & X_EXTEND) 14724 { 14725 // if our parent is a group, then it won't have applied any offset parameter to us, 14726 // so we need to do this ourself. 14727 Node* pParent = FindParent(); 14728 if (pParent != NULL && pParent->IsCompound()) 14729 { 14730 Trans2DMatrix baseXoffset(ExtParams.doccOffset.x, 0); 14731 Transform(baseXoffset); 14732 } 14733 14734 // we only move anything if we're outside a buffer-zone around the centre 14735 // (necessary as objects can be misaligned by a millipoint or two). 14736 if (doccCentre.x > ExtParams.doccEndCentre.x + ExtParams.xincExtendBuffer) 14737 { 14738 Trans2DMatrix translateX(ExtParams.xinc, 0); 14739 Transform(translateX); 14740 } 14741 else if (doccCentre.x < ExtParams.doccEndCentre.x - ExtParams.xdecExtendBuffer) 14742 { 14743 Trans2DMatrix translateX(-ExtParams.xdec, 0); 14744 Transform(translateX); 14745 } 14746 } 14747 14748 // y-extension - we move the whole Node; behaviour determined by its centre. 14749 if (ExtParams.fExtendFlags & Y_EXTEND) 14750 { 14751 // if our parent is a group, then it won't have applied any offset parameter to us, 14752 // so we need to do this ourself. 14753 Node* pParent = FindParent(); 14754 if (pParent != NULL && pParent->IsCompound()) 14755 { 14756 Trans2DMatrix baseYoffset(0, ExtParams.doccOffset.y); 14757 Transform(baseYoffset); 14758 } 14759 14760 // only extend if we're outside the centre's buffer-zone. 14761 if (doccCentre.y > ExtParams.doccEndCentre.y + ExtParams.yincExtendBuffer) 14762 { 14763 Trans2DMatrix translateY(0, ExtParams.yinc); 14764 Transform(translateY); 14765 } 14766 else if (doccCentre.y < ExtParams.doccEndCentre.y - ExtParams.ydecExtendBuffer) 14767 { 14768 Trans2DMatrix translateY(0, -ExtParams.ydec); 14769 Transform(translateY); 14770 } 14771 } 14772 }
|
|
Makes sure the Coords of the Fill are sensible. Defaults to natural size of the bitmap.
Reimplemented from AttrFillGeometry. Reimplemented in AttrFractalFill. Definition at line 14259 of file fillattr.cpp. 14260 { 14261 #if !defined(EXCLUDE_FROM_RALPH) 14262 if ((*GetStartPoint()) != DocCoord(0,0) && (*GetEndPoint()) != DocCoord(0,0) && 14263 (*GetEndPoint2()) != DocCoord(0,0)) 14264 return; 14265 14266 // Make some defaults 14267 DocRect AttrBounds = DocRect(0,0,0,0); 14268 14269 INT32 Width = DEFAULT_FILLWIDTH; 14270 INT32 Height = DEFAULT_FILLHEIGHT; 14271 14272 // Are we an Orphan ? 14273 if (FindParent() != NULL) 14274 { 14275 // Nope, so we can use Daddies Bounding Box 14276 SelRange* Selected = GetApplication()->FindSelection(); 14277 14278 if (Selected == NULL || Selected->Count() <= 1) 14279 AttrBounds = ((NodeRenderableBounded*)FindParent())->GetBoundingRect(TRUE); 14280 else 14281 AttrBounds = Selected->GetBoundingRect(); 14282 14283 Width = AttrBounds.Width(); 14284 Height = AttrBounds.Height(); 14285 } 14286 14287 BitmapInfo Info; 14288 BOOL GotBitmap = FALSE; 14289 14290 // if possible we base our default size on the bitmaps preferred size 14291 KernelBitmap* KerBmp = ((FillGeometryAttribute*)GetAttributeValue())->GetBitmap(); 14292 14293 if (KerBmp && KerBmp->ActualBitmap) 14294 GotBitmap = KerBmp->ActualBitmap->GetInfo( &Info ); 14295 14296 // Use the recommended Width and Height if possible 14297 INT32 BitmapWidth = (GotBitmap ? Info.RecommendedWidth : Width ); 14298 INT32 BitmapHeight = (GotBitmap ? Info.RecommendedHeight : Height ); 14299 14300 // Find the middle of the Attributes Bounds 14301 DocCoord Centre = CentreOf(AttrBounds); 14302 14303 // Get the current control positions 14304 DocCoord StartPoint = *GetStartPoint(); 14305 DocCoord EndPoint = *GetEndPoint(); 14306 DocCoord EndPoint2 = *GetEndPoint2(); 14307 14308 // If the StartPoint is 'NULL' then make all points sensible 14309 if (StartPoint == DocCoord(0,0)) 14310 { 14311 // Start in the middle 14312 StartPoint = DocCoord(Centre.x - BitmapWidth/2, Centre.y - BitmapHeight/2); 14313 // End on the Middle Right 14314 EndPoint = DocCoord(StartPoint.x + BitmapWidth, StartPoint.y); 14315 // and Middle Top 14316 EndPoint2 = DocCoord(StartPoint.x, StartPoint.y + BitmapHeight); 14317 } 14318 14319 // If the EndPoint is 'NULL' then make end points sensible 14320 if (EndPoint == DocCoord(0,0)) 14321 { 14322 EndPoint = DocCoord(StartPoint.x + BitmapWidth, StartPoint.y); 14323 EndPoint2 = DocCoord(StartPoint.x, StartPoint.y + BitmapHeight); 14324 } 14325 14326 // If the EndPoint2 is 'NULL' then make it sensible 14327 if (EndPoint2 == DocCoord(0,0)) 14328 { 14329 EndPoint2 = DocCoord(StartPoint.x, StartPoint.y + BitmapHeight); 14330 } 14331 14332 // Store the validated positions back 14333 SetStartPoint(&StartPoint); 14334 SetEndPoint(&EndPoint); 14335 SetEndPoint2(&EndPoint2); 14336 #endif 14337 }
|
|
Determine whether applying an extend to this Node is a reversible process.
Reimplemented from AttrFillGeometry. Definition at line 14638 of file fillattr.cpp. 14639 { 14640 // a bitmap fill is treated a bit like text - it should maintain its aspect ratio and 14641 // translate as a whole. therefore, we only validate its extend reference-centre. 14642 // it also has no children to test. 14643 DocCoord doccArray[1] = { FindExtendCentre() }; 14644 return Extender::ValidateControlPoints(1, doccArray, ExtParams); 14645 // return DocRect(INT32_MAX, INT32_MAX, INT32_MAX, INT32_MAX); 14646 }
|