Subversion Repositories Kolibri OS

Rev

Rev 2063 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2063 mario79 1
;---------------------------------------------------------------------
2
;    MAGNIFY SCREEN v1.0
31 halyavin 3
;
2063 mario79 4
;    Version for KolibriOS 2005-2011
31 halyavin 5
;
2063 mario79 6
;    Version for Menuet to 2005
7
;---------------------------------------------------------------------
8
; last update:  08/18/2011
9
; changed by:   Marat Zakiyanov aka Mario79, aka Mario
10
; changes:      Checking for "rolled up" window
11
;---------------------------------------------------------------------
12
	use32
13
	org     0x0
14
	db      'MENUET01'              ; 8 byte id
15
	dd      1                       ; header version
16
	dd      START                   ; program start
17
	dd      I_END                   ; program image size
18
	dd      0x1000                  ; required amount of memory
19
	dd      0x1000                  ; esp
20
	dd      0, 0                    ; no parameters, no path
21
;---------------------------------------------------------------------
22
include 'lang.inc'
485 heavyiron 23
include '..\..\..\macros.inc'
209 diamond 24
delay   equ     20
31 halyavin 25
 
209 diamond 26
magnify_width = 40
27
magnify_height = 30
2063 mario79 28
;---------------------------------------------------------------------
31 halyavin 29
START:                          ; start of execution
209 diamond 30
redraw:
2063 mario79 31
	call	draw_window
31 halyavin 32
still:
2063 mario79 33
	call	draw_magnify
209 diamond 34
wtevent:
2063 mario79 35
	mcall	23,delay	; wait here for event with timeout
36
	dec	eax
37
	js	still
38
	jz	redraw
39
	dec	eax
40
	jnz	button
209 diamond 41
; key in buffer
2063 mario79 42
	mov	al, 2
43
	mcall
44
	jmp	wtevent
45
;---------------------------------------------------------------------
209 diamond 46
button:
47
; we have only one button, close
2063 mario79 48
	or	eax, -1
49
	mcall
50
;---------------------------------------------------------------------
31 halyavin 51
;   *******  WINDOW DEFINITIONS AND DRAW ********
2063 mario79 52
;---------------------------------------------------------------------
31 halyavin 53
draw_window:
2063 mario79 54
	mcall	12,1
55
 
56
	mov	al, 48          ; function 48 : graphics parameters
57
	mov	bl, 4           ; subfunction 4 : get skin height
58
	mcall
59
					; DRAW WINDOW
60
	mov	ebx, 100*65536 + 8*magnify_width + 8
61
	lea	ecx, [eax + 100*65536 + 8*magnify_height + 3]
62
	mov	edx, 0x34000000         ; color of work area RRGGBB
63
	mov	edi, labelt             ; header
64
	xor	eax, eax                ; function 0 : define and draw window
65
	mcall
66
 
67
	mcall	12,2
68
	ret
69
;---------------------------------------------------------------------
31 halyavin 70
draw_magnify:
2063 mario79 71
	mcall	9,procinfo,-1
72
	mov	eax,[procinfo+70] ;status of window
73
	test	eax,100b
74
	jne	.end
31 halyavin 75
 
2063 mario79 76
	mcall	14	; get screen size
77
	movzx	ecx, ax
78
	inc	ecx
79
	mov	[size_y], ecx
80
	shr	eax, 16
81
	inc	eax
82
	mov	[size_x], eax
83
 
84
	xor	ebx, ebx
85
	mcall	37	; get mouse coordinates
86
	mov	ecx, eax
87
	shr	ecx, 16         ; ecx = x
88
	movzx	edx, ax         ; edx = y
89
	inc	ecx
90
	mov	[m_xe], ecx
91
	inc	edx
92
	mov	[m_ye], edx
93
	sub	ecx, magnify_width
94
	sub	edx, magnify_height
95
	mov	[m_x], ecx
96
	mov	[m_y], edx
209 diamond 97
.loop_y:
98
.loop_x:
2063 mario79 99
	xor	eax, eax        ; assume black color for invalid pixels
100
	test	ecx, ecx
101
	js	.nopix
102
	cmp	ecx, [size_x]
103
	jge	.nopix
104
	test	edx, edx
105
	js	.nopix
106
	cmp	edx, [size_y]
107
	jge	.nopix
108
	mov	ebx, edx
109
	imul	ebx, [size_x]
110
	add	ebx, ecx
111
	mcall	35	; read pixel
209 diamond 112
.nopix:
2063 mario79 113
	push	ecx edx
114
	sub	ecx, [m_x]
115
	sub	edx, [m_y]
116
	mov	ebx, ecx
117
	shl	ebx, 3+16
118
	mov	bl, 7
119
	mov	ecx, edx
120
	shl	ecx, 3+16
121
	mov	cl, 7
122
	mov	edx, eax
123
	mcall	13
124
	pop	edx ecx
125
	inc	ecx
126
	cmp	ecx, [m_xe]
127
	jnz	.loop_x
128
	mov	ecx, [m_x]
129
	inc	edx
130
	cmp	edx, [m_ye]
131
	jnz	.loop_y
132
.end:
133
	ret
134
;---------------------------------------------------------------------
31 halyavin 135
; DATA AREA
2063 mario79 136
;---------------------------------------------------------------------
137
if lang eq ru
31 halyavin 138
labelt:
2096 leency 139
    db   'Magnifier - Экранная лупа', 0
2063 mario79 140
else
141
labelt:
2096 leency 142
    db   'Magnifier', 0
2063 mario79 143
end if
31 halyavin 144
 
145
I_END:
209 diamond 146
align 4
147
m_x     dd      ?
148
m_y     dd      ?
149
m_xe    dd      ?
150
m_ye    dd      ?
151
size_x  dd      ?
152
size_y  dd      ?
2063 mario79 153
;---------------------------------------------------------------------
154
procinfo:
155
	rb 1024
156
;---------------------------------------------------------------------