Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 782 → Rev 783

/programs/develop/libraries/libs-dev/.test/002/test002.asm
14,6 → 14,7
include '../dll.inc'
 
include '../../libio/libio.inc'
include '../../libimg/libimg.inc'
 
;-----------------------------------------------------------------------------
 
49,6 → 50,7
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
75,16 → 77,62
 
button:
mcall 17
cmp ah, 1
shr eax, 8
 
; flip horizontally
cmp eax, 'flh'
jne @f
 
invoke img.flip, [image], FLIP_HORIZONTAL
jmp redraw_image
 
; flip vertically
@@: cmp eax, 'flv'
jne @f
 
invoke img.flip, [image], FLIP_VERTICAL
jmp redraw_image
 
; flip both horizontally and vertically
@@: cmp eax, 'flb'
jne @f
 
invoke img.flip, [image], FLIP_BOTH
jmp redraw_image
 
; rotate left
@@: cmp eax, 'rtl'
jne @f
 
invoke img.rotate, [image], ROTATE_90_CCW
jmp redraw_image
 
; rotate right
@@: cmp eax, 'rtr'
jne @f
 
invoke img.rotate, [image], ROTATE_90_CW
jmp redraw_image
 
@@: cmp eax, 1
jne still
 
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]
93,13 → 141,27
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
invoke gfx.line, [ctx], 0, 30, 630, 30
 
mcall 8, <5 + 25 * 0, 20>, <5, 20>, 'flh', 0x007F7F7F
mcall 8, <5 + 25 * 1, 20>, <5, 20>, 'flv', 0x007F7F7F
mcall 8, <5 + 25 * 2, 20>, <5, 20>, 'flb', 0x007F7F7F
 
invoke gfx.line, [ctx], 5 + 25 * 3, 0, 5 + 25 * 3, 30
 
mcall 8, <10 + 25 * 3, 20>, <5, 20>, 'rtl', 0x007F7F7F
mcall 8, <10 + 25 * 4, 20>, <5, 20>, 'rtr', 0x007F7F7F
 
mov ebx, [rgb_img]
mov ecx, [ebx + 0]
shl ecx, 16
mov cx, [ebx + 4]
add ebx, 4 * 2
mcall 7, , , <0, 0>
mcall 7, , , <5, 35>
 
invoke gfx.close, [ctx]
ret
168,6 → 230,7
libimg , 'libimg.obj'
 
import libio , \
libio.init , 'lib_init' , \
file.size , 'file.size' , \
file.open , 'file.open' , \
file.read , 'file.read' , \
174,13 → 237,19
file.close , 'file.close'
 
import libgfx , \
libgfx.init , 'lib_init' , \
gfx.open , 'gfx.open' , \
gfx.close , 'gfx.close'
gfx.close , 'gfx.close' , \
gfx.pen.color , 'gfx.pen.color' , \
gfx.line , 'gfx.line'
 
import libimg , \
libimg.init , 'lib_init' , \
img.is_img , 'img.is_img' , \
img.to_rgb , 'img.to_rgb' , \
img.decode , 'img.decode'
img.decode , 'img.decode' , \
img.flip , 'img.flip' , \
img.rotate , 'img.rotate'
 
;-----------------------------------------------------------------------------
 
190,6 → 259,7
img_data_len dd ?
fh dd ?
rgb_img dd ?
image dd ?
 
ctx dd ?
 
/programs/develop/libraries/libs-dev/.test/dll.inc
58,8 → 58,11
 
proc dll.GetProcAddress, exp:dword,sz_name:dword
mov edx,[exp]
.next: test edx,edx
xor eax,eax
.next: or edx,edx
jz .end
cmp dword[edx],0
jz .end
stdcall strcmp,[edx],[sz_name]
test eax,eax
jz .ok