Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FS_POINTF_ is a struct in Pdfium but a class in this library #25

Open
torfluor opened this issue Oct 10, 2024 · 2 comments
Open

FS_POINTF_ is a struct in Pdfium but a class in this library #25

torfluor opened this issue Oct 10, 2024 · 2 comments

Comments

@torfluor
Copy link

I'm trying to add ink annotations using FPDFAnnotAddInkStroke, and it takes a pointer to an array of FS_POINTF_. When sending in a C# array of points like this fpdf_annot.FPDFAnnotAddInkStroke(annot, fs_points[0], (ulong)fs_points.Length); I get strange results, leading me to think that there is an issue in the conversion between the class objects and the struct.
I think if would be better if FS_POINTF_ was a struct instead.

@torfluor
Copy link
Author

After reading up on helper-defines in CppSharp I added CS_VALUE_TYPE to the FS_POINTF struct in fpdfview.h. I also had to define CS_VALUE_TYPE, so the code ended up like this:

#define CS_VALUE_TYPE
// 2D Point. Coordinate system agnostic.
typedef struct CS_VALUE_TYPE FS_POINTF_ {
  float x;
  float y;
} * FS_LPPOINTF, FS_POINTF;

FS_POINTF_ is then generated as a struct in the C# code. This hard coding works, but I'm not sure how to best add this to the generator program. Please advice on how to add this change and I'll create a pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@torfluor and others