Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 2405 → Rev 2404

/programs/develop/libraries/libs-dev/.test/002/test002.asm
44,19 → 44,27
inc eax
jz exit
invoke img.decode, [img_data], [img_data_len], 0
invoke img.is_img, [img_data], [img_data_len]
or eax, eax
jz exit
invoke img.decode, [img_data], [img_data_len]
or eax, eax
jz exit
mov [image], eax
invoke img.to_rgb, eax
or eax, eax
jz exit
mov [rgb_img], eax
 
;-----------------------------------------------------------------------------
 
redraw:
red:
call draw_window
 
still:
mcall 10
cmp eax, 1
je redraw
je red
cmp eax, 2
je key
cmp eax, 3
76,7 → 84,7
jne @f
 
invoke img.flip, [image], FLIP_HORIZONTAL
jmp redraw
jmp redraw_image
 
; flip vertically
@@: cmp eax, 'flv'
83,7 → 91,7
jne @f
 
invoke img.flip, [image], FLIP_VERTICAL
jmp redraw
jmp redraw_image
 
; flip both horizontally and vertically
@@: cmp eax, 'flb'
90,7 → 98,7
jne @f
 
invoke img.flip, [image], FLIP_BOTH
jmp redraw
jmp redraw_image
 
; rotate left
@@: cmp eax, 'rtl'
97,7 → 105,7
jne @f
 
invoke img.rotate, [image], ROTATE_90_CCW
jmp redraw
jmp redraw_image
 
; rotate right
@@: cmp eax, 'rtr'
104,7 → 112,7
jne @f
 
invoke img.rotate, [image], ROTATE_90_CW
jmp redraw
jmp redraw_image
 
@@: cmp eax, 1
jne still
112,11 → 120,28
exit:
mcall -1
 
redraw_image:
stdcall mem.Free, [rgb_img]
invoke img.to_rgb, [image]
or eax, eax
jz exit
mov [rgb_img], eax
jmp red
 
draw_window:
invoke gfx.open, TRUE
mov [ctx], eax
 
@^
mov edi, [rgb_img]
mov ebx, 200 * 65536
mov bx, [edi + 0]
add bx, 9
mov ecx, 200 * 65536
mov cx, [edi + 4]
add cx, 5 + 21
mcall 0, , , 0x33FF0000, , s_header
^@
mcall 0, <100, 640>, <100, 480>, 0x33FFFFFF, , s_header
 
invoke gfx.pen.color, [ctx], 0x007F7F7F
131,8 → 156,12
mcall 8, <10 + 25 * 3, 20>, <5, 20>, 'rtl', 0x007F7F7F
mcall 8, <10 + 25 * 4, 20>, <5, 20>, 'rtr', 0x007F7F7F
 
mov eax, [image]
stdcall [img.draw], eax, 5, 35, [eax + Image.Width], [eax + Image.Height], 0, 0
mov ebx, [rgb_img]
mov ecx, [ebx + 0]
shl ecx, 16
mov cx, [ebx + 4]
add ebx, 4 * 2
mcall 7, , , <5, 35>
 
invoke gfx.close, [ctx]
ret
202,24 → 231,25
 
import libio , \
libio.init , 'lib_init' , \
file.size , 'file_size' , \
file.open , 'file_open' , \
file.read , 'file_read' , \
file.close , 'file_close'
file.size , 'file.size' , \
file.open , 'file.open' , \
file.read , 'file.read' , \
file.close , 'file.close'
 
import libgfx , \
libgfx.init , 'lib_init' , \
gfx.open , 'gfx_open' , \
gfx.close , 'gfx_close' , \
gfx.pen.color , 'gfx_pen_color' , \
gfx.line , 'gfx_line'
gfx.open , 'gfx.open' , \
gfx.close , 'gfx.close' , \
gfx.pen.color , 'gfx.pen.color' , \
gfx.line , 'gfx.line'
 
import libimg , \
libimg.init , 'lib_init' , \
img.draw , 'img_draw' , \
img.decode , 'img_decode' , \
img.flip , 'img_flip' , \
img.rotate , 'img_rotate'
img.is_img , 'img.is_img' , \
img.to_rgb , 'img.to_rgb' , \
img.decode , 'img.decode' , \
img.flip , 'img.flip' , \
img.rotate , 'img.rotate'
 
;-----------------------------------------------------------------------------
 
228,6 → 258,7
img_data dd ?
img_data_len dd ?
fh dd ?
rgb_img dd ?
image dd ?
 
ctx dd ?