画渐变函数
来源:互联网 发布:淘宝店铺首页怎么全屏 编辑:程序博客网 时间:2024/05/01 08:21
代码
procedure ColorFul(_Sender:TCanvas;_C1,_C2:TColor;_Width,_Height:Integer;_Mode:Integer);
var i:Integer;Rct:TRect;R1,G1,B1,R2,G2,B2,R3,G3,B3:Byte;
begin
with TCanvas(_Sender) do begin
R1:=Byte(_C1);
G1:=Byte(_C1 shr 8);
B1:=Byte(_C1 shr 16);
R2:=Byte(_C2);
G2:=Byte(_C2 shr 8);
B2:=Byte(_C2 shr 16);
case _Mode of
1:begin
for i:=0 to _Width do begin
if R1>R2 then R3:=R1-MulDiv(i,R1-R2,_Width) else R3:=R1+MulDiv(i,R2-R1,_Width);
if G1>G2 then G3:=G1-MulDiv(i,G1-G2,_Width) else G3:=G1+MulDiv(i,G2-G1,_Width);
if B1>B2 then B3:=B1-MulDiv(i,B1-B2,_Width) else B3:=B1+MulDiv(i,B2-B1,_Width);
Brush.Color:=RGB(R3,G3,B3);
Rct:=Rect(i,0,i+1,_Height);
FillRect(Rct);
end;
end;
2:begin
for i:=0 to _Height do begin
if R1>R2 then R3:=R1-MulDiv(i,R1-R2,_Height) else R3:=R1+MulDiv(i,R2-R1,_Height);
if G1>G2 then G3:=G1-MulDiv(i,G1-G2,_Height) else G3:=G1+MulDiv(i,G2-G1,_Height);
if B1>B2 then B3:=B1-MulDiv(i,B1-B2,_Height) else B3:=B1+MulDiv(i,B2-B1,_Height);
Brush.Color:=RGB(R3,G3,B3);
Rct:=Rect(0,i,_Width,i+1);
FillRect(Rct);
end;
end;
end;
SetBkMode(Handle,Windows.TRANSPARENT);
end;
end;
用法
procedure TForm1.FormPaint(Sender: TObject);
begin
ColorFul(Self.Canvas,clSkyBlue,clWhite,Self.Width,Self.Height,2);
//1是横着,2是竖着
end;
- 画渐变函数
- 绘制颜色渐变矩形函数
- 渐变画刷示例
- opencv 画渐变色
- flex画渐变圆
- GDI+ 画渐变色环
- 画渐变的柱状图
- 渐变
- 渐变
- 渐变
- 渐变
- 渐变
- 渐变
- 渐变
- 渐变
- 渐变
- 渐变
- 渐变
- 使用rman复制数据库
- How to embed a True Type font( 转载 )
- 非COM环境下的接口编程--问题,技巧,应用
- vb入门教程-第一章HELLO WORLD
- 使用一个入侵测系统+主动防火墙-->Snort+Guardian (ZT)
- 画渐变函数
- 第五次培训
- 如何遍历DataSet
- [原创]一个可以自动创建多级目录的函数
- 为JEdit设置墙纸(add wallpaper for jedit)
- GNU make 指南(转自www.lisoleg.net)
- 我也是一名"博客"了
- 你会用Google?估计你会用一半就不错了![转自365key]
- 宿舍上网啦