Skip to content

How use my SKBitmap or a Maui Resource png with SkiaImage? #96

Answered by taublast
ToolmakerSteve asked this question in Q&A
Discussion options

You must be logged in to vote

Hi!

You have 2 ways:

  • 1 like was mentioned in the readme:

All files to be consumed (images etc) must be placed inside the MAUI app Resources/Raw folder, subfolders allowed. If you need to load from the native app folder use prefix "file://".

<draw:SkiaImage x:Name="BtnImage" Source="baboon.jpg" ... /> where image is embedded in Resources/Raw.

This will use SkiaImageManager

  • 2 Directly set image with SetBitmapInternal or SetImageInternal, example
SKImage screenshot = load/create...
BtnImage.SetImageInternal(screenshot);

Also play with BtnImage.LoadSourceOnFirstDraw would want it to be False in your case

Replies: 7 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by taublast
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #91 on October 19, 2024 15:30.