u/Rubus_Leucodermis

Where is the dotnet-apiref command?

Where is the dotnet-apiref command?

This is apparently used in generating the Avalonia API documentation from the doc comments in the Avalonia source code. See:

https://github.com/AvaloniaUI/avalonia-docs#api-reference-generation

Reason I ask is that I find it annoying that many Avalonia API documentation pages do not have the names of the methods, properties, etc. alphabetized, and I was going to submit a PR to rectify this (it should be easy enough, computers are good at sorting). But I can't seem to locate the relevant code that needs changing (which I am guessing would be in this script).

Neither Google nor Duck Duck Go seem to have anything to say about dotnet-apiref save for AI hallucinations. It seems to be some sort of Avalonia-specific build tool that never got checked into Github.

u/Rubus_Leucodermis — 13 days ago
▲ 2 r/AvaloniaUI+1 crossposts

ImagePrepSharp: Prepare Photos for Sharing

https://github.com/DavidBarts/ImagePrepSharp

This is a C#/Avalonia program to make it easy to share photos. It does this by stripping out extraneous metadata and ensuring the shared image will always display properly (no more surprises with images that come out sideways or upside down).

It opens an image file (it can handle any format Image Magick can, which is a whole lot of formats; this includes the HEIC files produced by iPhones but does not include camera raw files). It prompts for a desired maximum resolution (i.e. the resolution of the height or the width, whichever is greater), and downsamples the image to that resolution if needed. If the colour space is not sRGB, it converts it to sRGB. Most metadata (except for the colour profile) are deleted; this includes privacy-sensitive metadata revealing your camera model and serial number, and details of the image you shot.

Then it displays the image and lets you rotate it so it is right side up, if needed. After possibly rotating the image, the it can be saved in JPEG or WebP format suitable for sharing.

Mac app bundles (built on Tahoe 26.5.1) are included, because a Mac is what I have. It should build under Linux and Windows as well (and I’d appreciate someone doing that and sharing the resulting binaries with me so I can add them to the dist subdirectory).

I wrote this program for my own personal use and figured I’d share it in case anyone else finds it useful.

reddit.com
u/Rubus_Leucodermis — 25 days ago

Generic font names?

Is there any way to get generic (system-preferred) serif, sans serif, and monospace fonts in Avalonia like there is in CSS with "serif", "sans-serif", "monospace", etc?

reddit.com
u/Rubus_Leucodermis — 1 month ago

Subclassed ButtonSpinner does not render properly

I am trying to subclass a ButtonSpinner with TextBlock content:

public class MaxDimSpinner : ButtonSpinner
{
    private static readonly int[] DIMENSIONS = [320, 400, 512, 640, 800, 1024, 1280, 1600];

    private int index;

    public int Value {
        get => DIMENSIONS[index];
        set {
            var _index = Array.IndexOf(DIMENSIONS, value);
            if (_index < 0)
            {
                throw new ArgumentException($"Invalid maximum dimension: {value}.");
            }
            index = _index;
            ((TextBlock) Content!).Text = value.ToString();
        }
    }
    
    public MaxDimSpinner() : base()
    {
        Content = new TextBlock();
        Value = Settings.Instance.MaxDimension;
        Spin += OnSpin;
    }
[edited for brevity]

When I try to use my control in XAML, something like:

<local:MaxDimSpinner />

I just get the content (the text block). No up and down buttons, no box drawn around the whole control. I assume I am not doing something programmatically that happens when one nests a <TextBlock> inside a <ButtonSpinner> in XAML (this works as expected), but I haven't been able to figure out what it is.

reddit.com
u/Rubus_Leucodermis — 1 month ago