OpenMacroBoard / OpenMacroBoard.SDK

MIT License
20 stars 10 forks source link

Have no FromGraphics on the version last version #20

Closed dxh-sc closed 5 months ago

dxh-sc commented 11 months ago

I am using the version of 3.0.0, but after i update to last version 5.0.0, can't build the project now. I see there have no "KeyBitmap.Create.FromGraphics" on the version 5.0.0. So there have another method to instead of it?

jskeet commented 5 months ago

Looks like this was removed in the "big bang v4 preview" commit.

I believe all the relevant code was in KeyBitmapDrawingExtensions.cs.

If the intention was to remove GDI+ dependencies from OpenMacroBoard.SDK, I suspect it would be reasonably simple to build a separate extension package that basically contained that code (assuming licensing etc is okay). Otherwise, I suspect the expectation is that folks will move to use ImageSharp (KeyBitmap.Create.FromImageSharpImage(...)) instead.

wischi-chr commented 5 months ago

@dxh-sc Sorry it took me so long to respond.

With the switch to v5 I removed some dependencies which were typically "windows-only" and/or not .NET 5 compatible. Yesterday I released v6 and there is now a new package you can add (as @jskeet suggested) to bring back those methods.

https://www.nuget.org/packages/OpenMacroBoard.SDK.KeyBitmap.GDI

I originally even thought about moving the ImageSharp dependency into a separate package with v6, but that would probably lead to a pretty bad developer experience, because the "naked" OpenMacroBoard.SDK - without the ImageSharp dependency - would only be able to create very trivial KeyBitmaps like solid colors or from raw RGB data and not load typical image formats like PNGs, JPEGs, etc. Also some things like the ButtonPressEffectAdapter internally use ImageSharp to rescale images and I would also have to move those. The StreamDeckSharp library is also probably the main use-case for OpenMacroBoard.SDK which internally also needs ImageSharp, because the protocol of some StreamDeckDevices require JPEGs and I use ImageSharp to do the JPEG conversion.

Please let me know if that works for you and feel free to reopen the issue or create a new one.

jskeet commented 5 months ago

@wischi-chr: Woot! Glad I was thinking along reasonable lines :) With the new package, I'll have another go at upgrading. (I don't know of any reason I particularly need to upgrade - but being ready for if and when there's Stream Deck+ support would be good :)