// Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. using System; using System.Collections.Generic; using System.IO; using Avalonia.Media; namespace Avalonia.Platform { /// /// Defines the main platform-specific interface for the rendering subsystem. /// public interface IPlatformRenderInterface { /// /// Creates a formatted text implementation. /// /// The text. /// The base typeface. /// The font size. /// The text alignment. /// The text wrapping mode. /// The text layout constraints. /// The style spans. /// An . IFormattedTextImpl CreateFormattedText( string text, Typeface typeface, double fontSize, TextAlignment textAlignment, TextWrapping wrapping, Size constraint, IReadOnlyList spans); /// /// Creates an ellipse geometry implementation. /// /// The bounds of the ellipse. /// An ellipse geometry.. IGeometryImpl CreateEllipseGeometry(Rect rect); /// /// Creates a line geometry implementation. /// /// The start of the line. /// The end of the line. /// A line geometry. IGeometryImpl CreateLineGeometry(Point p1, Point p2); /// /// Creates a rectangle geometry implementation. /// /// The bounds of the rectangle. /// A rectangle. IGeometryImpl CreateRectangleGeometry(Rect rect); /// /// Creates a stream geometry implementation. /// /// An . IStreamGeometryImpl CreateStreamGeometry(); /// /// Creates a renderer. /// /// /// The list of native platform surfaces that can be used for output. /// /// An . IRenderTarget CreateRenderTarget(IEnumerable surfaces); /// /// Creates a render target bitmap implementation. /// /// The size of the bitmap in device pixels. /// The DPI of the bitmap. /// An . IRenderTargetBitmapImpl CreateRenderTargetBitmap(PixelSize size, Vector dpi); /// /// Creates a writeable bitmap implementation. /// /// The size of the bitmap in device pixels. /// The DPI of the bitmap. /// Pixel format (optional). /// An . IWriteableBitmapImpl CreateWriteableBitmap(PixelSize size, Vector dpi, PixelFormat? format = null); /// /// Loads a bitmap implementation from a file.. /// /// The filename of the bitmap. /// An . IBitmapImpl LoadBitmap(string fileName); /// /// Loads a bitmap implementation from a file.. /// /// The stream to read the bitmap from. /// An . IBitmapImpl LoadBitmap(Stream stream); /// /// Loads a bitmap implementation from a pixels in memory. /// /// The pixel format. /// The pointer to source bytes. /// The size of the bitmap in device pixels. /// The DPI of the bitmap. /// The number of bytes per row. /// An . IBitmapImpl LoadBitmap(PixelFormat format, IntPtr data, PixelSize size, Vector dpi, int stride); /// /// Creates a platform implementation of a glyph run. /// /// The glyph run. /// The glyph run's width. /// IGlyphRunImpl CreateGlyphRun(GlyphRun glyphRun, out double width); } }