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

Enable building code without System.Drawing.Common dependency #931

Merged
merged 3 commits into from
Jan 5, 2022

Conversation

wieslawsoltes
Copy link
Contributor

Reference Issue

What does this implement/fix? Explain your changes.

Enabled building library without System.Drawing.Common dependency by defining NO_SDC.

Any other comments?

@wieslawsoltes wieslawsoltes changed the title Remove System.Drawing.Common dependency Enable compiling without System.Drawing.Common dependency Jan 2, 2022
@wieslawsoltes wieslawsoltes marked this pull request as ready for review January 2, 2022 16:21
@wieslawsoltes wieslawsoltes changed the title Enable compiling without System.Drawing.Common dependency Enable building code without System.Drawing.Common dependency Jan 2, 2022
@H1Gdev
Copy link
Contributor

H1Gdev commented Jan 4, 2022

I don't know how to surround NO_SDC...
Are there any rules ?

@wieslawsoltes
Copy link
Contributor Author

If you removeSystem.Drawing.Common package reference anything that does not compile. All the code that uses types from System.Drawing.Common are surrounded by NO_SDC if/def.

@wieslawsoltes
Copy link
Contributor Author

If you removeSystem.Drawing.Common package reference anything that does not compile. All the code that uses types from System.Drawing.Common are surrounded by NO_SDC if/def.

In Svg.Skia I substituted the System.Drawing.Common with SkiaSharp alternative.

@mrbean-bremen
Copy link
Member

@wieslawsoltes - I have rebased this with master, please check if all still works with Svg.Skia and I haven't messed something up while resolving conflicts. Will merge if you give the ok.

@wieslawsoltes
Copy link
Contributor Author

@wieslawsoltes - I have rebased this with master, please check if all still works with Svg.Skia and I haven't messed something up while resolving conflicts. Will merge if you give the ok.

@mrbean-bremen Works fine with Svg.Skia. Thanks!

@mrbean-bremen mrbean-bremen merged commit 4ba2433 into svg-net:master Jan 5, 2022
github-actions bot pushed a commit that referenced this pull request Jan 5, 2022
…BuildProcessTemplates CONTRIBUTING.md Generators Nuget README.md Samples Source Tests doc docfx.json index.md license.txt Remove System.Drawing.Common dependency
@wieslawsoltes wieslawsoltes deleted the RemoveSDC branch January 5, 2022 21:02
@H1Gdev
Copy link
Contributor

H1Gdev commented Jan 6, 2022

@wieslawsoltes

The questions are listed below.

  • Where is NO_SDC defined ?
  • How does SVG behave when NO_SDC is defined?

@wieslawsoltes
Copy link
Contributor Author

@wieslawsoltes

The questions are listed below.

  • Where is NO_SDC defined ?
  • How does SVG behave when NO_SDC is defined?

In my Svg.Custom project https://github.com/wieslawsoltes/Svg.Skia/blob/407a032aeaaf9a3716959e52e63aca6953f50c6d/src/Svg.Custom/Svg.Custom.csproj#L14

When it's defined I replace all removed functionality with my code.

@H1Gdev
Copy link
Contributor

H1Gdev commented Jan 6, 2022

@wieslawsoltes

Thanks !

@mrbean-bremen

This PR depends on Svg.Skia.
How about creating another branch ?

@mrbean-bremen
Copy link
Member

@H1Gdev - it is the other way around, Svg.Skia depends on this. It is not ideal, but I see this as a first step to factor out the drawing functionality as mentioned in #590. Anyway we need a way to handle the dropped support for Common.Drawing, and Svg.Skia already does a lot here. I would like to work both repos to be able to work together more seemlessly, and this change might be a step on this way.

@@ -34,6 +36,7 @@ private static PointF CalculateSecondControlPoint(PointF controlPoint, PointF en
return new PointF(x2, y2);
}

#if !NO_SDC
Copy link
Contributor

Choose a reason for hiding this comment

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

@wieslawsoltes

I think it surrounds AddToPath.

Copy link
Member

Choose a reason for hiding this comment

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

It surrounds AddToPath and the helper function CalculateControlPoint used in AddToPath. Is that wrong?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I will submit PR with splitting of all drawing code inside NO_SDC if/def into separate files. This should be easier to read and maintain also make next step closer for #590

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Started work here #934 @H1Gdev @mrbean-bremen your input would be appreciated

Copy link
Member

Choose a reason for hiding this comment

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

That sounds good, thanks! I will have a look later today.

@wxdlt
Copy link

wxdlt commented May 12, 2022

I need to not include "system. Drawing. Common". Due to the problem of memory non release in Linux, when can It release a new version?

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.

4 participants