Jump to content

AppDev

Newbies
  • Posts

    6
  • Joined

  • Last visited

Everything posted by AppDev

  1. Well, i figured it out myself. I am posting this for other newbies like me. The problem was that I was trying to include namespaces in the CodeLab somehow but it is not possible. In CodeLab if you have to use file I/O functionality, you have to declare object like this; System.IO.StreamReader reader. So whatever object you want to declare and if codelab is giving error that "namespace not found" then just write full class name along with required namespaces prefix.
  2. Hi all, I have written a simple plugin which draws an Arrow. Arrow is made up of two polygons. Left and Right. Each side has different color. I want to resize any side such that it maintain the symmetry and shape of the arrow. I have achieved this only if the Arrow head is an equilateral triangle. But if its not equilateral then Arrow gets de-shape. I have attached screenshot for the reference. Also if i resize 1 side and then resize other side arrow again gets de-shape. What will be a generic algorithm to achieve this. I want that Arrow maintain it symmetry in any way i resize it. Regards
  3. Hi All, I want to write a Plugin which reads a text file and take two parameters startpoint(x,y) endpoint(x,y) from it and draw a line between these two points. I want to know that is it possible to read a text file programmatically in codelab? Thanx
  4. Hi all, I have figured it out. I was actually drawing polygon at point (400,400) and then applying transform to it which was causing rotation problem. Now i have drawn the Polygon at Point (0,0) and applied TranslateTranform(400,400), now polygon is rotating around point (400, 400). Thanx all.
  5. Thank you all for your replies. I have used g.TranslateTransform(p1, p2); and g.RotateTransform(angle); but it still not rotating the arrow around a specific point. I have attached the screenshots of the problem. I have drawn the arrow on point (400, 400). In the 1st screenshot I have set g.TranslateTransform(0, 0); and g.RotateTransform(0); and the arrow is positioned right where it is drawn with no rotation. i.e. (400,400). In the 2nd screenshot I have set g.TranslateTransform(0, 0); and g.RotateTransform(20); and the arrow is positioned Below the position (400, 400) with a little angle. In the 3rd screenshot I have set g.TranslateTransform(400, 400); and g.RotateTransform(20); and most of the arrow is positioned outside the canvas. Am I missing something here? What values I will use to correctly do this? Also When I declare an object of Matrix class it gives an error "The type or namespace "Matrix" could not be found"
  6. Hi, I am new to Paint.net Plugin development. I have viewed few tutorials to code in C# using CodeLab. I have write a simple program that draw an Arrow on the canvas using different parameters. The code for drawing arrow is as follow. Rectangle selection = EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt(); dst.CopySurface(src,rect.Location,rect); // create a Brush to draw a filled Polygon SolidBrush myBrushColor1 = new SolidBrush(Amount9); // create a GDI+ graphics surface Graphics g = new RenderArgs(dst).Graphics; g.Clip = new Region(rect); // Code for Drawing Arrow g.FillPolygon(myBrushColor1, new PointF[] { new PointF(Amount1, Amount2), new PointF(Amount1+Amount4, Amount2), new PointF(Amount1+Amount4, Amount2-Amount5), new PointF(Amount1+Amount4+Amount6, Amount2-Amount5), new PointF(Amount1, Amount2-Amount5-Amount8) }); By using the above code the Arrow is drawn on the canvas successfully. Now I want to rotate the Drawn arrow to any specified angle. I have used g.RotateTransform(Angle); but it rotate the arrow according to the starting point of the canvas, but i want to rotate the arrow around its center point. Any help will be appreciated. Thanks,
×
×
  • Create New...