DelphiBlend2D
1.0.0
Blend2D是高性能2D矢量图形引擎。它是从头开始写的,目的是实现2D渲染的最佳基于软件的加速度。 Blend2D提供了高质量的分析射击器,一种使用曲线偏移而不是变平的新引擎,以及使用JIT编译在运行时生成最佳2D管道的2D管道生成器。
Delphiblend2D为Delphi开发人员打开了OP Blend2D。它为Blend2D C API提供标头翻译,以及面向对象的框架,以使其易于使用。
请注意,Blend2D(因此Delphiblend2d)仍在beta中。 API和框架可能会发生变化。
Delphiblend2D当前支持Windows(32和64位)。计划对MacOS,iOS和Android的支持为将来的版本提供。
当前使用的Blend2D库尚未完全优化。尽管性能已经出色,但是一旦Blend2D脱离了Beta,期望表现更好。
Delphiblend2d OOP框架尽可能接近Blend2d C ++ API。它使用接口进行自动资源管理。下图取自blGettingStarted05样本项目。
procedure Run ;
var
Image: IBLImage;
Context: IBLContext;
Radial, Linear: IBLGradient;
Codec: IBLImageCodec;
begin
Image := TBLImage.Create( 480 , 480 );
Context := TBLContext.Create(Image);
Context.CompOp := TBLCompOp.SrcCopy;
Context.FillAll;
{ First shape filled by a radial gradient. }
Radial := TBLGradient.Create(BLRadialGradientValues( 180 , 180 , 180 , 180 , 180 ));
Radial.AddStop( 0.0 , BLRgba32($FFFFFFFF));
Radial.AddStop( 1.0 , BLRgba32($FFFF6F3F));
Context.CompOp := TBLCompOp.SrcOver;
Context.SetFillStyle(Radial);
Context.FillCircle( 180 , 180 , 160 );
{ Second shape filled by a linear gradient. }
Linear := TBLGradient.Create(BLLinearGradientValues( 195 , 195 , 470 , 470 ));
Linear.AddStop( 0.0 , BLRgba32($FFFFFFFF));
Linear.AddStop( 1.0 , BLRgba32($FF3F9FFF));
Context.CompOp := TBLCompOp.Difference;
Context.SetFillStyle(Linear);
Context.FillRoundRect( 195 , 195 , 270 , 270 , 25 );
Context.Finish;
Codec := TBLImageCodec.Create;
if (Codec.FindByName( ' BMP ' )) then
Image.WriteToFile( ' blGettingStarted05.bmp ' , Codec);
end ;它创建以下输出:

目前可以在Blend2D.pas单元中找到文档作为代码注释。 Blend2D退出Beta后,将提供单独的文档。
由于该框架在可能的情况下与原始的C ++ API匹配,因此您还可以使用原始的Blend2D文档。
delphiblend2d配备了各种示例应用程序,这些应用程序与Blend2d的原始示例应用程序相匹配:
SamplesGettingStarted Directory包含使用Delphiblend2D创建图像并将其保存到.BMP文件的控制台应用程序。这些样品不使用VCL或FireMonKey框架。SamplesFireMonkey目录包含使用FireMonKey框架提供简单UI的样品。这些匹配使用QT框架的原始Blend2D示例。这些应用程序中的大多数允许您在内置的FireMonkey渲染和Blend2D渲染之间切换。当前,这些样品仅在Windows和MacOS上起作用。 未来版本计划的功能包括:
TPaintBox控件。Blend2D和Delphiblend2D均在ZLIB许可下发布。有关详细信息,请参见License.txt。