请问关于ScanLine的参数和各个参数的意义和用法

amartapple 2003-01-12 02:18:32
谢谢
...全文
106 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
amartapple 2003-01-22
  • 打赏
  • 举报
回复
这是我用Pixels写的一个图象转置的程序,很慢
var
SourcePic,DestPic:TBitmap;

for i:=0 to SourcePic.Width-1 do
begin
for j:=0 to SourcePic.Height-1 do
begin
DestPic.Canvas.Pixels[j,i]:=SourcePic.Canvas.Pixels[i,j];
end;
end;

如果您不嫌麻烦,请用scanline写一遍,让我参考一下,谢谢
amartapple 2003-01-22
  • 打赏
  • 举报
回复
再问一下
LinePtr = (BYTE *) Image1->Picture->Bitmap->ScanLine[y];
这一句是什么意思
amartapple 2003-01-12
  • 打赏
  • 举报
回复
感谢楼上代码
有没有人能讲一下这个知识点
huangrenguang 2003-01-12
  • 打赏
  • 举报
回复
这是一段图像处理的代码,它是在2维数组中执行图像处理操作,然后使用ScanLine把结果拷贝到图像的TBitmap。当然这儿是BCB的代码,需要你改成Delphi的代码。
void __fastcall TForm1::Button3Click(TObject *Sender)
{
int x, y;
int Amplitude;
float Period;
BYTE ImageData[256][256], *LinePtr;

Image1->Picture->Bitmap = new Graphics::TBitmap;
Image1->Picture->Bitmap->PixelFormat = pf24bit;
Image1->Picture->Bitmap->Width = 256;
Image1->Picture->Bitmap->Height = 256;
for (y=0; y<=255; y++)
for (x=0; x<=255; x++)
{
Amplitude = 64*(255-y)/255;
Period = 100*sqrt(1/(1+(exp(0.013*x)*exp(0.027*x)/400)));
ImageData[x][y] = Amplitude*sin(2*M_PI/Period*x)+128;
}
// Copy the image data to TBitmap
for (y=0; y<=255; y++)
{
LinePtr = (BYTE *) Image1->Picture->Bitmap->ScanLine[y];
for (x=0; x<=255; x++)
{
LinePtr[x*3] = ImageData[x][y]; // Red
LinePtr[x*3+1] = ImageData[x][y]; // Green
LinePtr[x*3+2] = ImageData[x][y]; // Blue
}
}
Image1->Refresh();
}

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧