Constructor of array of Point
-
german or english, which language do you prefer ?
Actually, you don't need an multidimensional array here if you only want to pass it to the Matrix constructor. You just add three Points to the array like this:
cli::array<System::Drawing::Point^>^ plgpts; // no dimension means single-dimension plgpts = gcnew cli::array<System::Drawing::Point^>(3); // 3 for 3 Points // define Points System::Drawing::Point^ pt1; System::Drawing::Point^ pt2; System::Drawing::Point^ pt3; pt1=gcnew System::Drawing::Point::Point(0,0); pt2=gcnew System::Drawing::Point::Point(0,2048); pt3=gcnew System::Drawing::Point::Point(1536,2048); // add them to the array plgpts[0] = pt1; plgpts[1] = pt2; plgpts[2] = pt3;
or:
cli::array<System::Drawing::Point^>^ plgpts = gcnew cli::array<System::Drawing::Point^>{pt1, pt2, pt3};
or:
cli::array<System::Drawing::Point^>^ plgpts = {pt1, pt2, pt3};
with kind regards,
Probe-Nutzer
-
ich weiß ein bisschen Deutsch aber nicht genug um technische Sachen zu sprechen, jjeje!!
I have proved your suggestions and all of them have the same problem:
error C2059: syntax error : ';'
3 times, one for each of those lines
pt1=gcnew (System::Drawing::Point::Point(0,0)); pt2=gcnew (System::Drawing::Point::Point(0,2048)); pt3=gcnew (System::Drawing::Point::Point(1536,2048));
and too
Error C2665: 'System::Drawing::Drawing2D::Matrix::Matrix' : none of the 6 overloads could convert all the argument typesin
L=gcnew( System::Drawing::Drawing2D::Matrix::Matrix(rect,plgpts));
but I supposed that it comes from the error of the points.
-
my mistake, try it like this:
// omit one ::Point in all of the Point definitions pt1=gcnew System::Drawing::Point(0,0); ...
the same with Matrix:
L=gcnew System::Drawing::Drawing2D::Matrix(rect,plgpts);
with kind regards,
Probe-Nutzer
-
I have made these changes and now I have got another error but I don't understand why, it says something about RectangleF and I am not using it. If I change my Rectangle into RectangleF there is also another error.
System::Drawing::Rectangle^ rect; System::Drawing::Bitmap^ img; img=gcnew System::Drawing::Bitmap(image); int nc=img->Width; int nr=img->Height; rect=System::Drawing::Rectangle(0, 0, nc, nr); L=gcnew System::Drawing::Drawing2D::Matrix(rect,plgpts);
error C2664: 'System::Drawing::Drawing2D::Matrix::Matrix(System::Drawing::RectangleF,cli::array<Type,dimension> ^)' : cannot convert parameter 1 from 'System::Drawing::Rectangle ^' to 'System::Drawing::RectangleF'
if I declare it as RectangleF this is the error (the same as before)
error C2664: 'System::Drawing::Drawing2D::Matrix::Matrix(System::Drawing::RectangleF,cli::array<Type,dimension> ^)' : cannot convert parameter 1 from 'System::Drawing::RectangleF ^' to 'System::Drawing::RectangleF'
-
both of the System::Drawing::Drawing2D::Matrix constructors with Rectangle(F) arguments expect a value type as first argument. Look at the declaration:
public: Matrix ( Rectangle rect, array<Point>^ plgpts )
There's no "^" next to Rectangle, therefore:
System::Drawing::Rectangle rect;
is the right way to declare the rect.
with kind regards,
Probe-Nutzer
-
System::Drawing::Drawing2D::Matrix^ L; System::Drawing::Rectangle rect; cli::array<System::Drawing::Point^>^ plgpts; plgpts = gcnew cli::array<System::Drawing::Point^>(3); // 3 for 3 Points System::Drawing::Point^ pt1; System::Drawing::Point^ pt2; System::Drawing::Point^ pt3; pt1=gcnew System::Drawing::Point(0,0); pt2=gcnew System::Drawing::Point(0,2048); pt3=gcnew System::Drawing::Point(2048,1536); plgpts[0] = pt1; plgpts[1] = pt2; plgpts[2] = pt3; System::Drawing::Bitmap^ img; img=gcnew System::Drawing::Bitmap(image); int nc=img->Width; int nr=img->Height; rect=System::Drawing::Rectangle(0, 0, nc, nr); L=gcnew System::Drawing::Drawing2D::Matrix(rect,plgpts);
this is what I have until now. Now that there is no problem in the first parameter there is another one with the second one. Puff!!it has no end
error C2664: 'System::Drawing::Drawing2D::Matrix::Matrix(System::Drawing::RectangleF,cli::array<Type,dimension> ^)' : cannot convert parameter 2 from 'cli::array<Type> ^' to 'cli::array<Type,dimension> ^'
-
yet another change:
System::Drawing::Drawing2D::Matrix^ L; System::Drawing::Rectangle rect; cli::array<System::Drawing::Point>^ plgpts; plgpts = gcnew cli::array<System::Drawing::Point>(3); // 3 for 3 Points System::Drawing::Point pt1; System::Drawing::Point pt2; System::Drawing::Point pt3; pt1=System::Drawing::Point(0,0); pt2=System::Drawing::Point(0,2048); pt3=System::Drawing::Point(2048,1536); plgpts[0] = pt1; plgpts[1] = pt2; plgpts[2] = pt3; System::Drawing::Bitmap^ img; img=gcnew System::Drawing::Bitmap(image); int nc=img->Width; int nr=img->Height; rect=System::Drawing::Rectangle(0, 0, nc, nr); L=gcnew System::Drawing::Drawing2D::Matrix(rect,plgpts);
with kind regards,
Probe-Nutzer
-
puff!!it's unbelievable that nothing works. Now the errors are in the points
error C2440: '=' : cannot convert from 'System::Drawing::Point ^' to 'System::Drawing::Point'
The constructor of Matrix in the second parameter needs this
cli::arraySystem::Drawing::Point,1^plgptsmaybe there is something wrong with that 1, or we don't need Point to be Point^ but if I try there's the error of above.
-
change the array's initialization:
cli::array<System::Drawing::Point>^ plgpts = gcnew cli::array<System::Drawing::Point>{System::Drawing::Point(0,0), System::Drawing::Point(0,2048), System::Drawing::Point(2048,1536)};
then the following lines:
plgpts = gcnew cli::array<System::Drawing::Point>(3); // 3 for 3 Points System::Drawing::Point pt1; System::Drawing::Point pt2; System::Drawing::Point pt3; pt1=System::Drawing::Point(0,0); pt2=System::Drawing::Point(0,2048); pt3=System::Drawing::Point(2048,1536); plgpts[0] = pt1; plgpts[1] = pt2; plgpts[2] = pt3;
can be removed.
with kind regards,
Probe-Nutzer
-
wunderbaaaar!!!
IT WORKS!!!!!
Thank you so much for your help and dedication!!