关于Bitmap图像的大小

garypeng 2001-07-10 11:23:22
1. 在我的程序中,TBitmap图像的高和宽只能是2800多象素,再大就会出现
OutOfResource的错误。TBitmap图像的大小到底和什么有关系?
(我机器的内存可是很大的)

2. 如果有很大的图像,是否只好自己计算显示区域的象素值,再构造2800多
象素之内的bitmap?

3. 使用canvas的Pixels来设置象素是否速度比较慢?用什么方法来填写内存bitmap
的各象素值最快?
...全文
155 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
fenglingdu 2002-01-18
  • 打赏
  • 举报
回复
学习。。。
garypeng 2001-07-11
  • 打赏
  • 举报
回复
由于给分的上限太小,先给分,另外开个题目。
yhec 2001-07-10
  • 打赏
  • 举报
回复
关注!
gqxs 2001-07-10
  • 打赏
  • 举报
回复
关注
jearry_zhou 2001-07-10
  • 打赏
  • 举报
回复
用TBitmap的ScanLine属性比较快
void __fastcall TForm1::Button1Click(TObject *Sender)

{
Graphics::TBitmap *pBitmap = new Graphics::TBitmap();
// This example shows drawing directly to the Bitmap
Byte *ptr;
try
{
pBitmap->LoadFromFile("C:\\Program Files\\Common Files\\Borland Shared\\Images\\Splash\\256color\\factory.bmp ");
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;
}void __fastcall TForm1::Button1Click(TObject *Sender)

{
Graphics::TBitmap *pBitmap = new Graphics::TBitmap();
// This example shows drawing directly to the Bitmap
Byte *ptr;
try
{
pBitmap->LoadFromFile("C:\\Program Files\\Common Files\\Borland Shared\\Images\\Splash\\256color\\factory.bmp ");
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;
}
路人丁 2001-07-10
  • 打赏
  • 举报
回复
gz
garypeng 2001-07-10
  • 打赏
  • 举报
回复
有人回答吗。

13,825

社区成员

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

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