Click or drag to resize

GH_GraphicsUtil Class

Utility class with static (Shared) functions that help with colour, shape and text rendering.
Inheritance Hierarchy
SystemObject
  Grasshopper.GUIGH_GraphicsUtil

Namespace:  Grasshopper.GUI
Assembly:  Grasshopper (in Grasshopper.dll)
Syntax
public sealed class GH_GraphicsUtil

The GH_GraphicsUtil type exposes the following members.

Properties
  NameDescription
Public propertyStatic memberUiScale
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.
Top
Methods
  NameDescription
Public methodStatic memberAppendArc(Point3d, Point3d, Vector3d, GraphicsPath)
Append an arc segment to a GraphicsPath. If the arc cannot be solved, a linear segment is appended instead.
Public methodStatic memberAppendArc(PointF, PointF, SizeF, GraphicsPath)
Append an arc segment to a GraphicsPath. If the arc cannot be solved, a linear segment is appended instead.
Public methodStatic memberBlendColour(Color, Color)
Overlays two colours. The Alpha component of the top colour controls the blend.
Public methodStatic memberBlendColour(Color, Color, Double)
Overlays two colours.
Public methodStatic memberCode exampleBlendInteger
Calculates a linear blend between two extremes. Although the inputs are unlimited integers, the output is an integer in the byte range (0-255).
Public methodStatic memberBoxClosestArcPoint
Find the closest point on or in a box given a test point. Arc extension is implied.
Public methodStatic memberBoxClosestPoint(Point, Rectangle)
Find the closest point on or in a box given a test point.
Public methodStatic memberBoxClosestPoint(PointF, RectangleF)
Find the closest point on or in a box given a test point.
Public methodStatic memberBoxFurthestPoint(Point, Rectangle)
Find the furthest point on or in a box given a test point.
Public methodStatic memberBoxFurthestPoint(PointF, RectangleF)
Find the furthest point on or in a box given a test point.
Public methodStatic memberBoxViewCone
Computes the graphicspath that represents the viewcone for a point and a rectangle. If the rectangle contains the point, null is returned.
Public methodStatic memberColourARGB(Double, Double, Double)
Create a colour from floating ARGB channels (0.0~1.0). Channels are clipped to valid ranges.
Public methodStatic memberColourARGB(Int32, Int32, Int32)
Create a colour from integer RGB channels. Channels are clipped to valid ranges.
Public methodStatic memberColourARGB(Int32, Int32, Int32, Int32)
Create a colour from integer ARGB channels. Channels are clipped to valid ranges.
Public methodStatic memberCreateColourIcon
Create a colour swatch icon.
Public methodStatic memberDentHorizontal(Graphics, Rectangle)
Draws a horizontal dent. A horizontal dent had dark lines along the top and bottom edges.
Public methodStatic memberDentHorizontal(Graphics, Rectangle, Int32, Int32)
Draws a horizontal dent. A horizontal dent had dark lines along the top and bottom edges.
Public methodStatic memberDentVertical(Graphics, Rectangle)
Draws a vertical dent. A vertical dent had dark lines along the left and right edges.
Public methodStatic memberDentVertical(Graphics, Rectangle, Int32, Int32)
Draws a vertical dent. A vertical dent had dark lines along the left and right edges.
Public methodStatic memberDistance
Compute the distance between two points.
Public methodStatic memberDistanceS
Compute the squared distance between two points.
Public methodStatic memberEtchFadingHorizontal
Draw an etched line with fading on the extremes.
Public methodStatic memberEtchFadingVertical
Draw an etched line with fading on the extremes.
Public methodStatic memberEtchHorizontal(Graphics, Single, Single, Single, Int32)
Draws an etched line segment.
Public methodStatic memberEtchHorizontal(Graphics, Int32, Int32, Int32, Int32, Int32)
Draws an etched line segment.
Public methodStatic memberEtchVertical(Graphics, Int32, Int32, Int32, Int32)
Draws an etched line segment.
Public methodStatic memberEtchVertical(Graphics, Single, Single, Single, Int32)
Draws an etched line segment.
Public methodStatic memberFadeColour
Fade a colour to transparency by linearly blending a parameter between extremes.
Public methodStatic memberForegroundColour
Calculates a suitable foreground color. If the background is lighter than 50%, the foreground will be darker, otherwise the foreground will be lighter.
Public methodStatic memberGrid(Graphics, RectangleF, Int32)
Draw a default grid.
Public methodStatic memberGrid(Graphics, RectangleF, Int32, Int32)
Draw a default grid.
Public methodStatic memberGrid(Graphics, RectangleF, Int32, Int32, Color, Color)
Draw a grid.
Public methodStatic memberHighlightBrush
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.
Public methodStatic memberHighlightPen
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.
Public methodStatic memberInvertColour
Computes the inverted colour. Alpha remains the same.
Public methodStatic memberIsPointInEllipse
Test whether a point is inside or outside an ellipse.
Public methodStatic memberLimitInteger
Limits the given integer to the 0~255 range.
Public methodStatic memberLimitIntegers
Limits RGB channels to the 0~255 range,
Public methodStatic memberOffsetColour(Color, Int32)
Add a fixed value to all the channels in a colour.
Public methodStatic memberOffsetColour(Color, Int32, Int32, Int32)
Add a fixed value to all the channels in a colour.
Public methodStatic memberRenderBalloonTag(Graphics, String, PointF, RectangleF)
Draw a default balloon tag in a container.
Public methodStatic memberRenderBalloonTag(Graphics, String, Font, PointF, RectangleF)
Draw a default balloon tag in a container with a Font override.
Public methodStatic memberRenderBalloonTag(Graphics, String, Font, Color, Color, PointF, Boolean)
Draw a balloon tag in a container.
Public methodStatic memberRenderBalloonTag(Graphics, String, Font, Color, Color, PointF, RectangleF)
Draw a balloon tag in a container.
Public methodStatic memberRenderCenteredIcon(Graphics, RectangleF, Image) Obsolete.
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.
Public methodStatic memberRenderCenteredIcon(Graphics, RectangleF, Image, Double)
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.
Public methodStatic memberRenderCenteredIcon(Graphics, RectangleF, Image, Single) Obsolete.
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.
Public methodStatic memberRenderCenteredText
Render a bit of text centered on a point.
Public methodStatic memberRenderColourIcon(Graphics, Rectangle, Color) Obsolete.
Render a colour icon into a graphics context. A colour icon contains a black outer and white inner edge.
Public methodStatic memberRenderColourIcon(Graphics, Rectangle, Color, Single)
Render a colour icon into a graphics context. A colour icon contains a black outer and white inner edge.
Public methodStatic memberRenderFadedImage(Graphics, Image, Rectangle, Double)
Render an icon into a rectangle with a specific fading factor.
Public methodStatic memberRenderFadedImage(Graphics, Image, Rectangle, Int32)
Render an icon into a rectangle with a specific fading factor.
Public methodStatic memberRenderHighlightBox(Graphics, Rectangle, Int32)
Render a typical blueish highlight rectangle
Public methodStatic memberRenderHighlightBox(Graphics, Rectangle, Int32, Boolean, Boolean)
Render a typical blueish highlight rectangle
Public methodStatic memberRenderHighlightBox(Graphics, Rectangle, Int32, Color, Color)
Render a typical blueish highlight rectangle
Public methodStatic memberRenderIcon
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.
Public methodStatic memberRenderObjectOverlay(Graphics, IGH_DocumentObject, RectangleF)
Render all overlay icons for a specific object. Overlays aren't drawn when the zoom is less than 80%
Public methodStatic memberRenderObjectOverlay(Graphics, IGH_ObjectProxy, RectangleF)
Render all overlay icons for a specific object. Overlays aren't drawn when the zoom is less than 80%
Public methodStatic memberRenderRoundBar
Render a cylinder shaped object with round caps.
Public methodStatic memberCode exampleRenderTag
Render a text tag into a Graphics surface.
Public methodStatic memberRenderUnscaledIcon(Graphics, Image, Int32, Int32) Obsolete.
Draws an image file at 1:1 scale centered on the given coordinates.
Public methodStatic memberRenderUnscaledIcon(Graphics, Image, Int32, Int32, Double) Obsolete.
Draws an image file at 1:1 scale centered on the given coordinates.
Public methodStatic memberRenderVerticalString
Render vertical text (rotated 90 degrees counter-clockwise) within a rectangle.
Public methodStatic memberRenderWarningIcon
Render a typical warning icon into a graphics context. A warning icon is an upright yellow triangle.
Public methodStatic memberScaleColour
Multiply the channels of a colour construct with a fixed factor.
Public methodStatic memberShadowHorizontal(Graphics, Int32, Int32, Int32, Int32, Boolean, Color)
Draws a horizontal shadow edge.
Public methodStatic memberShadowHorizontal(Graphics, Int32, Int32, Int32, Int32, Boolean, Int32)
Draws a horizontal shadow edge.
Public methodStatic memberShadowHorizontal(Graphics, Single, Single, Single, Single, Boolean, Int32)
Draws a horizontal shadow edge.
Public methodStatic memberShadowRectangle(Graphics, Rectangle, Int32, Color)
Draws shadow edges on the interior of a rectangle.
Public methodStatic memberShadowRectangle(Graphics, Rectangle, Int32, Int32)
Draws shadow edges on the interior of a rectangle.
Public methodStatic memberShadowVertical(Graphics, Int32, Int32, Int32, Int32, Boolean, Color)
Draws a vertical shadow edge.
Public methodStatic memberShadowVertical(Graphics, Int32, Int32, Int32, Int32, Boolean, Int32)
Draws a vertical shadow edge.
Public methodStatic memberShadowVertical(Graphics, Single, Single, Single, Single, Boolean, Int32)
Draws a vertical shadow edge.
Public methodStatic memberSolveArc(Point3d, Point3d, Vector3d, RectangleF, Single, Single)
Create a GDI circular arc definition from start-point, end-point and tangent direction.
Public methodStatic memberSolveArc(PointF, PointF, SizeF, RectangleF, Single, Single)
Create a GDI circular arc definition from start-point, end-point and tangent direction.
Public methodStatic memberSolveArc(Double, Double, Double, Double, Double, Double, RectangleF, Single, Single)
Create a GDI circular arc definition from start-point, end-point and tangent direction.
Public methodStatic memberTransparencyMatrix(Double)
Create an image transparency matrix for a specific blending factor.
Public methodStatic memberTransparencyMatrix(Int32)
Create an image transparency matrix for a specific blending factor.
Top
See Also