Contains routines and types used when drawing graphics.

GraphUtil.pp contains routines and types used when drawing graphics. They focus primarily on converting colors and drawing gradients, scroll bars, and arrows.

It includes routines used to convert between both the HSL (hue, saturation, lightness) and HSV (hue, saturation, brightness value) alternative representations of the RGB color model.

HSV models the way different colors mix together, with the saturation dimension resembling various tints of brightly colored paint, and the value dimension resembling the mixture of those paints with varying amounts of black or white paint.

HSL places saturated colors around a circle with a lightness value of 0.5, where a lightness value of 0 or 1 is fully black or white (respectively).

GraphUtil is used in the Lazarus IDE, in LCL WidgetSet components, and optional Lazarus components like FPReport, SynEdit, and TAChart.

Converts a Lazarus TColor value to its grayscale equivalent. Byte contain the grayscale value for the specified color. TColor value converted in the method. Converts a TColor value to its Hue, Lightness, and Saturation values. TColor value converted in the method. Hue value for the specified color. Lightness value for the specified color. Saturation value for the specified color. Converts RGB color values to Hue, Lightness, and Saturation values. Converts Hue, Lightness, and Saturation values to a TColor value. Converts Hue, Lightness, and Saturation values to a RGB color values. Converts a TColor value to Hue, Saturation, and brightness Values. Converts Hue, Saturation, and brightness values to a TColor value. Converts RGB values to Hue, Saturation, and brightness values. Converts Hue, Saturation, and brightness values to RGB values. Converts Hue, Saturation, and brightness values to a TRGBTriple value . Converts Hue, Saturation, and brightness values to a TRGBQuad value . Gets the Hue value from the specified TColor value. Gets the Saturation value from the specified TColor value. Saturation value for the specified color. Color examined in the routine. Gets the brightness value from the specified TColor value. Brightness value for the specified color. Color examined in the routine. Draws a gradient from top to bottom with parabolic color variation. Canvas where the gradient is drawn. Rectangle that defines the drawing boundaries for the gradient. Color used at the top of the gradient. Color used at the end or bottom of the gradient. Draws a window with a Title using gradient coloring. Canvas where the gradient is drawn. Rectangle for the window drawn using a gradient . Height of the the title bar in the window. Base color for the window. Stretch-draws a bitmap using anti-aliased drawing. Bitmap drawn in the routine. Bitmap where the new image is drawn. Width for the resized image. Height for the resized image. Enumerated type that indicates the direction for scrollbar arrows. Indicates the drawing style for an arrow. Arrow is drawn using a solid, filled color. Arrow is drawn using chevrons. 45*pi/180 Draws an arrow at the specified location on a canvas.

DrawArrow is an overloaded procedure used to draw an arrow on a canvas at the specified location. Overloaded variants of the routine allow the type of arrow, length, angle, and drawing style to be specified as arguments.

Canvas where the arrow is drawn. Direction for the arrow. Point that indicates the canvas coordinates where the arrow is drawn. Drawing style for the arrow. A simple first-in-first-out circular buffer (queue) for flood-filling contiguous voxels.

FloodFill is a procedure which implements a simple first-in-first-out circular buffer (queue) for flood-filling contiguous voxels. This algorithm avoids stack problems associated simple recursive algorithms described in the discussion at . Please note that the routine is slow because of its use of Canvas.Pixels.

Orginal author: Chris Rorden

Scales the specified image to the required dimensions.

ScaleImg is a procedure used to scale the image in AImage to the dimensions in AWidth and AWidth.

ScaleImg calls the CreateIntfImage method in AImage to get a TLazIntfImage instance with the original content. A temporary TLazCanvas instance is created for the source image, and its StretchDraw method is called to resize and draw the interface image on the Canvas. AImage is updated with the resized content, and its Height and Width properties are set to the parameter values.

Bitmap image resize in the routine. New Width requested for the image. New height requested for the image. Converts an RGB color value to Hue, Lightness, and Saturation values . Ensures that coordinates in the rectangle are in the correct order. Rectangle with the corrected values for its coordinates. Rectangle examined in the routine. Draws a hoizontal or vertical wave at the specified position to the given device context. Device context that is the target for the drawing operation. Horizontal position where the wave is drawn. Vertical position where the wave is drawn. Amplitude for changes in horizontal or vertical positions in the wave.