GdPicture.NET.14.API
GdPicture14 Namespace / GdPictureImaging Class / DrawTextGradient Method / DrawTextGradient(Int32,String,Int32,Int32,Int32,Int32,Single,GdPictureFontStyle,String,Boolean) Method
GdPicture image identifier.
Text to draw.
Specifies the x-coordinate of the upper-left corner of the rectangle that bounds the.
Specifies the y-coordinate of the upper-left corner of the rectangle that bounds the.
Starting color of the gradient. A suitable color value can be obtained by using the ARGBI() method.
Ending color of the gradient. A suitable color value can be obtained by using the ARGBI() method.
The font size in units specified by the FontSetUnit() method.
A member of the FontStyle enumeration.
The name of the font. IE: "Arial".
Set to True to apply the Antialiasing algorithm else False.
Example





In This Topic
DrawTextGradient(Int32,String,Int32,Int32,Int32,Int32,Single,GdPictureFontStyle,String,Boolean) Method
In This Topic
Draws a text on a GdPicture image using a linear gradient Imaging.Colors. The drawing colors are specified with integer values.
Syntax
'Declaration
 
Public Overloads Function DrawTextGradient( _
   ByVal ImageID As Integer, _
   ByVal Text As String, _
   ByVal DstLeft As Integer, _
   ByVal DstTop As Integer, _
   ByVal StartColor As Integer, _
   ByVal EndColor As Integer, _
   ByVal FontSize As Single, _
   ByVal FontStyle As GdPictureFontStyle, _
   ByVal FontName As String, _
   ByVal AntiAlias As Boolean _
) As GdPictureStatus
public GdPictureStatus DrawTextGradient( 
   int ImageID,
   string Text,
   int DstLeft,
   int DstTop,
   int StartColor,
   int EndColor,
   float FontSize,
   GdPictureFontStyle FontStyle,
   string FontName,
   bool AntiAlias
)
public function DrawTextGradient( 
    ImageID: Integer;
    Text: String;
    DstLeft: Integer;
    DstTop: Integer;
    StartColor: Integer;
    EndColor: Integer;
    FontSize: Single;
    FontStyle: GdPictureFontStyle;
    FontName: String;
    AntiAlias: Boolean
): GdPictureStatus; 
public function DrawTextGradient( 
   ImageID : int,
   Text : String,
   DstLeft : int,
   DstTop : int,
   StartColor : int,
   EndColor : int,
   FontSize : float,
   FontStyle : GdPictureFontStyle,
   FontName : String,
   AntiAlias : boolean
) : GdPictureStatus;
public: GdPictureStatus DrawTextGradient( 
   int ImageID,
   string* Text,
   int DstLeft,
   int DstTop,
   int StartColor,
   int EndColor,
   float FontSize,
   GdPictureFontStyle FontStyle,
   string* FontName,
   bool AntiAlias
) 
public:
GdPictureStatus DrawTextGradient( 
   int ImageID,
   String^ Text,
   int DstLeft,
   int DstTop,
   int StartColor,
   int EndColor,
   float FontSize,
   GdPictureFontStyle FontStyle,
   String^ FontName,
   bool AntiAlias
) 

Parameters

ImageID
GdPicture image identifier.
Text
Text to draw.
DstLeft
Specifies the x-coordinate of the upper-left corner of the rectangle that bounds the.
DstTop
Specifies the y-coordinate of the upper-left corner of the rectangle that bounds the.
StartColor
Starting color of the gradient. A suitable color value can be obtained by using the ARGBI() method.
EndColor
Ending color of the gradient. A suitable color value can be obtained by using the ARGBI() method.
FontSize
The font size in units specified by the FontSetUnit() method.
FontStyle
A member of the FontStyle enumeration.
FontName
The name of the font. IE: "Arial".
AntiAlias
Set to True to apply the Antialiasing algorithm else False.

Return Value

A member of the GdPictureStatus enumeration.
Remarks
To draw watermark text use an ARGB value with alpha component < 255.

This method requires the Image Documents component to run.

Example
Drawing text using linear gradient fill with red start color and black end color on a jpeg image.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
    int imageID = gdpictureImaging.CreateGdPictureImageFromFile("input.jpg");
 
    // Draw the text in the top left corner of the image.
    gdpictureImaging.DrawTextGradient(imageID, "GdPicture.Net", 5, 5, gdpictureImaging.ARGBI(255, 255, 0, 0), gdpictureImaging.ARGBI(255, 0, 0, 0), 48, GdPicture14.FontStyle.FontStyleRegular, "Arial", true);
    gdpictureImaging.SaveAsJPEG(imageID, "output.jpg");
    gdpictureImaging.ReleaseGdPictureImage(imageID);
}
See Also