#include <fillattr2.h>
Inheritance diagram for AttrTextureColourFill:
Public Member Functions | |
AttrTextureColourFill () | |
Constructor for a texture fill. | |
AttrTextureColourFill (Node *ContextNode, AttachNodeDirection Direction, BOOL Locked=FALSE, BOOL Mangled=FALSE, BOOL Marked=FALSE, BOOL Selected=FALSE) | |
~AttrTextureColourFill () | |
Destructor for a texture fill. | |
virtual void | Render (RenderRegion *pRender) |
'Renders' a Fractal Fill colour attribute. | |
virtual Node * | SimpleCopy () |
This method returns a shallow copy of the node with all Node pointers NULL. The function is virtual, and must be defined for all derived classes. | |
virtual void | GetDebugDetails (StringBase *Str) |
Output details of this attribute to the Camelot debug tree dialog. | |
virtual UINT32 | GetAttrNameID (void) |
Returns a string resource ID describing the attribute. | |
virtual void | RenderFillMesh (RenderRegion *, DocCoord *, BOOL *, INT32 NumControlPoints=0) |
virtual void | RenderFillBlobs (RenderRegion *pRender) |
Renders the grad fills arrow blob when requested to by its selected parent. | |
virtual void | OnControlDrag (DocCoord, FillControl &, ClickModifiers) |
virtual FillControl | CheckForControlHit (DocCoord &) |
Check to see if a click was on a Fill Control Point. | |
virtual BOOL | IsVisible () |
virtual CCRuntimeClass * | GetAttributeType () |
virtual BOOL | ChangeControlColour (AttrColourChange *NewCol) |
Applies a colour to selected Fill Control Points. | |
AttrFillGeometry * | ChangeAttrValue (AttrValueChange *pValue) |
virtual BOOL | IsAColourFill () const |
Virtual function for determining if the node is a Colour Fill attribute. | |
virtual AttributeValue * | GetAttributeValue () |
virtual BOOL | IsSeeThrough (BOOL CheckIndirectAttrs) |
Protected Member Functions | |
virtual void | RenderControl (FillControl, BOOL) |
Redraws the Fill Control blobs when the selection changes. |
Definition at line 2076 of file fillattr2.h.
|
Constructor for a texture fill.
Definition at line 16150 of file fillattr.cpp.
|
|
Definition at line 2082 of file fillattr2.h. 02087 : 02088 AttrFractalFill(ContextNode, Direction, Locked, Mangled, Marked, Selected) {}
|
|
Destructor for a texture fill.
Definition at line 16164 of file fillattr.cpp.
|
|
Reimplemented from AttrFillGeometry. Definition at line 2112 of file fillattr2.h. 02112 { return ChangeColour(pValue); }
|
|
Applies a colour to selected Fill Control Points.
Reimplemented from AttrBitmapFill. Definition at line 2109 of file fillattr2.h. 02110 { return AttrFillGeometry::ChangeControlColour(NewCol); }
|
|
Check to see if a click was on a Fill Control Point.
Reimplemented from AttrBitmapFill. Definition at line 16354 of file fillattr.cpp. 16355 { 16356 #if !defined(EXCLUDE_FROM_RALPH) 16357 if (!GetApplication()->GetBlobManager()->GetCurrentInterest().Fill || !IsVisible()) 16358 return FILLCONTROL_NULL; 16359 16360 // Set up a default, that indicates not control points hit 16361 FillControl HitControl = FILLCONTROL_NULL; 16362 DocRect BlobRect; 16363 16364 DocCoord StartPoint = *GetStartPoint(); 16365 DocCoord EndPoint = *GetEndPoint(); 16366 DocCoord EndPoint2 = *GetEndPoint2(); 16367 16368 // Bodge Alert !! 16369 16370 // Bitmap fills have a complicated control point system. 16371 // The actual control points needed for rendering are the Bottom Left, 16372 // Top Left, and Bottom Right points of the bitmap. But on screen the 16373 // points seen and moved are the Centre, Middle Right, and Middle Top. 16374 // So we need to convert the click points into vitual points before 16375 // we do the hit test. 16376 16377 DocCoord CentrePoint; 16378 DocCoord Drag2Blob; 16379 DocCoord Drag3Blob; 16380 16381 GetBitmapVirtualPoints(StartPoint, EndPoint, EndPoint2, 16382 &CentrePoint, &Drag2Blob, &Drag3Blob); 16383 16384 // Get the rectangle around the Centre Control Point 16385 (Camelot.GetBlobManager())->GetBlobRect(CentrePoint, &BlobRect); 16386 // See if the Click Position is within the rectangle 16387 if ( BlobRect.ContainsCoord(ClickPos) ) 16388 HitControl = FILLCONTROL_STARTPOINT; 16389 16390 // Get the rectangle around the First End Point 16391 (Camelot.GetBlobManager())->GetBlobRect(Drag2Blob, &BlobRect); 16392 // See if the Click Position is within the rectangle 16393 if ( BlobRect.ContainsCoord(ClickPos) ) 16394 HitControl = FILLCONTROL_ENDPOINT; 16395 16396 // Get the rectangle around the Second End Point 16397 (Camelot.GetBlobManager())->GetBlobRect(Drag3Blob, &BlobRect); 16398 // See if the Click Position is within the rectangle 16399 if ( BlobRect.ContainsCoord(ClickPos) ) 16400 HitControl = FILLCONTROL_SECONDARYPOINT; 16401 16402 return HitControl; 16403 #else 16404 return FILLCONTROL_NULL; 16405 #endif 16406 }
|
|
Reimplemented from NodeAttribute. Definition at line 2107 of file fillattr2.h. 02107 { return CC_RUNTIME_CLASS(AttrFillGeometry); }
|
|
Implements AttrBitmapFill. Reimplemented in AttrFractalColourFill, and AttrNoiseColourFill. Definition at line 2115 of file fillattr2.h. 02115 { return NULL; }
|
|
Returns a string resource ID describing the attribute.
Reimplemented from NodeAttribute. Reimplemented in AttrFractalColourFill, and AttrNoiseColourFill. Definition at line 16210 of file fillattr.cpp. 16211 { 16212 return (_R(IDS_BITMAPFILL)); 16213 }
|
|
Output details of this attribute to the Camelot debug tree dialog.
Reimplemented from NodeRenderable. Reimplemented in AttrFractalColourFill, and AttrNoiseColourFill. Definition at line 16240 of file fillattr.cpp. 16241 { 16242 #ifdef _DEBUG 16243 NodeAttribute::GetDebugDetails( Str ); 16244 16245 String_256 TempStr; 16246 16247 TempStr._MakeMsg( TEXT("\r\nTexture Fill:\r\n")); 16248 (*Str) += TempStr; 16249 16250 // TempStr._MakeMsg(TEXT("\r\nStart")); 16251 // (*GetStartColour()).GetDebugDetails(&TempStr); 16252 // (*Str) += TempStr; 16253 16254 // TempStr._MakeMsg(TEXT("\r\nEnd")); 16255 // (*GetEndColour()).GetDebugDetails(&TempStr); 16256 // (*Str) += TempStr; 16257 16258 TempStr._MakeMsg(TEXT("\r\nStart = (#1%ld, #2%ld)"), 16259 (*GetStartPoint()).x, (*GetStartPoint()).y); 16260 (*Str) += TempStr; 16261 16262 TempStr._MakeMsg(TEXT("\r\nEnd = (#1%ld, #2%ld) "), 16263 (*GetEndPoint()).x, (*GetEndPoint()).y); 16264 (*Str) += TempStr; 16265 16266 TempStr._MakeMsg(TEXT("\r\n3rd = (#1%ld, #2%ld) \n"), 16267 (*GetEndPoint2()).x, (*GetEndPoint2()).y); 16268 (*Str) += TempStr; 16269 16270 #endif 16271 }
|
|
Virtual function for determining if the node is a Colour Fill attribute.
Reimplemented from NodeAttribute. Definition at line 2114 of file fillattr2.h. 02114 { return TRUE; }
|
|
Reimplemented from NodeAttribute. Definition at line 2123 of file fillattr2.h. 02124 { 02125 return (GetStartColour() != NULL && GetStartColour()->IsTransparent() && 02126 GetEndColour() != NULL && GetEndColour()->IsTransparent()); 02127 02128 return false; 02129 }
|
|
Reimplemented from AttrFillGeometry. Definition at line 2105 of file fillattr2.h. 02105 { return IsColourMeshVisible(); }
|
|
Reimplemented from AttrBitmapFill. Definition at line 16422 of file fillattr.cpp. 16423 { 16424 #if !defined(EXCLUDE_FROM_RALPH) 16425 // Get the current Control Point Positions 16426 DocCoord StartPoint = *GetStartPoint(); 16427 DocCoord EndPoint = *GetEndPoint(); 16428 DocCoord EndPoint2 = *GetEndPoint2(); 16429 16430 DocCoord CentrePoint; 16431 DocCoord Drag2Blob; 16432 DocCoord Drag3Blob; 16433 16434 // Bodge Alert !! 16435 16436 // Bitmap fills have a complicated control point system. 16437 // The actual control points needed for rendering are the Bottom Left, 16438 // Top Left, and Bottom Right points of the bitmap. But on screen the 16439 // points seen and moved are the Centre, Middle Right, and Middle Top. 16440 // So we need to convert the click points into vitual points before 16441 // we start dragging them about. 16442 16443 GetBitmapVirtualPoints(StartPoint, EndPoint, EndPoint2, 16444 &CentrePoint, &Drag2Blob, &Drag3Blob); 16445 16446 INT32 dx, dy; 16447 16448 // Which control is being dragged ? 16449 switch (DragControl) 16450 { 16451 case FILLCONTROL_STARTPOINT: 16452 16453 // They're dragging the Centre Point 16454 dx = CentrePoint.x - Pos.x; 16455 dy = CentrePoint.y - Pos.y; 16456 // Move the other points relative 16457 Drag2Blob.translate(-dx, -dy); 16458 Drag3Blob.translate(-dx, -dy); 16459 CentrePoint = Pos; 16460 break; 16461 16462 case FILLCONTROL_ENDPOINT: 16463 16464 // If the Constrain key is down then constrain the Angle of the 16465 // point, relative to the centre position. 16466 if (ClickMods.Constrain) 16467 DocView::ConstrainToAngle(CentrePoint, &Pos); 16468 16469 if (ClickMods.Adjust) 16470 { 16471 // Shift is pressed, so lock the aspect ratio of the bitmap mesh 16472 double OldLen = CentrePoint.Distance(Drag2Blob); 16473 double NewLen = CentrePoint.Distance(Pos); 16474 double Ratio = 1.0; 16475 16476 if (OldLen == 0) 16477 Ratio = 0; 16478 else 16479 Ratio = NewLen/OldLen; 16480 16481 // Calculate the new point based on the aspect ratio 16482 Drag3Blob = 16483 MakeLineAtAngle(CentrePoint, Pos, 90, INT32(CentrePoint.Distance(Drag3Blob) * Ratio)); 16484 } 16485 16486 Drag2Blob = Pos; 16487 break; 16488 16489 case FILLCONTROL_SECONDARYPOINT: 16490 16491 // If the Constrain key is down then constrain the Angle of the 16492 // point, relative to the centre position. 16493 if (ClickMods.Constrain) 16494 DocView::ConstrainToAngle(CentrePoint, &Pos); 16495 16496 if (ClickMods.Adjust) 16497 { 16498 // Shift is pressed, so lock the aspect ratio of the bitmap mesh 16499 double OldLen = CentrePoint.Distance(Drag3Blob); 16500 double NewLen = CentrePoint.Distance(Pos); 16501 double Ratio = 1.0; 16502 16503 if (OldLen == 0) 16504 Ratio = 0; 16505 else 16506 Ratio = NewLen/OldLen; 16507 16508 // Calculate the new point based on the aspect ratio 16509 Drag2Blob = 16510 MakeLineAtAngle(CentrePoint, Pos, -90, INT32(CentrePoint.Distance(Drag2Blob) * Ratio)); 16511 } 16512 16513 Drag3Blob = Pos; 16514 break; 16515 } 16516 16517 // Now we have to convert the Vitual Coords back into real 16518 // bitmap control points. 16519 16520 GetBitmapRealPoints(CentrePoint, Drag2Blob, Drag3Blob, 16521 &StartPoint, &EndPoint, &EndPoint2); 16522 16523 // Store the new points back in the Fill 16524 SetStartPoint(&StartPoint); 16525 SetEndPoint(&EndPoint); 16526 SetEndPoint2(&EndPoint2); 16527 #endif 16528 }
|
|
'Renders' a Fractal Fill colour attribute.
Reimplemented from NodeAttribute. Definition at line 16284 of file fillattr.cpp. 16285 { 16286 if (GetBitmap() == NULL || GetBitmap()->ActualBitmap == NULL) 16287 { 16288 if (!RecalcFractal()) 16289 return; 16290 } 16291 16292 pRender->SetFillGeometry((ColourFillAttribute*)GetAttributeValue(), FALSE); 16293 }
|
|
Redraws the Fill Control blobs when the selection changes.
Reimplemented from AttrFillGeometry. Definition at line 16543 of file fillattr.cpp. 16544 { 16545 #if !defined(EXCLUDE_FROM_RALPH) 16546 DocRect ControlRect; 16547 16548 // Ignore if we're not in the tree yet 16549 // We may be a tempory clone, or something 16550 NodeRenderable* pParent = (NodeRenderable*)FindParent(); 16551 16552 if (pParent == NULL) 16553 return; 16554 16555 if (IsBlobSame(Control)) 16556 return; // Ignore if same as the last blob rendered 16557 16558 Spread* pSpread = this->FindParentSpread(); 16559 16560 DocCoord StartPoint = *GetStartPoint(); 16561 DocCoord EndPoint = *GetEndPoint(); 16562 DocCoord EndPoint2 = *GetEndPoint2(); 16563 16564 DocCoord CentrePoint; 16565 DocCoord Drag2Blob; 16566 DocCoord Drag3Blob; 16567 16568 GetBitmapVirtualPoints(StartPoint, EndPoint, EndPoint2, 16569 &CentrePoint, &Drag2Blob, &Drag3Blob); 16570 16571 switch (Control) 16572 { 16573 case FILLCONTROL_STARTPOINT: 16574 16575 if (GetStartPoint() != NULL) 16576 { 16577 // Redraw the Start Point Blob 16578 (Camelot.GetBlobManager())->GetBlobRect(CentrePoint, &ControlRect); 16579 RenderFillControl(RenderOn, &ControlRect, pSpread, pParent); 16580 } 16581 break; 16582 16583 case FILLCONTROL_ENDPOINT: 16584 16585 if (GetEndPoint() != NULL) 16586 { 16587 // Redraw BOTH End Point Blobs 16588 (Camelot.GetBlobManager())->GetBlobRect(Drag2Blob, &ControlRect); 16589 RenderFillControl(RenderOn, &ControlRect, pSpread, pParent); 16590 } 16591 16592 if (GetEndPoint2() != NULL) 16593 { 16594 (Camelot.GetBlobManager())->GetBlobRect(Drag3Blob, &ControlRect); 16595 RenderFillControl(RenderOn, &ControlRect, pSpread, pParent); 16596 } 16597 break; 16598 16599 case FILLCONTROL_SECONDARYPOINT: 16600 16601 if (GetEndPoint2() != NULL) 16602 { 16603 // Redraw BOTH End Point Blobs 16604 (Camelot.GetBlobManager())->GetBlobRect(Drag2Blob, &ControlRect); 16605 RenderFillControl(RenderOn, &ControlRect, pSpread, pParent); 16606 } 16607 16608 if (GetEndPoint2() != NULL) 16609 { 16610 (Camelot.GetBlobManager())->GetBlobRect(Drag3Blob, &ControlRect); 16611 RenderFillControl(RenderOn, &ControlRect, pSpread, pParent); 16612 } 16613 break; 16614 } 16615 #endif 16616 }
|
|
Renders the grad fills arrow blob when requested to by its selected parent.
Reimplemented from AttrBitmapFill. Definition at line 16308 of file fillattr.cpp. 16309 { 16310 #if !defined(EXCLUDE_FROM_RALPH) 16311 if (!IsVisible()) 16312 return; // We're Not in Fill Transparency Mode 16313 16314 // Don't bother if this fill is being edited as a copy of it 16315 // we be rendered thoughout the drag op 16316 if (IsFillBeingEdited()) 16317 return; 16318 16319 // Ignore this if the mesh is the same as the last one rendered. 16320 if (CheckPreviousFillMesh()) 16321 return; 16322 16323 DocCoord ControlPoints[5]; 16324 ControlPoints[FILLCONTROL_STARTPOINT] = (*GetStartPoint()); 16325 ControlPoints[FILLCONTROL_ENDPOINT] = (*GetEndPoint()); 16326 ControlPoints[FILLCONTROL_SECONDARYPOINT] = (*GetEndPoint2()); 16327 16328 // Render a nice pretty Fill Mesh thingy 16329 RenderFillMesh(pRender, ControlPoints, SelectionState, 5); 16330 16331 // This call was removed by Gerry (2/9/96) as it causes blob problems 16332 // If we are removing blobs then force all blobs to be deselected 16333 // if ((Camelot.GetBlobManager())->IsRemovingBlobs()) 16334 // DeselectAllNoRedraw(); 16335 #endif 16336 }
|
|
Reimplemented from AttrBitmapFill. Definition at line 16637 of file fillattr.cpp. 16640 { 16641 #if !defined(EXCLUDE_FROM_RALPH) 16642 DocCoord StartPoint = ControlPoints[FILLCONTROL_STARTPOINT]; 16643 DocCoord EndPoint = ControlPoints[FILLCONTROL_ENDPOINT]; 16644 16645 if (StartPoint == EndPoint) 16646 return; 16647 16648 if (SelState == NULL) 16649 { 16650 // If no selection state passed in, then assume 16651 // all the points are deselected 16652 BOOL Selected[NUMCONTROLPOINTS]; 16653 for (INT32 i=0; i< NumControlPoints; i++) 16654 { 16655 Selected[i] = FALSE; 16656 } 16657 SelState = Selected; 16658 } 16659 16660 DocCoord EndPoint2 = ControlPoints[FILLCONTROL_SECONDARYPOINT]; 16661 16662 DocCoord Start; 16663 DocCoord End; 16664 DocCoord End2; 16665 16666 // Work out the Virtual positions of the Bitmap Controls 16667 GetBitmapVirtualPoints(StartPoint, EndPoint, EndPoint2, 16668 &Start, &End, &End2); 16669 16670 // Remember what attributes were here before 16671 pRender->SaveContext(); 16672 16673 // Get the current blob size in Doc Units 16674 INT32 BlobSize = (Camelot.GetBlobManager())->GetBlobSize(); 16675 16676 // Calculate the Arrow on the End of the Line 16677 Path ArrowPath; 16678 ArrowPath.Initialise(); 16679 DocCoord LineEnd; 16680 MakeMeshArrow(&ArrowPath, Start, End, &LineEnd); 16681 16682 // Calculate the Arrow on the End of the Line2 16683 Path ArrowPath2; 16684 ArrowPath2.Initialise(); 16685 DocCoord LineEnd2; 16686 MakeMeshArrow(&ArrowPath2, Start, End2, &LineEnd2); 16687 16688 // Set the line colours etc as we need them 16689 pRender->SetLineWidth(0); 16690 pRender->SetLineColour(COLOUR_UNSELECTEDBLOB); 16691 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB); 16692 16693 // First Draw the Line 16694 pRender->SetLineWidth(BlobSize/4); 16695 pRender->DrawLine(Start, LineEnd); 16696 16697 // Draw the secondary line 16698 pRender->DrawLine(Start, LineEnd2); 16699 16700 // Render an Arrow at the end of the line 16701 pRender->SetLineWidth(0); 16702 pRender->SetLineColour(COLOUR_NONE); 16703 pRender->DrawPath(&ArrowPath); 16704 16705 // and on the end of the secondary line 16706 pRender->DrawPath(&ArrowPath2); 16707 16708 if (DraggedFill == this) 16709 { 16710 // If we are being dragged then draw a Parallelgram to 16711 // show the shape of the bitmap 16712 pRender->SetLineColour(COLOUR_SELECTEDBLOB); 16713 pRender->SetFillColour(COLOUR_NONE); 16714 16715 Path ParaPath; 16716 ParaPath.Initialise(); 16717 MakeMeshParallelagram(&ParaPath, Start, End, End2); 16718 16719 // Draw the parallelagram 16720 pRender->DrawPath(&ParaPath); 16721 } 16722 16723 // Now Render the blobs on the path 16724 16725 // Draw a blob at the start point 16726 if (SelState[FILLCONTROL_STARTPOINT]) 16727 { 16728 // Draw Selected Blob 16729 // pRender->SetLineColour(COLOUR_SELECTEDBLOB); 16730 pRender->SetLineColour(COLOUR_NONE); 16731 pRender->SetFillColour(COLOUR_SELECTEDBLOB); 16732 pRender->DrawBlob(Start, BT_SELECTED); 16733 } 16734 else 16735 { 16736 // Draw Unselected Blob 16737 // pRender->SetLineColour(COLOUR_UNSELECTEDBLOB); 16738 pRender->SetLineColour(COLOUR_NONE); 16739 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB); 16740 pRender->DrawBlob(Start, BT_UNSELECTED); 16741 } 16742 16743 // Draw a blob at the end point 16744 if (SelState[FILLCONTROL_ENDPOINT]) 16745 { 16746 // Draw Selected Blob 16747 // pRender->SetLineColour(COLOUR_SELECTEDBLOB); 16748 pRender->SetLineColour(COLOUR_NONE); 16749 pRender->SetFillColour(COLOUR_SELECTEDBLOB); 16750 pRender->DrawBlob(End, BT_SELECTED); 16751 pRender->DrawBlob(End2,BT_SELECTED); 16752 } 16753 else 16754 { 16755 // Draw Unselected Blob 16756 // pRender->SetLineColour(COLOUR_UNSELECTEDBLOB); 16757 pRender->SetLineColour(COLOUR_NONE); 16758 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB); 16759 pRender->DrawBlob(End, BT_UNSELECTED); 16760 pRender->DrawBlob(End2,BT_UNSELECTED); 16761 } 16762 16763 // Put all the old attributes back 16764 pRender->RestoreContext(); 16765 #endif 16766 }
|
|
This method returns a shallow copy of the node with all Node pointers NULL. The function is virtual, and must be defined for all derived classes.
Reimplemented from NodeAttribute. Reimplemented in AttrFractalColourFill, and AttrNoiseColourFill. Definition at line 16185 of file fillattr.cpp. 16186 { 16187 TRACEUSER( "Mike", _T("AttrTextureColourFill::SimpleCopy() called. This should NOT happen.")); 16188 16189 AttrTextureColourFill* NodeCopy = new AttrTextureColourFill(); 16190 if (NodeCopy == NULL) 16191 return NULL; 16192 16193 CopyNodeContents(NodeCopy); 16194 16195 return NodeCopy; 16196 }
|