随笔分类 -  Delphi 与 GDI+

上一页 1 2 3 4 5 6 7 ··· 11 下一页
GdiPlus[22]: IGPFont
摘要:测试效果图:uses GdiPlus;procedure TForm1.FormPaint(Sender: TObject);var Graphics: IGPGraphics; Brush: IGPSolidBrush; Pt: TGPPointF; Font: IGPFont;begin Graphics := TGPGraphics.Create(Handle); Pt.Init... 阅读全文
posted @ 2009-12-15 14:33 万一 阅读(2418) 评论(0) 推荐(0) 编辑
GdiPlus[21]: IGPPathGradientBrush 之 InterpolationColors
摘要:测试效果图:测试代码:uses GdiPlus, GdiPlusHelpers;procedure TForm1.FormPaint(Sender: TObject);const C1 = $FF000000; C2 = $FFFF0000; C3 = $FFFFFF00; C4 = $FFFF0000; C5 = $FF000000;var Brush: IGPPathGradien... 阅读全文
posted @ 2009-12-15 13:37 万一 阅读(1717) 评论(0) 推荐(0) 编辑
GdiPlus[20]: IGPPathGradientBrush 之 SetFocusScales
摘要:测试效果图:测试代码:uses GdiPlus;procedure TForm1.FormPaint(Sender: TObject);var Graphics: IGPGraphics; Brush: IGPPathGradientBrush; Rect: TGPRect; Path: IGPGraphicsPath;begin Graphics := TGPGraphics.Crea... 阅读全文
posted @ 2009-12-15 11:58 万一 阅读(1736) 评论(0) 推荐(0) 编辑
GdiPlus[19]: IGPPathGradientBrush 之 SetCenterPoint
摘要:测试效果图:测试代码:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs;type TForm1 = class(TForm) procedure FormPaint(Sender: TObject); procedure For... 阅读全文
posted @ 2009-12-15 11:40 万一 阅读(1627) 评论(0) 推荐(0) 编辑
GdiPlus[18]: IGPPathGradientBrush 之 CenterColor、SurroundColors
摘要:最简单的 IGPPathGradientBrush 就是有一个中心颜色和一组周边颜色的渐变.这里牵扯到 CenterColor、SurroundColors 属性和 SetSurroundColors 方法.测试一效果图:测试一代码://使用 SetSurroundColors 方法设置周边色组:uses GdiPlus, GdiPlusHelpers;procedure TForm1.FormP... 阅读全文
posted @ 2009-12-15 11:17 万一 阅读(2059) 评论(0) 推荐(0) 编辑
GdiPlus[17]: IGPLinearGradientBrush 的其他方法和属性
摘要:LinearColors //属性; 获取或设置渐变的起始色和结束色.Rectangle //属性; 获取定义渐变的起始点和终结点的矩形区域.WrapMode //属性; 获取或设置 WrapMode 枚举, 指定画刷环绕模式; 感觉它没有存在的必要.TranslateTransform //方法; 平移.ScaleTransform //方法; 放缩.RotateTransform //方法; ... 阅读全文
posted @ 2009-12-14 22:53 万一 阅读(1946) 评论(0) 推荐(0) 编辑
GdiPlus[16]: IGPLinearGradientBrush 之 SetBlendBellShape、SetBlendTriangularShape
摘要:SetBlendBellShape 方法: 创建基于钟形曲线的渐变过渡过程;SetBlendTriangularShape 方法: 创建一个从中心色向两端单个颜色线性过渡的线性渐变过程.两个方法好像区别不大.SetBlendBellShape 测试效果图:SetBlendTriangularShape 测试效果图:SetBlendBellShape 测试代码:uses GdiPlus;proced... 阅读全文
posted @ 2009-12-14 22:19 万一 阅读(2099) 评论(3) 推荐(0) 编辑
GdiPlus[15]: IGPLinearGradientBrush 之 GammaCorrection
摘要:GammaCorrection 属性是一个 Boolean 值, 默认 False; 为 True 表示启用了灰度校正.测试图中的第二个图形使用了灰度校正:测试代码:uses GdiPlus;procedure TForm1.FormPaint(Sender: TObject);var Graphics: IGPGraphics; Rect: TGPRectF; Brush: IGPLine... 阅读全文
posted @ 2009-12-14 21:54 万一 阅读(1660) 评论(0) 推荐(0) 编辑
GdiPlus[14]: IGPLinearGradientBrush 之 Blend
摘要:IGPLinearGradientBrush.Blend 属性对应一个 IGPBlend 对象;TGPBlend.Create(Factors, Positions); 中的两个参数都是 Single 类型的数组, Factors 颜色强度因子, Positions 是位置偏移比例.对于两种颜色的渐变, 上面两个数组都应是三个元素构成; 默认效果是 [0, 0.5, 1].测试效果图:测试代码:u... 阅读全文
posted @ 2009-12-14 21:35 万一 阅读(2013) 评论(4) 推荐(0) 编辑
GdiPlus[13]: IGPLinearGradientBrush 之多色渐变
摘要:多色渐变需要: 一个 "颜色数组" 和一个 "位置数组" (0-1 之间的位置比例);IGPLinearGradientBrush.InterpolationColors 属性对应一个 IGPColorBlend 对象, 此对象专门用于装载上面两个数组.IGPColorBlend 的 Colors 和 Positions 两个属性分别对应这两个数组.下面的三个示例的结果都是一样的.测试效果图:测试... 阅读全文
posted @ 2009-12-14 19:48 万一 阅读(2497) 评论(5) 推荐(0) 编辑
GdiPlus[12]: IGPLinearGradientBrush 的其他构建方式
摘要:第二种构建方式: TGPLinearGradientBrush.Create(矩形, 颜色1, 颜色2, 渐变模式);第三种构建方式: TGPLinearGradientBrush.Create(矩形, 颜色1, 颜色2, 角度);第三种构建方式中的 "角度"(X 轴, 顺时针)相当于是对渐变模式的自定义, 下面两段测试代码的结果是一样的.另外, 第三种构建方式还有一个默认为 False 的 Bo... 阅读全文
posted @ 2009-12-14 16:51 万一 阅读(1738) 评论(0) 推荐(0) 编辑
GdiPlus[11]: IGPLinearGradientBrush 的第一种构建方式
摘要:第一种构建方式: TGPLinearGradientBrush.Create(点1, 点2, 颜色1, 颜色2);本例测试效果图:为了方便测试, 在 Unit2 单元从 TShape 继承了一个 TMyShape 类, 用来模拟一个可活动的颜色点.其主要功能: 1、可用鼠标左键拖动; 2、可用鼠标右键改变颜色.Unit2 的代码:unit Unit2;interfaceuses Class... 阅读全文
posted @ 2009-12-14 15:43 万一 阅读(1775) 评论(1) 推荐(0) 编辑
GdiPlus[10]: IGPTextureBrush 的构建参数
摘要:IGPTextureBrush 对应的 TGPTextureBrush 类的 Create 方法有很多重载.参数中可有 TGPWrapMode 和 IGPImageAttributes, 但测试中发现 IGPImageAttributes 在这里并不好用.比较有意义是: 可以从建立参数中指定原始图片的范围.测试效果图:uses GdiPlus;procedure TForm1.FormPaint(... 阅读全文
posted @ 2009-12-14 01:49 万一 阅读(1801) 评论(1) 推荐(0) 编辑
GdiPlus[9]: IGPTextureBrush 变换
摘要:TranslateTransform: 平移;ScaleTransform: 放缩;RotateTransform: 旋转;通过 MultiplyTransform 方法和 Transform 属性, 能完成包括上述变换在内的更多变换.ResetTransform 方法是重置变换.这些方法和属性, 在 IGPGraphics 中都有, 在 IGPGraphics 中详细学习更合适些.测试效果图:代... 阅读全文
posted @ 2009-12-14 00:19 万一 阅读(2118) 评论(1) 推荐(0) 编辑
GdiPlus[8]: IGPTextureBrush 之 WrapMode 属性
摘要:示例图片:示例代码:uses GdiPlus;procedure TForm1.FormPaint(Sender: TObject);var Graphics: IGPGraphics; Image: IGPImage; Brush: IGPTextureBrush; Rect: TGPRect;begin ChDir('C:\GdiPlusImg\'); Image := TGPIm... 阅读全文
posted @ 2009-12-13 22:05 万一 阅读(2592) 评论(0) 推荐(0) 编辑
GdiPlus[7]: IGPSolidBrush、IGPHatchBrush
摘要:IGPSolidBrush(实心画刷)只是在 IGPBrush 的基础上增加了一个可读写的 IGPSolidBrush.Color 属性.IGPHatchBrush(阴影画刷)有三个只读属性: 阴影样式、前景色、背景色; 它们也刚好是 Create 方法的参数.Create 也可只有前两个参数, 此时背景色默认为不透明的黑色.下面的例子展示了阴影画刷的所有阴影样式, 效果图如下:unit Unit... 阅读全文
posted @ 2009-12-13 20:51 万一 阅读(2168) 评论(0) 推荐(0) 编辑
GdiPlus[6]: 五种画刷总览
摘要:GDI+ 有五种画刷:实心画刷: IGPSolidBrush阴影画刷: IGPHatchBrush纹理画刷: IGPTextureBrush线性渐变画刷: IGPLinearGradientBrush路径渐变画刷: IGPPathGradientBrush它们分别有对应的实现类:TGPSolidBrushTGPHatchBrushTGPTextureBrushTGPLinearGradientBr... 阅读全文
posted @ 2009-12-13 12:44 万一 阅读(3965) 评论(4) 推荐(0) 编辑
GdiPlus[5]: IGPColors
摘要:IGPColors 是一个泛型数组应用于 TGPColor 的接口, 需要一组颜色时可以用它; 当然用其他方法也不麻烦, 它在整个体系中并不重要.本例把 TGPColor 中的 141 个颜色常量装载到一个 IGPColors, 顺便看看这些颜色.运行效果图:uses GdiPlus;procedure TForm1.FormPaint(Sender: TObject);const Count ... 阅读全文
posted @ 2009-12-12 00:25 万一 阅读(2466) 评论(0) 推荐(0) 编辑
GdiPlus[4]: TGPColor
摘要:TGPColor 是 GdiPlus 的颜色主体, 它虽然是个结构体, 但和类一样, 方法、属性一应俱全.之所以没有把它定义为类或接口, 我觉得主要是它需要和一个整数值进行隐式转换, 这要用到运算符重载(暂时只有结构有).TGPColor 的多种构建方法:var c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11: TGPColor;begin c1 :=... 阅读全文
posted @ 2009-12-12 00:04 万一 阅读(3313) 评论(5) 推荐(0) 编辑
GdiPlus[3]: 关于 GdiPlusHelpers 单元
摘要:本套接口只有两个单元: GdiPlus, GdiPlusHelpers; 主要的是前者, GdiPlusHelpers 的作用是通过 Helper 技术给 VCL 体系中的 TCanvas、TGraphicControl、TCustomControl、TBitmap 类补充添加 ToGPGraphics 方法, 以方便获取 IGPGraphics.在很多时候我们并不需要它, 这时也不需要 uses... 阅读全文
posted @ 2009-12-11 13:55 万一 阅读(3477) 评论(16) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 ··· 11 下一页