LogoLogo
HomeNewsSupportVideos
  • Introduction
  • Getting Started
  • What's new in 4.0
    • Known Issues
    • .NET Core Designer
    • Managed Graphics
    • Fluent Markup
    • Markdown Support
    • Upgrade from 3.x
  • Releases
    • What's new in 4.0
    • What's new in 3.5
    • What's new in 3.2
      • View Builder
      • Validation Rules
      • Enhanced Font Support
      • Design-Time Debug
    • What's new in 3.1
    • What's new in 3.0
      • FAQs
      • Update Existing Projects
      • Multi Targeting
      • Visual Studio Designer
      • Referencing Assemblies
      • Docker Support
      • Troubleshooting
      • Deployment
    • What's new in 2.5
    • What's new in 2.2
    • What's new in 2.1
    • What's new in 2.0
    • Upgrade from 1.x
  • Getting Started
    • New Project
    • Templates
    • Troubleshooting
    • License Activation
    • FAQ
    • API
    • Hybrid
    • Deployment
    • Theme Builder
  • Concepts
    • Startup
    • Configuration
    • Load Balancing
    • Designer
    • Layouts
    • Client Profiles
    • Tab Order
    • Compression
    • Embedded Resources
    • Modal Workflow
    • Localization
    • RightToLeft
    • Background Tasks
    • Real Time Web Applications
    • JavaScript
    • JavaScript Object Model
    • Security
    • Synchronization
    • Session Management
    • Theming
    • Dependency Injection
    • Application Switches
    • Visual Studio Code
  • Controls & Components
    • General
      • Application
      • AutoSizing
      • AutoScroll
      • AutoScaling
      • Accessibility
      • Colors & Fonts
      • Embedded Tools
      • Events
      • Touch Events
      • Images
      • Labels
      • ToolTips
      • Data Binding
      • Common Properties
      • Custom Painting
      • Move & Resize
      • Drag & Drop
      • Validation
      • User Data
      • Responsive Properties
      • VB.NET Extensions
    • Common Dialogs
      • FolderBrowserDialog
      • ColorDialog
      • OpenFileDialog
      • SaveFileDialog
    • Editors
      • TextBox
        • TagTextBox
        • MaskedTextBox
        • TypedTextBox
      • DateTimePicker
      • MonthCalendar
      • TimeUpDown
      • DomainUpDown
      • NumericUpDown
      • TrackBar
    • Buttons
      • Button
      • SplitButton
      • CheckBox
      • RadioButton
    • Containers
      • Page
      • Form
      • Desktop
      • Panel
      • FlexLayoutPanel
      • FlowLayoutPanel
      • TableLayoutPanel
      • GroupBox
      • Accordion
      • TabControl
      • UserPopup
      • UserControl
      • ToolBar
      • StatusBar
      • SplitContainer
      • SlideBar
    • Lists & Grids
      • ComboBox
        • UserComboBox
        • TreeViewComboBox
        • ListViewComboBox
      • ListBox
        • CheckedListBox
      • TreeView
      • ListView
      • DataGridView
        • Column
        • TextBoxColumn
        • ButtonColumn
        • LinkColumn
        • ImageColumn
        • MaskedTextBoxColumn
        • DateTimePickerColumn
        • NumericUpDownColumn
        • CheckBoxColumn
        • ComboBoxColumn
      • DataRepeater
      • PropertyGrid
    • Extenders
      • Animation
      • ToolTip
      • ErrorProvider
      • Rotation
      • StyleSheet
      • JavaScript
    • Media
      • Audio
      • Video
      • FlashPlayer
    • Content
      • Label
      • LinkLabel
      • PictureBox
      • ScrollBars
      • Upload
      • AspNetPanel
      • ImageList
      • PdfViewer
      • ProgressBar
      • Spacer
      • Widget
      • WebBrowser
      • IFramePanel
      • HtmlPanel
      • Canvas
      • Shape
      • Line
    • Menus
      • MainMenu
      • MenuBar
      • MenuItem
      • LinkMenuItem
      • ContextMenu
    • Notifications
      • AlertBox
      • MessageBox
      • Toast
    • Other Components
      • Timer
      • BindingSource
      • BindingNavigator
      • DataSet
      • EventLog
      • MessageQueue
      • PerformanceCounter
Powered by GitBook
On this page
  • Overview
  • Wisej.NET 4 Usage
  • Platforms Support
  • Namespace Collision
  • Alternative Libraries
  • ImageSharp
  • SkiaSharp
  • Aspose.Drawing
  • Microsoft.Maui.Graphics

Was this helpful?

Export as PDF
  1. What's new in 4.0

Managed Graphics

Previous.NET Core DesignerNextFluent Markup

Last updated 2 months ago

Was this helpful?

Overview

.NET (formerly .NET Core) version 7.0.0 and later System.Drawing.Common on Linux. This change leaves Linux users without a direct, Microsoft-provided alternative.

If you're developing cross-platform applications, be particularly mindful of graphics-related code. While our managed implementation provides consistent behavior across platforms, you should still test the target platform thoroughly to ensure compatibility.

Until version 6.0.0, you could set the System.Drawing.EnableUnixSupport application switch to use System.Drawing.Common on Linux systems with libgdiplus. This is why Wisej.NET references version 6.0.0 of the System.Drawing.Common NuGet package.

Additionally, .NET code running on iOS or Android platforms has never supported any version of System.Drawing.Common. Microsoft recommends using such as ImageSharp or SkiaSharp for these platforms.

In Wisej.NET 3, there are three graphics implementations: GDI+ on Windows, libgdiplus on Linux, on iOS and Android. All three implementations provide different font measurements, leading to inconsistencies across platforms.

Our new System.Drawing.Managed implementation delivers consistent performance across all platforms and aligns much more closely with the browsers' font measurements. This ensures a uniform experience regardless of the deployment platform.

Any reference to "net8.0" indicates the version against which Wisej.NET 4 is compiled. In your projects, you can use "net9.0" or "net10.0".

Wisej.NET 4 Usage

Wisej.NET requires a graphics library for loading images from files or embedded resources and measuring text on the server side for controls AutoSize set to true. No painting functionality is needed within Wisej.NET.

Applications built on Wisej.NET can use the event to draw on controls or within grid cells, enabling complex UI features.

The Wisej.NET 4 package includes this dependency:

<PackageReference Include="Managed.System.Drawing" Version="4.0.*-*" />

We named the package "Managed.System.Drawing" because the "System" root name on nuget.org is reserved for Microsoft.

The namespace remains System.Drawing, so no code changes are needed. All primitives like Point, Size, and Color come from System.Drawing.Primitives. System.Drawing.Managed classes like Font and Image can cast to and from their System.Drawing.Common (GDI+) counterparts.

Platforms Support

In Wisej.NET 4 for .NET Framework, we shield developers from this difference. Although Font and Image come from System.Drawing.Common, all font measurements use the managed System.Drawing.Font internally, ensuring compatibility with .NET Core deployments.

As explained on the .NET Core Designer page, using the Visual Studio Designer required building a version of Wisej.Framework compatible with "net8.0-windows". This build uses System.Drawing.Common for public properties.

Feature
Windows (.NET Fx)
.NET Core All Platforms
.NET Core Designer

Font

Managed

Managed

Managed

Graphics

GDI+

Managed

GDI+

For deployment, we recommend using the non-OS-specific net8.0 target instead of "net8.0-windows" as it uses only managed code.

Deployment Target
Target Framework

Windows

net481 or net8.0

Linux or MacOS

net8.0

iOS Hybrid

net8.0-ios

Android Hybrid

net8.0-android

MacOS Hybrid

net8.0-maccatalyst

Windows Hybrid

net8.0-windows10.0.19041.0

As shown above, System.Drawing (GDI+) is only used for deployment on Windows servers using the .NET Framework.

Namespace Collision

Wisej.NET imports System.Drawing on .NET Framework targets and System.Drawing.Common on .NET Core targets to enable multi-targeting. It also imports System.Drawing.Managed. Since all three use the same namespace, failing to alias them may cause compiler errors, such as the Font class being available in multiple assemblies.

Since all three use the same namespace, failing to reference one of the assemblies correctly may cause compiler errors, such as the Font class being available in multiple assemblies.

In Wisej.NET 4, we reference and alias System.Drawing.Common like this:

Wisej-4.props
<!-- NETCORE:
	Include aliased System.Drawing.Common, it's almost never used. It's a required dependency for
	Managed.System.Drawing on netcore to provide optional implicit casting to/from native GDI+ types.
-->
<ItemGroup Condition="!$(TargetFramework.Contains(`-windows`)) And '$(TargetFramework.TrimEnd(`0123456789`))'!='net'">
	<PackageReference Include="System.Drawing.Common" Version="$(_TargetFrameworkVersionWithoutV).0" Aliases="sdc" ExcludeAssets="compile"/>
</ItemGroup>
  • If you get a namespace collision error, remove any System.Drawing.Common reference from your projects, as it's included with the Wisej.NET 4 NuGet package.

  • If a third party NuGet pulls in a reference to System.Drawing.Common with a different version causing compiler errors, you can instead add a <PackageReference> item in your project with the same version and add Alias="sdm" to the tag.

Alternative Libraries

Here are Microsoft's four alternatives and our assessment of each:

We plan to release the 4.0.0 NuGet package on nuget.org for use independently of Wisej.NET 4. Version 3.5 is incomplete and required only by Wisej.NET Hybrid for iOS and Android.

The Aspose.Drawing package provides a completely managed re-implementation of System.Drawing. While it offers excellent GDI+ compatibility, it uses a different namespace and requires a commercial license.

Provides interfaces, classes, and supporting types for .NET MAUI Graphics, the abstracted, unified drawing APIs that work cross-platform.

It provides minimal functionality to replace System.Drawing.Font or Image and gives different results on different platforms. It requires many dependencies and native bindings from various sources.

System.Drawing.Managed (and ) has two major implementations: Font and Graphics. Font handles loading, measuring, and rendering fonts. Graphics handles loading, saving, and drawing images, providing operations available in System.Drawing.Graphics.

Only the Font implementation is available on the .NET Framework because 's Graphics implementation relies on graphics acceleration primitives exclusive to .NET Core.

Fully Managed Code: With no native dependencies or interop code, ImageSharp simplifies development and can be installed anywhere supports- anything from external devices to embedded/IoT scenarios.

is a managed graphics library that handles various graphic formats, including WebP. Combined with its Fonts library, it provides a foundation for implementing a cross-platform version of System.Drawing.

We licensed the source code and worked with SixLabors' founder to create System.Drawing.Managed. This single, self-contained, managed .NET library replaces System.Drawing.Common on all platforms, ensuring consistent font measurements across browsers and platforms.

SkiaSharp is a cross-platform 2D graphics API for .NET platforms based on Google's . It provides a comprehensive 2D API for rendering images for mobile, server, and desktop models.

Developed by the Mono team, this library offers classes built around Google's native library. It requires different native assets for platforms and differs from System.Drawing basic operations like reading font size or measuring text. It cannot measure wrapping lines of text without extensions. Our tests showed font measurements that differed from those of Chromepite Chrome using ; it appears to use many extensions and modifications.

A thin wrapper with limited functionality around (a wrapper around UWP and WinUI platforms) and (a wrapper around , which wraps ).

ImageSharp
ImageSharp
ImageSharp
.NET 6+
ImageSharp
ImageSharp
SkiaSharp
Skia Graphics Library
Skia
Skia
Aspose.Drawing
Microsoft.Maui.Graphics
Microsoft.Graphics.Win2D
Microsoft.Maui.Graphics.Skia
SkiaSharp
Skia
no longer supports
ImageSharp
Paint
alternative libraries