forked from KolibriOS/kolibrios
version 1.4:
- use 'libimg.obj' - can open *.jpg and *.png files git-svn-id: svn://kolibrios.org@6328 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
0a69c65794
commit
32bb153b9f
@ -1,6 +1,10 @@
|
|||||||
;*******************************************************
|
;*******************************************************
|
||||||
;**************GRAPHICS EDITOR ANIMAGE *****************
|
;**************GRAPHICS EDITOR ANIMAGE *****************
|
||||||
;*******************************************************
|
;*******************************************************
|
||||||
|
; version: 1.4
|
||||||
|
; last update: 12/03/2016
|
||||||
|
; changes: Use library 'libimg.obj'
|
||||||
|
;--------------------------------------------------------
|
||||||
; version: 1.3
|
; version: 1.3
|
||||||
; last update: 05/10/2010
|
; last update: 05/10/2010
|
||||||
; written by: Marat Zakiyanov aka Mario79, aka Mario
|
; written by: Marat Zakiyanov aka Mario79, aka Mario
|
||||||
@ -20,25 +24,28 @@
|
|||||||
|
|
||||||
use32
|
use32
|
||||||
org 0x0
|
org 0x0
|
||||||
|
|
||||||
db 'MENUET01'
|
db 'MENUET01'
|
||||||
dd 0x1
|
dd 0x1
|
||||||
dd START
|
dd START
|
||||||
dd IM_END
|
dd IM_END
|
||||||
dd I_END ;0x19000;100 kb
|
dd I_END
|
||||||
dd stacktop ;0x19000;
|
dd stacktop
|
||||||
dd file_path ;parameters
|
dd file_path ;parameters
|
||||||
dd cur_dir_path
|
dd cur_dir_path
|
||||||
|
|
||||||
|
|
||||||
include '../../../config.inc' ;for nightbuild
|
include '../../../config.inc' ;for nightbuild
|
||||||
include '..\..\..\macros.inc'
|
include '../../../macros.inc'
|
||||||
|
include '../../../proc32.inc'
|
||||||
|
include '../../../KOSfuncs.inc'
|
||||||
include '../../../develop/libraries/box_lib/load_lib.mac'
|
include '../../../develop/libraries/box_lib/load_lib.mac'
|
||||||
@use_library
|
include '../../../dll.inc'
|
||||||
|
include '../../../libio.inc'
|
||||||
|
|
||||||
|
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
|
||||||
|
|
||||||
COLOR_ORDER equ MENUETOS
|
COLOR_ORDER equ MENUETOS
|
||||||
include 'gif_lite.inc'
|
include 'gif_lite.inc'
|
||||||
include 'bmplib.inc'
|
include 'bmplib.inc'
|
||||||
;include 'dialog.inc'
|
|
||||||
include 'dialog2.inc'
|
include 'dialog2.inc'
|
||||||
include 'design.inc'
|
include 'design.inc'
|
||||||
include 'graphlib.inc'
|
include 'graphlib.inc'
|
||||||
@ -78,13 +85,13 @@ include 'init_data.inc'
|
|||||||
;---------------------------------------------------------
|
;---------------------------------------------------------
|
||||||
;---------Check loading of file from parameters-----------
|
;---------Check loading of file from parameters-----------
|
||||||
;---------------------------------------------------------
|
;---------------------------------------------------------
|
||||||
; mov eax,parameters
|
|
||||||
; mov ebx,file_path
|
|
||||||
; call check_loading_from_parameters
|
|
||||||
mov eax,file_path
|
mov eax,file_path
|
||||||
cmp [eax],byte 0
|
cmp [eax],byte 0
|
||||||
jz @f
|
jz @f
|
||||||
call load_picture
|
call load_picture
|
||||||
|
call MovePictureToWorkScreen
|
||||||
|
mov [Scroll1CoordinatX],9
|
||||||
|
mov [Scroll2CoordinatY],89
|
||||||
@@:
|
@@:
|
||||||
|
|
||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
@ -171,6 +178,7 @@ include 'width_lines.inc'
|
|||||||
dd 0
|
dd 0
|
||||||
panel_picture:
|
panel_picture:
|
||||||
file 'panel_buttons.gif'
|
file 'panel_buttons.gif'
|
||||||
|
.end:
|
||||||
;****************cursors******************
|
;****************cursors******************
|
||||||
brush_cursor:
|
brush_cursor:
|
||||||
file 'brush.cur'
|
file 'brush.cur'
|
||||||
@ -314,28 +322,12 @@ align 4
|
|||||||
CursorsID rd 10
|
CursorsID rd 10
|
||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
align 4
|
align 4
|
||||||
file_path:
|
file_path rb 4096
|
||||||
rb 4096
|
filename_area rb 256
|
||||||
;---------------------------------------------------------------------
|
temp_dir_pach rb 4096
|
||||||
align 4
|
library_path rb 4096
|
||||||
filename_area:
|
cur_dir_path rb 4096
|
||||||
rb 256
|
procinfo: rb 1024
|
||||||
;---------------------------------------------------------------------
|
|
||||||
align 4
|
|
||||||
temp_dir_pach:
|
|
||||||
rb 4096
|
|
||||||
;---------------------------------------------------------------------
|
|
||||||
align 4
|
|
||||||
library_path:
|
|
||||||
rb 4096
|
|
||||||
;---------------------------------------------------------------------
|
|
||||||
align 4
|
|
||||||
cur_dir_path:
|
|
||||||
rb 4096
|
|
||||||
;---------------------------------------------------------------------
|
|
||||||
align 4
|
|
||||||
procinfo:
|
|
||||||
rb 1024
|
|
||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
align 4
|
align 4
|
||||||
rb 4096
|
rb 4096
|
||||||
|
@ -1,235 +1,3 @@
|
|||||||
;**************************************************************************
|
|
||||||
;**********************DECODING BMP FILE(1,4,8,24 bits)*********************
|
|
||||||
;***************************************************************************
|
|
||||||
; BMPTOIMG -Convert BMP format TO IMG format
|
|
||||||
;***************************************************************************
|
|
||||||
bmptoimg:
|
|
||||||
|
|
||||||
mov [bmp_load_area],esi
|
|
||||||
mov [img_dest_area],edi
|
|
||||||
xor eax,eax
|
|
||||||
mov ax,word[esi+28]
|
|
||||||
mov ebx,[esi+14]
|
|
||||||
mov ecx,[esi+18]
|
|
||||||
mov edx,[esi+22]
|
|
||||||
mov [bmp_bits_per_pixel],ax
|
|
||||||
mov [bmp_first_structure_size],ebx
|
|
||||||
mov [Bmp_SizeY],edx
|
|
||||||
mov [Bmp_SizeX],ecx
|
|
||||||
|
|
||||||
xor eax,eax
|
|
||||||
mov ax,[esi+28]
|
|
||||||
mul dword [esi+18]
|
|
||||||
add eax,31
|
|
||||||
shr eax,5
|
|
||||||
mov dword [bmptoimg_data_area_dwps],eax ;dwps-doublewords per string
|
|
||||||
shl eax,2
|
|
||||||
mov dword [bmptoimg_data_area_bps],eax ;bps-bytes per string
|
|
||||||
|
|
||||||
cmp dword [esi+34],0
|
|
||||||
jne yespicsize ;if picture size is defined
|
|
||||||
mul dword [esi+22]
|
|
||||||
mov dword [esi+34],eax
|
|
||||||
|
|
||||||
yespicsize:
|
|
||||||
|
|
||||||
mov eax,[bmp_load_area]
|
|
||||||
add eax, [esi+10] ;how mach bytes to begin bitmap
|
|
||||||
add eax, [esi+34] ;size of bitmap in BMP file
|
|
||||||
mov dword [bmptoimg_data_area_eop],eax ;eop-end of picture in file
|
|
||||||
;calculate bytes per string
|
|
||||||
mov eax, [esi+18]
|
|
||||||
lea eax,[eax+2*eax] ;3x pixels in eax
|
|
||||||
mov [bmp_bytes_per_string],eax
|
|
||||||
|
|
||||||
mov esi,dword [bmptoimg_data_area_eop]
|
|
||||||
sub esi,dword [bmptoimg_data_area_bps]
|
|
||||||
|
|
||||||
mov ebp,[img_dest_area]
|
|
||||||
mov edi,[img_dest_area]
|
|
||||||
mov ebx,[bmp_load_area]
|
|
||||||
add ebx, [bmp_first_structure_size]
|
|
||||||
add ebx,14 ;in ebx start of color table
|
|
||||||
|
|
||||||
|
|
||||||
cmp [bmp_bits_per_pixel],24
|
|
||||||
je convert_to_24bpp
|
|
||||||
|
|
||||||
cmp [bmp_bits_per_pixel],8
|
|
||||||
je convert_to_8bpp
|
|
||||||
|
|
||||||
cmp [bmp_bits_per_pixel],4
|
|
||||||
je convert_to_4bpp
|
|
||||||
|
|
||||||
cmp [bmp_bits_per_pixel],1
|
|
||||||
je convert_to_1bpp
|
|
||||||
|
|
||||||
jmp end_bmp
|
|
||||||
|
|
||||||
;--------------------------------------------------
|
|
||||||
;-----------Decoding 24 bit BMP file---------------
|
|
||||||
;--------------------------------------------------
|
|
||||||
convert_to_24bpp:
|
|
||||||
|
|
||||||
mov ebx,[Bmp_SizeY]
|
|
||||||
loop_convert_to_24bpp_y:
|
|
||||||
|
|
||||||
mov edi,ebp
|
|
||||||
mov ecx,[bmptoimg_data_area_dwps]
|
|
||||||
|
|
||||||
cld
|
|
||||||
rep movsd
|
|
||||||
|
|
||||||
sub esi,[bmptoimg_data_area_bps]
|
|
||||||
sub esi,[bmptoimg_data_area_bps]
|
|
||||||
|
|
||||||
add ebp,eax
|
|
||||||
dec ebx
|
|
||||||
jnz loop_convert_to_24bpp_y
|
|
||||||
|
|
||||||
jmp end_bmp
|
|
||||||
;-----------------------------------------------------
|
|
||||||
;--------------Decoding 8 bits BMP file---------------
|
|
||||||
;-----------------------------------------------------
|
|
||||||
convert_to_8bpp:
|
|
||||||
|
|
||||||
mov ebp,[Bmp_SizeY]
|
|
||||||
loop_convert_8bpp_y:
|
|
||||||
|
|
||||||
mov ecx,[bmptoimg_data_area_bps]
|
|
||||||
push edi
|
|
||||||
|
|
||||||
loop_convert_8bpp_x:
|
|
||||||
|
|
||||||
xor eax,eax
|
|
||||||
mov al,byte [esi]
|
|
||||||
call converttable
|
|
||||||
inc esi
|
|
||||||
add edi,3
|
|
||||||
|
|
||||||
dec ecx
|
|
||||||
jnz loop_convert_8bpp_x
|
|
||||||
|
|
||||||
pop edi
|
|
||||||
|
|
||||||
add edi,[bmp_bytes_per_string]
|
|
||||||
sub esi,[bmptoimg_data_area_bps]
|
|
||||||
sub esi,[bmptoimg_data_area_bps]
|
|
||||||
|
|
||||||
dec ebp
|
|
||||||
jnz loop_convert_8bpp_y
|
|
||||||
|
|
||||||
jmp end_bmp
|
|
||||||
;-----------------------------------------------------
|
|
||||||
;--------------Decoding 4 bits BMP file---------------
|
|
||||||
;-----------------------------------------------------
|
|
||||||
convert_to_4bpp:
|
|
||||||
|
|
||||||
mov ebp,[Bmp_SizeY]
|
|
||||||
loop_convert_4bpp_y:
|
|
||||||
|
|
||||||
mov ecx,[bmptoimg_data_area_bps]
|
|
||||||
push edi
|
|
||||||
|
|
||||||
loop_convert_4bpp_x:
|
|
||||||
|
|
||||||
mov [Bmp_save1],ecx
|
|
||||||
xor eax,eax
|
|
||||||
mov al,byte [esi]
|
|
||||||
xor ecx,ecx
|
|
||||||
mov cl,al
|
|
||||||
shr al,4 ;first pixel in byte
|
|
||||||
and cl,0xf ;second pixel in byte
|
|
||||||
call converttable ;draw first pixel of byte
|
|
||||||
mov eax,ecx ;move second pixel to register al and draw
|
|
||||||
add edi,3
|
|
||||||
call converttable ;draw second pixel of byte
|
|
||||||
add edi,3
|
|
||||||
mov ecx,[Bmp_save1]
|
|
||||||
inc esi
|
|
||||||
|
|
||||||
dec ecx
|
|
||||||
jnz loop_convert_4bpp_x
|
|
||||||
|
|
||||||
pop edi
|
|
||||||
|
|
||||||
add edi,[bmp_bytes_per_string]
|
|
||||||
sub esi,[bmptoimg_data_area_bps]
|
|
||||||
sub esi,[bmptoimg_data_area_bps]
|
|
||||||
|
|
||||||
dec ebp
|
|
||||||
jnz loop_convert_4bpp_y
|
|
||||||
|
|
||||||
jmp end_bmp
|
|
||||||
;-----------------------------------------------------
|
|
||||||
;---------------Decoding 1 bit BMP file---------------
|
|
||||||
;-----------------------------------------------------
|
|
||||||
convert_to_1bpp:
|
|
||||||
|
|
||||||
mov ebp,[Bmp_SizeY]
|
|
||||||
loop_convert_1bpp_y:
|
|
||||||
|
|
||||||
mov ecx,[bmptoimg_data_area_bps]
|
|
||||||
push edi
|
|
||||||
|
|
||||||
loop_convert_1bpp_x:
|
|
||||||
|
|
||||||
xor eax,eax
|
|
||||||
mov al,byte [esi]
|
|
||||||
mov [Bmp_save1],ecx
|
|
||||||
mov ecx,eax
|
|
||||||
mov edx,7
|
|
||||||
nextbit:
|
|
||||||
xor eax,eax
|
|
||||||
bt ecx,edx
|
|
||||||
jnc noaddelem
|
|
||||||
inc eax
|
|
||||||
noaddelem:
|
|
||||||
|
|
||||||
push edx
|
|
||||||
call converttable
|
|
||||||
pop edx
|
|
||||||
|
|
||||||
add edi,3
|
|
||||||
dec edx
|
|
||||||
jns nextbit
|
|
||||||
mov ecx,[Bmp_save1]
|
|
||||||
inc esi
|
|
||||||
dec ecx
|
|
||||||
jnz loop_convert_1bpp_x
|
|
||||||
|
|
||||||
pop edi
|
|
||||||
|
|
||||||
add edi,[bmp_bytes_per_string]
|
|
||||||
sub esi,[bmptoimg_data_area_bps]
|
|
||||||
sub esi,[bmptoimg_data_area_bps]
|
|
||||||
|
|
||||||
dec ebp
|
|
||||||
jnz loop_convert_1bpp_y
|
|
||||||
|
|
||||||
jmp end_bmp
|
|
||||||
;-----------------------------------------------------
|
|
||||||
converttable:
|
|
||||||
shl eax,2
|
|
||||||
add eax,ebx
|
|
||||||
mov edx, dword [eax]
|
|
||||||
mov [edi],edx
|
|
||||||
ret
|
|
||||||
;-----------------------------------------------------
|
|
||||||
; DATA AREA
|
|
||||||
bmptoimg_data_area_bps dd 0
|
|
||||||
bmptoimg_data_area_dwps dd 0
|
|
||||||
bmptoimg_data_area_eop dd 0
|
|
||||||
bmp_load_area dd 0
|
|
||||||
img_dest_area dd 0
|
|
||||||
bmp_bits_per_pixel dw 0
|
|
||||||
bmp_first_structure_size dd 0
|
|
||||||
bmp_bytes_per_string dd 0
|
|
||||||
|
|
||||||
end_bmp:
|
|
||||||
|
|
||||||
ret
|
|
||||||
|
|
||||||
;***************************************************************************
|
;***************************************************************************
|
||||||
;*******************CODING BMP FILE(1,4,8,24 bits)**************************
|
;*******************CODING BMP FILE(1,4,8,24 bits)**************************
|
||||||
;***************************************************************************
|
;***************************************************************************
|
||||||
|
@ -116,15 +116,7 @@ save_file:
|
|||||||
;-------------file information structure-------------------
|
;-------------file information structure-------------------
|
||||||
;----------------------------------------------------------
|
;----------------------------------------------------------
|
||||||
|
|
||||||
file_information:
|
file_information FileInfoBlock 5,0,0,0,bufer_for_info,0,filepath
|
||||||
|
|
||||||
dd 5
|
|
||||||
dd 0
|
|
||||||
dd 0
|
|
||||||
dd 0
|
|
||||||
dd bufer_for_info
|
|
||||||
dd 0
|
|
||||||
dd filepath
|
|
||||||
|
|
||||||
filepath rb 1040
|
filepath rb 1040
|
||||||
|
|
||||||
|
@ -2,12 +2,12 @@
|
|||||||
;---load icons in memory and draw icons on panel-----------
|
;---load icons in memory and draw icons on panel-----------
|
||||||
;-----------------------------------------------------------
|
;-----------------------------------------------------------
|
||||||
load_icons:
|
load_icons:
|
||||||
mov esi,panel_picture
|
stdcall [img_decode], panel_picture, panel_picture.end-panel_picture, 0
|
||||||
|
mov ebx,eax
|
||||||
mov edi,[ScreenPointer]
|
mov edi,[ScreenPointer]
|
||||||
add edi,(1200*1000*3)
|
add edi,(1200*1000*3)+8
|
||||||
;mov edi,[PointerToIcons]
|
stdcall [img_to_rgb2], ebx,edi ;преобразуем изображение к формату rgb
|
||||||
call ReadGIF
|
stdcall [img_destroy], ebx ;удаляем временный буфер с параметрами изображения
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
draw_icons:
|
draw_icons:
|
||||||
|
@ -1,19 +1,27 @@
|
|||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
system_dir_ProcLib db '/sys/lib/proc_lib.obj',0
|
|
||||||
;---------------------------------------------------------------------
|
|
||||||
head_f_i:
|
head_f_i:
|
||||||
head_f_l db 'System error',0
|
head_f_l db 'System error',0
|
||||||
|
;---------------------------------------------------------------------
|
||||||
|
system_dir_1: db '/sys/lib/libimg.obj',0
|
||||||
|
err_message_found_lib_1 db 39,'libimg.obj',39,' - Not found!',0
|
||||||
|
err_message_import_1 db 39,'libimg.obj',39,' - Wrong import!',0
|
||||||
|
|
||||||
err_message_found_lib2 db 'proc_lib.obj - Not found!',0
|
system_dir_ProcLib db '/sys/lib/proc_lib.obj',0
|
||||||
|
err_message_found_lib2 db 39,'proc_lib.obj',39,' - Not found!',0
|
||||||
|
err_message_import2 db 39,'proc_lib.obj',39,' - Wrong import!',0
|
||||||
|
|
||||||
err_message_import2 db 'proc_lib.obj - Wrong import!',0
|
system_dir_3: db '/sys/lib/kmenu.obj',0
|
||||||
|
err_message_found_lib_3 db 39,'kmenu.obj',39,' - Not found!',0
|
||||||
|
err_message_import_3 db 39,'kmenu.obj',39,' - Wrong import!',0
|
||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
align 4
|
align 4
|
||||||
l_libs_start:
|
l_libs_start:
|
||||||
|
lib1 l_libs system_dir_1+9, cur_dir_path, library_path, system_dir_1,\
|
||||||
library02 l_libs system_dir_ProcLib+9, cur_dir_path, library_path, system_dir_ProcLib, \
|
err_message_found_lib_1, head_f_l, import_libimg, err_message_import_1, head_f_i
|
||||||
err_message_found_lib2, head_f_l, ProcLib_import, err_message_import2, head_f_i
|
lib2 l_libs system_dir_ProcLib+9, cur_dir_path, library_path, system_dir_ProcLib, \
|
||||||
|
err_message_found_lib2, head_f_l, ProcLib_import, err_message_import2, head_f_i
|
||||||
|
lib3 l_libs system_dir_3+9, cur_dir_path, library_path, system_dir_3,\
|
||||||
|
err_message_found_lib_3, head_f_l, import_libkmenu, err_message_import_3, head_f_i
|
||||||
end_l_libs:
|
end_l_libs:
|
||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
align 4
|
align 4
|
||||||
@ -53,6 +61,8 @@ dd Filter.end - Filter
|
|||||||
.1:
|
.1:
|
||||||
db 'BMP',0
|
db 'BMP',0
|
||||||
db 'GIF',0
|
db 'GIF',0
|
||||||
|
db 'JPG',0
|
||||||
|
db 'PNG',0
|
||||||
.end:
|
.end:
|
||||||
db 0
|
db 0
|
||||||
|
|
||||||
@ -60,6 +70,52 @@ db 0
|
|||||||
|
|
||||||
path4 db '/sys/noname.bmp',0
|
path4 db '/sys/noname.bmp',0
|
||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
|
align 4
|
||||||
|
import_libimg:
|
||||||
|
dd alib_init1
|
||||||
|
img_is_img dd aimg_is_img
|
||||||
|
img_info dd aimg_info
|
||||||
|
img_from_file dd aimg_from_file
|
||||||
|
img_to_file dd aimg_to_file
|
||||||
|
img_from_rgb dd aimg_from_rgb
|
||||||
|
img_to_rgb dd aimg_to_rgb
|
||||||
|
img_to_rgb2 dd aimg_to_rgb2
|
||||||
|
img_decode dd aimg_decode
|
||||||
|
img_encode dd aimg_encode
|
||||||
|
img_create dd aimg_create
|
||||||
|
img_destroy dd aimg_destroy
|
||||||
|
img_destroy_layer dd aimg_destroy_layer
|
||||||
|
img_count dd aimg_count
|
||||||
|
img_lock_bits dd aimg_lock_bits
|
||||||
|
img_unlock_bits dd aimg_unlock_bits
|
||||||
|
img_flip dd aimg_flip
|
||||||
|
img_flip_layer dd aimg_flip_layer
|
||||||
|
img_rotate dd aimg_rotate
|
||||||
|
img_rotate_layer dd aimg_rotate_layer
|
||||||
|
img_draw dd aimg_draw
|
||||||
|
dd 0,0
|
||||||
|
alib_init1 db 'lib_init',0
|
||||||
|
aimg_is_img db 'img_is_img',0
|
||||||
|
aimg_info db 'img_info',0
|
||||||
|
aimg_from_file db 'img_from_file',0
|
||||||
|
aimg_to_file db 'img_to_file',0
|
||||||
|
aimg_from_rgb db 'img_from_rgb',0
|
||||||
|
aimg_to_rgb db 'img_to_rgb',0
|
||||||
|
aimg_to_rgb2 db 'img_to_rgb2',0
|
||||||
|
aimg_decode db 'img_decode',0
|
||||||
|
aimg_encode db 'img_encode',0
|
||||||
|
aimg_create db 'img_create',0
|
||||||
|
aimg_destroy db 'img_destroy',0
|
||||||
|
aimg_destroy_layer db 'img_destroy_layer',0
|
||||||
|
aimg_count db 'img_count',0
|
||||||
|
aimg_lock_bits db 'img_lock_bits',0
|
||||||
|
aimg_unlock_bits db 'img_unlock_bits',0
|
||||||
|
aimg_flip db 'img_flip',0
|
||||||
|
aimg_flip_layer db 'img_flip_layer',0
|
||||||
|
aimg_rotate db 'img_rotate',0
|
||||||
|
aimg_rotate_layer db 'img_rotate_layer',0
|
||||||
|
aimg_draw db 'img_draw',0
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
ProcLib_import:
|
ProcLib_import:
|
||||||
OpenDialog_Init dd aOpenDialog_Init
|
OpenDialog_Init dd aOpenDialog_Init
|
||||||
@ -70,4 +126,28 @@ OpenDialog_Start dd aOpenDialog_Start
|
|||||||
aOpenDialog_Init db 'OpenDialog_init',0
|
aOpenDialog_Init db 'OpenDialog_init',0
|
||||||
aOpenDialog_Start db 'OpenDialog_start',0
|
aOpenDialog_Start db 'OpenDialog_start',0
|
||||||
;aOpenDialog_Version db 'Version_OpenDialog',0
|
;aOpenDialog_Version db 'Version_OpenDialog',0
|
||||||
|
|
||||||
|
align 4
|
||||||
|
import_libkmenu:
|
||||||
|
kmenu_init dd akmenu_init
|
||||||
|
kmainmenu_draw dd akmainmenu_draw
|
||||||
|
kmainmenu_dispatch_cursorevent dd akmainmenu_dispatch_cursorevent
|
||||||
|
ksubmenu_new dd aksubmenu_new
|
||||||
|
ksubmenu_delete dd aksubmenu_delete
|
||||||
|
ksubmenu_draw dd aksubmenu_draw
|
||||||
|
ksubmenu_add dd aksubmenu_add
|
||||||
|
kmenuitem_new dd akmenuitem_new
|
||||||
|
kmenuitem_delete dd akmenuitem_delete
|
||||||
|
kmenuitem_draw dd akmenuitem_draw
|
||||||
|
dd 0,0
|
||||||
|
akmenu_init db 'kmenu_init',0
|
||||||
|
akmainmenu_draw db 'kmainmenu_draw',0
|
||||||
|
akmainmenu_dispatch_cursorevent db 'kmainmenu_dispatch_cursorevent',0
|
||||||
|
aksubmenu_new db 'ksubmenu_new',0
|
||||||
|
aksubmenu_delete db 'ksubmenu_delete',0
|
||||||
|
aksubmenu_draw db 'ksubmenu_draw',0
|
||||||
|
aksubmenu_add db 'ksubmenu_add',0
|
||||||
|
akmenuitem_new db 'kmenuitem_new',0
|
||||||
|
akmenuitem_delete db 'kmenuitem_delete',0
|
||||||
|
akmenuitem_draw db 'kmenuitem_draw',0
|
||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
@ -1,88 +1,54 @@
|
|||||||
; load picture from file to memory
|
; load picture from file to memory
|
||||||
|
align 4
|
||||||
|
open_b rb 560
|
||||||
|
|
||||||
load_picture:
|
load_picture:
|
||||||
mov eax,file_path
|
mov [file_information.Function], SSF_GET_INFO
|
||||||
mov ebx,[ScreenPointer]
|
mov [file_information.Position], 0
|
||||||
add ebx,0x10000
|
mov [file_information.Flags], 0
|
||||||
|
mov dword[file_information.Count], 0
|
||||||
|
mov dword[file_information.Buffer], open_b
|
||||||
|
mov byte[file_information+20], 0
|
||||||
|
mov dword[file_information.FileName], file_path
|
||||||
|
mcall SF_FILE,file_information
|
||||||
|
or eax,eax
|
||||||
|
jnz .end_open
|
||||||
|
|
||||||
call load_heading_of_file
|
mov ecx,dword[open_b+32] ;+32 qword: размер файла в байтах
|
||||||
|
add ecx,(1200*1000)*3+50*(20*20*3)+500000+16000+0x4000
|
||||||
mov esi,[ScreenPointer]
|
mcall SF_SYS_MISC,SSF_MEM_REALLOC,,[ScreenPointer]
|
||||||
add esi,0x10000
|
mov [ScreenPointer],eax
|
||||||
;-------------is this BMP file ?----------------
|
add eax,0x10000
|
||||||
xor eax,eax
|
sub ecx,(1200*1000)*3+50*(20*20*3)+500000+16000+0x4000
|
||||||
mov ax,[esi]
|
mov [file_information.Function], SSF_READ_FILE
|
||||||
mov [type],ax
|
mov [file_information.Position], 0
|
||||||
|
mov [file_information.Flags], 0
|
||||||
cmp [type],word 'BM'
|
mov [file_information.Count], ecx
|
||||||
jne no_bmp_file_1
|
mov [file_information.Buffer], eax
|
||||||
|
mov byte[file_information+20], 0
|
||||||
xor eax,eax
|
mov [file_information.FileName], file_path
|
||||||
xor ebx,ebx
|
mcall SF_FILE,file_information ;загружаем файл изображения
|
||||||
mov eax,[esi+18]
|
cmp ebx,0xffffffff
|
||||||
mov ebx,[esi+22]
|
je .end_open
|
||||||
mov [Picture_SizeX],eax
|
;определяем вид изображения и пишем его параметры
|
||||||
mov [Picture_SizeY],ebx
|
|
||||||
jmp exit_type_1
|
|
||||||
|
|
||||||
no_bmp_file_1:
|
|
||||||
;-------------is this GIF file ?----------------
|
|
||||||
xor eax,eax
|
|
||||||
mov ax,[esi]
|
|
||||||
mov [type],ax
|
|
||||||
cmp [type],'GI'
|
|
||||||
jne no_gif_file_1
|
|
||||||
|
|
||||||
add esi,6
|
|
||||||
xor eax,eax
|
|
||||||
xor ebx,ebx
|
|
||||||
mov ax,word[esi]
|
|
||||||
mov bx,word[esi+2]
|
|
||||||
mov [Picture_SizeX],eax
|
|
||||||
mov [Picture_SizeY],ebx
|
|
||||||
jmp exit_type_1
|
|
||||||
|
|
||||||
no_gif_file_1:
|
|
||||||
jmp no_unpakcing_file_1
|
|
||||||
|
|
||||||
exit_type_1:
|
|
||||||
;----------------------------------------------------------
|
|
||||||
;Get momory for unpacking picture and for picture's bufers
|
|
||||||
;----------------------------------------------------------
|
|
||||||
call GetMemory
|
|
||||||
;----------------------------------------------------------
|
|
||||||
;--------------------Load file in memory-------------------
|
|
||||||
;----------------------------------------------------------
|
|
||||||
|
|
||||||
mov eax,file_path
|
|
||||||
mov ebx,[PointerToCopyPicture]
|
|
||||||
add ebx,1000
|
|
||||||
call load_file
|
|
||||||
|
|
||||||
;----------------------------------------------------------
|
|
||||||
;-------------------Unpacking picture----------------------
|
|
||||||
;----------------------------------------------------------
|
|
||||||
mov esi,[PointerToCopyPicture]
|
|
||||||
add esi,1000
|
|
||||||
mov edi,[PointerToPicture]
|
|
||||||
mov eax,[ScreenPointer]
|
mov eax,[ScreenPointer]
|
||||||
cmp [type],'BM'
|
add eax,0x10000
|
||||||
jne no_unpakcing_bmp_file_1
|
stdcall [img_decode], eax,ebx,0
|
||||||
;BMP DECODER
|
push eax
|
||||||
call bmptoimg
|
;определяем размер декодированного изображения
|
||||||
|
mov ecx,[eax+4] ;+4 = image width
|
||||||
|
mov dword[Picture_SizeX],ecx
|
||||||
|
mov eax,[eax+8] ;+8 = image height
|
||||||
|
mov dword[Picture_SizeY],eax
|
||||||
|
imul ecx,eax
|
||||||
|
imul ecx,15
|
||||||
|
add ecx,(1200*1000)*3+50*(20*20*3)+500000+16000+0x4000
|
||||||
|
mcall SF_SYS_MISC,SSF_MEM_REALLOC,,[ScreenPointer]
|
||||||
|
mov [ScreenPointer],eax
|
||||||
|
call prepare_data_pointers
|
||||||
|
pop ebx
|
||||||
|
stdcall [img_to_rgb2], ebx,[PointerToPicture] ;преобразуем изображение к формату rgb
|
||||||
|
stdcall [img_destroy], ebx ;удаляем временный буфер с параметрами изображения
|
||||||
mov [save_flag],1
|
mov [save_flag],1
|
||||||
jmp no_unpakcing_file_1
|
.end_open:
|
||||||
|
|
||||||
no_unpakcing_bmp_file_1:
|
|
||||||
cmp [type],'GI'
|
|
||||||
jne no_unpakcing_file_1
|
|
||||||
;GIF DECODER
|
|
||||||
sub edi,8
|
|
||||||
call ReadGIF
|
|
||||||
mov [save_flag],1
|
|
||||||
|
|
||||||
no_unpakcing_file_1:
|
|
||||||
call MovePictureToWorkScreen
|
|
||||||
mov [Scroll1CoordinatX],9
|
|
||||||
mov [Scroll2CoordinatY],89
|
|
||||||
ret
|
ret
|
||||||
|
@ -164,99 +164,14 @@ no_new:
|
|||||||
cmp [OpenDialog_data.status],1
|
cmp [OpenDialog_data.status],1
|
||||||
jne still
|
jne still
|
||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
open_1:
|
;open_1:
|
||||||
mcall 40,0x80000027 ; 100111b
|
mcall 40,0x80000027 ; 100111b
|
||||||
|
|
||||||
mov eax,file_path
|
call load_picture
|
||||||
mov ebx,[ScreenPointer]
|
|
||||||
add ebx,0x10000
|
|
||||||
|
|
||||||
call load_heading_of_file
|
|
||||||
|
|
||||||
mov esi,[ScreenPointer]
|
|
||||||
add esi,0x10000
|
|
||||||
;-------------is this BMP file ?----------------
|
|
||||||
xor eax,eax
|
|
||||||
mov ax,[esi]
|
|
||||||
mov [type],ax
|
|
||||||
|
|
||||||
cmp [type],word 'BM'
|
|
||||||
jne no_bmp_file
|
|
||||||
|
|
||||||
xor eax,eax
|
|
||||||
xor ebx,ebx
|
|
||||||
mov eax,[esi+18]
|
|
||||||
mov ebx,[esi+22]
|
|
||||||
mov [Picture_SizeX],eax
|
|
||||||
mov [Picture_SizeY],ebx
|
|
||||||
jmp exit_type
|
|
||||||
;---------------------------------------------------------------------
|
|
||||||
no_bmp_file:
|
|
||||||
;-------------is this GIF file ?----------------
|
|
||||||
xor eax,eax
|
|
||||||
mov ax,[esi]
|
|
||||||
mov [type],ax
|
|
||||||
|
|
||||||
cmp [type],'GI'
|
|
||||||
jne no_gif_file
|
|
||||||
|
|
||||||
add esi,6
|
|
||||||
xor eax,eax
|
|
||||||
xor ebx,ebx
|
|
||||||
mov ax,word[esi]
|
|
||||||
mov bx,word[esi+2]
|
|
||||||
mov [Picture_SizeX],eax
|
|
||||||
mov [Picture_SizeY],ebx
|
|
||||||
jmp exit_type
|
|
||||||
;---------------------------------------------------------------------
|
|
||||||
no_gif_file:
|
|
||||||
jmp no_unpakcing_file
|
|
||||||
;---------------------------------------------------------------------
|
|
||||||
exit_type:
|
|
||||||
;----------------------------------------------------------
|
|
||||||
;Get momory for unpacking picture and for picture's bufers
|
|
||||||
;----------------------------------------------------------
|
|
||||||
call GetMemory
|
|
||||||
;----------------------------------------------------------
|
|
||||||
;--------------------Load file in memory-------------------
|
|
||||||
;----------------------------------------------------------
|
|
||||||
mov eax,file_path
|
|
||||||
mov ebx,[PointerToCopyPicture]
|
|
||||||
add ebx,1000
|
|
||||||
call load_file
|
|
||||||
;----------------------------------------------------------
|
|
||||||
;-------------------Unpacking picture----------------------
|
|
||||||
;----------------------------------------------------------
|
|
||||||
mov esi,[PointerToCopyPicture]
|
|
||||||
add esi,1000
|
|
||||||
mov edi,[PointerToPicture]
|
|
||||||
mov eax,[ScreenPointer]
|
|
||||||
|
|
||||||
cmp [type],'BM'
|
|
||||||
jne no_unpakcing_bmp_file
|
|
||||||
;BMP DECODER
|
|
||||||
|
|
||||||
call bmptoimg
|
|
||||||
|
|
||||||
mov [save_flag],1
|
|
||||||
jmp draw_1
|
|
||||||
;---------------------------------------------------------------------
|
|
||||||
no_unpakcing_bmp_file:
|
|
||||||
cmp [type],'GI'
|
|
||||||
jne no_unpakcing_file
|
|
||||||
;GIF DECODER
|
|
||||||
sub edi,8
|
|
||||||
|
|
||||||
call ReadGIF
|
|
||||||
|
|
||||||
mov [save_flag],1
|
|
||||||
jmp draw_1
|
|
||||||
;---------------------------------------------------------------------
|
|
||||||
no_unpakcing_file:
|
|
||||||
call load_icons
|
call load_icons
|
||||||
draw_1:
|
|
||||||
call drawwin
|
call drawwin
|
||||||
open_2:
|
|
||||||
mov [Scroll1CoordinatX],9
|
mov [Scroll1CoordinatX],9
|
||||||
mov [Scroll2CoordinatY],89
|
mov [Scroll2CoordinatY],89
|
||||||
and [number_panel],0
|
and [number_panel],0
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
;**********************************************************
|
;**********************************************************
|
||||||
;------------------TEXT DATA-------------------------------
|
;------------------TEXT DATA-------------------------------
|
||||||
;**********************************************************
|
;**********************************************************
|
||||||
name_of_program db 'ANIMAGE graphics editor v1.3',0
|
name_of_program db 'ANIMAGE graphics editor v1.4',0
|
||||||
mouse_pos_x db 'X='
|
mouse_pos_x db 'X='
|
||||||
mouse_pos_y db 'Y='
|
mouse_pos_y db 'Y='
|
||||||
new_text1 db 'PICTURE SIZE X'
|
new_text1 db 'PICTURE SIZE X'
|
||||||
|
Loading…
Reference in New Issue
Block a user