一张bmp图片,底色为白色,上面有一个椭圆,椭圆内部全为黑色,我求一种算法,结果要在在另一张同样大小的BMP图片的同样位置上,生成一个一模一样的椭圆,但内部为红色的。有几个难点:1 怎样确定椭圆在图片上的相对位置。2 怎样确定椭圆的大小及弧度?这个问题我想了三天了。顶者有分,希望有高手能把代码贴出来一下。谢谢了。
解决方案 »
- 如何实现资源管理器中对文件夹的排序,按时间,按名称等?
- delphi xe 生成的 webservice 在iis7 出错
- 只给DCU文件的控件,如何进行安装
- 急!怎么解决内存增长的问题!
- 关于VF的库死机以后经常被破坏的讨论
- 为什么总是出现这个信息?
- nmhttp控件的问题(急,在线等待)
- 我用ADOtable 和adoconnection 来连接数据库。但在运行时老是提示出错:couldnot convert variant of type(null) into type(string
- DefaultExt(缺省后缀)的字符串是怎样的?
- 初学者的问题1
- [50分初级问题]delphi中new的用法?
- 一个关于qrdbtext的问题?望各位帮帮忙啊?
type
PRGBArray = ^TRGBArray;
TRGBArray = array[0..PixelCountMax-1] of TRGBTriple;
var Bitmap:TBitmap;
p : PRGBArray;
x, y: integer;
c : array of array of TColor;
begin
Bitmap := TBitmap.Create;
try
Bitmap.LoadFromFile('c:\1.bmp');
SetLength(c, Bitmap.Width, Bitmap.Height);
Bitmap.PixelFormat := pf24bit;
for y:=0 to Bitmap.Height-1 do
begin
p := PRGBArray(Bitmap.ScanLine[y]);
for x:=0 to Bitmap.Width-1 do
begin
c[x,y]:= RGB(p[x].rgbtRed,p[x].rgbtGreen,p[x].rgbtBlue);
end;
end;
for x:=0 to bitmap.Width-1 do
for y:=0 to Bitmap.Height-1 do
if c[x,y] = clBlack then
Canvas.Pixels[x, y] := clRed
else
Canvas.Pixels[x, y] := c[x,y];
finally
Bitmap.Free;
end;
end;
贴到第二张图片就可以了