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

SkiaSharp.Views.Blazor and the SkiaSharp.Views not work well with Blazor/Wasm #3020

Open
1 task done
ShingYehGit opened this issue Sep 28, 2024 · 2 comments
Open
1 task done
Labels

Comments

@ShingYehGit
Copy link

Description

BlazorSKiaErr

Blazor .Net 8 / SkiaSharp 2.88

(1).
in app.css
FitBody {
width: 100%;
height: calc(100vh - 5rem);
background-color: #239B56;
border-radius: 6px;
}
in Home.razor

work well, the div size (width: 100%; height: calc(100vh - 5rem);)as expected

(2).
once

(3).
void OnPaintSurface(SKPaintSurfaceEventArgs args)
{
SKImageInfo NewInfo = args.Info;
SKSurface surface = args.Surface;
SKCanvas canvas = surface.Canvas;

canvas.Clear(SKColors.White);

DisplayingSize = NewInfo.Size;

}

(4).
It should be whole white cover the


The SKCanvas canvas size is wrong
Only cover the Left Top part
The SKCanvas canvas size should be equal to the
div size (width: 100%; height: calc(100vh - 5rem);)as expected

Code

The best way to share code for larger projects is a link to a GitHub repository: https://github.com/user/repo/tree/bug-123

But, you can also share a short block of code here:
FitBody {
width: 100%;
height: calc(100vh - 5rem);
background-color: #239B56;
border-radius: 6px;/* margin: 0 0 0 -20px; */
}

// some C# code here
void OnPaintSurface(SKPaintSurfaceEventArgs args)
{
    SKImageInfo NewInfo = args.Info;
    SKSurface surface = args.Surface;
    SKCanvas canvas = surface.Canvas;

    //canvas.Clear();
    canvas.Clear(SKColors.White);

    DisplayingSize = NewInfo.Size;
}

You can also share some XAML:

<!-- xaml code here -->
i
<div class=“FitBody”>
<SKCanvasView @ref=“skiaView” OnPaintSurface=“OnPaintSurface” IgnorePixelScaling=“true” />
</div>

Expected Behavior

The SKCanvas canvas size should be equal to the
div size (width: 100%; height: calc(100vh - 5rem);)as expected

Actual Behavior

The SKCanvas canvas size is wrong
BlazorSKiaErr
Only cover the Left Top part

Version of SkiaSharp

2.88.3 (Current)

Last Known Good Version of SkiaSharp

2.88.2 (Previous)

IDE / Editor

Visual Studio (Windows)

Platform / Operating System

Windows

Platform / Operating System Version

Blazor/Wasm .Net 8 / SkiaSharp.Views.Blazor and the SkiaSharp.Views 2.88

Devices

Dell LapTop Win 11

Relevant Screenshots

Dell Laptop Window 11

Relevant Log Output

There is no log out

Code of Conduct

  • I agree to follow this project's Code of Conduct
@whateverharder
Copy link

@ShingYehGit
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants