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

Missing methods for DrawingContext #16349

Closed
Shadowblitz16 opened this issue Jul 17, 2024 · 2 comments
Closed

Missing methods for DrawingContext #16349

Shadowblitz16 opened this issue Jul 17, 2024 · 2 comments

Comments

@Shadowblitz16
Copy link

Describe the bug

The following are missing from DrawingContext

  • FillGeometry
  • FillEllipse
  • FillLine
  • FillText
  • DrawPixel
  • FetchPixels

To Reproduce

public class Surface : RenderTargetBitmap
{
    
    public Surface(uint width, uint height) : base(new((int)width, (int)height), Vector.One)
    {
        var target = CreateDrawingContext()
            target.
    }
}

Expected behavior

FillLine is a bit obscure due to lines usually not having outlines but the others would be really nice to have.

Avalonia version

11.0.10

OS

Linux

Additional context

No response

@maxkatz6
Copy link
Member

  1. FillGeometry, FillEllipse - existing DrawGeometry method accepts both Pen and Brush parameters for outline and filling accordingly. This is not missing.
  2. FillLine - use DrawLine.
  3. FillText - build FormattedText and call BuildHighlightGeometry on it. Now you have a highlight/outline geometry than can be outlined independently. This is not missing.
  4. DrawPixel and FetchPixels - drawing context doesn't operate with pixels. It's a set of commands that will be send to the GPU. You can draw a rectangle with width calculated depending on the RenderScaling though.

@Shadowblitz16
Copy link
Author

thankyou for clarifyng

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

No branches or pull requests

2 participants