delphi – 如何直接在FMX2中访问TBitmap像素(TBitmap.ScanLine替
发布时间:2020-12-15 09:36:42 所属栏目:大数据 来源:网络整理
导读:FMX.Types.TBitmap 类在FMX(FireMonkey)中具有 ScanLine 属性,但似乎此属性已被删除,并且在FMX2(FireMonkey FM2)中丢失. 有没有解决方法?我们如何直接在FMX2中访问TBitmap内容? 解决方法 对于直接访问,您应该使用 Map 方法.该文档包含许多示例,例如 FMX.Al
FMX.Types.TBitmap类在FMX(FireMonkey)中具有
ScanLine属性,但似乎此属性已被删除,并且在FMX2(FireMonkey FM2)中丢失.
有没有解决方法?我们如何直接在FMX2中访问TBitmap内容? 解决方法
对于直接访问,您应该使用
Map方法.该文档包含许多示例,例如
FMX.AlphaColorToScanline:
function TForm1.TestAlphaColorToScanline(ABitmap: TBitmap;
start,count: integer): TBitmap;
var
bitdata1,bitdata2: TBitmapData;
begin
Result := TBitmap.Create(Round(ABitmap.Width),Round(count));
if (ABitmap.Map(TMapAccess.maRead,bitdata1) and
Result.Map(TMapAccess.maWrite,bitdata2)) then
begin
try
AlphaColorToScanline(@PAlphaColorArray(bitdata1.Data)
[start * (bitdata1.Pitch div GetPixelFormatBytes(ABitmap.PixelFormat))],bitdata2.Data,Round(Result.Height * Result.Width),ABitmap.PixelFormat);
finally
ABitmap.Unmap(bitdata1);
Result.Unmap(bitdata2);
end;
end;
end;
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
