随笔 - 2146  文章 - 97 评论 - 11765 trackbacks - 253


LinearColors //属性; 获取或设置渐变的起始色和结束色.
Rectangle    //属性; 获取定义渐变的起始点和终结点的矩形区域.

WrapMode     //属性; 获取或设置 WrapMode 枚举, 指定画刷环绕模式; 感觉它没有存在的必要.

TranslateTransform //方法; 平移.
ScaleTransform     //方法; 放缩.
RotateTransform    //方法; 旋转.
Transform          //属性; 矩阵变换.
MultiplyTransform  //方法: 矩阵变换.


下面是仅就 RotateTransform 方法做的一个测试:



测试代码:

uses GdiPlus;

procedure TForm1.FormPaint(Sender: TObject);
const
  C1 = $FF000000;
  C2 = $FFFF0000;
  C3 = $FFFFFF00;
  C4 = $FFFF0000;
  C5 = $FF000000;
var
  Graphics: IGPGraphics;
  Rect: TGPRect;
  Brush: IGPLinearGradientBrush;
  ColorBlend: IGPColorBlend;
begin
  Graphics := TGPGraphics.Create(Canvas.Handle);
  Rect.Initialize(ClientRect);
  Brush := TGPLinearGradientBrush.Create(Rect, 0, 0, 0);

  ColorBlend := TGPColorBlend.Create([C1, C2, C3, C4, C5], [0, 0.25, 0.5, 0.75, 1]);
  Brush.InterpolationColors := ColorBlend;

  Brush.RotateTransform(30);
  
  Graphics.FillRectangle(Brush, Rect);
end;

procedure TForm1.FormResize(Sender: TObject);
begin
  Repaint;
end;

posted on 2009-12-14 22:53 万一 阅读(...) 评论(...) 编辑 收藏