Skip to main content
Participating Frequently
May 27, 2020
Question

[C++ SDK] Adobe FixedPoint and FixedRect to cartesian coordinate mapping

  • May 27, 2020
  • 2 replies
  • 687 views

I am trying to understand the equivalency of some structure in the SDK and how they relate to a Cartesian coordinate system. I feel like some of these questions are dumb, but I don’t want to make assumption and continue with a false sense of understanding of the how the structures maps. In an attempt to express my confusion clearly, I have broken down these into multiple questions.

 

Question 1. How does an ASFixedPoint map to x and y?

Given an ASFixedPoint, is it safe to assume that:

  • h ---> x
  • v ---> y

I took to assume that h was short for horizontal, and v for vertical

 

Question 2. How does a rectangle expressed as [left top right bottom] map to an ASFixedQuad?

 

Here’s the source of my confusion: in the PDF Reference V1.7, Section 3.8.4, a rectangle is said to be specified by an array that takes the form:

[ll_x, ll_y, ur_x, ur_y] 

where 

ll_x is lower-left x, 

ll_y is lower-left y, 

ur_x is upper-right x, 

ur_y is upper-right y

 

The passage also states specifying the other set of opposite is okay.

The rectangle structure is also allowed to be specified as [left, top, right, bottom] (this is what the ASFixedRect are specified as)

 

My question is, what is the mapping of these coordinates?

Is the following correspondence correct:

left -> upper left x, 

Top -> upper left y

Right -> lower right x,

Bottom -> lower right y

----

I know this question might be super simple, but I don't want to make assumptions about the SDK as I have in the past.

 

Thanks

This topic has been closed for replies.

2 replies

Thom Parker
Community Expert
Community Expert
May 29, 2020

Do what I do, try it and see.

I've written endless test plug-ins for Acrobat. It's the only way to really know. 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Legend
May 27, 2020

Fixed point values are not integers or floating point and must not be typecast to them (Not what you ask, but a common error). The types in the API are often derived from info in a PDF but may be an abstraction. Never assume correspondence unless explicitly documented. h and v are horizontal and vertical, so x and y respectively.  ASFixedQuad values may not be rectangles. The API would often use ASFixedRect in the case where a value is an axis aligned rectangle.