ST.Library.Drawing.SvgRender.dll 1.0.0

dotnet add package ST.Library.Drawing.SvgRender.dll --version 1.0.0
NuGet\Install-Package ST.Library.Drawing.SvgRender.dll -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ST.Library.Drawing.SvgRender.dll" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ST.Library.Drawing.SvgRender.dll --version 1.0.0
#r "nuget: ST.Library.Drawing.SvgRender.dll, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ST.Library.Drawing.SvgRender.dll as a Cake Addin
#addin nuget:?package=ST.Library.Drawing.SvgRender.dll&version=1.0.0

// Install ST.Library.Drawing.SvgRender.dll as a Cake Tool
#tool nuget:?package=ST.Library.Drawing.SvgRender.dll&version=1.0.0

VS2010 .NET40 license

emoji-svg-render

emoji-svg-render is an svg renderer for emoji only. So the code is very lightweight.

EmojiRenderForm

private void FrmEmojiRender_Load(object sender, EventArgs e) {
    //EmojiRender.PackageSvgFiles("./svg_files", "./svg_mix_new");
    m_redner = new EmojiRender("./svg_mix_twemoji");
    textBox1.Text = "😀";
}

private void button1_Click(object sender, EventArgs e) {
    string strEmoji = textBox1.Text;
    if (!m_redner.IsEmoji(strEmoji)) {
        MessageBox.Show("Can not found this emoji from package file!");
    }
    RectangleF rectF = new RectangleF(20, 50, 50, 50);
    using (Graphics g = this.CreateGraphics()) {
        g.Clear(Color.White);
        m_redner.DrawEmoji(g, strEmoji, 20, 50, 50, false);
        m_redner.DrawEmoji(g, strEmoji, 100, 50, 50, true);
        // Note: the selected mean that...like the selected text forecolor .. 
        // When emoji selected DrawEmoji will set the alpha 0.5
    }
}

Implemented svg elements

circle ellipse g line path polygon polyline lineargradient radialgradient stop rect defs use

NOTE:lineargradient radialgradient implementation is not complete, and complex gradients cannot currently be implemented. such as transform

So this project is friendly to Emoji support without gradients.

such as: Openmoji Twemoji

Extend

[SvgElement("circle")]  // for automatic registration
public class SvgTestCircle : SvgElement
{
    public override string TargetName {
        get { return "circle"; }
    }

    public override bool AllowElementDraw {
        get { return true; }  // some element not need to draw. such as: <defs>
    }

    public float CX { get; set; }
    public float CY { get; set; }
    public float R { get; set; }

    protected internal override void OnInitAttribute(string strName, string strValue) {
        switch (strName) {
            case "cx":
                this.CX = SvgAttributes.GetSize(this, "cx");
                break;
            case "cy":
                this.CY = SvgAttributes.GetSize(this, "cy");
                break;
            case "r":
                this.R = SvgAttributes.GetSize(this, "r");
                break;
        }
    }

    public override GraphicsPath GetPath() {
        GraphicsPath gp = new GraphicsPath();
        RectangleF rectF = new RectangleF(
            SvgAttributes.GetSize(this.CurrentParent, "x") + this.CX - this.R,
            SvgAttributes.GetSize(this.CurrentParent, "y") + this.CY - this.R,
            this.R * 2,
            this.R * 2);
        gp.AddEllipse(rectF);
        return gp;
    }

    protected internal override void Dispose() { }
}
// [register the element] =================
SvgDocument.RegisterType("circle", typeof(SvgTestCircle));
SvgDocument.RegisterType(Application.ExecutablePath); // will check [SvgElement("TargetName")]
...
SvgDocument svg = SvgDocument.FromXml(strXml);
// When an unregistered tag name appears in strXml. . Parsing of this element is ignored.
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 272 3/21/2022

support element:
circle, ellipse, g, line, path, polygon, polyline, lineargradient, radialgradient, stop, rect, defs, use
but lineargradient, radialgradient implementation is not complete, and complex gradients cannot currently be implemented. such as transform