#include <fillattr2.h>
Inheritance diagram for AttrTextureTranspFill:
Public Member Functions | |
AttrTextureTranspFill () | |
Constructor for a fractal fill. | |
AttrTextureTranspFill (Node *ContextNode, AttachNodeDirection Direction, BOOL Locked=FALSE, BOOL Mangled=FALSE, BOOL Marked=FALSE, BOOL Selected=FALSE) | |
~AttrTextureTranspFill () | |
Destructor for a fractal fill. | |
virtual void | Render (RenderRegion *pRender) |
'Renders' a Fractal Fill Transp 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 | OnControlDrag (DocCoord, FillControl &, ClickModifiers) |
virtual FillControl | CheckForControlHit (DocCoord &) |
Check to see if a click was on a Fill Control Point. | |
virtual void | RenderFillBlobs (RenderRegion *pRender) |
Renders the grad fills arrow blob when requested to by its selected parent. | |
virtual BOOL | IsVisible () |
virtual BOOL | NeedsTransparency () const |
Called. | |
virtual CCRuntimeClass * | GetAttributeType () |
virtual AttributeValue * | GetAttributeValue () |
virtual BOOL | ChangeControlTransp (AttrTranspChange *NewTransp) |
Applies a colour to selected Fill Control Points. | |
AttrFillGeometry * | ChangeAttrValue (AttrValueChange *pValue) |
virtual BOOL | IsATranspFill () const |
Virtual function for determining if the node is an attribute. | |
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 2303 of file fillattr2.h.
|
Constructor for a fractal fill.
Definition at line 17228 of file fillattr.cpp.
|
|
Definition at line 2309 of file fillattr2.h. 02314 : 02315 AttrFractalFill(ContextNode, Direction, Locked, Mangled, Marked, Selected) {}
|
|
Destructor for a fractal fill.
Definition at line 17242 of file fillattr.cpp.
|
|
Reimplemented from AttrFillGeometry. Definition at line 2338 of file fillattr2.h. 02338 { return ChangeTransp(pValue); }
|
|
Applies a colour to selected Fill Control Points.
Reimplemented from AttrBitmapFill. Definition at line 2335 of file fillattr2.h. 02336 { return AttrFillGeometry::ChangeControlTransp(NewTransp); }
|
|
Check to see if a click was on a Fill Control Point.
Reimplemented from AttrBitmapFill. Definition at line 17437 of file fillattr.cpp. 17438 { 17439 #if !defined(EXCLUDE_FROM_RALPH) 17440 if (!GetApplication()->GetBlobManager()->GetCurrentInterest().Fill || !IsVisible()) 17441 return FILLCONTROL_NULL; 17442 17443 // Set up a default, that indicates not control points hit 17444 FillControl HitControl = FILLCONTROL_NULL; 17445 DocRect BlobRect; 17446 17447 DocCoord StartPoint = *GetStartPoint(); 17448 DocCoord EndPoint = *GetEndPoint(); 17449 DocCoord EndPoint2 = *GetEndPoint2(); 17450 17451 // Bodge Alert !! 17452 17453 // Bitmap fills have a complicated control point system. 17454 // The actual control points needed for rendering are the Bottom Left, 17455 // Top Left, and Bottom Right points of the bitmap. But on screen the 17456 // points seen and moved are the Centre, Middle Right, and Middle Top. 17457 // So we need to convert the click points into vitual points before 17458 // we do the hit test. 17459 17460 DocCoord CentrePoint; 17461 DocCoord Drag2Blob; 17462 DocCoord Drag3Blob; 17463 17464 GetBitmapVirtualPoints(StartPoint, EndPoint, EndPoint2, 17465 &CentrePoint, &Drag2Blob, &Drag3Blob); 17466 17467 // Get the rectangle around the Centre Control Point 17468 (Camelot.GetBlobManager())->GetBlobRect(CentrePoint, &BlobRect); 17469 // See if the Click Position is within the rectangle 17470 if ( BlobRect.ContainsCoord(ClickPos) ) 17471 HitControl = FILLCONTROL_STARTPOINT; 17472 17473 // Get the rectangle around the First End Point 17474 (Camelot.GetBlobManager())->GetBlobRect(Drag2Blob, &BlobRect); 17475 // See if the Click Position is within the rectangle 17476 if ( BlobRect.ContainsCoord(ClickPos) ) 17477 HitControl = FILLCONTROL_ENDPOINT; 17478 17479 // Get the rectangle around the Second End Point 17480 (Camelot.GetBlobManager())->GetBlobRect(Drag3Blob, &BlobRect); 17481 // See if the Click Position is within the rectangle 17482 if ( BlobRect.ContainsCoord(ClickPos) ) 17483 HitControl = FILLCONTROL_SECONDARYPOINT; 17484 17485 return HitControl; 17486 #else 17487 return FILLCONTROL_NULL; 17488 #endif 17489 }
|
|
Reimplemented from NodeAttribute. Definition at line 2332 of file fillattr2.h. 02332 { return CC_RUNTIME_CLASS(AttrTranspFillGeometry); }
|
|
Implements AttrBitmapFill. Reimplemented in AttrFractalTranspFill, and AttrNoiseTranspFill. Definition at line 2333 of file fillattr2.h. 02333 { return NULL; }
|
|
Returns a string resource ID describing the attribute.
Reimplemented from NodeAttribute. Reimplemented in AttrFractalTranspFill, and AttrNoiseTranspFill. Definition at line 17303 of file fillattr.cpp. 17304 { 17305 17306 return (_R(IDS_BITMAPTRANSPFILL)); 17307 }
|
|
Output details of this attribute to the Camelot debug tree dialog.
Reimplemented from NodeRenderable. Definition at line 17330 of file fillattr.cpp. 17331 { 17332 #ifdef _DEBUG 17333 NodeAttribute::GetDebugDetails( Str ); 17334 17335 String_256 TempStr; 17336 17337 TempStr._MakeMsg( TEXT("\r\nTexture transparency:\r\n")); 17338 (*Str) += TempStr; 17339 17340 TempStr._MakeMsg(TEXT("\r\nStart = (#1%ld, #2%ld)"), 17341 (*GetStartPoint()).x, (*GetStartPoint()).y); 17342 (*Str) += TempStr; 17343 17344 TempStr._MakeMsg(TEXT("\r\nEnd = (#1%ld, #2%ld) "), 17345 (*GetEndPoint()).x, (*GetEndPoint()).y); 17346 (*Str) += TempStr; 17347 17348 TempStr._MakeMsg(TEXT("\r\n3rd = (#1%ld, #2%ld) "), 17349 (*GetEndPoint2()).x, (*GetEndPoint2()).y); 17350 (*Str) += TempStr; 17351 #endif 17352 }
|
|
Virtual function for determining if the node is an attribute.
Reimplemented from NodeAttribute. Definition at line 2340 of file fillattr2.h. 02340 { return TRUE; }
|
|
Reimplemented from NodeAttribute. Definition at line 2348 of file fillattr2.h. 02348 { 02349 return ((GetStartTransp() != NULL && *GetStartTransp() != 0) || 02350 (GetEndTransp() != NULL && *GetEndTransp() != 0)); 02351 }
|
|
Reimplemented from AttrFillGeometry. Definition at line 2329 of file fillattr2.h. 02329 { return IsTranspMeshVisible(); }
|
|
Called.
Reimplemented from AttrFillGeometry. Definition at line 17261 of file fillattr.cpp. 17262 { 17263 return TRUE; 17264 }
|
|
Reimplemented from AttrBitmapFill. Definition at line 17506 of file fillattr.cpp. 17507 { 17508 #if !defined(EXCLUDE_FROM_RALPH) 17509 // Get the current Control Point Positions 17510 DocCoord StartPoint = *GetStartPoint(); 17511 DocCoord EndPoint = *GetEndPoint(); 17512 DocCoord EndPoint2 = *GetEndPoint2(); 17513 17514 DocCoord CentrePoint; 17515 DocCoord Drag2Blob; 17516 DocCoord Drag3Blob; 17517 17518 // Bodge Alert !! 17519 17520 // Bitmap fills have a complicated control point system. 17521 // The actual control points needed for rendering are the Bottom Left, 17522 // Top Left, and Bottom Right points of the bitmap. But on screen the 17523 // points seen and moved are the Centre, Middle Right, and Middle Top. 17524 // So we need to convert the click points into vitual points before 17525 // we start dragging them about. 17526 17527 GetBitmapVirtualPoints(StartPoint, EndPoint, EndPoint2, 17528 &CentrePoint, &Drag2Blob, &Drag3Blob); 17529 17530 INT32 dx, dy; 17531 17532 // Which control is being dragged ? 17533 switch (DragControl) 17534 { 17535 case FILLCONTROL_STARTPOINT: 17536 17537 // They're dragging the Centre Point 17538 dx = CentrePoint.x - Pos.x; 17539 dy = CentrePoint.y - Pos.y; 17540 // Move the other points relative 17541 Drag2Blob.translate(-dx, -dy); 17542 Drag3Blob.translate(-dx, -dy); 17543 CentrePoint = Pos; 17544 break; 17545 17546 case FILLCONTROL_ENDPOINT: 17547 17548 // If the Constrain key is down then constrain the Angle of the 17549 // point, relative to the centre position. 17550 if (ClickMods.Constrain) 17551 DocView::ConstrainToAngle(CentrePoint, &Pos); 17552 17553 if (ClickMods.Adjust) 17554 { 17555 // Shift is pressed, so lock the aspect ratio of the bitmap mesh 17556 double OldLen = CentrePoint.Distance(Drag2Blob); 17557 double NewLen = CentrePoint.Distance(Pos); 17558 double Ratio = 1.0; 17559 17560 if (OldLen == 0) 17561 Ratio = 0; 17562 else 17563 Ratio = NewLen/OldLen; 17564 17565 // Calculate the new point based on the aspect ratio 17566 Drag3Blob = 17567 MakeLineAtAngle(CentrePoint, Pos, 90, INT32(CentrePoint.Distance(Drag3Blob) * Ratio)); 17568 } 17569 17570 Drag2Blob = Pos; 17571 break; 17572 17573 case FILLCONTROL_SECONDARYPOINT: 17574 17575 // If the Constrain key is down then constrain the Angle of the 17576 // point, relative to the centre position. 17577 if (ClickMods.Constrain) 17578 DocView::ConstrainToAngle(CentrePoint, &Pos); 17579 17580 if (ClickMods.Adjust) 17581 { 17582 // Shift is pressed, so lock the aspect ratio of the bitmap mesh 17583 double OldLen = CentrePoint.Distance(Drag3Blob); 17584 double NewLen = CentrePoint.Distance(Pos); 17585 double Ratio = 1.0; 17586 17587 if (OldLen == 0) 17588 Ratio = 0; 17589 else 17590 Ratio = NewLen/OldLen; 17591 17592 // Calculate the new point based on the aspect ratio 17593 Drag2Blob = 17594 MakeLineAtAngle(CentrePoint, Pos, -90, INT32(CentrePoint.Distance(Drag2Blob) * Ratio)); 17595 } 17596 17597 Drag3Blob = Pos; 17598 break; 17599 } 17600 17601 // Now we have to convert the Vitual Coords back into real 17602 // bitmap control points. 17603 17604 GetBitmapRealPoints(CentrePoint, Drag2Blob, Drag3Blob, 17605 &StartPoint, &EndPoint, &EndPoint2); 17606 17607 // Store the new points back in the Fill 17608 SetStartPoint(&StartPoint); 17609 SetEndPoint(&EndPoint); 17610 SetEndPoint2(&EndPoint2); 17611 #endif 17612 }
|
|
'Renders' a Fractal Fill Transp attribute.
Reimplemented from NodeAttribute. Definition at line 17366 of file fillattr.cpp. 17367 { 17368 if (GetBitmap() == NULL || GetBitmap()->ActualBitmap == NULL) 17369 { 17370 if (!RecalcFractal()) 17371 return; 17372 } 17373 17374 pRender->SetTranspFillGeometry((TranspFillAttribute*)GetAttributeValue(), FALSE); 17375 }
|
|
Redraws the Fill Control blobs when the selection changes.
Reimplemented from AttrFillGeometry. Definition at line 17626 of file fillattr.cpp. 17627 { 17628 #if !defined(EXCLUDE_FROM_RALPH) 17629 DocRect ControlRect; 17630 17631 // Ignore if we're not in the tree yet 17632 // We may be a tempory clone, or something 17633 NodeRenderable* pParent = (NodeRenderable*)FindParent(); 17634 17635 if (pParent == NULL) 17636 return; 17637 17638 if (IsBlobSame(Control)) 17639 return; // Ignore if same as the last blob rendered 17640 17641 Spread* pSpread = this->FindParentSpread(); 17642 17643 DocCoord StartPoint = *GetStartPoint(); 17644 DocCoord EndPoint = *GetEndPoint(); 17645 DocCoord EndPoint2 = *GetEndPoint2(); 17646 17647 DocCoord CentrePoint; 17648 DocCoord Drag2Blob; 17649 DocCoord Drag3Blob; 17650 17651 GetBitmapVirtualPoints(StartPoint, EndPoint, EndPoint2, 17652 &CentrePoint, &Drag2Blob, &Drag3Blob); 17653 17654 switch (Control) 17655 { 17656 case FILLCONTROL_STARTPOINT: 17657 17658 if (GetStartPoint() != NULL) 17659 { 17660 // Redraw the Start Point Blob 17661 (Camelot.GetBlobManager())->GetBlobRect(CentrePoint, &ControlRect); 17662 RenderFillControl(RenderOn, &ControlRect, pSpread, pParent); 17663 } 17664 break; 17665 17666 case FILLCONTROL_ENDPOINT: 17667 17668 if (GetEndPoint() != NULL) 17669 { 17670 // Redraw BOTH End Point Blobs 17671 (Camelot.GetBlobManager())->GetBlobRect(Drag2Blob, &ControlRect); 17672 RenderFillControl(RenderOn, &ControlRect, pSpread, pParent); 17673 } 17674 17675 if (GetEndPoint2() != NULL) 17676 { 17677 (Camelot.GetBlobManager())->GetBlobRect(Drag3Blob, &ControlRect); 17678 RenderFillControl(RenderOn, &ControlRect, pSpread, pParent); 17679 } 17680 break; 17681 17682 case FILLCONTROL_SECONDARYPOINT: 17683 17684 if (GetEndPoint2() != NULL) 17685 { 17686 // Redraw BOTH End Point Blobs 17687 (Camelot.GetBlobManager())->GetBlobRect(Drag2Blob, &ControlRect); 17688 RenderFillControl(RenderOn, &ControlRect, pSpread, pParent); 17689 } 17690 17691 if (GetEndPoint2() != NULL) 17692 { 17693 (Camelot.GetBlobManager())->GetBlobRect(Drag3Blob, &ControlRect); 17694 RenderFillControl(RenderOn, &ControlRect, pSpread, pParent); 17695 } 17696 break; 17697 } 17698 #endif 17699 }
|
|
Renders the grad fills arrow blob when requested to by its selected parent.
Reimplemented from AttrBitmapFill. Definition at line 17389 of file fillattr.cpp. 17390 { 17391 #if !defined(EXCLUDE_FROM_RALPH) 17392 if (!IsVisible()) 17393 return; // We're Not in Fill Transparency Mode 17394 17395 // Don't bother if this fill is being edited as a copy of it 17396 // we be rendered thoughout the drag op 17397 if (IsFillBeingEdited()) 17398 return; 17399 17400 // Ignore this if the mesh is the same as the last one rendered. 17401 if (CheckPreviousFillMesh()) 17402 return; 17403 17404 DocCoord ControlPoints[5]; 17405 ControlPoints[FILLCONTROL_STARTPOINT] = (*GetStartPoint()); 17406 ControlPoints[FILLCONTROL_ENDPOINT] = (*GetEndPoint()); 17407 ControlPoints[FILLCONTROL_SECONDARYPOINT] = (*GetEndPoint2()); 17408 17409 // Render a nice pretty Fill Mesh thingy 17410 RenderFillMesh(pRender, ControlPoints, SelectionState, 5); 17411 17412 // This call was removed by Gerry (2/9/96) as it causes blob problems 17413 // If we are removing blobs then force all blobs to be deselected 17414 // if ((Camelot.GetBlobManager())->IsRemovingBlobs()) 17415 // DeselectAllNoRedraw(); 17416 #endif 17417 }
|
|
Reimplemented from AttrBitmapFill. Definition at line 17720 of file fillattr.cpp. 17723 { 17724 #if !defined(EXCLUDE_FROM_RALPH) 17725 DocCoord StartPoint = ControlPoints[FILLCONTROL_STARTPOINT]; 17726 DocCoord EndPoint = ControlPoints[FILLCONTROL_ENDPOINT]; 17727 17728 if (StartPoint == EndPoint) 17729 return; 17730 17731 if (SelState == NULL) 17732 { 17733 // If no selection state passed in, then assume 17734 // all the points are deselected 17735 BOOL Selected[NUMCONTROLPOINTS]; 17736 for (INT32 i=0; i< NumControlPoints; i++) 17737 { 17738 Selected[i] = FALSE; 17739 } 17740 SelState = Selected; 17741 } 17742 17743 DocCoord EndPoint2 = ControlPoints[FILLCONTROL_SECONDARYPOINT]; 17744 17745 DocCoord Start; 17746 DocCoord End; 17747 DocCoord End2; 17748 17749 // Work out the Virtual positions of the Bitmap Controls 17750 GetBitmapVirtualPoints(StartPoint, EndPoint, EndPoint2, 17751 &Start, &End, &End2); 17752 17753 // Remember what attributes were here before 17754 pRender->SaveContext(); 17755 17756 // Get the current blob size in Doc Units 17757 INT32 BlobSize = (Camelot.GetBlobManager())->GetBlobSize(); 17758 17759 // Calculate the Arrow on the End of the Line 17760 Path ArrowPath; 17761 ArrowPath.Initialise(); 17762 DocCoord LineEnd; 17763 MakeMeshArrow(&ArrowPath, Start, End, &LineEnd); 17764 17765 // Calculate the Arrow on the End of the Line2 17766 Path ArrowPath2; 17767 ArrowPath2.Initialise(); 17768 DocCoord LineEnd2; 17769 MakeMeshArrow(&ArrowPath2, Start, End2, &LineEnd2); 17770 17771 // Set the line colours etc as we need them 17772 pRender->SetLineWidth(0); 17773 pRender->SetLineColour(COLOUR_UNSELECTEDBLOB); 17774 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB); 17775 17776 // First Draw the Line 17777 pRender->SetLineWidth(BlobSize/4); 17778 pRender->DrawLine(Start, LineEnd); 17779 17780 // Draw the secondary line 17781 pRender->DrawLine(Start, LineEnd2); 17782 17783 // Render an Arrow at the end of the line 17784 pRender->SetLineWidth(0); 17785 pRender->SetLineColour(COLOUR_NONE); 17786 pRender->DrawPath(&ArrowPath); 17787 17788 // and on the end of the secondary line 17789 pRender->DrawPath(&ArrowPath2); 17790 17791 if (DraggedFill == this) 17792 { 17793 // If we are being dragged then draw a Parallelgram to 17794 // show the shape of the bitmap 17795 pRender->SetLineColour(COLOUR_SELECTEDBLOB); 17796 pRender->SetFillColour(COLOUR_NONE); 17797 17798 Path ParaPath; 17799 ParaPath.Initialise(); 17800 MakeMeshParallelagram(&ParaPath, Start, End, End2); 17801 17802 // Draw the parallelagram 17803 pRender->DrawPath(&ParaPath); 17804 } 17805 17806 // Now Render the blobs on the path 17807 17808 // Draw a blob at the start point 17809 if (SelState[FILLCONTROL_STARTPOINT]) 17810 { 17811 // Draw Selected Blob 17812 // pRender->SetLineColour(COLOUR_SELECTEDBLOB); 17813 pRender->SetLineColour(COLOUR_NONE); 17814 pRender->SetFillColour(COLOUR_SELECTEDBLOB); 17815 pRender->DrawBlob(Start, BT_SELECTED); 17816 } 17817 else 17818 { 17819 // Draw Unselected Blob 17820 // pRender->SetLineColour(COLOUR_UNSELECTEDBLOB); 17821 pRender->SetLineColour(COLOUR_NONE); 17822 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB); 17823 pRender->DrawBlob(Start, BT_UNSELECTED); 17824 } 17825 17826 // Draw a blob at the end point 17827 if (SelState[FILLCONTROL_ENDPOINT]) 17828 { 17829 // Draw Selected Blob 17830 // pRender->SetLineColour(COLOUR_SELECTEDBLOB); 17831 pRender->SetLineColour(COLOUR_NONE); 17832 pRender->SetFillColour(COLOUR_SELECTEDBLOB); 17833 pRender->DrawBlob(End, BT_SELECTED); 17834 pRender->DrawBlob(End2,BT_SELECTED); 17835 } 17836 else 17837 { 17838 // Draw Unselected Blob 17839 // pRender->SetLineColour(COLOUR_UNSELECTEDBLOB); 17840 pRender->SetLineColour(COLOUR_NONE); 17841 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB); 17842 pRender->DrawBlob(End, BT_UNSELECTED); 17843 pRender->DrawBlob(End2,BT_UNSELECTED); 17844 } 17845 17846 // Put all the old attributes back 17847 pRender->RestoreContext(); 17848 #endif 17849 }
|
|
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 AttrFractalTranspFill, and AttrNoiseTranspFill. Definition at line 17281 of file fillattr.cpp. 17282 { 17283 AttrTextureTranspFill* NodeCopy = new AttrTextureTranspFill(); 17284 if (NodeCopy == NULL) 17285 return NULL; 17286 17287 CopyNodeContents(NodeCopy); 17288 17289 return NodeCopy; 17290 }
|