Skip to content

Expose routines for reading and creating .png files#1553

Open
zur003 wants to merge 2 commits into
gircore:mainfrom
zur003:png-support
Open

Expose routines for reading and creating .png files#1553
zur003 wants to merge 2 commits into
gircore:mainfrom
zur003:png-support

Conversation

@zur003

@zur003 zur003 commented Jul 4, 2026

Copy link
Copy Markdown
  • I agree that my contribution may be licensed either under MIT or any version of LGPL license.

This pull request exposes the cairo_image_surface_create_from_png and cairo_surface_write_to_png routines and thereby resolves #1229.

@badcel badcel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR 🚀

Please see my comments.

If you do changes please squash all your commits into one afterwards, so that we can merge your code with one commit only.

Comment thread src/Libs/cairo-1.0/Internal/ImageSurface.cs Outdated
Comment thread src/Libs/cairo-1.0/Internal/Surface.cs Outdated
Comment thread src/Libs/cairo-1.0/Public/ImageSurface.cs Outdated
Comment thread src/Libs/cairo-1.0/Internal/Surface.cs
Comment thread src/Libs/cairo-1.0/Public/Surface.cs
@zur003

zur003 commented Jul 4, 2026

Copy link
Copy Markdown
Author

I've partially made the changes you suggested, but haven't moved WriteToPng. Provide me with your feedback, and I'll squash my changes into a new PR.

@badcel badcel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick updates.

Only one comment remains. I will need to test your code manually. Which will happen probably tomorrow.

Afterwards I could merge it.

If you squash your commits you don't need to create a new PR. You just make 1 commit from multiple and force push your branch. The PR will update itself. If you prefer it the other way, it's fine for me, too.

Thanks for your contribution already 👍

SetUserData(data);
}

public ImageSurface(string filename) :

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I like the constructor here as it does not make clear that it is valid for png only.

We should at least rename the parameter to filenamePng or similar. But then there would be no way to create other image surfaces from a file name.

On the other hand I like that it's aligned with the rest of the API.

There is still issue: #1506

So to come to a conclusion: Let's start with a regular constructor in this PR and other considerations come later.

What do you think?

Comment thread src/Libs/cairo-1.0/Internal/Surface.cs
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

Successfully merging this pull request may close these issues.

support cairo_image_surface_create_from_png()

2 participants