#include <pathops.h>
Inheritance diagram for OpMakeSegmentsCurves:
Public Member Functions | |
OpMakeSegmentsCurves () | |
OpMakeSegmentsCurves constructor - does nothing itself. | |
Static Public Member Functions | |
static BOOL | Init () |
OpMakeSegmentsCurves initialiser method. | |
static OpState | GetState (String_256 *, OpDescriptor *) |
static BOOL | CarryOut (INT32, INT32, NodePath *, UndoableOperation *, ActionList *pActions) |
Protected Member Functions | |
virtual INT32 | GetProcessPathType () |
virtual INT32 | GetPathType () |
virtual BOOL | ProcessSegment (NodePath *pPath, INT32 *Index, INT32 PrevIndex) |
Performs the make selected segments into lines operation. |
Definition at line 186 of file pathops.h.
|
OpMakeSegmentsCurves constructor - does nothing itself.
Definition at line 524 of file pathops.cpp.
|
|
Definition at line 618 of file pathops.cpp. 00620 { 00621 #ifndef STANDALONE 00622 00623 ERROR2IF(pOp == NULL,FALSE, "Operation pointer was NULL"); 00624 ERROR2IF(ThisPath == NULL,FALSE, "Path pointer was NULL"); 00625 00626 DocCoord* Coords = ThisPath->InkPath.GetCoordArray(); 00627 // PathFlags* Flags = ThisPath->InkPath.GetFlagArray(); 00628 PathVerb* Verbs = ThisPath->InkPath.GetVerbArray(); 00629 00630 DocCoord First; 00631 DocCoord Second; 00632 PathFlags NewFlags; 00633 NewFlags.IsEndPoint = FALSE; 00634 NewFlags.NeedToRender = FALSE; 00635 NewFlags.IsSelected = TRUE; 00636 NewFlags.IsSmooth = TRUE; 00637 NewFlags.IsRotate = TRUE; 00638 00639 // By default position the control points one-third of the way along the line between the 00640 // first and second endpoints (changing the line into an identical line). At the end of the 00641 // make curves operation we can go round and smooth the entire path. 00642 First.x = Coords[PrevPos].x-(Coords[PrevPos].x-Coords[Count].x)/3; 00643 First.y = Coords[PrevPos].y-(Coords[PrevPos].y-Coords[Count].y)/3; 00644 Second.x = Coords[PrevPos].x-((Coords[PrevPos].x-Coords[Count].x)/3)*2; 00645 Second.y = Coords[PrevPos].y-((Coords[PrevPos].y-Coords[Count].y)/3)*2; 00646 00647 PathVerb EndVerb = Verbs[Count]; 00648 DocCoord EndCoord = Coords[Count]; 00649 00650 ERROR2IF((EndVerb & ~PT_CLOSEFIGURE) != PT_LINETO, FALSE, "Attempt to convert a non-line to a curve!"); 00651 00652 EndVerb = ((EndVerb & PT_CLOSEFIGURE) | PT_BEZIERTO) ; 00653 00654 // After any of these actions the path must be OK. 00655 BOOL DoneOK = TRUE; 00656 00657 // Insert a curve into the path 00658 if (DoneOK) 00659 { 00660 if ((PrevPos+2) >= ThisPath->InkPath.GetNumCoords()) 00661 { 00662 DoneOK = ThisPath->InkPath.AddCurveTo(First, Second, EndCoord, &NewFlags); 00663 } 00664 else 00665 { 00666 ThisPath->InkPath.SetPathPosition(PrevPos+2); 00667 DoneOK = ThisPath->InkPath.InsertCurveTo(First, Second, EndCoord, &NewFlags); 00668 } 00669 } 00670 00671 // Correct the end verb 00672 if (DoneOK) 00673 { 00674 Verbs = ThisPath->InkPath.GetVerbArray(); 00675 Verbs[PrevPos+4] = EndVerb; 00676 } 00677 00678 // Now insert an action to remove the curve 00679 if (DoneOK) 00680 { 00681 Action* UnAction; 00682 ActionCode Act; 00683 Act = RemovePathElementAction::Init(pOp, pActions, 3, PrevPos+2, (Action**)(&UnAction)); 00684 if (Act == AC_OK) 00685 ((RemovePathElementAction*)UnAction)->RecordPath(ThisPath); 00686 DoneOK = !(Act == AC_FAIL); 00687 } 00688 00689 // Finally delete the line 00690 if (DoneOK) 00691 DoneOK = pOp->DoDeletePathSection(ThisPath, PrevPos+1, 1, FALSE); 00692 00693 return DoneOK; 00694 00695 #else 00696 return TRUE; 00697 #endif 00698 }
|
|
Reimplemented from OpBaseConvertPathSegment. Definition at line 198 of file pathops.h. 00198 {return PT_BEZIERTO;}
|
|
Reimplemented from OpBaseConvertPathSegment. Definition at line 197 of file pathops.h. 00197 {return PT_LINETO;}
|
|
Definition at line 558 of file pathops.cpp. 00559 { 00560 return OpBaseConvertPathSegment::BaseGetState(PT_BEZIERTO); 00561 }
|
|
OpMakeSegmentsCurves initialiser method.
Reimplemented from SimpleCCObject. Definition at line 544 of file pathops.cpp. 00545 { 00546 return (RegisterOpDescriptor( 0, 00547 _R(IDS_MAKECURVES), 00548 CC_RUNTIME_CLASS(OpMakeSegmentsCurves), 00549 OPTOKEN_MAKECURVESOP, 00550 OpMakeSegmentsCurves::GetState, 00551 0, /* help ID */ 00552 _R(IDBBL_MAKELINES), 00553 0 /* bitmap ID */)); 00554 }
|
|
Performs the make selected segments into lines operation.
Reimplemented from OpBaseConvertPathSegment. Definition at line 579 of file pathops.cpp. 00580 { 00581 // Get the path pointers 00582 PathVerb* Verbs; 00583 PathFlags* Flags; 00584 DocCoord* Coords; 00585 pPath->InkPath.GetPathArrays(&Verbs, &Coords, &Flags); 00586 00587 // Quick check 00588 ERROR2IF(((Verbs[*Index] & ~PT_CLOSEFIGURE) != PT_LINETO), FALSE, "Unknown segment encountered"); 00589 ERROR2IF(((PrevIndex+1) != *Index), FALSE, "Points between segment start and end"); 00590 00591 BOOL ok = CarryOut(*Index, PrevIndex, pPath, this, &UndoActions); 00592 *Index = PrevIndex + 3; 00593 00594 return ok; 00595 }
|