Table of Contents

Interface IRenderContext

Namespace
Icy.Rendering
Assembly
IcyUI.dll

Represents a service that is used by UI components to draw brushes.

public interface IRenderContext : IDisposable
Inherited Members
Extension Methods

Remarks

At the moment this library doesn't support engine font assets rendering because it doesn't have API for render glyphs access.

Properties

DisplayScale

Gets the operating system display scale of the surface this context renders into.

float DisplayScale { get; }

Property Value

float

Remarks

1.0 means 96 DPI (100 %), 2.0 means 192 DPI (200 %). A host process that isn't DPI-aware always reports 1.0, because the OS scales its window itself. The default implementation returns 1.0.

Options

Gets the current rendering options.

IRenderOptions Options { get; }

Property Value

IRenderOptions

Transform

Gets or sets the transform used for rendering.

Transform2D Transform { get; set; }

Property Value

Transform2D

ViewportSize

Gets the actual size of the viewport to render into.

Size ViewportSize { get; }

Property Value

Size

Remarks

Typically, the viewport size represent the actual size of the graphics device back buffer.

WhiteTexture

Gets an instance of the shared white ITexture for auxiliary drawing.

ITexture WhiteTexture { get; }

Property Value

ITexture

Methods

ApplyEffect(IEffect)

Applies an effect to the next draw calls.

void ApplyEffect(IEffect effect)

Parameters

effect IEffect

Effect instance to apply.

Begin()

Begins rendering process.

void Begin()

ClearEffects()

Remove applied effect instance by setting default effect instance.

void ClearEffects()

CreateTexture<TColor>(int, int, TColor[])

Creates an instance of the texture with specified size and colors data.

ITexture CreateTexture<TColor>(int width, int height, TColor[] data) where TColor : unmanaged

Parameters

width int

Width of the texture to create.

height int

Height of the texture to create.

data TColor[]

Colors data to set to the texture.

Returns

ITexture

An instance of the created texture with colors data set.

Type Parameters

TColor

Format of the pixel colors to set data to the texture.

Draw(ITexture, in TextureRenderingOptions)

Draws a texture into the rendering surface.

void Draw(ITexture texture, in TextureRenderingOptions options)

Parameters

texture ITexture

A texture to render.

options TextureRenderingOptions

Options to draw the brush with.

End()

Ends rendering process.

void End()

Flush()

Clears rendering queue with making context ready for new render.

void Flush()

GetBuiltInEffect(EffectCode)

Gets the built-in effect instance by its EffectCode.

IEffect GetBuiltInEffect(EffectCode code)

Parameters

code EffectCode

The code to identify built-in effect.

Returns

IEffect

An instance of the IEffect for the specified effect code.

Events

DisplayScaleChanged

Occurs when DisplayScale changes, e.g. when the window moves to a monitor with a different DPI.

event EventHandler? DisplayScaleChanged

Event Type

EventHandler

Remarks

Provided for application code. Canvas doesn't subscribe to it; it re-reads DisplayScale on every Render() call instead. The default implementation never raises the event.

ViewportResize

Occurs when size of the viewport changes.

event EventHandler? ViewportResize

Event Type

EventHandler