image组件画图,当长宽太大就提示存储空间不足,怎么解决?我在image的canvas上画线。一旦设置长宽太大,差不多4000左右就提示存储空间不足。查了一下百度发现跟内存大小有关……然后有人说要用分块显示。不知道怎么分块?既然要分块显示,那么总需要一个东西来预先存放这个大图吧?我试着用tbitmap来,也照样,一旦我设置bitmap.heigth和width超过了一定大小就提示存储空间不足……那应该用什么来存储呢?最好哪位高手能够给出一个可用的demo……,实在郁闷~~~分不够再加~~~
解决方案 »
- 【菜鸟问题100分】为什么捕捉不到数据库连接异常
- Tadodataset的paramcheck属性是什么意思,怎么用呀??
- FastReport3 条件求和的问题,紧急,解决结帖
- 类的成员变量不能在成员函数中被访问?
- 高分求:DirectDraw+Delphi的实例,不需要DelphiX,实现对图片的平滑显示,有对surface的操作。分不够的话还可以再加~~~~~
- 请教delphi高手:传入参数问题
- 如何用HOOK技术得到输入的汉字?
- 请教:WIN98和 WIN2000(FAT)都装在C盘,现在想卸载2000,那为大哥知道?谢谢了!
- 请问在SQL中动态时间参数的匹配方法
- 如何读取注册的应用程序列表?
- 为什么Tidhttp.get时报错?
- 请大侠出手将下列VC++语句转换为Delphi语句,奉送所有分数!
mapx5.02 没有用过,请介绍以下你的GPS模块的主要功能和规模.
TCAD
http://www.codeidea.com/cn/
BitMap.PixelFormat:=pf4bit;
给你个读取并显示24位位图的代码,其他格式的自己写:// 输入: sFile -- 位图文件
// hFormDC -- 绘制到那个DC上
// 输出: Boolean
// True -- Success
// False -- Fail.
function ReadBMP(sFile: String; hFormDC: HDC): boolean;
var
smFile: TFileStream; bmpHead: BITMAPFILEHEADER;
bmpInfo: BITMAPINFO; dwSize : Integer;
nWidth : Integer;
nHeight: Integer;
pBuffer: Pointer; nPitch : Integer;
nTmp : Integer;
nRow, nCol: Integer;
begin
Result:= false; if (not FileExists(sFile)) or (sFile = '') then exit; smFile:= TFileStream.Create(sFile, fmOpenRead);
smFile.Seek(0, 0); if (smFile.Read(bmpHead, SizeOf(bmpHead)) > 0) then
begin
if (bmpHead.bfType <> $4D42) then
begin
ShowMessage('Not a bitmap file!');
FreeAndNil(smFile);
exit;
end;
end
else begin
FreeAndNil(smFile);
exit;
end; if (smFile.Read(bmpInfo.bmiHeader, SizeOf(BITMAPINFOHEADER)) <= 0) then
begin
FreeAndNil(smFile);
exit;
end; if (bmpInfo.bmiHeader.biBitCount <> 24) then
begin
ShowMessage('Not a 24 bit bitmap!');
FreeAndNil(smFile);
exit;
end; nWidth := bmpInfo.bmiHeader.biWidth;
nHeight:= bmpInfo.bmiHeader.biHeight; dwSize := SizeOf(BYTE) * bmpInfo.bmiHeader.biSizeImage; GetMem(pBuffer, dwSize);
try
smFile.Seek(bmpHead.bfOffBits, soBeginning); if (smFile.Read(pBuffer^, dwSize) > 0) then
begin
nPitch:= nWidth mod 4; for nRow:= 0 to nHeight - 1 do
begin
nTmp:= nRow * nPitch;
for nCol:= 0 to nWidth - 1 do
begin
// 这里显示的时候一些问题,当nWidth小于0的时候是倒的,显示的时候要处理一下,这里没有处理。
SetPixel(hFormDC, nCol, nRow,
RGB(
BYTE(Pointer(Integer(pBuffer) + (nRow * nWidth + nCol) * 3 + 2 + nTmp)^),
BYTE(Pointer(Integer(pBuffer) + (nRow * nWidth + nCol) * 3 + 1 + nTmp)^),
BYTE(Pointer(Integer(pBuffer) + (nRow * nWidth + nCol) * 3 + nTmp)^)
)
);
end;
end;
end
else begin
ShowMessage(IntToStr(GetLastError));
end;
finally
FreeMem(pBuffer);
FreeAndNil(smFile);
end; Result:= true;
end;// 测试
procedure TForm1.Button1Click(Sender: TObject);
begin
ReadBMP('test.bmp', Self.Canvas.Handle);
end;