scanline的一些问题

xiao234666 2006-12-02 01:38:50
Graphics::TBitmap *pBitmap = new Graphics::TBitmap();
// This example shows drawing directly to the Bitmap
Byte *ptr;
try
{
pBitmap->LoadFromFile("MyBitmap.png");
for (int y = 0; y < pBitmap->Height; y++)
{
ptr = (Byte *)pBitmap->ScanLine[y];
for (int x = 0; x < pBitmap->Width; x++)

ptr[x] = (Byte)y;
}
Canvas->Draw(0,0,pBitmap);
}
catch (...)
{
ShowMessage("Could not load or alter bitmap");
}
delete pBitmap;
我想问一下,上面的程序中ptr[x] = (Byte)y;是什么意思?
...全文
109 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
xiao234666 2006-12-02
  • 打赏
  • 举报
回复
不是的,这个程序就是把mybitmap这幅图象显示出来而已
cczlp 2006-12-02
  • 打赏
  • 举报
回复
无符号字节用Byte(unsigned char)
cczlp 2006-12-02
  • 打赏
  • 举报
回复
把每行的像素灰度值设为y, 看起来应该是从黑到白逐渐变亮。

13,825

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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