Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about Android development and PDF
  • Page:
  • 1

TOPIC:

Drawing a polygon 6 years 7 months ago #12848

  • doubleeye
  • doubleeye's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 21
  • Thank you received: 0
Good day, please advise me how to draw a polygon using the latest library version.

This is what I currently have

Page page = m_doc.GetPage(vpage.GetPageNo());
page.ObjsStart();
Path path = new Path();
path.MoveTo(100, 100);
path.LineTo(120, 100);
path.LineTo(120, 130);
path.LineTo(110, 120);
path.LineTo(100, 130);
path.LineTo(100, 100);
path.ClosePath();

int color = 0x99ff0000;
page.AddAnnotPolygon(path, color, color, 200);
page.Close();
path.Destroy();

it should look like a bookmark icon but it looks very strange with lines going all over the place

Please Log in or Create an account to join the conversation.

Drawing a polygon 6 years 7 months ago #12851

  • nermeen
  • nermeen's Avatar
  • Offline
  • Platinum Member
  • Platinum Member
  • Posts: 962
  • Thank you received: 87
You are setting a 200 as stroke width (very big):
using the following code you obtain the correct shap:
Path path = new Path();
		path.MoveTo(100, 100);
		path.LineTo(120, 100);
		path.LineTo(120, 130);
		path.LineTo(110, 120);
		path.LineTo(100, 130);
		path.LineTo(100, 100);
		path.ClosePath();

		int color = 0x99ff0000;
		page.AddAnnotPolygon(path, 0xff000000, color, 2);


If you want it upside down:
Path path = new Path();
		path.MoveTo(100, 130);
		path.LineTo(120, 130);
		path.LineTo(120, 100);
		path.LineTo(110, 110);
		path.LineTo(100, 100);
		path.LineTo(100, 130);
		path.ClosePath();

		int color = 0x99ff0000;
		page.AddAnnotPolygon(path, 0xff000000, color, 2);

Attachments:

Please Log in or Create an account to join the conversation.

Drawing a polygon 6 years 7 months ago #12853

  • doubleeye
  • doubleeye's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 21
  • Thank you received: 0
Brilliant, thanks, I will give this a try!

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Powered by Kunena Forum