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。