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

TOPIC:

Ink Annotation 7 years 4 months ago #11528

  • mrawy
  • mrawy's Avatar
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 20
  • Thank you received: 0
The documentation says node types are:
www.radaeepdf.com/documentation/javadocs...GetNode-int-float:A-
0: move to
1: line to
3: curve to, index, index + 1, index + 2 are all data
4: close operation
But i have only a 3 types of node: 0, 1 and 2.
I think there is something wrong.
And please can you provide code sample.

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

Ink Annotation 7 years 4 months ago #11548

  • nermeen
  • nermeen's Avatar
  • Offline
  • Platinum Member
  • Platinum Member
  • Posts: 962
  • Thank you received: 87
Sorry it's an error in the javadoc, below you can find an example on how to read the ink path:
if(annot != null && annot.GetType() == 15) {
			Path inkPath = annot.GetInkPath();
			float pt1[] = new float[2];
			float pt2[] = new float[2];
			int index = 0;
			int cnt = inkPath.GetNodeCount();
			while( index < cnt ) {
				int op = inkPath.GetNode(index, pt1);
				switch( op ) {
					case 1: //line to
						Log.i("---INK---", "-- line to " + pt1[0] + ", " + pt1[1]);
						index++;
						break;
					case 2: //curve to
						inkPath.GetNode(index + 1, pt2);
                                                float pt3[] = new float[2];
						inkPath.GetNode(index + 2, pt3);
						Log.i("---INK---", "-- curve to " + pt1[0] + ", " + pt1[1] + ", " + pt2[0] + ", " + pt2[1] + ", " + pt3[0] + ", " + pt3[1]);
						index += 3;
						break;
					default: //move to
						Log.i("---INK---", "-- move to " + pt1[0] + ", " + pt1[1]);
						index++;
						break;
				}
			}
			inkPath.Destroy();
		}

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

Last edit: by nermeen.
Powered by Kunena Forum