Professional Documents
Culture Documents
Bitmap & Load Bitmap - 07KT
Bitmap & Load Bitmap - 07KT
Contents
Q&A
S bit
trn mi
im nh
Chiu cao
ca nh
Chiu rng
ca nh
(height)
(width)
14 bytes
Bitmap Header
40 bytes
Bitmap Information
4*x bytes
(x l s mu)
D liu nh
Color Palette
Bitmap Data
typedef struct
{
char
unsigned char
unsigned char
unsigned char
unsigned char
bfType[2];
bfSize[4];
bfReserved1[2];
bfReserved2[2];
bfOffBits[4];
} bmfh;
} bmfh;
Bitmap Header
7
typedef struct
{
unsigned char biSize[4];
unsigned char biWidth[4];
unsigned char biHeight[4];
unsigned char biPlanes[2];
unsigned char biBitCount[2];
unsigned char stuff1[16];
unsigned char biClrUsed[4];
unsigned char
biClrImportant[4];
} bmih;
Bitmap Information
8
11
12
13
Ct
hng
10
11
12
13
14
15
15
Chng ta c nhng g?
Screen.h: vi nhng thuc
tnh d liu thng dng
nh: DN_SCRCOLOR,
DN_SCRBMP,
DN_SCRUPDRECT
Graphic.h: in_rect,
draw_pixel, draw_line,
fill_rect, draw_text,
draw_btn
16
c bitmap Header
c bitmap Info
Ly cc thng
tin c bn nh:
chiu rng,
chiu cao, s
bit cho mt
pixel.
T suy ra
s mu v kch
thc palette
mu
17
c Palette mu
c bitmap data
Chuyn i
Palette mu t
dng Blue
Green Red
Reserved sang
Ren Green
Blue.
18
19
Cc hm cn hin thc
unsigned long ** read_BMP(char*
file_name,int *h,int *w): c file BMP
t tp file_name, suy ra chiu cao h, v
rng w ca nh, tnh ton pixel cn v.
void show_BMP(unsigned long **
pixels,int x,int y,int height,int width):
v tng pixel theo th t t tri sang phi
v t di ln trn.
20
Q&A
Q
&
A
21
LOGO