BMP的问题,不难,但请说的详细(200分)

  • 主题发起人 主题发起人 guoguo303
  • 开始时间 开始时间
G

guoguo303

Unregistered / Unconfirmed
GUEST, unregistred user!
1.读取BMP文件的头信息和每个点的象素值
2.将象素值存成一个二进制文件
3.如何较好的对该二进制文件以图形方式编辑
本人水平较菜,请各位富翁指教,以前的问题都已经查找过,没找到讲的比较详细的
多谢谢各位,分不够再加
 
楼主是用来控制LED显示屏的吧!LED屏点对点控制。
 
怎么没人救我阿,给点意见也好的阿
 
http://www.gameres.com/Articles/Program/Visual/Other/BmptoVC.htm
是VC的,DELPHI我很久没有用,而且没有装,不然给你DELPHI的
 
嗯 LED顯示屏,以前做過, VB的,
Public Type BitmapFileHeader
bfType As Integer '0000h
bfSize As Long '0002h
bfReserver As Long '0006h
bfOffBits As Long '000Ah
End Type

Public Type BitmapInfoHeader
biSize As Long '000Eh
biWidth As Long ' 0012h
biHeight As Long ' 0016h
biPlanes As Integer '001Ah
biBitCount As Integer ' 001Ch
biCompression As Long '001Eh
biSizeImage As Long '0022h
biXPelsPerMeter As Long '0026h
biYPelsPerMeter As Long '002Ah
End Type

Public Type RgbQuad
rgbBlue As Byte '002Eh
rgbGreen As Byte '002Fh
rgbRed As Byte '0030h
rgbReserved As Byte '0031h
End Type

Public Type PaletTeentry
peRed As Byte '0032h
peGreen As Byte '0033h
peBlue As Byte '0034h
peFlags As Byte '0035h
End Type

Public BF As BitmapFileHeader
Public BI As BitmapInfoHeader
Public RG As RgbQuad
Public PA As PaletTeentry

//打開文件,讀取數據
Open Sendfile For Binary As hSend
Get hSend, , BF
Get hSend, , BI
Get hSend, , RG
Get hSend, , PA
Get hSend, , DouWord
Get hSend, , DouWord //讀到這里,以下的就是BMP數據了...

 
获取象素值:
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;

type
TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
Image1: TImage;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}


procedure TForm1.Button1Click(Sender: TObject);
var TempImage:TImage;
I,J:Integer;
begin
Try
TempImage:=TImage.Create(Nil);
TempImage.Picture.LoadFromFile('f:/a.bmp');
TempImage.AutoSize:=True;
TempImage.Center:=True;
For I:=0 To TempImage.Width Do
For J:=0 To TempImage.Height Do
Begin
memo1.Lines.Add(' '+IntToStr(TempImage.Picture.Bitmap.Canvas.Pixels[I,J]));
End;
Finally
FreeAndNil(TempImage);
End;
end;

end.
*******************************
object Form1: TForm1
Left = 192
Top = 107
Width = 696
Height = 480
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object Image1: TImage
Left = 240
Top = 64
Width = 105
Height = 105
end
object Button1: TButton
Left = 296
Top = 168
Width = 75
Height = 25
Caption = 'Button1'
TabOrder = 0
OnClick = Button1Click
end
object Memo1: TMemo
Left = 0
Top = 8
Width = 145
Height = 401
Lines.Strings = (
'')
ScrollBars = ssVertical
TabOrder = 1
end
end
 
谢谢Writer,ChineseBoy
第一个问题基本解决了,不知道,后面两个问题有没有高手指点一下
 
多人接受答案了。
 
后退
顶部