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
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
Transform
Gets or sets the transform used for rendering.
Transform2D Transform { get; set; }
Property Value
ViewportSize
Gets the actual size of the viewport to render into.
Size ViewportSize { get; }
Property Value
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
Methods
ApplyEffect(IEffect)
Applies an effect to the next draw calls.
void ApplyEffect(IEffect effect)
Parameters
effectIEffectEffect 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
widthintWidth of the texture to create.
heightintHeight of the texture to create.
dataTColor[]Colors data to set to the texture.
Returns
- ITexture
An instance of the created texture with colors data set.
Type Parameters
TColorFormat 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
textureITextureA texture to render.
optionsTextureRenderingOptionsOptions 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
codeEffectCodeThe code to identify built-in effect.
Returns
Events
DisplayScaleChanged
Occurs when DisplayScale changes, e.g. when the window moves to a monitor with a different DPI.
event EventHandler? DisplayScaleChanged
Event Type
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