Marblecore Imaging Library Documentation

Documentation Introduction
Documentation / Marblecore Imaging / Methods / DrawTextInGradient

DrawTextInGradient method

Draws text on the current image canvas and fills the text with a gradient color.

Syntax

Boolean DrawTextInGradient(strText As String, nLeft As Number, nTop As Number, nColorA As Number, nOpacityA As Number, nColorB As Number, nOpacityB As Number, nGradient As Gradient, nWidth As Number, nHeight As Number, bNoWrap As State, strFontFace As String, nFontSize As Number, bFontBold As State, bFontItalic As State, bFontUnderline As State, bFontStrikeout As State, bFontAntiAliasing As State, nFontAlignment As Alignment, nFontRotation As Number, nFontShearX As Number, nFontShearY As Number)

Return value

Returns true if the function succeeded.

Parameters

ParameterTypeRequiredDescription
strTextStringYesText to draw.
nLeftNumberYesLeft coordinate for the text.
nTopNumberYesTop coordinate for the text.
nColorANumberYesSpecifies the first color for the gradient.
nOpacityANumberYesParameter containing the opacity percentage (where 0% is completely transparent) for the first color.
nColorBNumberYesSpecifies the second color for the gradient.
nOpacityBNumberYesParameter containing the opacity percentage (where 0% is completely transparent) for the second color.
nGradientGradient (Enumeration)NoOptional parameter containing the gradient style.
nWidthNumberNoOptional parameter which specifies if horizontal text clipping is enabled. A value of 0 (zero) means clipping is disabled. A value above 0 specifies the width of the clip box.
nHeightNumberNoOptional parameter which specifies if vertical text clipping is enabled. A value of 0 (zero) means clipping is disabled. A value above 0 specifies the height of the clip box.
bNoWrapState (Enumeration)NoOptional parameter which disables or enables text wrapping. Wrapping is enabled by default (so this no-wrap parameter is disabled by default) when a positive value is passed to the nWidth parameter.
strFontFaceStringNoOptional parameter which specifies the font face.
nFontSizeNumberNoOptional parameter which specifies the font size.
bFontBoldState (Enumeration)NoOptional parameter which enables or disables the bold font style.
bFontItalicState (Enumeration)NoOptional parameter which enables or disables the italic font style.
bFontUnderlineState (Enumeration)NoOptional parameter which enables or disables the underline font style.
bFontStrikeoutState (Enumeration)NoOptional parameter which enables or disables the strikeout font style.
bFontAntiAliasingState (Enumeration)NoOptional parameter which enables or disables the font anti-aliasing.
nFontAlignmentAlignment (Enumeration)NoOptional parameter which specifies the alignment of the text.
nFontRotationNumberNoOptional parameter which specifies the rotation angle of the text in degrees.
nFontShearXNumberNoOptional parameter which specifies the horizontal shear percentage of the text.
nFontShearYNumberNoOptional parameter which specifies the vertical shear percentage of the text.

Example

The example below shows how to use the method. If you take a look at the example code, assume there is a reference to the Marblecore Imaging object with the name 'MarblecoreImaging'. Transparent parts of the image are displayed using a checkerboard pattern.
 
 
1 // Creates a new transparent image
2 MarblecoreImaging.Create(150, 150, true);
3 
4 // Execute the operation
5 MarblecoreImaging.DrawTextInGradient("Demo", 25, 45, 16711680, 100, 65280, 100);
6 
7 // Save the modified image to the specified file
8 MarblecoreImaging.SaveToFile("example-drawtextingradient.jpg");

Category

Text drawing

See also

DrawTextInGradientUsingWarp | DrawTextInGradientWithBorder | DrawTextInGradientWithBorderAndShadow | DrawTextInGradientWithBorderAndShadowUsingWarp | DrawTextInGradientWithBorderUsingWarp | DrawTextInGradientWithShadow | DrawTextInGradientWithShadowUsingWarp | DrawTextNormal | DrawTextUsingWarp | DrawTextWithBorder | DrawTextWithBorderUsingWarp | DrawTextWithShadow | DrawTextWithShadowUsingWarp | GetTextHeight | GetTextWidth