|
@@ -1,13 +1,7 @@
|
|
|
#include "cdrapp.h"
|
|
|
#include <stdio.h>
|
|
|
|
|
|
-#define ZERO_4PC 0, 0, 0, 0
|
|
|
|
|
|
-IVGShapePtr MakeEllipse(corel* cdr, double x, double y, double r);
|
|
|
-IVGShapePtr MakeEllipse(corel* cdr, IVGShapePtr s, double r);
|
|
|
-
|
|
|
-IVGShapePtr MakeRectangle(corel* cdr, double x, double y, double w, double h);
|
|
|
-IVGShapePtr MakeRectangle(corel* cdr, IVGShapePtr s, double w, double h);
|
|
|
bool polygon_gravity_dot(corel* cdr){
|
|
|
cdr->ActiveDocument->Unit = cdrMillimeter;
|
|
|
double x, y;
|
|
@@ -15,6 +9,9 @@ bool polygon_gravity_dot(corel* cdr){
|
|
|
|
|
|
auto s = cdr->ActiveShape;
|
|
|
|
|
|
+
|
|
|
+ auto srs = cdr->CreateShapeRange();
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -26,14 +23,19 @@ bool polygon_gravity_dot(corel* cdr){
|
|
|
y = n->PositionY;
|
|
|
printf("%f, %f\n", x, y);
|
|
|
|
|
|
- auto sy = MakeEllipse(cdr, x, y, 5);
|
|
|
- sy->Outline->Color->RGBAssign(255, 0, 0);
|
|
|
+
|
|
|
+
|
|
|
|
|
|
- auto sj = MakeRectangle(cdr, x, y, 10, 10);
|
|
|
- sj->Outline->Color->RGBAssign(0, 255, 0);
|
|
|
+
|
|
|
+
|
|
|
|
|
|
+ auto l = DrawLine(cdr, x, y, s->CenterX, s->CenterY);
|
|
|
+ srs->Add(l);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ srs->CreateSelection();
|
|
|
+
|
|
|
return true;
|
|
|
}
|
|
|
|
|
@@ -69,4 +71,21 @@ IVGShapePtr MakeRectangle(corel* cdr, IVGShapePtr s, double w, double h){
|
|
|
sj->PutCenterX(x);
|
|
|
sj->PutCenterY(y);
|
|
|
return sj;
|
|
|
-}
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+IVGShapePtr DrawLine(corel* cdr, double x1, double y1, double x2, double y2){
|
|
|
+ auto line = cdr->ActiveLayer->CreateLineSegment(x1, y1, x2, y2);
|
|
|
+ line->Outline->Color->CMYKAssign(0, 100, 0, 0);
|
|
|
+ return line;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|