GdiPlus[58]: 图像(十) IGPMetafile 特有的属性与方法
摘要:这包括://方法IGPMetafile.GetMetafileHeader; { 获取 Metafile 的 MetafileHeader }IGPMetafile.GetHEnhMetafile; { 获取增强型 Metafile 的 Windows 句柄 }IGPMetafile.PlayRecord(); { 播放单个图元文件记录 }//属性IGPMetafile.DownLevelRast...
阅读全文
posted @
2009-12-31 21:48
万一
阅读(3323)
推荐(0)
GdiPlus[57]: 图像(九) IGPBitmap 特有的属性与方法
摘要:这包括://属性IGPBitmap.Pixels; { 获取或设置指定像素的颜色 }//方法IGPBitmap.SetResolution(); { 设置分辨率 }IGPBitmap.GetHBitmap(); { 创建 GDI 格式的 Bitmap 并返回句柄 }IGPBitmap.GetHIcon; { 创建 Icon 文件并返回句柄 }IGPBitmap.LockBits(); { 锁定对象...
阅读全文
posted @
2009-12-31 11:39
万一
阅读(6159)
推荐(0)
GdiPlus[56]: 图像(八) 关于多帧图像
摘要:TIFF 与 GIF 是多帧图像; GIF 还可以关联时间形成动画.在编码或解码多帧图像的过程中会用到下面两个常数值:FrameDimensionPage (用于 TIFF)FrameDimensionTime (用于 GIF)GDI+1.0 不能编码 GIF 动画; 但都能解析.解析 TIFF 多页图像的例子:uses GdiPlus;procedure TForm1.FormDblClick(...
阅读全文
posted @
2009-12-30 15:51
万一
阅读(5820)
推荐(0)
GdiPlus[55]: 图像(七) 图像编码的参数
摘要:通过 IGPImage.GetEncoderParameterList 可以获取指定编码格式的参数列表;通过此列表可以遍历出各参数的指针: PGPNativeEncoderParameter(TGPNativeEncoderParameter 的指针);TGPNativeEncoderParameter 是一个结构体:TGPNativeEncoderParameter = record Guid...
阅读全文
posted @
2009-12-29 17:25
万一
阅读(6019)
推荐(1)
GdiPlus[54]: 图像(六) 图像解码与编码
摘要:GDI+ 能够打开某种格式的图像, 就会有对应的解码器; 能够保存为某种格式, 也会有对应的编码器.下面程序通过 IGPImageCodecInfoArray 与 IGPImageCodecInfo 获取了 GDI+ 能够编码与解码的格式:uses GdiPlus;procedure TForm1.Button1Click(Sender: TObject);var Encoders, Decod...
阅读全文
posted @
2009-12-29 16:05
万一
阅读(3709)
推荐(0)
GdiPlus[53]: 图像(五) 图像的属性(图像元数据)
摘要:相关方法和属性:IGPImage.GetPropertyItem(); { 获取属性项 }IGPImage.SetPropertyItem(); { 设置属性项 }IGPImage.RemovePropertyItem(); { 删除属性项 }IGPImage.PropertyIdList; { 获取图像属性 ID 数组 }IGPImage.PropertyItems; { 获取图像属性集合 }...
阅读全文
posted @
2009-12-29 12:03
万一
阅读(4149)
推荐(1)
GdiPlus[52]: 图像(四) 图像信息
摘要:相关属性、方法、函数:IGPImage.Width; { 宽度(单位是像素) }IGPImage.Height; { 高度(单位是像素) }IGPImage.HorizontalResolution; { 获取水平分辨率(以"像素/英寸"为单位) }IGPImage.VerticalResolution; { 获取垂直分辨率(以"像素/英寸"为单位) }IGPImage.RawFormat; { ...
阅读全文
posted @
2009-12-28 21:14
万一
阅读(4212)
推荐(0)
GdiPlus[51]: 图像(三) 关于呈现
摘要:相关方法:IGPGraphics.DrawImage();IGPImage.GetThumbnailImage();IGPImage.RotateFlip();用 DrawImage 呈现图像时, 是否指定 Width 和 Height 的区别://如果图像的分辨率与 Graphics 的分辨率不一致, 则指定 Width、Height 是有必要的.uses GdiPlus;procedure T...
阅读全文
posted @
2009-12-28 19:57
万一
阅读(4487)
推荐(0)
GdiPlus[50]: 图像(二) 关于 Create
摘要:IGPImage 类提供的 Create 方法:Image := TGPImage.Create(文件(或流), Boolean);//其中的布尔值默认 False; 如果为 True 则使用文件(或流)中的已嵌入颜色管理信息来进行颜色校正.{ 示例1: 从文件建立 }var Graphics: IGPGraphics; Image: IGPImage;begin Image := TGPI...
阅读全文
posted @
2009-12-28 12:21
万一
阅读(4396)
推荐(0)
创建大窗口
摘要:procedure TForm1.FormCreate(Sender: TObject);begin SetWindowLong( Handle, GWL_STYLE, not (WS_THICKFRAME) and GetWindowLong(Handle, GWL_STYLE) or Integer(WS_POPUP) ); SetWindowPos(Handle, 0, 0, 0, 1...
阅读全文
posted @
2009-12-27 14:54
万一
阅读(2269)
推荐(0)
GdiPlus[49]: 图像(一) 概览
摘要:三个主要的图像相关接口是: IGPImage、IGPBitmap、IGPMetafile.IGPBitmap、IGPMetafile 都是从 IGPImage 继承, 分别用于处理位图和图元文件.还有从 IGPBitmap 继承的 IGPCachedBitmap 用于快速呈现图像.IGPImage 的方法与属性://方法IGPImage.Clone; { 克隆 }IGPImage.Save(); ...
阅读全文
posted @
2009-12-25 22:52
万一
阅读(4656)
推荐(0)
GdiPlus[48]: IGPMatrix 矩阵(三) 关于矩阵的旋转
摘要:矩阵旋转一个角度, 会关联到 M11、M12、M21、M22 四个数据, 计算公式如下:┏ ┓┃ cos(r) sin(r) 0┃┃-sin(r) cos(r) 0┃┃ DX DY 1┃┗ ┛//其中的 r 不是角度是弧度; 弧度的计算方法是: r = 角度 * Pi / 180.下面两段程序对上面的公式进行了对比测试://var m: IGPMatrix;begin m := TGP...
阅读全文
posted @
2009-12-25 11:29
万一
阅读(3418)
推荐(0)
GdiPlus[47]: IGPMatrix 矩阵(二)
摘要:IGPMatrix 的属性与方法://方法IGPMatrix.Reset; { 重置 Matrix 得到单位矩阵(斜对角线是1其他是0) }IGPMatrix.Translate(); { 平移 }IGPMatrix.Scale(); { 放缩 }IGPMatrix.Rotate(); { 旋转(沿(0,0)点, 顺时针) }IGPMatrix.RotateAt(); { 沿指定点, 顺时针旋转 ...
阅读全文
posted @
2009-12-24 22:46
万一
阅读(3818)
推荐(1)
GdiPlus[46]: IGPMatrix 矩阵(一)
摘要:认识矩阵, 譬如这是一个 2*3 (2 行 3 列) 的矩阵:┏ ┓┃3 1 4┃┃2 5 0┃┗ ┛矩阵相加的例子:┏ ┓ ┏ ┓ ┏ ┓┃1 0┃ ┃2 4┃ ┃3 4┃┃0 2┃ + ┃1 5┃ = ┃1 7┃┃1 3┃ ┃0 6┃ ┃1 9┃┗ ┛ ┗ ┛ ┗ ┛在 GDI+ 中应用的矩阵运算是 "相乘".矩阵相乘有个前提: 就是第一个矩阵的 "列数" 要和第二个...
阅读全文
posted @
2009-12-24 17:47
万一
阅读(2899)
推荐(0)
GdiPlus[45]: IGPGraphics (四) 关于呈现质量与合成模式
摘要:相关内容有:IGPGraphics.SmoothingMode; { 绘图质量 }IGPGraphics.InterpolationMode; { 插补模式 }IGPGraphics.CompositingMode; { 前景色与背景色的合成混合模式 }IGPGraphics.CompositingQuality; { 图像合成质量 }IGPGraphics.PixelOffsetMode; { ...
阅读全文
posted @
2009-12-22 22:53
万一
阅读(4439)
推荐(0)
GdiPlus[44]: IGPGraphics (三) 关于文本绘制续 - IGPStringFormat
摘要:IGPStringFormat 的方法和属性://方法:IGPStringFormat.GetTabStops(); { 获取制表位 }IGPStringFormat.SetTabStops(); { 设置制表位 }IGPStringFormat.SetDigitSubstitution(); { 指定用本地数字替换西方数字时使用的语言和方法 }IGPStringFormat.SetMeasura...
阅读全文
posted @
2009-12-22 18:04
万一
阅读(4326)
推荐(0)
GdiPlus[43]: IGPGraphics (二) 关于文本绘制
摘要:IGPGraphics 中绘制文本相关的方法和属性:IGPGraphics.DrawString(); { 绘制文本 }IGPGraphics.MeasureString(); { 获取指定格式的字符串需要的矩形 }IGPGraphics.MeasureCharacterRanges(); { 获取指定字符所在的区域 }IGPGraphics.DrawDriverString(); { 绘制可指定...
阅读全文
posted @
2009-12-22 13:54
万一
阅读(8784)
推荐(0)
GdiPlus[42]: IGPGraphics (一)
摘要://方法IGPGraphics.DrawLine(); { 画线 }IGPGraphics.DrawLines(); { 画一组线 }IGPGraphics.DrawArc(); { 画弧线 }IGPGraphics.DrawBezier(); { 画 Bezier 线 }IGPGraphics.DrawBeziers(); { 画一组 Bezier 线 }IGPGraphics.DrawRect...
阅读全文
posted @
2009-12-21 19:49
万一
阅读(6206)
推荐(1)
GdiPlus[41]: IGPRegion 区域
摘要:// 区域建立:TGPRegion.Create(); { 参数可以是矩形、路径、HRGN、区域数据, 或无参}TGPRegion.FromHRGN(); { 从 HRGN 初始化 }// 区域运算(矩形、路径、或另一个区域):IGPRegion.Intersect(); { 交集 }IGPRegion.Union(); { 并集 }IGPRegion.Exclude(); { 减去 }IGPRe...
阅读全文
posted @
2009-12-21 12:00
万一
阅读(3322)
推荐(0)
GdiPlus[40]: 不该忽略的一些基础结构
摘要:这些基础结构有: TGPSize、TGPSizeF、TGPPoint、TGPPointF、TGPRect、TGPRectF.它们自身提供了一些方便的功能, 如果早看看的话前面的很多代码能更精简些.TGPPoint 或 TGPPointF 方便的功能:1、因为已经重载了 Add、Subtract 运算符, 所以 "点" 可以 + 或 -;2、可使用 Equals 函数对比是否一致.var Pt1,...
阅读全文
posted @
2009-12-20 21:57
万一
阅读(2436)
推荐(1)
GdiPlus[39]: IGPGraphicsPath (六) - 路径的辅助工具 IGPGraphicsPathIterator
摘要:IGPGraphicsPathIterator 能遍历路径中的子路径和路径标记.IGPGraphicsPathIterator.Count; { 点总数 }IGPGraphicsPathIterator.SubpathCount; { 子路径数 }IGPGraphicsPathIterator.HasCurve; { 是否包含曲线 }IGPGraphicsPathIterator.Rewind; ...
阅读全文
posted @
2009-12-19 22:42
万一
阅读(2546)
推荐(0)
X 的 Y 次方
摘要:var x,y,z: Real;begin x := 2; y := 3; { 使用 Math.Power } z := Math.Power(x, y); ShowMessage(FloatToStr(z)); //8 { 不想 uses Math, 就用 System.Exp、System.Ln } z := Exp(Ln(x) * y); ShowMessage(Float...
阅读全文
posted @
2009-12-19 09:54
万一
阅读(5249)
推荐(0)
GdiPlus[38]: IGPGraphicsPath (五) 路径标记
摘要:IGPGraphicsPath.SetMarker //建立一个标记IGPGraphicsPath.ClearMarkers //取消全部标记在路径中每建立一个图形都可以同时做个 Marker,真正使用这些个标记时, 主要通过 IGPGraphicsPathIterator 的 NextMarker() 方法.下面是建立并遍历 Marker 的演示代码, 暂未使用 IGPGraphicsPathI...
阅读全文
posted @
2009-12-18 21:45
万一
阅读(2280)
推荐(0)
详解 EnumWindows 与 EnumWindowsProc - 回复 "SplendourChiang" 的问题
摘要:问题来源: http://www.cnblogs.com/del/archive/2009/10/16/1584488.html#1727205// EnumWindows 的功能是遍历所有顶层窗口function EnumWindows( lpEnumFunc: TFNWndEnumProc; {回调函数指针} lParam: LPARAM {给回调函数的参数, 它对应回调函数的第二个参数}...
阅读全文
posted @
2009-12-18 13:22
万一
阅读(14407)
推荐(0)
GdiPlus[37]: IGPGraphicsPath (四) 路径变换
摘要:IGPGraphicsPath.Flatten(); //把路径中的曲线转换为近似直线段(路径中只有 Bezier 线和直线).IGPGraphicsPath.Outline(); //同 Flatten();IGPGraphicsPath.Warp(); //四边形或平行四边形扭曲. IGPGraphicsPath.Widen(); //把轮廓转换为范围.IGPGraphicsPath.Tran...
阅读全文
posted @
2009-12-17 20:46
万一
阅读(3657)
推荐(1)
GdiPlus[36]: IGPGraphicsPath (三) 路径中的数据
摘要:IGPGraphicsPath.PointCount; // 点总数IGPGraphicsPath.PathPoints; // 点数组, 浮点型IGPGraphicsPath.PathPointsI; // 点数组, 整型IGPGraphicsPath.PathTypes; // 点类型数组IGPGraphicsPath.PathData; // 点与点类型数据, IGPPathData 类型...
阅读全文
posted @
2009-12-17 16:40
万一
阅读(3008)
推荐(0)
GdiPlus[35]: IGPGraphicsPath (二) 命中测试
摘要:IGPGraphicsPath.IsVisible //指定点是否在路径内IGPGraphicsPath.IsOutlineVisible //指定点是否在路径轮廓上本例测试图:本例代码:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dial...
阅读全文
posted @
2009-12-17 14:21
万一
阅读(3108)
推荐(0)
GdiPlus[34]: IGPGraphicsPath (一)
摘要:路径是一组图形命令, 它能容纳所有基本图形和文本、子路径:IGPGraphicsPath.AddLine();IGPGraphicsPath.AddLines();IGPGraphicsPath.AddArc();IGPGraphicsPath.AddBezier();IGPGraphicsPath.AddBeziers();IGPGraphicsPath.AddCurve();IGPGraphi...
阅读全文
posted @
2009-12-17 13:53
万一
阅读(3951)
推荐(0)
GdiPlus[33]: 基本绘图与填充命令
摘要:DrawLine();DrawLines();DrawArc();DrawBezier();DrawBeziers();DrawRectangle();DrawRectangles();DrawEllipse();DrawPie();DrawPolygon();DrawCurve();DrawClosedCurve();FillRectangle();FillRectangles();FillPo...
阅读全文
posted @
2009-12-16 21:31
万一
阅读(7187)
推荐(0)
DebugHook 与 ReportMemoryLeaksOnShutdown
摘要:DebugHook 与 ReportMemoryLeaksOnShutdown 都是 System 下的变量.DebugHook: 程序中母体中运行时, 此值是 1; 独立运行时, 它是 0.在程序的任何地方加上一句 ReportMemoryLeaksOnShutdown := True; 这样程序在关闭时可检测是否有内存泄漏.如果这样使用: ReportMemoryLeaksOnShutdown...
阅读全文
posted @
2009-12-16 15:46
万一
阅读(5828)
推荐(0)
GdiPlus[32]: IGPPen: LineJoin、MiterLimit
摘要:LineJoin 测试效果图:LineJoin 测试代码:uses GdiPlus;procedure TForm1.FormPaint(Sender: TObject);const Pts: array[0..2] of TGPPoint = ((X:90;Y:80), (X:240;Y:30), (X:240;Y:80));var Graphics: IGPGraphics; Pen: ...
阅读全文
posted @
2009-12-16 15:35
万一
阅读(2131)
推荐(0)
GdiPlus[31]: IGPPen: 自定义线帽
摘要:自定义线帽可以通过两个接口: IGPCustomLineCap、IGPAdjustableArrowCap.后者继承与前者, 专用于修改箭头线帽.IGPAdjustableArrowCap 测试效果图:IGPAdjustableArrowCap 测试代码:uses GdiPlus;procedure TForm1.FormPaint(Sender: TObject);var Graphics: ...
阅读全文
posted @
2009-12-16 15:14
万一
阅读(2368)
推荐(0)
GdiPlus[30]: IGPPen: 线帽
摘要:StartCap 和 EndCap 属性分别用来读写两段的线帽, 测试图:StartCap 和 EndCap 测试代码:uses GdiPlus;procedure TForm1.FormPaint(Sender: TObject);const CapArr: array[0..8] of Byte = (0, 1, 2, 3, $10, $11, $12, $13, $14);var Gra...
阅读全文
posted @
2009-12-16 12:21
万一
阅读(2314)
推荐(0)
GdiPlus[29]: IGPPen: 虚线样式
摘要:通过画笔的 DashStyle 属性可设置或读取虚线样式.通过 SetDashPattern 方法或 DashPattern 属性可自定义虚线样式.通过 DashPattern 属性还可以读出已有样式定义时的数组.自定义虚线样式样式时, 需要元素数是双数的数组数组, 元素值依次表示实线与空白的长度.通过 DashOffset 属性可设置虚线偏移.系统提供的虚线样式效果:自定义的两种样式效果:虚线偏...
阅读全文
posted @
2009-12-16 00:56
万一
阅读(3016)
推荐(0)
GdiPlus[28]: IGPPen: 建立复合画笔
摘要:设置画笔的 CompoundArray 属性可得到复合画笔.它对应的类型是 IGPCompoundArray (IGPCompoundArray = IGPArray<Single).如果复合画笔是 X 条线, 则数组需要 2*X 个元素; 元素从外向里分别表示线的起点和终点的比例值.uses GdiPlus;procedure TForm1.FormPaint(Sender: TObje...
阅读全文
posted @
2009-12-16 00:22
万一
阅读(1901)
推荐(0)
GdiPlus[27]: IGPPen: Alignment (画笔对齐)
摘要:uses GdiPlus;procedure TForm1.FormPaint(Sender: TObject);var Graphics: IGPGraphics; BlackPen, GreenPen: IGPPen; Rect: TGPRect;begin Rect.Initialize(20, 20, 80, 80); Graphics := TGPGraphics.Create...
阅读全文
posted @
2009-12-16 00:00
万一
阅读(1609)
推荐(0)
GdiPlus[26]: IGPPen: 用画刷建立画笔
摘要:Color 是画笔的基本属性, 比较有意思的是可以通过画刷来建立画笔.五种画刷都可以, 但使用实心画刷就没有意义了; 建立后, 通过画笔的 PenType 能知道是通过什么画刷建立的; 也能通过 Brush 属性获取回画刷.下面的例子只是测试了通过阴影画刷建立画笔:uses GdiPlus, GdiPlusHelpers;procedure TForm1.FormPaint(Sender: TOb...
阅读全文
posted @
2009-12-15 23:48
万一
阅读(2165)
推荐(0)
可爱的 CreateMessageDialog
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Button1: TButton; Button2: TButton; Button3: TButton...
阅读全文
posted @
2009-12-15 18:58
万一
阅读(3813)
推荐(0)
GdiPlus[25]: IGPInstalledFontCollection: 获取已安装的字体列表
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) ListBox1: TListBox; Button1: TButton; Button2: TButt...
阅读全文
posted @
2009-12-15 16:41
万一
阅读(2081)
推荐(0)
GdiPlus[24]: IGPPrivateFontCollection: 分别从文件和内存加载字体
摘要:IGPPrivateFontCollection.AddFontFile: 从文件加载字体;IGPPrivateFontCollection.AddMemoryFont: 从内存加载字体AddFontFile 测试:uses GdiPlus;function GetFontsDirectory: string;var Len: Integer; buf: array[0..MAX_PATH-1...
阅读全文
posted @
2009-12-15 16:34
万一
阅读(2966)
推荐(0)
GdiPlus[23]: IGPFontFamily
摘要:IGPFontFamily 的基本使用:uses GdiPlus, GdiPlusHelpers;procedure TForm1.FormPaint(Sender: TObject);const Pt: TGPPointF = (X:10; Y:10);var FontFamily: IGPFontFamily; Font: IGPFont; Brush: IGPSolidBrush;b...
阅读全文
posted @
2009-12-15 16:17
万一
阅读(2871)
推荐(0)
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
万一
阅读(2457)
推荐(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
万一
阅读(1752)
推荐(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
万一
阅读(1762)
推荐(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
万一
阅读(1651)
推荐(0)
GdiPlus[18]: IGPPathGradientBrush 之 CenterColor、SurroundColors
摘要:最简单的 IGPPathGradientBrush 就是有一个中心颜色和一组周边颜色的渐变.这里牵扯到 CenterColor、SurroundColors 属性和 SetSurroundColors 方法.测试一效果图:测试一代码://使用 SetSurroundColors 方法设置周边色组:uses GdiPlus, GdiPlusHelpers;procedure TForm1.FormP...
阅读全文
posted @
2009-12-15 11:17
万一
阅读(2080)
推荐(0)
ExtCtrls.Frame3D
摘要:uses ExtCtrls;procedure TForm1.FormPaint(Sender: TObject);var R1, R2: TRect;begin R1 := Rect(10, 10, 150, 50); Frame3D(Canvas, R1, clBlack, clSilver, 1); R2 := Bounds(10, 80, 140, 40); Frame3D(Ca...
阅读全文
posted @
2009-12-15 10:08
万一
阅读(2300)
推荐(0)
GdiPlus[17]: IGPLinearGradientBrush 的其他方法和属性
摘要:LinearColors //属性; 获取或设置渐变的起始色和结束色.Rectangle //属性; 获取定义渐变的起始点和终结点的矩形区域.WrapMode //属性; 获取或设置 WrapMode 枚举, 指定画刷环绕模式; 感觉它没有存在的必要.TranslateTransform //方法; 平移.ScaleTransform //方法; 放缩.RotateTransform //方法; ...
阅读全文
posted @
2009-12-14 22:53
万一
阅读(1966)
推荐(0)
GdiPlus[16]: IGPLinearGradientBrush 之 SetBlendBellShape、SetBlendTriangularShape
摘要:SetBlendBellShape 方法: 创建基于钟形曲线的渐变过渡过程;SetBlendTriangularShape 方法: 创建一个从中心色向两端单个颜色线性过渡的线性渐变过程.两个方法好像区别不大.SetBlendBellShape 测试效果图:SetBlendTriangularShape 测试效果图:SetBlendBellShape 测试代码:uses GdiPlus;proced...
阅读全文
posted @
2009-12-14 22:19
万一
阅读(2129)
推荐(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
万一
阅读(1678)
推荐(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
万一
阅读(2035)
推荐(0)
GdiPlus[13]: IGPLinearGradientBrush 之多色渐变
摘要:多色渐变需要: 一个 "颜色数组" 和一个 "位置数组" (0-1 之间的位置比例);IGPLinearGradientBrush.InterpolationColors 属性对应一个 IGPColorBlend 对象, 此对象专门用于装载上面两个数组.IGPColorBlend 的 Colors 和 Positions 两个属性分别对应这两个数组.下面的三个示例的结果都是一样的.测试效果图:测试...
阅读全文
posted @
2009-12-14 19:48
万一
阅读(2534)
推荐(0)
GdiPlus[12]: IGPLinearGradientBrush 的其他构建方式
摘要:第二种构建方式: TGPLinearGradientBrush.Create(矩形, 颜色1, 颜色2, 渐变模式);第三种构建方式: TGPLinearGradientBrush.Create(矩形, 颜色1, 颜色2, 角度);第三种构建方式中的 "角度"(X 轴, 顺时针)相当于是对渐变模式的自定义, 下面两段测试代码的结果是一样的.另外, 第三种构建方式还有一个默认为 False 的 Bo...
阅读全文
posted @
2009-12-14 16:51
万一
阅读(1757)
推荐(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
万一
阅读(1810)
推荐(0)
GdiPlus[10]: IGPTextureBrush 的构建参数
摘要:IGPTextureBrush 对应的 TGPTextureBrush 类的 Create 方法有很多重载.参数中可有 TGPWrapMode 和 IGPImageAttributes, 但测试中发现 IGPImageAttributes 在这里并不好用.比较有意义是: 可以从建立参数中指定原始图片的范围.测试效果图:uses GdiPlus;procedure TForm1.FormPaint(...
阅读全文
posted @
2009-12-14 01:49
万一
阅读(1824)
推荐(0)
GdiPlus[9]: IGPTextureBrush 变换
摘要:TranslateTransform: 平移;ScaleTransform: 放缩;RotateTransform: 旋转;通过 MultiplyTransform 方法和 Transform 属性, 能完成包括上述变换在内的更多变换.ResetTransform 方法是重置变换.这些方法和属性, 在 IGPGraphics 中都有, 在 IGPGraphics 中详细学习更合适些.测试效果图:代...
阅读全文
posted @
2009-12-14 00:19
万一
阅读(2161)
推荐(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
万一
阅读(2623)
推荐(0)
GdiPlus[7]: IGPSolidBrush、IGPHatchBrush
摘要:IGPSolidBrush(实心画刷)只是在 IGPBrush 的基础上增加了一个可读写的 IGPSolidBrush.Color 属性.IGPHatchBrush(阴影画刷)有三个只读属性: 阴影样式、前景色、背景色; 它们也刚好是 Create 方法的参数.Create 也可只有前两个参数, 此时背景色默认为不透明的黑色.下面的例子展示了阴影画刷的所有阴影样式, 效果图如下:unit Unit...
阅读全文
posted @
2009-12-13 20:51
万一
阅读(2204)
推荐(0)
GdiPlus[6]: 五种画刷总览
摘要:GDI+ 有五种画刷:实心画刷: IGPSolidBrush阴影画刷: IGPHatchBrush纹理画刷: IGPTextureBrush线性渐变画刷: IGPLinearGradientBrush路径渐变画刷: IGPPathGradientBrush它们分别有对应的实现类:TGPSolidBrushTGPHatchBrushTGPTextureBrushTGPLinearGradientBr...
阅读全文
posted @
2009-12-13 12:44
万一
阅读(4068)
推荐(0)
GdiPlus[5]: IGPColors
摘要:IGPColors 是一个泛型数组应用于 TGPColor 的接口, 需要一组颜色时可以用它; 当然用其他方法也不麻烦, 它在整个体系中并不重要.本例把 TGPColor 中的 141 个颜色常量装载到一个 IGPColors, 顺便看看这些颜色.运行效果图:uses GdiPlus;procedure TForm1.FormPaint(Sender: TObject);const Count ...
阅读全文
posted @
2009-12-12 00:25
万一
阅读(2527)
推荐(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
万一
阅读(3370)
推荐(0)
GdiPlus[3]: 关于 GdiPlusHelpers 单元
摘要:本套接口只有两个单元: GdiPlus, GdiPlusHelpers; 主要的是前者, GdiPlusHelpers 的作用是通过 Helper 技术给 VCL 体系中的 TCanvas、TGraphicControl、TCustomControl、TBitmap 类补充添加 ToGPGraphics 方法, 以方便获取 IGPGraphics.在很多时候我们并不需要它, 这时也不需要 uses...
阅读全文
posted @
2009-12-11 13:55
万一
阅读(3552)
推荐(0)
GdiPlus[2]: 获取绘图表面(Graphics)
摘要:绘图表面(Graphics, 这在 VCL 体系中叫 Canvas), 在 GdiPlus 中有四种获取方法:1、通过窗口句柄获取;2、通过窗口的 Canvas.Handle 获取;3、通过 GdiPlus 利用 Helper 技术给部分 VCL 对象添加的 ToGPGraphics 方法获取;4、通过图像对象获取.本例效果图:unit Unit1;interfaceuses Windows, ...
阅读全文
posted @
2009-12-11 13:25
万一
阅读(5351)
推荐(0)
GdiPlus[1]: 一个给 Delphi 提供的、新的 GDI+ 接口, 很好用!
摘要:尽管 GDI+ 已经有近 10 年的历史(随 Win2000 推出), 尽管 DirectX 如日中天, 但在 Windows 7 之前的版本下进行 2D 绘图还是离不开它, 微软也没有停止对它的升级, 随 Vista 的 GDI 版本是 1.1(6.0.xxxx.x), 新增了 Blur 等功能.不过 Win7 已经有了 Direct D2D1, Delphi 也同步有了 Direct2D 支持...
阅读全文
posted @
2009-12-11 11:54
万一
阅读(18289)
推荐(1)
System.Assert 断言
摘要:可用 {$ASSERTIONS OFF/ON} 决定是否启用 Assert; 默认只用于 Debug 版本.
阅读全文
posted @
2009-12-10 11:55
万一
阅读(4966)
推荐(0)
打开"我的电脑"等特殊文件夹
摘要:uses ShellAPI;//打开 C 盘procedure TForm1.Button1Click(Sender: TObject);begin ShellExecute(Handle, 'open', 'Explorer.exe', 'C:\', nil, SW_SHOWNORMAL);end;//打开 我的电脑procedure TForm1.Button2Click(Sender: T...
阅读全文
posted @
2009-12-09 13:19
万一
阅读(3453)
推荐(1)
{$POINTERMATH ON} 方便指针操作的编译指令
摘要:编译指令 PointerMath 默认 off; 打开后, 可以像数组一样地读写指针中的系列数据, 非常方便!//测试整数指针procedure TForm1.Button1Click(Sender: TObject);var p: PInteger; i: Integer;begin{$POINTERMATH ON} //写入 p := GetMemory(SizeOf(Integer)...
阅读全文
posted @
2009-12-07 17:51
万一
阅读(4550)
推荐(0)
SameText
摘要:var s1,s2: string; b1,b2: Boolean;begin s1 := 'C:\Temp'; s2 := 'c:\temp'; b1 := SameText(s1, s2); //True b2 := s1 = s2; //False ShowMessage(BoolToStr(b1,True) + ' - ' + BoolToStr(b2,True));end;
阅读全文
posted @
2009-12-07 15:39
万一
阅读(5425)
推荐(0)