SRI.Core 0.0.1

dotnet add package SRI.Core --version 0.0.1
NuGet\Install-Package SRI.Core -Version 0.0.1
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="SRI.Core" Version="0.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SRI.Core --version 0.0.1
#r "nuget: SRI.Core, 0.0.1"
#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 SRI.Core as a Cake Addin
#addin nuget:?package=SRI.Core&version=0.0.1

// Install SRI.Core as a Cake Tool
#tool nuget:?package=SRI.Core&version=0.0.1

ScalableRelativeImage

An implementation of vector image, using a markup language which is based on XML and the syntax is like XAML.

This library/software is still in active development, all things may change without proper notification.

Library

The main library is ScalableRelativeImage. To use it, just refer it to your project.

Resolve the vector image and render it.

The use of it is quite simple, use SRIEngine.Deserialize(string Content,out List<ExecutionWarning> warnings) and you can obtain an abstract image. o get the final picture, you need to use Render(RendProfile profile).

Here is an example:

    var image = SRIAnalyzer.Parse("", out _);
    var bitmap = image.Render(new RenderProfile() { TargetWidth = 1920, TargetHeight = 1080 });

Create a vector image and get the XML text

To do it, you need to create an ImageNodeRoot and use SRIEngine.SerializeToString(ImageNodeRoot imageRoot) to obtain the XML text.

Here is an example:

ImageNodeRoot image = new ImageNodeRoot();
image.RelativeWidth = 192;
image.RelativeHeight = 108;
{
    Text text = new Text();
    text.X = 1;
    text.Y = 1;
    text.Width = 15;
    text.Height = 5;
    text.Content = "Hello, world!";
    text.FontFamily = "Arial";
    text.RelativeFontSize=0.2f;
    image.AddNode(text);
}
var XMLOutcome=SRIEngine.SerializeToString(image);
Console.WriteLine(XMLOutcome);

The result should be

<?xml version="1.0" encoding="utf-16"?>
<ScalableRelativeImage Flavor="CreeperLv.SRI" FormatVersion="1.0.0.0">
  <ImageNodeRoot RelativeWidth="192" RelativeHeight="108">
    <Text Content="Hello, world!" FontFamily="Arial" FontStyle="Regular" Size="0.2" X="1" Y="1" Width="15" Height="5" />
  </ImageNodeRoot>
</ScalableRelativeImage>

CLI Tool

Currently, the CLI tool I made works like a compiler. It directly reads a SRI file and render then write it to a pixel format file.

Example:

ScalableRelativeImage.CLI.exe --S Example.SRI --W 1920 --H 1080 --F White --B Black --O Example.png

Extend Shapes

This is quite sample. If you wish to add a shape that is not in SRI library, just create a libaray targeting net5.0 then create a class which implements INode.

To use your own shape, we assume your shapes are in a library named foo.dll, when using the CLI tool, added --E foo.dll in your command line arguments.

Example Command Line:

ScalableRelativeImage.CLI.exe --S Example.SRI --W 1920 --H 1080 --F White --B Black --O Example.png --E foo.dll

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
0.0.1 216 4/8/2022

See github for changes.