
源程序:
code segment
assume cs:code,ds:code
org 100h
start:
jmp install
BMP 文件头定义
---------------------------------------------------------------
BMP_HEAD DB 'BM' 固定为 'BM'
D_FILE_LENGTH DD 640*480*3+36h 文件总长度,包括文件头
D_RESERVED DD ? reserved
D_OFFSET DD 36h 数据区开始位置
D_BISIZE DD 28h bit map info'配或 head length
D_WIDTH DD 640 图形的宽度(单位象素)
D_HEIGHT DD 480 图形的高度(单位象素)
D_PLANES DW 1 图形的平面数
D_BIT DW 24 颜色位数
D_COMPRESS DD 0 压缩方式让族(0为不压缩)
D_SIZE DD 640*480*3 数据长度
D_XPPM DD 0c00h pixels per meter (x)
D_YPPM DD 0c00h pixels per meter (y)
D_CLRUSED DD 0 color used
D_CLRIMP DD 0 important color index
BMP_HEAD_END EQU THIS BYTE
----------------------------------------------------------------HANDLE DW ?
FILE_NAME DB 'test.bmp',0
LINE_BUF DB 640*3 dup (0)
D_RED DB 0ffh
D_GREEN DB 0
D_BLUE DB 0install:
mov ah,3ch 建立文件
xor cx,cx
mov dx,offset file_name
int 21h
jnb cre_ok
int 20h
cre_ok:
mov handle,ax
mov ah,40h 写入文件头
mov bx,handle
mov cx,offset bmp_head_end-offset bmp_head
mov dx,offset bmp_head
int 21h
mov cx,480 写入 480 行数据
xor bp,bp
b_lop:
push cx
mov ax,bp
inc bp
cmp ax,160
jb b1
cmp ax,320
jb b2
b3:
sub ax,320
mov si,offset d_blue
mov di,offset d_red
jmp short b4
b2:
sub ax,160
mov si,offset d_green
mov di,offset d_blue
jmp short b4
b1:
mov si,offset d_red
mov di,offset d_green
b4:
mov cx,0ffh
mul cx
mov cx,160 160
div cx
mov byte ptr ds:[si],0ffh
sub byte ptr ds:[si],al
mov byte ptr ds:[di],al
mov cx,640
mov di,offset line_buf
cld
b_lop1:
mov al,d_red
stosb
mov al,d_green
stosb
mov al,d_blue
stosb
loop b_lop1
mov ah,40h
mov bx,handle
mov cx,640*3
mov dx,offset line_buf
int 21h
pop cx
loop b_lop
mov ah,3eh 关闭文件
int 21h
int 20hCODE ENDS
END START
1.先打开做好的衡行应用程序窗口2.按Alt+PrtScn键
3.打开“画图”程序
4.Ctrl+V
5.保存,保存悉拦含时选择文件类型为BMP位图格式。
上面的方法,也是截图,但是只截取应用程序的窗口。既然是BMP的位图,也就是一样的,没什么不专业的。再专业也是这样睁笑的。
建立一个空白BMP图像文件的方法是:
码拍1、通过WINDOWS自带的画图程序建立一个新文件,另存为选择扩展名为BMP即可;
2、像PHOTOSHOP软件也胡耐可以完成这个 *** 作,也是通裤模春过另存为BMP即可;
3、JPG,PNG之类文件 *** 作方法相同。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)