BitmapDataFactoryCreateLinearGradient(Int32, Int32, PointF, PointF, ColorF, ColorF, GradientWrapMode, WorkingColorSpace) Method
Creates a read-only bitmap data with no actual underlying buffer, containing a linear gradient that transitions between two colors along a straight line.
Namespace: KGySoft.Drawing.ImagingAssembly: KGySoft.Drawing.Core (in KGySoft.Drawing.Core.dll) Version: 10.0.1
public static IReadableBitmapData CreateLinearGradient(
int width,
int height,
PointF startPoint,
PointF endPoint,
ColorF startColor,
ColorF endColor,
GradientWrapMode wrapMode = GradientWrapMode.Stop,
WorkingColorSpace workingColorSpace = WorkingColorSpace.Default
)
Public Shared Function CreateLinearGradient (
width As Integer,
height As Integer,
startPoint As PointF,
endPoint As PointF,
startColor As ColorF,
endColor As ColorF,
Optional wrapMode As GradientWrapMode = GradientWrapMode.Stop,
Optional workingColorSpace As WorkingColorSpace = WorkingColorSpace.Default
) As IReadableBitmapData
public:
static IReadableBitmapData^ CreateLinearGradient(
int width,
int height,
PointF startPoint,
PointF endPoint,
ColorF startColor,
ColorF endColor,
GradientWrapMode wrapMode = GradientWrapMode::Stop,
WorkingColorSpace workingColorSpace = WorkingColorSpace::Default
)
static member CreateLinearGradient :
width : int *
height : int *
startPoint : PointF *
endPoint : PointF *
startColor : ColorF *
endColor : ColorF *
?wrapMode : GradientWrapMode *
?workingColorSpace : WorkingColorSpace
(* Defaults:
let _wrapMode = defaultArg wrapMode GradientWrapMode.Stop
let _workingColorSpace = defaultArg workingColorSpace WorkingColorSpace.Default
*)
-> IReadableBitmapData
- width Int32
- The width of the bitmap data to create, in pixels.
- height Int32
- The height of the bitmap data to create, in pixels.
- startPoint PointF
- The starting point of the gradient.
- endPoint PointF
- The end point of the gradient.
- startColor ColorF
- The color at the start of the gradient.
- endColor ColorF
- The color at the end of the gradient.
- wrapMode GradientWrapMode (Optional)
- Determines how the gradient is treated outside the gradient area. This parameter is optional.
Default value: Stop. - workingColorSpace WorkingColorSpace (Optional)
- The color space used for gradient interpolation. This parameter is optional.
Default value: Default, which means Linear for this overload.
IReadableBitmapDataAn
IReadableBitmapData instance containing the generated linear gradient image.
This overload creates a gradient specified by coordinates. To automatically apply the gradient to the bounds of the entire bitmap,
use the overloads with an angle parameter.
In this overload the default value of workingColorSpace maps to WorkingColorSpace.Linear, because
the ColorF type represents a color in the linear color space. When creating a monochromatic gradient, specifying Srgb can be better, because then the perceived
mid-tone brightness will be at the middle of the gradient. Otherwise, using Linear may be more appropriate, so the transition between the colors will seem more "natural".
Though the returned bitmap does not allocate an internal buffer and calculates every pixel dynamically when they are accessed,
operations on the result that return a new bitmap data (e.g.
Clone,
Resize,
ToGrayscale, etc.)
end up allocating a pixel buffer.