question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow Anti-Aliasing to be disabled

See original GitHub issue

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I’m always frustrated when […]

Drawing 1-pixel thick lines results in blurry, fuzzy outputs while using DrawingContext.DrawLine(). image I believe this is due to anti-aliasing.

Describe the solution you’d like A clear and concise description of what you want to happen.

A way to disable anti-aliasing for the drawing context (which I believe is included in native WPF).

Describe alternatives you’ve considered A clear and concise description of any alternative solutions or features you’ve considered.

Right now, I can add 0.5 to all my x,y values to prevent this behavior. image

But this is less than ideal as I can’t add a centre line through the square without it being blurred.

Additional context Add any other context or screenshots about the feature request here.

Blurry lines:

public void Draw(double x, double y, DrawingContext drawingContext)
{
    Pen _pen = new(new SolidColorBrush(Color.FromRgb(202, 205, 169)));

    List<Point> Points = new List<Point>()
    {
        new Point(x - 4, y - 4),
        new Point(x + 4, y - 4),
        new Point(x + 4, y + 4),
        new Point(x - 4, y + 4),
        new Point(x - 4, y - 4),
    };

    for (int i = 0; i < Points.Count - 1; i++)
    {
        drawingContext.DrawLine(_pen, Points[i], Points[i + 1]);
    }
}

Non-blurry lines:

public void Draw(double x, double y, DrawingContext drawingContext)
{
    Pen _pen = new(new SolidColorBrush(Color.FromRgb(202, 205, 169)));

    List<Point> Points = new List<Point>()
    {
        new Point(x - 4.5, y - 4.5),
        new Point(x + 4.5, y - 4.5),
        new Point(x + 4.5, y + 4.5),
        new Point(x - 4.5, y + 4.5),
        new Point(x - 4.5, y - 4.5),
    };

    for (int i = 0; i < Points.Count - 1; i++)
    {
        drawingContext.DrawLine(_pen, Points[i], Points[i + 1]);
    }
}

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
maxkatz6commented, Jun 27, 2022

@kolbyd @HoneyTauOverTwo you can set RenderOptions.BitmapInterpolationMode property:

<Image Source="{Binding MyBitmap}" RenderOptions.BitmapInterpolationMode="LowQuality" />

It has quite confusing naming for enum values, because we copied Skia naming. https://github.com/AvaloniaUI/Avalonia/blob/d1afd3bb591c266015dcdecc9611148ca08c2ee4/src/Skia/Avalonia.Skia/SkiaSharpExtensions.cs#L16 https://github.com/AvaloniaUI/Avalonia/blob/4c77f1eb3d11308412b915a82460e4408ce360a0/src/Windows/Avalonia.Direct2D1/Media/Imaging/WicBitmapImpl.cs#L28

0reactions
timuniecommented, Jan 12, 2023

@Hanprogramer If I understood correctly there is currently no easy easy to do. As you can see the issue is also still open. There is a PR to implement this, see #9584 . You may want to try this PR out and see if your issue is resolved.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Disable Antialiasing – FXAA in Nvidia - YouTube
How to Disable Antialiasing – FXAA in Nvidia Are you looking to improve the performance of your games on your Nvidia graphics card?...
Read more >
How to Disable Antialiasing for Video Drivers
1. Open the Nvidia Control Panel window by clicking the Nvidia icon in the system tray or the Start menu. · 2. Click...
Read more >
Any way to disable anti-aliasing on PC? : r/btd6
Click the "Antialiasing - Mode" option to select it, and then select "Off" in the box next to it. Click "Apply" to apply...
Read more >
Tips for Setting Antialiasing
Start the game and set antialiasing through the game menu. Game has its own antialiasing controls, but has only an "enable/disable" or "on/off"...
Read more >
Allow to disable the antialiasing when using Image/Painter ...
I would like to ask to allow to disable the antialiasing when using the Image composable. Paint has an antialiasing property but it's...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found