System.Drawing
The basic types of 2D graphics that System.Image, System.Graphics and System.Ui share: Color, Point,
Size, Rect and Vector2. Positions are in pixels, X to the right and Y down from the top left corner.
using System.Drawing;
var player = Rect.Create(10, 20, 16, 16);var coin = Rect.Create(18, 30, 8, 8);if (player.Intersects(coin)) Console.WriteLine("collected at " + coin.Center().ToString());var shadow = Color.Black().WithAlpha(128);| Type | Description |
|---|---|
Color |
A color: alpha, red, green and blue, from 0 to 255 each (an alpha of 0 is transparent, 255 opaque). |
Point |
A position in pixels: X to the right, Y down; (0, 0) is the top left corner. |
Size |
A size in pixels. |
Rect |
A rectangle in pixels: X and Y are its top left corner. |
Vector2 |
A position or a direction with fractions, for movement and physics; Vector2.ToPoint rounds it to a pixel. |