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

Base package without ImageSharp #428

Open
cyanfish opened this issue Mar 3, 2024 · 0 comments
Open

Base package without ImageSharp #428

cyanfish opened this issue Mar 3, 2024 · 0 comments

Comments

@cyanfish
Copy link

cyanfish commented Mar 3, 2024

Would you be open to splitting the PdfSharpCore package so that the ImageSharp dependency is decoupled?

For example:

  • Move ImageSharpImageSource & ImageSharp dependency into a new PdfSharpCore.ImageSharp project that references the PdfSharpCore project
  • PdfSharpCore project -> PdfSharpCore.Base Nuget package
    • Keeping old project/folder name to not break all PRs/forks
  • PdfSharpCore.ImageSharp project -> PdfSharpCore Nuget package
    • Keeping Nuget package the same so as to not break existing users

For my own uses I would like to use PdfSharpCore with my own IImageSource implementation (currently I use a fork without ImageSharp). I think this would also help resolve the various complaints about ImageSharp v3 as someone could create their own package on top of PdfSharpCore.Base including ImageSharp v3 support.

The only implementation issue I see is this direct dependency from XImage -> ImageSharpImageSource:

if (ImageSource.ImageSourceImpl == null) ImageSource.ImageSourceImpl = new ImageSharpImageSource<Rgba32>();

That could either be replaced with reflection or a separate static helper class (e.g. XImageSharp.FromFile instead of XImage.FromFile). Neither solution is !00% perfect as reflection might not work with trimming and a separate class is obviously a breaking change (though a minor one).

Anyway, if you're open to the idea, I'd be happy to make a PR for this.

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

1 participant