【图像处理高级编程】-位图反走样Bitmap.Canvas.Pixels[x,y] Bitmap.ScanLine[y]

这篇博客探讨了如何使用Delphi进行位图反走样处理,主要通过Bitmap.Canvas.Pixels[x,y]和Bitmap.ScanLine[y]实现。文章详细介绍了核心源码,包括AntiAliasPicture和FastAntiAliasPicture两个关键过程,以及如何在不同缩放情况下处理位图。此外,还展示了如何绘制和释放资源,以及处理滚动条事件。" 128658591,16960838,建筑工程管理系统实现与部署(Node.js+Vue),"['前端开发', '后端开发', 'Vue.js', 'Node.js', '项目管理']
摘要由CSDN通过智能技术生成

位图反走样Bitmap.Canvas.Pixels[x,y] Bitmap.ScanLine[y]

提示:这里可以添加技术概要

请添加图片描述

核心源码

`
public
{ Public declarations }
procedure AntiAliasPicture;
procedure FastAntiAliasPicture;
end;

var
AntiAliasForm: TAntiAliasForm;

const
MaxPixelCount = 32768;

type
pRGBArray = ^TRGBArray;
TRGBArray = array[0…MaxPixelCount - 1] of TRGBTriple;

implementation

{$R *.DFM}

var
orig_bmp, big_bmp, out_bmp: TBitmap;

procedure TAntiAliasForm.SeparateColor(color: TColor;
var r, g, b: Integer);
begin
r := Byte(color);
g := Byte(color shr 8);
b := Byte(color shr 16);
end;

procedure TAntiAliasForm.AntiAliasPicture;
var
x, y: integer;
totr, totg, totb, r, g, b: integer;
i, j: integer;
begin
for y := 0 to orig_bmp.Height - 1 do
begin
for x := 0 to orig_bmp.Width - 1 do
begin
totr := 0;
totg := 0;
totb := 0;
for i := 0 to 2 do
begin
for j := 0 to 2 do
begin
SeparateColor(big_bmp.Canvas.Pixels[(x * 3) + j, (y *
3) + i], r, g, b);
totr := totr + r;
totg := totg + g;
totb := totb + b;
end;
end;

        out_bmp.Canvas.Pixels[x, y] := RGB(totr div 9,
            totg div 9,
            totb div 9);
    end;
end;

end;

procedure TAntiAliasForm.FastAntiAliasPicture;
var
x, y, cx, cy: integer;
totr, totg, totb: integer;
Row1, Row2, Row3, DestRow: pRGBArray;
i: integer;
begin

for y := 0 to orig_bmp.Height - 1 do
begin
    cy := y * 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

大龙软件研发

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值