GH_GraphicsUtil

public sealed class GH_GraphicsUtil
Utility class with static (Shared) functions that help with colour, shape and text rendering.

Properties

UiScale

#
public static float UiScale { get; }
Gets the screen-scaling factor for the entire system. Use the UiAdjust methods in the Grasshopper top level namespace (Global_Proc module) to modify integer and single values.
Scaling factor (dpi / 96).

Methods

AppendArc

#
public static void AppendArc(Point3d p0, Point3d p1, Vector3d dir, GraphicsPath path)
Append an arc segment to a GraphicsPath. If the arc cannot be solved, a linear segment is appended instead.
p0 (Point3d)Start point of arc.
p1 (Point3d)End point of arc.
dir (Vector3d)Tangent direction at start of arc.
path (GraphicsPath)Path to append to.

AppendArc

#
public static void AppendArc(PointF p0, PointF p1, SizeF dir, GraphicsPath path)
Append an arc segment to a GraphicsPath. If the arc cannot be solved, a linear segment is appended instead.
p0 (PointF)Start point of arc.
p1 (PointF)End point of arc.
dir (SizeF)Tangent direction at start of arc.
path (GraphicsPath)Path to append to.

BlendColour

#
public static Color BlendColour(Color bottom, Color top, double factor)
Overlays two colours.
bottom (Color)Base colour.
top (Color)Overlay colour.
factor (double)Blend factor. 0.0 means the return colour will be identical to the bottom colour, 1.0 means the return colour will be identical to the top colour.
The blended colour.

BlendColour

#
public static Color BlendColour(Color bottom, Color top)
Overlays two colours. The Alpha component of the top colour controls the blend.
bottom (Color)Base colour.
top (Color)Overlay colour.
The blended colour. Alpha channels are added together.

BlendInteger

#
public static int BlendInteger(double t0, double t1, int a0, int a1, double t)
Calculates a linear blend between two extremes. Although the inputs are unlimited integers, the output is an integer in the byte range (0-255).
t0 (double)Value of first extreme.
t1 (double)Value of second extreme.
a0 (int)Integer value at first extreme.
a1 (int)Integer value at second extreme.
t (double)Interpolation parameter.
Interpolated value.
This function is useful when you need to link colour alpha amounts to zoom levels:
Sub DrawZoomAwareCircle(ByVal G As Graphics, _
                        ByVal center As PointF, _
                        ByVal radius As Single, _
                        ByVal fill As Color)
  'Find the zoom level of the Graphics transform.
  Dim zoom As Single = G.Transform.Elements(0)

  'Abort if zoom less than 25%
  If (zoom < 0.25f) Then Return
  
  'Blend the alpha channel byte between 25% and 95% zoom.
  Dim alpha As Int32 = GH_GraphicsUtil.BlendByte(0.25, 0.95, 0, 255, zoom)
  G.FillEllipse(center.X - radius, center.Y - radius, _
                2.0f * radius, 2.0f * radius, _
                New SolidBrush(Color.FromARGB(alpha, fill)))
End Sub

BoxClosestArcPoint

#
public static PointF BoxClosestArcPoint(PointF pt, RectangleF box)
Find the closest point on or in a box given a test point. Arc extension is implied.
pt (PointF)Sample point.
box (RectangleF)Box to evaluate.

BoxClosestPoint

#
public static Point BoxClosestPoint(Point pt, Rectangle box)
Find the closest point on or in a box given a test point.
pt (Point)Sample point.
box (Rectangle)Box to evaluate.

BoxClosestPoint

#
public static PointF BoxClosestPoint(PointF pt, RectangleF box)
Find the closest point on or in a box given a test point.
pt (PointF)Sample point.
box (RectangleF)Box to evaluate.

BoxFurthestPoint

#
public static Point BoxFurthestPoint(Point pt, Rectangle box)
Find the furthest point on or in a box given a test point.
pt (Point)Sample point.
box (Rectangle)Box to evaluate.

BoxFurthestPoint

#
public static PointF BoxFurthestPoint(PointF pt, RectangleF box)
Find the furthest point on or in a box given a test point.
pt (PointF)Sample point.
box (RectangleF)Box to evaluate.

BoxViewCone

#
public static GraphicsPath BoxViewCone(PointF pt, RectangleF box)
Computes the graphicspath that represents the viewcone for a point and a rectangle. If the rectangle contains the point, null is returned.
pt (PointF)
box (RectangleF)

ColourARGB

#
public static Color ColourARGB(double r, double g, double b)
Create a colour from floating ARGB channels (0.0~1.0). Channels are clipped to valid ranges.
r (double)
g (double)
b (double)
The colour implied by the RGB channel values.

ColourARGB

#
public static Color ColourARGB(int a, int r, int g, int b)
Create a colour from integer ARGB channels. Channels are clipped to valid ranges.
a (int)
r (int)
g (int)
b (int)
Returns the colour as implied by the ARGB channel values.

ColourARGB

#
public static Color ColourARGB(int r, int g, int b)
Create a colour from integer RGB channels. Channels are clipped to valid ranges.
r (int)
g (int)
b (int)
Returns the colour as implied by the RGB channel values.

CreateColourIcon

#
public static Bitmap CreateColourIcon(int width, int height, Color colour)
Create a colour swatch icon.
width (int)Width of icon.
height (int)Height of icon.
colour (Color)Colour for swatch, if colour contains an alpha component, you should draw an alpha-grid behind the icon.
A bitmap with the requested icon colour.

DentHorizontal

#
public static void DentHorizontal(Graphics g, Rectangle box, int alphaEdge, int alphaFill)
Draws a horizontal dent. A horizontal dent had dark lines along the top and bottom edges.
g (Graphics)Graphics object to draw with.
box (Rectangle)Dimensions of the dent.
alphaEdge (int)Transparency on the middle of the edges.
alphaFill (int)Transparency on the middle of the fill.

DentHorizontal

#
public static void DentHorizontal(Graphics g, Rectangle box)
Draws a horizontal dent. A horizontal dent had dark lines along the top and bottom edges.
g (Graphics)Graphics object to draw with.
box (Rectangle)Dimensions of the dent.

DentVertical

#
public static void DentVertical(Graphics g, Rectangle box, int alphaEdge, int alphaFill)
Draws a vertical dent. A vertical dent had dark lines along the left and right edges.
g (Graphics)Graphics object to draw with.
box (Rectangle)Dimensions of the dent.
alphaEdge (int)Transparency on the middle of the edges.
alphaFill (int)Transparency on the middle of the fill.

DentVertical

#
public static void DentVertical(Graphics g, Rectangle box)
Draws a vertical dent. A vertical dent had dark lines along the left and right edges.
g (Graphics)Graphics object to draw with.
box (Rectangle)Dimensions of the dent.

Distance

#
public static float Distance(PointF a, PointF b)
Compute the distance between two points.
a (PointF)First point.
b (PointF)Second point.

DistanceS

#
public static float DistanceS(PointF a, PointF b)
Compute the squared distance between two points.
a (PointF)First point.
b (PointF)Second point.

EtchFadingHorizontal

#
public static void EtchFadingHorizontal(Graphics g, int x0, int x1, int y, int alphaLight = 200, int alphaDark = 35)
Draw an etched line with fading on the extremes.
g (Graphics)Graphics object to draw with.
x0 (int)Left x coordinate of etch.
x1 (int)Right x coordinate of etch.
y (int)Y coordinate of etch.
alphaLight (int = 200)Transparancy of bright etch line.
alphaDark (int = 35)Transparency of dark etch line.

EtchFadingVertical

#
public static void EtchFadingVertical(Graphics g, int y0, int y1, int x, int alphaLight = 200, int alphaDark = 80)
Draw an etched line with fading on the extremes.
g (Graphics)Graphics object to draw with.
y0 (int)Top y coordinate of etch.
y1 (int)Bottom y coordinate of etch.
x (int)X coordinate of etch.
alphaLight (int = 200)Transparancy of etch.
alphaDark (int = 80)Transparancy of etch.

EtchHorizontal

#
public static void EtchHorizontal(Graphics g, float x0, float x1, float y, int alpha = 50)
Draws an etched line segment.
g (Graphics)Graphics object to draw with.
x0 (float)x component of start point.
x1 (float)x component of end point.
y (float)y component of line segment.
alpha (int = 50)Alpha level of etched line.

EtchHorizontal

#
public static void EtchHorizontal(Graphics g, int x0, int x1, int y, int alphaLight = 200, int alphaDark = 35)
Draws an etched line segment.
g (Graphics)Graphics object to draw with.
x0 (int)x component of start point.
x1 (int)x component of end point.
y (int)y component of line segment.
alphaLight (int = 200)Alpha level of etched lit line.
alphaDark (int = 35)Alpha level of etched shadow line.

EtchVertical

#
public static void EtchVertical(Graphics g, float x, float y0, float y1, int alpha = 50)
Draws an etched line segment.
g (Graphics)Graphics object to draw with.
x (float)x component of line segment.
y0 (float)x component of start point.
y1 (float)y component of end point.
alpha (int = 50)Alpha level of etched line.

EtchVertical

#
public static void EtchVertical(Graphics g, int x, int y0, int y1, int alpha = 50)
Draws an etched line segment.
g (Graphics)Graphics object to draw with.
x (int)x component of line segment.
y0 (int)x component of start point.
y1 (int)y component of end point.
alpha (int = 50)Alpha level of etched line.

FadeColour

#
public static Color FadeColour(double t0, double t1, double t, Color col)
Fade a colour to transparency by linearly blending a parameter between extremes.
t0 (double)First extreme. (represents transparency)
t1 (double)Second extreme. (represent unaltered colour)
t (double)Blending factor between t0 and t1.
col (Color)Colour to fade.
The colour adjusted for blending.

ForegroundColour

#
public static Color ForegroundColour(Color col, int contrast = 30)
Calculates a suitable foreground color. If the background is lighter than 50%, the foreground will be darker, otherwise the foreground will be lighter.
col (Color)Foreground colour that works well on the given background colour.
contrast (int = 30)Contrast amount (in 0~255 range)

Grid

#
public static void Grid(Graphics g, RectangleF rec, int density)
Draw a default grid.
g (Graphics)Graphics object to draw with.
rec (RectangleF)Grid rectangle.
density (int)Density in both directions.

Grid

#
public static void Grid(Graphics g, RectangleF rec, int densityX, int densityY, Color colorBg, Color colorWire)
Draw a grid.
g (Graphics)Graphics object to draw with.
rec (RectangleF)Grid rectangle.
densityX (int)Density in x direction.
densityY (int)Density in y direction.
colorBg (Color)Background colour override, the default is 30/255 white.
colorWire (Color)Grid line colour override, the default is 40/255 black.

Grid

#
public static void Grid(Graphics g, RectangleF rec, int densityX, int densityY)
Draw a default grid.
g (Graphics)Graphics object to draw with.
rec (RectangleF)Grid rectangle.
densityX (int)Density in x direction.
densityY (int)Density in y direction.

HighlightBrush

#
public static Brush HighlightBrush()
Gets a new brush object that can be used to draw the content of hover and focus rectangles. Caller is responsible for disposing the brush.

HighlightPen

#
public static Pen HighlightPen()
Gets a new pen object that can be used to draw the edges of hover and focus rectangles. Caller is responsible for disposing the pen.

InvertColour

#
public static Color InvertColour(Color col)
Computes the inverted colour. Alpha remains the same.
col (Color)
Colour where RGB channels are set to 255-C.

IsPointInEllipse

#
public static bool IsPointInEllipse(RectangleF ellipse, PointF point)
Test whether a point is inside or outside an ellipse.
ellipse (RectangleF)Rectangle describing ellipse.
point (PointF)Point to test for inclusion.
True if the point is in or on the ellipse.

LimitInteger

#
public static void LimitInteger(ref int channel)
Limits the given integer to the 0~255 range.
channel (ref int)

LimitIntegers

#
public static void LimitIntegers(ref int r, ref int g, ref int b)
Limits RGB channels to the 0~255 range,
r (ref int)
g (ref int)
b (ref int)

OffsetColour

#
public static Color OffsetColour(Color col, int redShift, int greenShift, int blueShift)
Add a fixed value to all the channels in a colour.
Remarks: The alpha channel of the colour is not offset.
col (Color)The colour to mutate
redShift (int)Offset value for red channel (-255 ~ +255).
greenShift (int)Offset value for green channel (-255 ~ +255).
blueShift (int)Offset value for blue channel (-255 ~ +255).
The offsetted colour.

OffsetColour

#
public static Color OffsetColour(Color col, int shift)
Add a fixed value to all the channels in a colour.
Remarks: The alpha channel of the colour is not offset.
col (Color)The colour to mutate.
shift (int)Offset value (-255 ~ +255).
The offsetted colour.

RenderBalloonTag

#
public static void RenderBalloonTag(Graphics g, string text, Font font, Color backColor, Color foreColor, PointF tip, bool upright)
Draw a balloon tag in a container.
g (Graphics)Graphics object to draw with.
text (string)Text of tag.
font (Font)Font of tag.
backColor (Color)Background colour of balloon.
foreColor (Color)Foreground colour of balloon edge and text.
tip (PointF)Tip of balloon.
upright (bool)If true, the balloon will be above the tip point.

RenderBalloonTag

#
public static void RenderBalloonTag(Graphics g, string text, Font font, Color backColor, Color foreColor, PointF tip, RectangleF container)
Draw a balloon tag in a container.
g (Graphics)Graphics object to draw with.
text (string)Text of tag.
font (Font)Font of tag.
backColor (Color)Background colour of balloon.
foreColor (Color)Foreground colout of balloon edge and text.
tip (PointF)Tip of balloon (should be inside container).
container (RectangleF)Container for balloon.

RenderBalloonTag

#
public static void RenderBalloonTag(Graphics g, string text, Font font, PointF tip, RectangleF container)
Draw a default balloon tag in a container with a Font override.
g (Graphics)Graphics object to draw with.
text (string)Text of tag.
font (Font)Font of tag.
tip (PointF)Tip of balloon.
container (RectangleF)Container for balloon.

RenderBalloonTag

#
public static void RenderBalloonTag(Graphics g, string text, PointF tip, RectangleF container)
Draw a default balloon tag in a container.
g (Graphics)Graphics object to draw with.
text (string)Text of tag.
tip (PointF)Tip of balloon.
container (RectangleF)Container for balloon.

RenderCenteredIcon

#
public static void RenderCenteredIcon(Graphics g, RectangleF frame, Image icon, double alpha)
Draw an icon centered in a frame. This code is not zoom-aware, but it will perform consistent rounding (to avoid pixel-jitter when moving the frame across the screen). Icon will not be clipped to the frame.
g (Graphics)Graphics object to render with.
frame (RectangleF)Frame to center icon in.
icon (Image)Icon to render
alpha (double)Transparency factor.

RenderCenteredIcon

#
public static void RenderCenteredIcon(Graphics g, RectangleF frame, Image icon, float scale)
obsoleteThis method is obsolete, use a RenderIcon() overload instead.
Draw an icon centered in a frame. This code is not zoom-aware, but it will perform consistent rounding (to avoid pixel-jitter when moving the frame across the screen). Icon will not be clipped to the frame.
g (Graphics)Graphics object to render with.
frame (RectangleF)Frame to center icon in.
icon (Image)Icon to render
scale (float)

RenderCenteredIcon

#
public static void RenderCenteredIcon(Graphics g, RectangleF frame, Image icon)
obsoleteThis method is obsolete, use a RenderIcon() overload instead.
Draw an icon centered in a frame. This code is not zoom-aware, but it will perform consistent rounding (to avoid pixel-jitter when moving the frame across the screen). Icon will not be clipped to the frame.
g (Graphics)Graphics object to render with.
frame (RectangleF)Frame to center icon in.
icon (Image)Icon to render

RenderCenteredText

#
public static void RenderCenteredText(Graphics g, string text, Font font, Color color, PointF center)
Render a bit of text centered on a point.
g (Graphics)Graphics object to draw with.
text (string)Text to draw.
font (Font)Font to use.
color (Color)Text color.
center (PointF)Center point.

RenderColourIcon

#
public static void RenderColourIcon(Graphics g, Rectangle rec, Color colour, float scale)
Render a colour icon into a graphics context. A colour icon contains a black outer and white inner edge.
g (Graphics)Graphics object to draw with.
rec (Rectangle)Rectangle describing icon dimensions.
colour (Color)Colour for icon.
scale (float)Scale adjustment.

RenderColourIcon

#
public static void RenderColourIcon(Graphics g, Rectangle rec, Color colour)
obsoleteUse RenderColourIcon(Graphics, Rectangle, Color, Single) instead.
Render a colour icon into a graphics context. A colour icon contains a black outer and white inner edge.
g (Graphics)Graphics object to draw with.
rec (Rectangle)Rectangle describing icon dimensions.
colour (Color)Colour for icon.

RenderFadedImage

#
public static void RenderFadedImage(Graphics graphics, Image image, Rectangle destination, double fade)
Render an icon into a rectangle with a specific fading factor.
graphics (Graphics)Graphics object to draw with.
image (Image)Image to draw.
destination (Rectangle)Destination rectangle.
fade (double)Fading amount. 0.0=completely transparent, 1.0=original transparency.

RenderFadedImage

#
public static void RenderFadedImage(Graphics graphics, Image image, Rectangle destination, int alpha)
Render an icon into a rectangle with a specific fading factor.
graphics (Graphics)Graphics object to draw with.
image (Image)Image to draw.
destination (Rectangle)Destination rectangle.
alpha (int)Alpha value. 0=completely transparent, 255=original transparency.

RenderHighlightBox

#
public static void RenderHighlightBox(Graphics g, Rectangle box, int cornerRadius, bool drawFill, bool drawEdge)
Render a typical blueish highlight rectangle
g (Graphics)Graphics object to render with.
box (Rectangle)Dimensions of selection box.
cornerRadius (int)Radius (in pixels) of box corners, use zero or less to render crisp rectangles.
drawFill (bool)If true, the box fill have a blue background.
drawEdge (bool)If true, the box will have a blue edge.

RenderHighlightBox

#
public static void RenderHighlightBox(Graphics g, Rectangle box, int cornerRadius, Color fill, Color edge)
Render a typical blueish highlight rectangle
g (Graphics)Graphics object to render with.
box (Rectangle)Dimensions of selection box.
cornerRadius (int)Radius (in pixels) of box corners, use zero or less to render crisp rectangles.
fill (Color)Fill colour
edge (Color)Edge colour

RenderHighlightBox

#
public static void RenderHighlightBox(Graphics g, Rectangle box, int cornerRadius)
Render a typical blueish highlight rectangle
g (Graphics)Graphics object to render with.
box (Rectangle)Dimensions of selection box.
cornerRadius (int)Radius (in pixels) of box corners, use zero or less to render crisp rectangles.

RenderIcon

#
public static void RenderIcon(Graphics graphics, RectangleF frame, Image icon)
Render an icon into a frame. The icon is positioned in the center and will be drawn at its own size multiplied by the system UiScale, provided it doesn't exceed the frame.
graphics (Graphics)Graphics object to draw with.
frame (RectangleF)Limiting frame.
icon (Image)Icon to draw.

RenderObjectOverlay

#
public static void RenderObjectOverlay(Graphics graphics, IGH_DocumentObject obj, RectangleF target)
Render all overlay icons for a specific object. Overlays aren't drawn when the zoom is less than 80%
graphics (Graphics)Graphics object to draw with.
obj (IGH_DocumentObject)Object to draw overlay for.
target (RectangleF)Destination area for overlay icons.

RenderObjectOverlay

#
public static void RenderObjectOverlay(Graphics graphics, IGH_ObjectProxy obj, RectangleF target)
Render all overlay icons for a specific object. Overlays aren't drawn when the zoom is less than 80%
graphics (Graphics)Graphics object to draw with.
obj (IGH_ObjectProxy)Proxy to draw overlay for.
target (RectangleF)Destination area for overlay icons.

RenderRoundBar

#
public static void RenderRoundBar(Graphics graphics, RectangleF rec, Color colour)
Render a cylinder shaped object with round caps.
graphics (Graphics)Graphics object to draw with.
rec (RectangleF)Rectangle containing shape.
colour (Color)Fill colour of shape.

RenderTag

#
public static void RenderTag(Graphics g, string tag, Font font, Color backColor, Color foreColor, RectangleF frame, StringAlignment alignH, StringAlignment alignV)
Render a text tag into a Graphics surface.
g (Graphics)Graphics object to draw with.
tag (string)Text to draw.
font (Font)Font to use.
backColor (Color)Tag background colour.
foreColor (Color)Tag foreground colour.
frame (RectangleF)The frame into which the tags should be aligned.
alignH (StringAlignment)Horizontal alignment.
alignV (StringAlignment)Vertical alignment.
This example shows how to render the 8 corner and edge tags into a rectangle:
Function RenderCornerAndEdgeTags(ByVal G As Graphics, ByVal frame As RectangleF)
  Dim font As New Font("Courier New", 8)
  Dim bg As Color = Color.White
  Dim fg As Color = Color.Black
 
  'Render the 4 corner tags
  RenderTag(G, "UL", font, bg, fg, frame, StringAlignment.Near, StringAlignment.Near)
  RenderTag(G, "UR", font, bg, fg, frame, StringAlignment.Far, StringAlignment.Near)
  RenderTag(G, "LR", font, bg, fg, frame, StringAlignment.Far, StringAlignment.Far)
  RenderTag(G, "LL", font, bg, fg, frame, StringAlignment.Near, StringAlignment.Far)

  'Render the 4 edge tags
  RenderTag(G, "T", font, bg, fg, frame, StringAlignment.Center, StringAlignment.Near)
  RenderTag(G, "R", font, bg, fg, frame, StringAlignment.Far, StringAlignment.Center)
  RenderTag(G, "B", font, bg, fg, frame, StringAlignment.Center, StringAlignment.Far)
  RenderTag(G, "L", font, bg, fg, frame, StringAlignment.Near, StringAlignment.Center)
End Function

RenderUnscaledIcon

#
public static void RenderUnscaledIcon(Graphics g, Image icon, int cx, int cy, double fade)
obsoleteThis method is obsolete, use a RenderIcon() overload instead.
Draws an image file at 1:1 scale centered on the given coordinates.
g (Graphics)Graphics object to draw with.
icon (Image)Image to draw.
cx (int)X center of image in Graphics coordinate.
cy (int)Y center of image in Graphics coordinate.
fade (double)Alpha fading factor.

RenderUnscaledIcon

#
public static void RenderUnscaledIcon(Graphics g, Image icon, int cx, int cy)
obsoleteThis method is obsolete, use a RenderIcon() overload instead.
Draws an image file at 1:1 scale centered on the given coordinates.
g (Graphics)Graphics object to draw with.
icon (Image)Image to draw.
cx (int)X center of image in Graphics coordinate.
cy (int)Y center of image in Graphics coordinate.

RenderVerticalString

#
public static void RenderVerticalString(Graphics g, string text, Font font, Color colour, RectangleF rec, StringFormat format)
Render vertical text (rotated 90 degrees counter-clockwise) within a rectangle.
g (Graphics)Graphics object to draw with.
text (string)Text to render.
font (Font)Font to render with.
colour (Color)Colour of text content.
rec (RectangleF)
format (StringFormat)Formatting flags.

RenderWarningIcon

#
public static void RenderWarningIcon(Graphics graphics, PointF center, float radius, int alpha)
Render a typical warning icon into a graphics context. A warning icon is an upright yellow triangle.
graphics (Graphics)Graphics object to draw with.
center (PointF)Center of icon.
radius (float)Radius of icon.
alpha (int)Transparency of icon.

ScaleColour

#
public static Color ScaleColour(Color col, double factor)
Multiply the channels of a colour construct with a fixed factor.
Remarks: The alpha channel of the colour is not mutated.
col (Color)The colour to mutate
factor (double)An adjustment factor.
The scaled colour.

ShadowHorizontal

#
public static void ShadowHorizontal(Graphics g, float x0, float x1, float y, float size = 10, bool below = true, int darkness = 50)
Draws a horizontal shadow edge.
g (Graphics)Graphics object to draw with.
x0 (float)Start of shadow edge.
x1 (float)End of shadow edge.
y (float)Elevation of shadow edge.
size (float = 10)Length of cast shadow.
below (bool = true)If true, shadow is drawn below elevation line.
darkness (int = 50)Alpha component of darkness directly underneath the edge.

ShadowHorizontal

#
public static void ShadowHorizontal(Graphics g, int x0, int x1, int y, int size = 10, bool below = true, int darkness = 50)
Draws a horizontal shadow edge.
g (Graphics)Graphics object to draw with.
x0 (int)Start of shadow edge.
x1 (int)End of shadow edge.
y (int)Elevation of shadow edge.
size (int = 10)Length of cast shadow.
below (bool = true)If true, shadow is drawn below elevation line.
darkness (int = 50)Alpha component of darkness directly underneath the edge.

ShadowHorizontal

#
public static void ShadowHorizontal(Graphics g, int x0, int x1, int y, int size, bool below, Color color)
Draws a horizontal shadow edge.
g (Graphics)Graphics object to draw with.
x0 (int)Start of shadow edge.
x1 (int)End of shadow edge.
y (int)Elevation of shadow edge.
size (int)Length of cast shadow.
below (bool)If true, shadow is drawn below elevation line.
color (Color)Colour at shadow edge.

ShadowRectangle

#
public static void ShadowRectangle(Graphics g, Rectangle rec, int size = 10, int darkness = 50)
Draws shadow edges on the interior of a rectangle.
g (Graphics)Graphics object to draw with.
rec (Rectangle)Bounding rectangle.
size (int = 10)Length of cast shadow.
darkness (int = 50)Alpha component of darkness directly underneath the edge.

ShadowRectangle

#
public static void ShadowRectangle(Graphics g, Rectangle rec, int size, Color color)
Draws shadow edges on the interior of a rectangle.
g (Graphics)Graphics object to draw with.
rec (Rectangle)Bounding rectangle.
size (int)Length of cast shadow.
color (Color)Color at edge of shadow.

ShadowVertical

#
public static void ShadowVertical(Graphics g, float x, float y0, float y1, float size = 10, bool right = true, int darkness = 50)
Draws a vertical shadow edge.
g (Graphics)Graphics object to draw with.
x (float)Offset of shadow edge.
y0 (float)Start of shadow edge.
y1 (float)End of shadow edge.
size (float = 10)Length of cast shadow.
right (bool = true)If true, shadow is drawn to the right of the elevated line.
darkness (int = 50)Alpha component of darkness directly underneath the edge.

ShadowVertical

#
public static void ShadowVertical(Graphics g, int x, int y0, int y1, int size = 10, bool right = true, int darkness = 50)
Draws a vertical shadow edge.
g (Graphics)Graphics object to draw with.
x (int)Offset of shadow edge.
y0 (int)Start of shadow edge.
y1 (int)End of shadow edge.
size (int = 10)Length of cast shadow.
right (bool = true)If true, shadow is drawn to the right of the elevated line.
darkness (int = 50)Alpha component of darkness directly underneath the edge.

ShadowVertical

#
public static void ShadowVertical(Graphics g, int x, int y0, int y1, int size, bool right, Color color)
Draws a vertical shadow edge.
g (Graphics)Graphics object to draw with.
x (int)Offset of shadow edge.
y0 (int)Start of shadow edge.
y1 (int)End of shadow edge.
size (int)Length of cast shadow.
right (bool)If true, shadow is drawn to the right of the elevated line.
color (Color)Color at shadow edge.

SolveArc

#
public static bool SolveArc(double p0X, double p0Y, double p1X, double p1Y, double dx, double dy, ref RectangleF box, ref float angle, ref float sweep)
Create a GDI circular arc definition from start-point, end-point and tangent direction.
p0X (double)
p0Y (double)
p1X (double)
p1Y (double)
dx (double)
dy (double)
box (ref RectangleF)
angle (ref float)
sweep (ref float)

SolveArc

#
public static bool SolveArc(Point3d p0, Point3d p1, Vector3d dir, ref RectangleF box, ref float angle, ref float sweep)
Create a GDI circular arc definition from start-point, end-point and tangent direction.
p0 (Point3d)Start point of arc.
p1 (Point3d)End point of arc.
dir (Vector3d)Tangent direction at start of arc.
box (ref RectangleF)Bounding box of arc (out)
angle (ref float)Start angle of arc (out)
sweep (ref float)Sweep angle of arc (out)
True on success, false on failure.

SolveArc

#
public static bool SolveArc(PointF p0, PointF p1, SizeF dir, ref RectangleF box, ref float angle, ref float sweep)
Create a GDI circular arc definition from start-point, end-point and tangent direction.
p0 (PointF)Start point of arc.
p1 (PointF)End point of arc.
dir (SizeF)Tangent direction at start of arc.
box (ref RectangleF)Bounding box of arc (out)
angle (ref float)Start angle of arc (out)
sweep (ref float)Sweep angle of arc (out)
True on success, false on failure.

TransparencyMatrix

#
public static ColorMatrix TransparencyMatrix(double fade)
Create an image transparency matrix for a specific blending factor.
fade (double)Alpha fade amount. 0.0=complete transparency, 1.0=original transparency.

TransparencyMatrix

#
public static ColorMatrix TransparencyMatrix(int alpha)
Create an image transparency matrix for a specific blending factor.
alpha (int)Alpha level of color matrix.