Replies: 4 comments 2 replies
-
You can write a custom bitmap implementation that exposes all the Skia stuff. Avalonia's bitmap implementation is an abstraction around what ever backend you are using. Generally you would use the Skia backend, but there are other backends supported on some platforms so it does not make sense for it to directly expose the Skia types. |
Beta Was this translation helpful? Give feedback.
-
Agree with skipping Generally, the UI framework shouldn't own your state and |
Beta Was this translation helpful? Give feedback.
-
For app development I'm happy with a default readonly Bitmap class, but I think there should be :
Then a WriteableBitmap class extending Bitmap makes sense to me. With the above I would only need for Skia for those 5% cases requiring fancy drawing. |
Beta Was this translation helpful? Give feedback.
-
I'm having success with these helper methods :
|
Beta Was this translation helpful? Give feedback.
-
My app needs to load and save images, and display thumbnails. So I began using Bitmap which loads ".jpg" fine.
But when I needed to save JPEG thumbnails it got difficult, and the solutions are wasteful in processor and memory.
Strangely, Bitmap.Save only saves in PNG format, even though Bitmap.Load loads both PNG & JPEG.
Underneath, Skia supports JPEG saving like this
skImage.Encode(SKEncodedImageFormat.Jpeg, 90)
.But how do you get a SKImage from a Bitmap? It seems you have to do Bitmap->WriteableBitmap-> ILockedFramebuffer->SKBitmap->SKImage (see below).
To avoid one step I could use WriteableBitmap everywhere, but that will cause problems one day, isn't intuitive and shouldn't be necessary.
Beta Was this translation helpful? Give feedback.
All reactions