网上也有类似的帖子,但我就是没法显示出来,新手上路,水平有限。
纯数据的8位图像数据,因为图像很大,所以只要显示出来,而且要局部显示(只要能显示出来我想局部显示我是可以自己解决的),不要转化成bmp等格式。我想是应该读一段数据到image里,指定调色板和宽度高度,但就是没法放进去,请有经验的大虾们给一段代码,分不够可以再加,谢谢!
还有——scanline可以成行读出来,有什么方法可以成行写进去的吗?
纯数据的8位图像数据,因为图像很大,所以只要显示出来,而且要局部显示(只要能显示出来我想局部显示我是可以自己解决的),不要转化成bmp等格式。我想是应该读一段数据到image里,指定调色板和宽度高度,但就是没法放进去,请有经验的大虾们给一段代码,分不够可以再加,谢谢!
还有——scanline可以成行读出来,有什么方法可以成行写进去的吗?
解决方案 »
- 代码异常
- 今天试验了一个ODAC,连接的时候一直提示无法找到oci.dll
- 16进制数的字符串显示,及 00111111EA09 在LABEL.CAPTION中显示为00111111EA09==急
- 关于窗体显示的简单问题
- 请教 用sql语句查询某一表当中最后20条记录怎么写??
- 急需,在Delphi如何调用WIN32 API函数(如:copyfile),多谢了!!
- 21CMM遭封杀!
- cctv 已说了:中国信息产业部今天上午正式发布命令,不再对中国网民防问GOOGLE等网站进行限制。
- 请问哪有DELPHI的常用组件的全部属性的说明??
- 急救!!!关于udp控件!
- [正确就结贴]求教可以支持多数据库平台的东西能实现吗?
- SNMP通信中的TRAP接收问题?
const Width, Height, ColorDepth: Integer; Bmp: TBitmap);
var
RemLen, DataLen, i: Integer;
begin
case ColorDepth of
1:
begin
Bmp.PixelFormat := pf1Bit;
DataLen := (Width + 7) shr 3;
end;
4:
begin
Bmp.PixelFormat := pf4Bit;
DataLen := (Width + 1) shr 1;
end;
8:
begin
Bmp.PixelFormat := pf8Bit;
DataLen := Width;
end;
15:
begin
Bmp.PixelFormat := pf15Bit;
DataLen := Width shl 1;
end;
16:
begin
Bmp.PixelFormat := pf16Bit;
DataLen := Width shl 1;
end;
24:
begin
Bmp.PixelFormat := pf24Bit;
DataLen := Width shl 1 + Width;
end;
32:
begin
Bmp.PixelFormat := pf32Bit;
DataLen := Width shl 2;
end;
end;
Bmp.Width := Width;
Bmp.Height := Height;
RemLen := (DataLen + 3) shr 2 shl 2 - DataLen;Stream.Position := 0;
for i := 0 to Height - 1 do begin
Stream.Read(Bmp.ScanLine[Height - 1 - i]^, DataLen);
if RemLen <> 0 then
Stream.Seek(RemLen, soFromCurrent);
end;
end;
http://delphi.137bbs.com/simple/index.php?t77010.html
这个帖子可能有帮助,可是其中最后的一段代码 Stream.Read(Bmp.ScanLine[Height - 1 - i]^, DataLen);
是什么意思啊,编译也过不去。
Stream.Read(Bmp.ScanLine[Height - 1 - i]^, DataLen);
procedure TForm1.Button2Click(Sender: TObject);
var
i: Integer;
Stream: TStream;
Width, Height:Integer;
ColorDepth: Integer;
Bmp: TBitmap;
begin
Width:=5492;
Height:=4606;
ColorDepth:=8;
Stream:=TFileStream.Create('c://sh.tif', fmCreate or fmShareExclusive);
Bmp.PixelFormat := pf8Bit;
Bmp.Width:=Width;
Stream.Position := 14666;
for i := 0 to (Height - 1) do begin
Stream.Read(Bmp.ScanLine[Height - 1 - i]^, Bmp.Width);
end;
image1.Picture.Bitmap.Assign(Bmp);
end;