Skip to content
This repository was archived by the owner on Jun 5, 2026. It is now read-only.

shonescript/ShoneDrawing

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

88 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Note

This experimental project has been validated: through a cross-platform graphics interface, a subset of the public APIs in System.Drawing can be implemented.

At the same time, after evaluation, the public API surface of System.Drawing is so large that fully compatible implementation would require a great deal of work. Compared with mature existing cross-platform graphics libraries such as Skia, the investment required to reimplement System.Drawing in a cross-platform way is not cost-effective. This is presumably also the conclusion reached by the Microsoft team.

This experimental project will be archived as read-only.

ShoneDrawing

This project aims to produce a MewUI based crossplatform implementation Compatible with System.Drawing.Common. Many codes forks from SkiaDrawing, replacing all Skia canvas related drawing to MewUI IGraphicsContext implementations.

This is an implementation of the methods of System.Drawing in MewUI. It is a work in progress and is not yet complete. The goal is to provide a drop-in replacement for System.Drawing that uses MewUI graphics crossplatform backends for rendering.

Gloal

  • Performance: should boost by several times when using Direct2D backend on windows platform.
  • Crossplatform: support all X11, OpenGL etc. backends by MewUI.
  • Compatability: implements a commonly used subset of interfaces of System.Drawing.Common.
  • publish: one code base, two dlls for different namespace using.
  • Shone.System.Drawing.dll: keep System.Drawing namespace in direct replacement for System.Drawing.Common.dll. No codes need changed, but may conflict with other dlls such as winforms.
  • Shone.Drawing.dll: use different Shone.Drawing namespace. Need some namespace relected codes changed.

Usage

To use this library, you need to add a reference to the ShoneDrawing and MewUI projects in your project. Then, you can use the ShoneDrawing or System.Drawing (in direct portable use case) namespace in your code.

It is meant to be a drop-in replacement for System.Drawing, so you can use it in the same way. For example, you can create a new bitmap like this:

using Sysem.Drawing;  //when references Shone.System.Drawing.dll
//using Shone.Drawing; //when references Shone.Drawing.dll

Bitmap bitmap = new Bitmap(100, 100);

You can then use the Graphics class to draw on the bitmap:

using (Graphics g = Graphics.FromImage(bitmap))
{
    g.Clear(Color.White);
    g.DrawLine(Pens.Black, 0, 0, 100, 100);
}

You can also use the Graphics class to draw on a control:

using (Graphics g = e.Graphics)
{
    g.Clear(Color.White);
    g.DrawLine(Pens.Black, 0, 0, 100, 100);
}

Supported Features

The following features are currently supported:

  • Bitmap
  • Color
  • Graphics
  • Pen
  • Brush
  • Font
  • StringFormat
  • Rectangle
  • Point
  • Size
  • Image
  • ImageFormat

The following features are not yet supported:

  • Region
  • Path
  • Matrix

No intended features

  • ScreenCapture

About

This project aims to produce a MewUI based crossplatform implementation Compatible with System.Drawing.Common. Many codes forks from SkiaDrawing, replacing all Skia canvas related drawing to MewUI IGraphicsContext implementations.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • C# 100.0%