GDI+ 学习记录
一、GDI+体系
1、二维集合图形的处理
矢量图形由图元构成,图元由坐标中的一组点来指定。
① Rect类:存储矩形的位置和尺寸;
② Pen类: 存储线条的颜色、线宽和线条风格的信息;
③ Graphics类: 用于绘制直线、矩形及其他图形;
④ Brush类: 存储颜色图案来填充闭合图形和路径的方法。
2、显示图像
难以或者不可能使用矢量图形技术来表示的图像,一般存储为位图,位图是代表屏幕上单个点的颜色的数字阵列。
例子: CachedBitmap(缓存位图)类,该类用于在内存中存储位图以便快速访问与显示位图。
3、排版
排版与使用各种各样的字体、尺寸和风格显示的文本有关,针对文本样式。
GDI+提供了大量的函数来完成各种不同风格的文本输出。
二、GDI+特色
1、渐变画刷
画刷是用来填充控件、窗口和区域的一个GDI对象。
① 线性渐变画刷:可以双色渐变,也可以多色渐变。默认:水平方向、平均过渡。渐变过程可以控制;
② 路径渐变画刷: 定义路径内部的渐变色画刷。渐变色从路径内部的中心点逐渐过渡到路径的边框。 GDI+ 中使用 GraphicsPath 类来定义路径,应用程序使用路径来绘制形体的轮廓、填充形体内部及创建剪切区域。
2、独立的路径对象(Path Objects)
路径是可以被填充、被画出轮廓或者同时画出轮廓并填充的一个或多个图形。
在 GDI 中路径是设备环境的一个对象,在 BeginPath 函数 和 EndPath 函数之间进行绘图时,绘图的信息自动存入路径信息。这些信息在下次使用 BeginPath 函数时会被覆盖,即 GDI 中的路径信息是唯一并且不断改变的。
然而在 GDI+ 中,绘图是由图形对象(Graphics Object)来完成的,并且可以创建多个图形对象进行绘图,多个图形对象产生的路径信息是相对独立的,而且不会被新的绘图操作覆盖。
3、矩阵对象(Matrix Object)
GDI+ 提供了矩阵对象来使图形在变形(旋转及平移等)时做到简单且效果平滑。
矩阵对象存储了图形在变化过程中的位置信息。使用矩阵除了可以对坐标信息进行变换以外,还可以对色彩的空间信息进行变换。
4、Alpha 通道合成运算(Alpha Blending)
Alpha Blending 是图形处理中最常见的一种运算方法,改变透明度。
在 GDI+ 中,Alpha Blending 不仅运用在图片的合成方面,也体现在画笔、画刷与目标图形区域之间的合成运算中。
5、多格式图片支持
GDI+ 提供了对各种图片的打开、存储功能。
通过GDI+可以直接将一幅BMP文件存储成JPG或是其他格式的图片文件。
GDI+ 支持的文件格式: BMP、GIF、JPEG、EXIF、PNG、TIFF、ICON、WMF 及 EMF。
三、建立一个简单的 GDI+ 程序
① 在项目中引入GDI+的头文件、使用GDI+的命名空间;
② 初始化GDI+系统资源;
③ 使用完毕之后,释放GDI+所使用的资源;
④ 在编译时加入GDIpius.Lib库文件。
在开始调用GDI+各种函数之前,应该使用GdiplusStartup函数对GDI+系统资源进行初始化。
在结束GDI+调用之前,应该使用GdiplusShutdown函数进行GDI+系统资源的销毁操作。
//stdafx.h
//引入GDI+头文件
#include <gdiplus.h>
#pragma comment(lib, "gdiplus.lib")
using namespace Gdiplus;
//初始化GDI+系统资源
ULONG_PTR gdiplusToken;
BOOL CGdiPlusDemo1Dlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
//GDI+资源初始化
GdiplusStartupInput gdiplusStartupInput;
GdiplusStartup(&gdiplusToken,&gdiplusStartupInput,NULL);
return TRUE; // return TRUE unless you set the focus to a control
}
//在析构函数中销毁GDI+资源
GdiplusShutdown(gdiplusToken);
添加GDIplus.lib库文件,该文件一般位置为:
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib\GdiPlus.lib
//在 OnDraw 函数中实现GDI+输出文本
Graphics graphics(this->GetDC()->m_hDC);
//设定文本输出使用的画笔、色彩、字体
Pen pen(Color(255,0,0,255));
SolidBrush brush(Color(255,0,0,255));
FontFamily fontFamily(L"宋体");
Font font(&fontFamily,24,FontStyleRegular,UnitPixel);
//在窗口中央输出文本
CRect rect;
this->GetClientRect(&rect);
PointF pointF(rect.right/2,rect.bottom/2);
graphics.DrawString(L"GDI+程序示意",-1,&font,pointF,&brush);
L 标记 表示引号内文本需要通过双字节编码方式进行编译
Unicode 码使用
① TCHAR 类型(通用字符类型)
当定义了 _UNICODE 宏时,TCHAR 就是 WCHAR;没有定义这个宏时,TCHAR就是 char。
//TCHAR的数据类型
#ifdef UNICODE
typedef WCHAR TCHAR,*PTCHAR;
#else /*UNICODE*/
typedef char TCHAR,*PTCHAR;
#endif/*!_TCHAR_DEFINED*/
通过TCHAR,就可以支持兼容UNICODE和MULTIBYTE两种版本,例子:
TCHAR tStr[] = _T("t code");
MessageBox(sStr);
② 从CString类型转换成UNICODE
首先常用的CString,它本身就支持UNICODE。下面是CString转换为UNICODE的用法:
CString *pFileName = new CString("c:\\tmpfile.txt");
#ifdef_UNICODE //如果是使用的UNICODE
m_hFile = CreateFile(pFileName->AllocSysString(),
GENERIC_READ|GENERIC_WRITE,
FILE_SHARE_READ,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL);
#else
m_hFIle = CreateFile(pFileName->GetBuffer(pFileNanem->GetLength()),
GENERIC_READ|GENERIC_WRITE,
FILE_SHARE_READ,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL);
#endif
③ 在UNICODE方式中需要为一个字符串常量赋值时,可以使用L宏,如:
BSTR wcsStr = L"unicode";
这样的赋值方式确实很简单,但是,经过L宏处理后的字符串一定是UNICODE,
如果把它的值赋值到另一个MULTIBYTE的字符串,字符串可能被截断。
四、GDI+编程的基本操作
1、构造Graphics对象
static Graphics* FromHDC(HDC hdc);
static Graphics* FormHDC(HDC hdc, HANDLE hDevice);
static Graphics* FormHWND(HDC hdc, BOOL icm);
static Graphice* FormImage(Image* image);
参数:
hdc: 设备环境句柄
hWnd:窗口句柄
icm:是否使用色彩配置文件校正色彩
image: 图像对象
Hdevice: 设备句柄
2、绘制直线、矩形、曲线和多边形
//例子
//输出文本
Graphics graphics(this->GetDC()->m_hDC);
//设定文本输出使用的画笔、色彩、字体
Pen pen(Color(255,0,0,255));
SolidBrush brush(Color(255,0,0,255));
FontFamily fontFamily(L"宋体");
Font font(&fontFamily,24,FontStyleRegular,UnitPixel);
//在窗口中央输出文本
CRect rect;
this->GetClientRect(&rect);
PointF pointF(rect.right/2,rect.bottom/2);
graphics.DrawString(L"GDI+程序示意",-1,&font,pointF,&brush);
(1)绘制直线
DrawLine(Pen* pen,Point& pt1,Point& pt2)
DrawLine(Pen* pen,PointF& pt1,PointF& pt2)
DrawLine(Pen* pen,INT x1,INT y1,INT x2,INT y2)
DrawLine(Pen* pen,REAL x1,REAL y1,REAL x2,REAL y2)
DrawLines(Pen* pen,Point* points,INT count)
DrawLines(Pen* pen,PointF* points,INT count)
参数:
pt1、pt2: 线段起止点位置;
x1,y1,x2,y2: 线段起止点坐标;
points: 直线端点数组;
count: 线段定义点总数;
//例子
//直线
Graphics graphics(this->m_hWnd);
Pen blackPen(Color(255,0,0,0),3);
//定义点的位置
PointF point1(10.0f,10.0f);
PointF point2(10.0f,100.0f);
PointF point3(50.0f,50.0f);
PointF point4(10.0f,10.0f);
(2)绘制矩形
DrawREctangle(Pen* pen,Rect& rect);
DrawREctangle(Pen* pen,RectF& rect);
DrawREctangle(Pen* pen,INT x,INT y,INT width,INT height);
DrawREctangle(Pen* pen,REAL x,REAL y,REAL width,REAL height);
DrawREctangle(Pen* pen,Rect* rects,INT count);
DrawREctangle(Pen* pen,RectF* rects,INT count);
PointF points[4] = {point1,point2,point3,point4};
PointF* pPoints = points;
//绘制多条线
graphics.DrawLines(&blackPen,pPoints,4);
参数
rect: 矩形区间;
width,height: 矩形的宽和高;
//例子
RectF rect1(50.0f,10.0f,140.0f,50.0f);
RectF rect2(90.0f,40.0f,140.0f,50.0f);
RectF rect3(130.0f,40.0f,90.0f,100.0f);
RectF rects[] = {rect1,rect2,rect3};
RectF* pRects = rects;
graphics.DrawRectangles(&blackPen,pRects,3);
(3)绘制简单的曲线和贝塞尔曲线
DrawCurve 或者 DrawClosedCurve 两个函数进行曲线的绘制。
//DrawCurve 函数常见的调用方法
DrawCurve(Pen* pen,Point* points,INT count)
DrawCurve(Pen* pen,Point* points,INT count,REAL tension)
DrawClosedCurve 函数与 DrawCurve 函数参数一致,如果给出的首尾坐标不一致,
则会用平滑的曲线实现将曲线连接起来。
参数:
pen: 绘制曲线时使用的画笔;
points,count: 定义曲线的点及点的个数;
tension:曲线的弯曲强度,弯曲强度越小,曲线的弯曲程度也越小。
//绘制曲线
Pen greenPen(Color::Green,3);
Pen renPen(Color::Red,3);
Point point5(500,100);
Point point6(100,100);
Point point7(200,50);
Point point8(700,10);
Point curvePoints[4] = {point5,point6,point7,point8};
graphics.DrawCurve(&greenPen,curvePoints,4);
//使用红笔绘制弯曲强度为1.3的曲线
graphics.DrawCurve(&renPen,curvePoints,4,1.3f);
贝塞尔曲线绘制
贝塞尔曲线是用4个点来指定的曲线: 两个端点和两个控制点。
曲线连接两个端点,但是不通过控制点。
控制点的位置控制着曲线的弯曲方向。
//绘制贝塞尔曲线
this->RedrawWindow();
CDC* pDc = GetDC();
Graphics graphics(pDc->m_hDC);
Pen bluePen(Color::Blue);
//定义曲线起点
Point startPoint(100,100);
//定义两个控制点
Point controlPoint1(200,10);
Point controlPoint2(350,50);
//定义曲线终点
Point endPoint(500,100);
//绘制上面4个点:起止用红色,控制用绿色
graphics.FillEllipse(&SolidBrush(Color::Red),100,100,10,10);
graphics.FillEllipse(&SolidBrush(Color::Red),500,100,10,10);
graphics.FillEllipse(&SolidBrush(Color::Red),200,10,10,10);
graphics.FillEllipse(&SolidBrush(Color::Red),350,50,10,10);
//绘制贝塞尔曲线
graphics.DrawBezier(&bluePen,startPoint,controlPoint1,controlPoint2,endPoint);
(4)绘制多边形
多边形是由3条或者更多条直边组合成的闭合图形。
使用DrawPolygon函数。
DrawPolygon(Pen* pen,Point* points,INT count)
DrawPolygon(Pen* pen,PointF* points,INT count)
//绘制多边形
Graphics graphics(this->m_hWnd);
Pen blackPen(Color(255,0,0,3));
//定义多边形端点
Point point1(100,100);
Point point2(200,130);
Point point3(150,200);
Point point4(50,200);
Point point5(0,130);
Point points[5] = {point1,point2,point3,point4,point5};
Point* pPoints = points;
//绘制多边形
graphics.DrawPolygon(&blackPen,pPoints,5);
(5)绘制弧线与扇形
对于弧线的绘制,GDI+是通过 DrawArc 函数完成的,其函数调用形式:
DrawArc(Pen* pen,Rect& rect,REAL startAngle,REAL sweepAngle)
DrawArc(Pen* pen,RectF& rect,REAL startAngle,REAL sweepAngle)
DrawArc(Pen* pen,INT x,INT y,INT width,INT height,REAL startAngle,REAL sweepAngle)
DrawArc(Pen* pen,REAL x,REAL y,REAL width,REAL height,REAL startAngle,REAL sweepAngle)
参数:
Pen: 画笔;
rect; 定义弧线的矩形;
startAngle: 从x轴到弧线的起始点沿顺时针方向度量的角度;
sweepAngle: 从startAngle参数到弧线的结束点沿顺时针方向度量的角度。
//绘制弧线
Graphics m_graphics(this->m_hWnd);
Pen redPen(Color::Red);
Rect ellipseRect(10,10,200,100);
REAL startAngle = 0.0f;
REAL sweepAngle = 90.0f;
//绘制弧线
m_graphics.DrawArc(&redPen,ellipseRect,startAngle,sweepAngle);
//绘制边框
m_graphics.DrawRectangle(&Pen(Color::Black),ellipseRect);
对于扇形的绘制,GDI+是通过DrawPie函数完成的,其函数调用形式为:
DrawPie(Pen* pen,Rect& rect,REAL startAngle,REAL sweepAngle)
DrawPie(Pen* pen,RectF& rect,REAL startAngle,REAL sweepAngle)
DrawPie(Pen* pen,INT x,INT y,INT width,INT hight,REAL startAngle,REAL sweepAngle)
DrawPie(Pen* pen,REAL x,REAL y,REAL width,REAL hight,REAL startAngle,REAL sweepAngle)
参数:
rect: 定义弧线的矩形
startAngle、sweepAngle: 起止角度
3、填充区域
GDI+ 填充不同区域的填充函数
FillClosedCurve() //填充封闭曲线
FillEllipse() //填充椭圆
FillPath() //填充路径
FillPie() //填充扇形
FillPolygon() //填充多边形
FillRectangle() //填充矩形
FillRectangles() //填充矩形集
FillRegion() //填充区域
画刷的分类:
① 单色画刷;
② 影线画刷;
③ 纹理画刷;
④ 线性渐变画刷;
⑤ 路径渐变画刷。
下面以FillClosedCurve函数进行举例:
FillClosedCurve(Brush* brush,Point* points,INT count)
FillClosedCurve(Brush* brush,PointF* points,INT count)
FillClosedCurve(Brush* brush,Point* points,INT count,FillMode fillMode,REAL tension)
FillClosedCurve(Brush* brush,PointF* points,INT count,FillMode fillMode,REAL tension)
参数:
brush: 填充时使用的画刷;
points,count: 曲线的定义点击点数量;
fillMode,tension: 填充曲线的方式及曲线的张力;
4、使用色彩
GDI+的色彩由两种表示方法:
① RGB
② CYMK(青、洋红、黄色、黑色)
GDI+对于像素的访问是通过 GetPixel()函数实现的,该函数的调用方法为:
status GetPixel(
INT x,
INT y,
Color* clolr
);
参数:
x,y: 像素的位置;
color: 像素信息的返回值,该变量为一个Color对象。
GetPixel() 和 SetPixel() 一般配对使用。
5、输出文本
GDI+具有丰富的文本输出效果:
DrawString(string,length,font,layoutRect,stringFormat,brush)
DrawString(string,length,font,origin,brush)
DrawString(string,length,font,origin,stringFormat,brush)
参数:
string: 输出的文本内容,双字节型
length: 文本长度
font: 字体
layoutRect, origin: 文本输出的位置
stringFormat: 文本输出格式
brush: 输出文本时使用的画刷
三、画笔和画刷
1 、GDI+ 画笔
Pen(color,width)
Pen(brush,width)
更改画笔的线性:
通过Pen类的成员函数 SetDashStyle可以设置画笔的线性。
enum DashStyle{
DashStyleSolid = 0, //实线
DashStyleDash = 1, //虚线
DashStyleDot = 2, //点线
DashStyleDashDot = 3, //点划线
DashStyleDashDotDot = 4, //双点划线
DashStyleCustom = 5 //自定义线型
};
画笔的对齐方式:
居中和嵌入,通过 PenAlignment类来实现。
enum PenAlignment{
PenAlignmentCenter = 0, //居中
PenAlignmentInset = 1 //嵌入
};
画笔的缩放及旋转
Graphics graphics(this->m_hWnd);
Pen pen(Color(255,0,0,255));
pen.SetWidth(5);
Matrix matrix(1,0,0,2,0,0);
pen.MultiplyTransform(&matrix,MatrixOrderPrepend);
pen.SetTransform(&matrix);
pen.ScaleTransform(1,4);
graphics.DrawRectangle(&pen,50,50,200,200);
画笔的线帽属性
“线帽”(LineCap),就是线条首尾的外观。
SetStartCap() //设置起点的线帽
SetEndCap() //设置终点的线帽
enum LineCap{
LineCapFlat = 0; //平面
LineCapSquare = 1; //矩形
LineCapRound = 2; //圆形
LineCapTriangle = 3; //三角形
LineCapNoAnchor = 0x10,
LineCapSquareAnchor = 0x11, //矩形,高度大于直线宽度
LineCapRoundAnchor = 0x12, //圆形,直径大于直线直线宽度
LineCapDiamondAnchor = 0x13,//菱形,高度大于直线宽度,菱形中点即直线端点
LineCapArrowAnchor = 0x14, //箭头
LineCapCustom = 0xff //自定义形状
};
// 自定义线帽构造函数
CustomLineCap{
const GraphicsPath* fillPath,
const GraphicsPath* strokePath,
LineCap baseCap,
REAL baseInset
};
//使用
SetCustomStartCap();
SetCustomEndCap();
Graphics m_graphics(this->m_hWnd);
GraphicsPath StartPath,EndPath;
//在路径中添加一个矩形
StartPath.AddRectangle(Rect(-10,-5,20,10));
//构造结束点线帽的外观:箭头
EndPath.AddLine(0,-20,10,0);
EndPath.AddLine(0,-20,-10,0);
EndPath.AddLine(0,-10,10,0);
EndPath.AddLine(0,-10,-10,0);
Rect rect(10,-5,20,10);
Pen pen(Color(255,0,0,255),2);
//将路径作为线帽外观
CustomLineCap custCap(NULL,&StartPath);
CustomLineCap EndCap(NULL,&EndPath);
//设置画笔起点,终点的自定义线帽
pen.SetCustomEndCap(&EndCap);
pen.SetCustomStartCap(&custCap);
m_graphics.DrawLine(&pen,20,30,300,30);
//以300,300圆心绘制直线
for (float i = 0.0f;i < 6.28f;i+=0.15f)
{
m_graphics.DrawLine(&pen,300.0f,300.0f,300+200.0f*cos(i),300+200.0f*sin(i));
}
直线的连接点属性
斜接(LineJoinMiter)
斜切(LineJoinBevel)
圆形(LineJoinRound)
剪裁斜接(LineJoinMiterCLipped)
enum LineJoin{
LineJoinMiter = 0,
LineJoinBevel = 1,
LineJoinRound = 2,
LineJoinMiterClipped = 3
};
//平滑矩形
/* this->RedrawWindow();*/
Graphics m_graphics(this->m_hWnd);
Pen pen(Color(255,0,0,255),25);
pen.SetLineJoin(LineJoinRound);
m_graphics.DrawRectangle(&pen,20,20,150,100);
pen.SetLineJoin(LineJoinBevel);
m_graphics.DrawRectangle(&pen,300,20,150,100);
//演示四种不同的直线连接点
Point pt[3] = {
Point(20,220),
Point(100,200),
Point(50,280)
};
m_graphics.SetSmoothingMode(SmoothingModeHighQuality); //消除锯齿
//斜接
pen.SetLineJoin(LineJoinMiter);
m_graphics.DrawLines(&pen,pt,3);
pt[0].X += 100;
pt[1].X += 100;
pt[2].X += 100;
//斜切
pen.SetLineJoin(LineJoinBevel);
m_graphics.DrawLines(&pen,pt,3);
pt[0].X += 100;
pt[1].X += 100;
pt[2].X += 100;
//圆形
pen.SetLineJoin(LineJoinRound);
m_graphics.DrawLines(&pen,pt,3);
pt[0].X += 100;
pt[1].X += 100;
pt[2].X += 100;
//剪裁斜接
pen.SetLineJoin(LineJoinMiterClipped);
m_graphics.DrawLines(&pen,pt,3);
pt[0].X += 100;
pt[1].X += 100;
pt[2].X += 100;
画笔的透明度
this->RedrawWindow();
Graphics graphics(this->m_hWnd);
Pen blue(Color::Blue);
Pen red(Color::Red);
int x;
int y = 256;
for (x = 0; x < 256; x += 5)
{
graphics.DrawLine(&blue,0,y,x,0);
graphics.DrawLine(&red,0,x,y,0);
y -= 5;
Sleep(120);
}
for (y = 0; y <256; y++)
{
Pen pen(Color(y,0,255,0));
graphics.DrawLine(&pen,0,y,256,y);
Sleep(20);
}
for (x = 0; x < 256; x++)
{
Pen pen(Color(x,255,0,255));
graphics.DrawLine(&pen,x,100,x,200);
Sleep(20);
}
2、GDI+画刷
画刷分为5种:单色画刷、影线画刷、纹理画刷、线性渐变画刷及路径渐变画刷。
- 单色画刷,SolidBrush, 用纯色填充图形;
- 影线画刷,HatchBrush,用各种线型图案填充图形;
- 纹理画刷, TextureBrush, 使用基于光栅的图像填充图形;
- 线性渐变画刷, LineraGradientBrush, 使用渐变的色彩填充图形;
- 路径渐变画刷, PathGradientBrush, 画刷沿着预定义的路径进行色彩渐变的填充,色彩渐变的方向是从路径的边界到中心。
单色画刷的使用
SolidBrush greenBrush(Color(255,0,255,0));
FillClosedCurve() // 填充闭合曲线;
FillEllipse() //填充椭圆;
FillPath() //填充路径;
FillPie() //填充扇形;
FillPolygon() //填充多边形;
FillRectangle() //填充矩形;
FillRectangles() //填充矩形集;
FillRegion() //填充区域;
Graphics graphics(this->m_hWnd);
SolidBrush greenBrush(Color::Green);
PointF point1(100.0f,100.0f);
PointF point2(200.0f,50.0f);
PointF point3(250.0f,200.0f);
PointF point4(50.0f,150.0f);
PointF point5(100.0f,100.0f);
PointF points[4] = {point1,point2,point3,point4};
//填充闭合曲线
graphics.FillClosedCurve(&greenBrush,points,4,FillModeAlternate,1.0);
PointF poly[5] = {point1,point2,point3,point4,point5};
graphics.FillPolygon(&greenBrush,poly,5);
影线画刷的使用
HatchBrush(
HatchStyle hatchStyle, //影线画刷的类型
const Color& foreColor, //影线画刷线条的前景色
const Color& backColor //影线画刷线条的后景色
);
Graphics m_graphics(this->m_hWnd);
Color black(0,0,0);
Color white(255,255,255,255);
//第一种风格
HatchBrush brush(HatchStyleHorizontal,black,white);
m_graphics.FillRectangle(&brush,20,20,100,50);
//第二种风格
HatchBrush brush1(HatchStyleVertical,black,white);
m_graphics.FillRectangle(&brush1,120,20,100,50);
//第三种风格
HatchBrush brush2(HatchStyleForwardDiagonal,black,white);
m_graphics.FillRectangle(&brush2,220,20,100,50);
//第四种风格
HatchBrush brush3(HatchStyleBackwardDiagonal,black,white);
m_graphics.FillRectangle(&brush3,320,20,100,50);
//第五种风格
HatchBrush brush4(HatchStyleCross,black,white);
m_graphics.FillRectangle(&brush4,420,20,100,50);
//第六种风格
HatchBrush brush5(HatchStyleDiagonalCross,black,white);
m_graphics.FillRectangle(&brush5,520,20,100,50);
线性渐变画刷
LinearGradientBrush(Point& point1,Point& point2,Color& color1,Color& color2)
LinearGradientBrush(PointF& point1,PointF& point2,Color& color1,Color& color2)
LinearGradientBrush(Rect& rect,Color& color1,Color& color2,REAL angle,BOOL isAngleScalable)
LinearGradientBrush(RectF& rect,Color& color1,Color& color2,REAL angle,BOOL isAngleScalable)
LinearGradientBrush(Rect& rect,Color& color1,Color& color2,REAL angle,LinearGeadientMode mode)
LinearGradientBrush(RectF& rect,Color& color1,Color& color2,REAL angle,LinearGeadientMode mode)