Rev 1643 | Rev 6342 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1643 | Rev 6328 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | ; load picture from file to memory |
1 | ; load picture from file to memory |
- | 2 | align 4 |
|
- | 3 | open_b rb 560 |
|
Line 2... | Line 4... | ||
2 | 4 | ||
3 | load_picture: |
5 | load_picture: |
4 | mov eax,file_path |
6 | mov [file_information.Function], SSF_GET_INFO |
5 | mov ebx,[ScreenPointer] |
- | |
6 | add ebx,0x10000 |
- | |
7 | 7 | mov [file_information.Position], 0 |
|
8 | call load_heading_of_file |
- | |
9 | 8 | mov [file_information.Flags], 0 |
|
10 | mov esi,[ScreenPointer] |
- | |
11 | add esi,0x10000 |
9 | mov dword[file_information.Count], 0 |
12 | ;-------------is this BMP file ?---------------- |
- | |
13 | xor eax,eax |
- | |
14 | mov ax,[esi] |
10 | mov dword[file_information.Buffer], open_b |
15 | mov [type],ax |
- | |
16 | 11 | mov byte[file_information+20], 0 |
|
17 | cmp [type],word 'BM' |
12 | mov dword[file_information.FileName], file_path |
18 | jne no_bmp_file_1 |
- | |
19 | 13 | mcall SF_FILE,file_information |
|
20 | xor eax,eax |
- | |
21 | xor ebx,ebx |
- | |
22 | mov eax,[esi+18] |
- | |
23 | mov ebx,[esi+22] |
- | |
24 | mov [Picture_SizeX],eax |
- | |
25 | mov [Picture_SizeY],ebx |
14 | or eax,eax |
26 | jmp exit_type_1 |
15 | jnz .end_open |
27 | - | ||
28 | no_bmp_file_1: |
16 | |
29 | ;-------------is this GIF file ?---------------- |
17 | mov ecx,dword[open_b+32] ;+32 qword: размер файла в байтах |
30 | xor eax,eax |
18 | add ecx,(1200*1000)*3+50*(20*20*3)+500000+16000+0x4000 |
31 | mov ax,[esi] |
19 | mcall SF_SYS_MISC,SSF_MEM_REALLOC,,[ScreenPointer] |
32 | mov [type],ax |
- | |
33 | cmp [type],'GI' |
- | |
34 | jne no_gif_file_1 |
- | |
35 | 20 | mov [ScreenPointer],eax |
|
36 | add esi,6 |
21 | add eax,0x10000 |
37 | xor eax,eax |
22 | sub ecx,(1200*1000)*3+50*(20*20*3)+500000+16000+0x4000 |
38 | xor ebx,ebx |
23 | mov [file_information.Function], SSF_READ_FILE |
39 | mov ax,word[esi] |
24 | mov [file_information.Position], 0 |
40 | mov bx,word[esi+2] |
25 | mov [file_information.Flags], 0 |
41 | mov [Picture_SizeX],eax |
26 | mov [file_information.Count], ecx |
42 | mov [Picture_SizeY],ebx |
- | |
43 | jmp exit_type_1 |
- | |
44 | - | ||
45 | no_gif_file_1: |
27 | mov [file_information.Buffer], eax |
46 | jmp no_unpakcing_file_1 |
- | |
47 | - | ||
48 | exit_type_1: |
- | |
49 | ;---------------------------------------------------------- |
28 | mov byte[file_information+20], 0 |
50 | ;Get momory for unpacking picture and for picture's bufers |
- | |
51 | ;---------------------------------------------------------- |
- | |
52 | call GetMemory |
- | |
53 | ;---------------------------------------------------------- |
29 | mov [file_information.FileName], file_path |
54 | ;--------------------Load file in memory------------------- |
- | |
55 | ;---------------------------------------------------------- |
- | |
56 | 30 | mcall SF_FILE,file_information ;загружаем файл изображения |
|
57 | mov eax,file_path |
- | |
58 | mov ebx,[PointerToCopyPicture] |
31 | cmp ebx,0xffffffff |
59 | add ebx,1000 |
- | |
60 | call load_file |
- | |
61 | - | ||
62 | ;---------------------------------------------------------- |
32 | je .end_open |
63 | ;-------------------Unpacking picture---------------------- |
- | |
64 | ;---------------------------------------------------------- |
- | |
65 | mov esi,[PointerToCopyPicture] |
- | |
66 | add esi,1000 |
- | |
67 | mov edi,[PointerToPicture] |
33 | ;определяем вид изображения и пишем его параметры |
68 | mov eax,[ScreenPointer] |
34 | mov eax,[ScreenPointer] |
- | 35 | add eax,0x10000 |
|
- | 36 | stdcall [img_decode], eax,ebx,0 |
|
- | 37 | push eax |
|
- | 38 | ;определяем размер декодированного изображения |
|
- | 39 | mov ecx,[eax+4] ;+4 = image width |
|
- | 40 | mov dword[Picture_SizeX],ecx |
|
69 | cmp [type],'BM' |
41 | mov eax,[eax+8] ;+8 = image height |
70 | jne no_unpakcing_bmp_file_1 |
42 | mov dword[Picture_SizeY],eax |
- | 43 | imul ecx,eax |
|
- | 44 | imul ecx,15 |
|
- | 45 | add ecx,(1200*1000)*3+50*(20*20*3)+500000+16000+0x4000 |
|
- | 46 | mcall SF_SYS_MISC,SSF_MEM_REALLOC,,[ScreenPointer] |
|
- | 47 | mov [ScreenPointer],eax |
|
71 | ;BMP DECODER |
48 | call prepare_data_pointers |
- | 49 | pop ebx |
|
- | 50 | stdcall [img_to_rgb2], ebx,[PointerToPicture] ;преобразуем изображение к формату rgb |
|
72 | call bmptoimg |
51 | stdcall [img_destroy], ebx ;удаляем временный буфер с параметрами изображения |
73 | mov [save_flag],1 |
- | |
74 | jmp no_unpakcing_file_1 |
- | |
75 | - | ||
76 | no_unpakcing_bmp_file_1: |
- | |
77 | cmp [type],'GI' |
- | |
78 | jne no_unpakcing_file_1 |
- | |
79 | ;GIF DECODER |
52 | mov [save_flag],1 |
80 | sub edi,8 |
- | |
81 | call ReadGIF |
- | |
82 | mov [save_flag],1 |
- | |
83 | - | ||
84 | no_unpakcing_file_1: |
- | |
85 | call MovePictureToWorkScreen |
- | |
86 | mov [Scroll1CoordinatX],9 |
- | |
87 | mov [Scroll2CoordinatY],89 |
53 | .end_open: |