pixlib 0.1

git-svn-id: svn://kolibrios.org@880 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2008-10-18 09:23:53 +00:00
parent b3fee1b5e7
commit 869e8cdf52
7 changed files with 2655 additions and 2052 deletions

View File

@ -42,8 +42,8 @@ WRect
WFileName
10
clib_r.tgt
21
50
309
342
11
VComponent
12
@ -59,5 +59,5 @@ WFileName
7
crt.tgt
0
12
8
8

File diff suppressed because it is too large Load Diff

View File

@ -294,7 +294,7 @@ WString
COBJ
70
WVList
15
14
71
MVState
72
@ -367,8 +367,8 @@ WString
WCC
89
WString
33
?????Disable stack depth checking
30
?????Call/return optimizations
1
1
90
@ -379,22 +379,22 @@ WString
WCC
92
WString
30
?????Call/return optimizations
25
?????Relax alias checking
1
1
93
MCState
MRState
94
WString
3
WCC
95
WString
25
?????Relax alias checking
1
21
?????Compiler default
1
0
96
MRState
97
@ -415,10 +415,10 @@ WString
WCC
101
WString
21
?????Compiler default
37
?????In-line Pentium Pro instructions
1
1
0
102
MRState
103
@ -427,10 +427,10 @@ WString
WCC
104
WString
37
?????In-line Pentium Pro instructions
1
21
?????Compiler default
1
0
105
MRState
106
@ -439,10 +439,10 @@ WString
WCC
107
WString
21
?????Compiler default
29
?????In-line with coprocessor
1
1
0
108
MRState
109
@ -451,10 +451,10 @@ WString
WCC
110
WString
29
?????In-line with coprocessor
1
21
??2??32bit Flat model
1
0
111
MRState
112
@ -463,473 +463,461 @@ WString
WCC
113
WString
21
??2??32bit Flat model
1
0
114
MRState
115
WString
3
WCC
116
WString
22
??2??32bit Small model
1
1
117
114
WVList
0
-1
1
1
0
118
115
MItem
17
CLIB\CRT\8087cw.c
119
116
WString
4
COBJ
120
117
WVList
0
121
118
WVList
0
68
1
1
0
122
119
MItem
18
CLIB\CRT\___argc.c
123
120
WString
4
COBJ
124
121
WVList
0
125
122
WVList
0
68
1
1
0
126
123
MItem
16
CLIB\CRT\_exit.c
127
124
WString
4
COBJ
128
125
WVList
0
129
126
WVList
0
68
1
1
0
130
127
MItem
16
CLIB\CRT\abort.c
131
128
WString
4
COBJ
132
129
WVList
0
133
130
WVList
0
68
1
1
0
134
131
MItem
16
CLIB\CRT\argcv.c
135
132
WString
4
COBJ
136
133
WVList
0
137
134
WVList
0
68
1
1
0
138
135
MItem
17
CLIB\CRT\atexit.c
139
136
WString
4
COBJ
140
137
WVList
0
141
138
WVList
0
68
1
1
0
142
139
MItem
18
CLIB\CRT\binmode.c
143
140
WString
4
COBJ
144
141
WVList
0
145
142
WVList
0
68
1
1
0
146
143
MItem
18
CLIB\CRT\chk8087.c
147
144
WString
4
COBJ
148
145
WVList
0
149
146
WVList
0
68
1
1
0
150
147
MItem
16
CLIB\CRT\cinit.c
151
148
WString
4
COBJ
152
149
WVList
0
153
150
WVList
0
68
1
1
0
154
151
MItem
18
CLIB\CRT\cmdname.c
155
152
WString
4
COBJ
156
153
WVList
0
157
154
WVList
0
68
1
1
0
158
155
MItem
18
CLIB\CRT\commode.c
159
156
WString
4
COBJ
160
157
WVList
0
161
158
WVList
0
68
1
1
0
162
159
MItem
17
CLIB\CRT\cvtbuf.c
163
160
WString
4
COBJ
164
161
WVList
0
165
162
WVList
0
68
1
1
0
166
163
MItem
16
CLIB\CRT\errno.c
167
164
WString
4
COBJ
168
165
WVList
0
169
166
WVList
0
68
1
1
0
170
167
MItem
19
CLIB\CRT\errnovar.c
171
168
WString
4
COBJ
172
169
WVList
0
173
170
WVList
0
68
1
1
0
174
171
MItem
15
CLIB\CRT\exit.c
175
172
WString
4
COBJ
176
173
WVList
0
177
174
WVList
0
68
1
1
0
178
175
MItem
18
CLIB\CRT\fltused.c
179
176
WString
4
COBJ
180
177
WVList
0
181
178
WVList
0
68
1
1
0
182
179
MItem
19
CLIB\CRT\fpexcept.c
183
180
WString
4
COBJ
184
181
WVList
0
185
182
WVList
0
68
1
1
0
186
183
MItem
19
CLIB\CRT\initargv.c
187
184
WString
4
COBJ
188
185
WVList
0
189
186
WVList
0
68
1
1
0
190
187
MItem
19
CLIB\CRT\initrtns.c
191
188
WString
4
COBJ
192
189
WVList
0
193
190
WVList
0
68
1
1
0
194
191
MItem
17
CLIB\CRT\ioexit.c
195
192
WString
4
COBJ
196
193
WVList
0
197
194
WVList
0
68
1
1
0
198
195
MItem
18
CLIB\CRT\ljmphdl.c
199
196
WString
4
COBJ
200
197
WVList
0
201
198
WVList
0
68
1
1
0
202
199
MItem
19
CLIB\CRT\main2wnt.c
203
200
WString
4
COBJ
204
201
WVList
0
205
202
WVList
0
68
1
1
0
206
203
MItem
19
CLIB\CRT\seterrno.c
207
204
WString
4
COBJ
208
205
WVList
0
209
206
WVList
0
68
1
1
0
210
207
MItem
19
CLIB\CRT\stackwnt.c
211
208
WString
4
COBJ
212
209
WVList
0
213
210
WVList
0
68
1
1
0
214
211
MItem
18
CLIB\CRT\xmsgwnt.c
215
212
WString
4
COBJ
216
213
WVList
0
217
214
WVList
0
68

View File

@ -0,0 +1,270 @@
include 'proc32.inc'
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
use32
db 'MENUET01'
dd 1
dd start
dd i_end
dd mem
dd mem
dd 0
dd 0
include 'pixlib.inc'
align 4
start:
call load_pxlib
test eax, eax
jz .fail
sub esp, 1024
mov eax, 9
mov ebx, esp
mov ecx, -1
int 0x40
movzx ecx, word [esp+0x1E]
mov eax, 18
mov ebx, 21
int 0x40
mov [slot], eax
add esp, 1024
mov eax,48 ; get system colors
mov ebx,3
mov ecx,sc
mov edx,10*4
int 0x40
.redraw:
call draw_window
.wait_event:
mov eax, 18
mov ebx, 7
int 0x40
cmp eax, [slot]
jne .skip_draw
sub esp, 1024
mov eax, 9
mov ebx, esp
mov ecx, -1
int 0x40
mov edx, [esp+0x22]; xwin
mov ecx, [esp+0x26]; ywin
add edx, [esp+0x36]
add ecx, [esp+0x3A]
mov eax, [esp+0x3E]
mov ebx, [esp+0x42]
add esp, 1024
test eax, eax
jle .skip_draw
test ebx, ebx
jle .skip_draw
push ebx
push eax
push ecx
push edx
call _Draw
add esp, 16
.skip_draw:
; mov ebx, 1
; mov eax, 23
; int 0x40
mov eax, 11
int 0x40
dec eax ; if event = 1
js .wait_event
jz .redraw ; jump to redraw handler
dec eax ; else if event = 2
jz .key ; jump to key handler
dec eax
jz .button
jmp .wait_event
.button: ; button event handler
mov al, 17 ; get button identifier
int 0x40
cmp ah, 1
jne .wait_event ; return if button id != 1
.exit:
; restore old screen and cleanup
.fail:
or eax, -1 ; exit application
int 0x40
.key: ; key event handler
mov al, 2 ; get key code
int 0x40
jmp .wait_event
draw_window:
mov eax, 12 ; start drawing
mov ebx, 1
int 0x40
xor eax, eax ; create and draw the window
mov ebx, 100*65536+320 ; (window_cx)*65536+(window_sx)
mov ecx, 100*65536+240 ; (window_cy)*65536+(window_sy)
mov edx, [sc.work] ; work area color
or edx, 0x33000000 ; & window type 3
mov edi, title ; window title
int 0x40
mov eax, 12 ; finish drawing
mov ebx, 2
int 0x40
ret
DWORD equ dword
PTR equ
_Draw:
push ebp
xor edx, edx
push edi
push esi
push ebx
sub esp, 44
imul eax, DWORD PTR [_glSeed], 69069
mov ebp, DWORD PTR [esp+72]
mov ecx, DWORD PTR [esp+76]
inc eax
mov DWORD PTR [esp+32], eax
imul eax, eax, 69069
inc eax
mov DWORD PTR [esp+36], eax
imul eax, eax, 69069
inc eax
mov DWORD PTR [esp+40], eax
imul eax, eax, 69069
lea ebx, [eax+1]
mov eax, ebx
div ebp
imul eax, ebx, 69069
lea ebx, [eax+1]
mov eax, ebx
mov edi, edx
xor edx, edx
div ecx
imul eax, ebx, 69069
lea ebx, [eax+1]
mov eax, ebx
mov esi, edx
xor edx, edx
div ebp
imul eax, ebx, 69069
inc eax
mov DWORD PTR [_glSeed], eax
mov ebp, edx
mov DWORD PTR [esp+28], edx
xor edx, edx
div ecx
cmp ebp, edi
mov ebx, edx
jge L2
mov DWORD PTR [esp+28], edi
mov edi, ebp
L2:
cmp ebx, esi
jge L4
mov ebx, esi
mov esi, edx
L4:
push eax
mov ecx, 255
push -16777216
mov eax, DWORD PTR [esp+40]
xor edx, edx
div ecx
mov eax, DWORD PTR [esp+48]
mov ebp, edx
xor edx, edx
div ecx
mov eax, DWORD PTR [esp+44]
sal ebp, 16
or ebp, -16777216
mov DWORD PTR [esp+8], edx
or ebp, edx
xor edx, edx
div ecx
lea eax, [ebx+1]
sub eax, esi
sal edx, 8
or ebp, edx
push ebp
push eax
mov eax, DWORD PTR [esp+44]
inc eax
sub eax, edi
push eax
mov eax, esi
add eax, DWORD PTR [esp+88]
push eax
mov eax, edi
add eax, DWORD PTR [esp+88]
push eax
push -1
call [imp_DrawRect]
add esp, 76
pop ebx
pop esi
pop edi
pop ebp
ret
align 4
count dd 0
_glSeed dd -365387184
title db 'Draw rect demo',0
i_end:
align 4
slot rd 1
sc system_colors
align 16
rb 2048 ;stack
mem:

View File

@ -0,0 +1,278 @@
include 'proc32.inc'
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
use32
db 'MENUET01'
dd 1
dd start
dd i_end
dd mem
dd mem
dd 0
dd 0
include 'pixlib.inc'
align 4
start:
call load_pxlib
test eax, eax
jz .fail
sub esp, 1024
mov eax, 9
mov ebx, esp
mov ecx, -1
int 0x40
movzx ecx, word [esp+0x1E]
mov eax, 18
mov ebx, 21
int 0x40
mov [slot], eax
add esp, 1024
mov eax,48 ; get system colors
mov ebx,3
mov ecx,sc
mov edx,10*4
int 0x40
CreateHatch HS_CROSS, 0xFFFFFFFF, 0xFF000000
mov [br_cross], eax
CreateHatch HS_DIAGCROSS, 0xFFFFFFFF, 0xFF000000
mov [br_dcross], eax
CreateHatch HS_HORIZONTAL, 0xFFFFFFFF, 0xFF000000
mov [br_horz], eax
CreateHatch HS_VERTICAL, 0xFFFFFFFF, 0xFF000000
mov [br_vert], eax
CreateHatch HS_FDIAGONAL, 0xFFFFFFFF, 0xFF000000
mov [br_fd], eax
CreateHatch HS_BDIAGONAL, 0xFFFFFFFF, 0xFF000000
mov [br_bd], eax
.redraw:
call draw_window
.wait_event:
mov eax, 18
mov ebx, 7
int 0x40
cmp eax, [slot]
jne .skip_draw
sub esp, 1024
mov eax, 9
mov ebx, esp
mov ecx, -1
int 0x40
mov edx, [esp+0x22]; xwin
mov ecx, [esp+0x26]; ywin
add edx, [esp+0x36]
add ecx, [esp+0x3A]
mov eax, [esp+0x3E] ;width
mov ebx, [esp+0x42] ;height
add esp, 1024
cmp eax, 50
jle .skip_draw
cmp ebx, 40
jle .skip_draw
push ebx
push eax
push ecx
push edx
call _Draw
add esp, 16
.skip_draw:
mov ebx, 1000
mov eax, 23
int 0x40
; mov eax, 11
; int 0x40
dec eax ; if event = 1
; js .wait_event
jz .redraw ; jump to redraw handler
dec eax ; else if event = 2
jz .key ; jump to key handler
dec eax
jz .button
jmp .wait_event
.button: ; button event handler
mov al, 17 ; get button identifier
int 0x40
cmp ah, 1
jne .wait_event ; return if button id != 1
.exit:
; restore old screen and cleanup
.fail:
or eax, -1 ; exit application
int 0x40
.key: ; key event handler
mov al, 2 ; get key code
int 0x40
jmp .wait_event
draw_window:
mov eax, 12 ; start drawing
mov ebx, 1
int 0x40
xor eax, eax ; create and draw the window
mov ebx, 100*65536+320 ; (window_cx)*65536+(window_sx)
mov ecx, 100*65536+240 ; (window_cy)*65536+(window_sy)
mov edx, [sc.work] ; work area color
or edx, 0x33000000 ; & window type 3
mov edi, title ; window title
int 0x40
mov eax, 12 ; finish drawing
mov ebx, 2
int 0x40
ret
DWORD equ dword
PTR equ
_Draw:
push ebp
push edi
push esi
push ebx
mov ebx, 1431655766
sub esp, 44
mov esi, DWORD PTR [esp+72]
mov ecx, DWORD PTR [esp+76]
mov DWORD PTR [esp+24], -16777216
mov DWORD PTR [esp], -1
lea edi, [esi-40]
mov eax, edi
imul ebx
sar edi, 31
lea eax, [ecx-30]
sub ecx, 10
mov ebp, edx
sub ebp, edi
mov edi, eax
shr edi, 31
add edi, eax
lea edx, [esi-20]
lea eax, [ebp+ebp*2]
sub edx, eax
mov esi, edx
shr esi, 31
add esi, edx
sar esi, 1
add esi, DWORD PTR [esp+64]
sar edi, 1
lea eax, [ebp+10+esi]
mov DWORD PTR [esp+32], eax
lea eax, [edi+edi]
sub ecx, eax
mov ebx, ecx
shr ebx, 31
add ebx, ecx
sar ebx, 1
add ebx, DWORD PTR [esp+68]
lea edx, [esi+20+ebp*2]
mov DWORD PTR [esp+36], edx
lea eax, [ebx+10+edi]
mov DWORD PTR [esp+40], eax
FillRect -1, esi, ebx,ebp, edi, [br_fd], 0xFF000000
mov edx, DWORD PTR [esp+32]
FillRect -1, edx, ebx, ebp, edi, [br_cross], 0xFF000000
mov eax, DWORD PTR [esp+36]
FillRect -1, eax, ebx, ebp, edi, [br_horz],0xFF000000
mov edx, DWORD PTR [esp+40]
FillRect -1, esi, edx, ebp, edi, [br_bd], 0xFF000000
mov edx, DWORD PTR [esp+32]
mov eax, DWORD PTR [esp+40]
FillRect -1, edx, eax, ebp, edi, [br_dcross], 0xFF000000
mov edx, DWORD PTR [esp+36]
mov eax, DWORD PTR [esp+40]
FillRect -1, edx, eax, ebp, edi, [br_vert], 0xFF000000
call [imp_FillRect]
add esp, 44
pop ebx
pop esi
pop edi
pop ebp
ret
align 4
count dd 0
title db 'Hatches',0
i_end:
align 4
slot rd 1
br_fd rd 1
br_bd rd 1
br_cross rd 1
br_dcross rd 1
br_horz rd 1
br_vert rd 1
sc system_colors
align 16
rb 2048 ;stack
mem:

View File

@ -8,7 +8,14 @@ handle CreateHatchBrush(int hatch, color_t bkcolor, color_t fcolor);
Создать штрихованную кисть размером 8х8 пикселей
hatch тип штриховки
hatch тип штриховки:
HS_HORIZONTAL -------
HS_VERTICAL |||||||
HS_FDIAGONAL \\\\\\\
HS_BDIAGONAL ///////
HS_CROSS +++++++
HS_DIAGCROSS xxxxxxx
bkcolor цвет "0"
@ -176,10 +183,10 @@ int Blit(handle dst_pixmap, int dst_x, int dst_y,
Скопировать прямоугольную область пикселей.
dst_pixmap логический номер битмапа в который будет производится
dst_pixmap логический номер битмапа в который будет производитс
копирование. SCR_PIXMAP для первичного экрана.
dst_x, dst_y координаты левого верхнего угла области назначения
dst_x, dst_y координаты левого верхнего угла области назначени
src_pixmap логический номер битмапа - источника пикселей.
SCR_PIXMAP для первичного экрана.
@ -201,10 +208,10 @@ int TransparentBlit(handle dst_pixmap, int dst_x, int dst_y,
Скопировать прямоугольную область пикселей используя прозрачный цвет.
dst_pixmap логический номер битмапа в который будет производится
dst_pixmap логический номер битмапа в который будет производитс
копирование. SCR_PIXMAP для первичного экрана.
dst_x, dst_y координаты левого верхнего угла области назначения
dst_x, dst_y координаты левого верхнего угла области назначени
src_pixmap логический номер битмапа - источника пикселей.
SCR_PIXMAP для первичного экрана.

View File

@ -204,14 +204,14 @@ int DrawRect(io_draw_t* draw)
OUTREG(R5XX_DST_WIDTH_HEIGHT,(w<<16)|1);
h--;
}
if( x0 == draw->x0)
if( (h > 0) && (x0 == draw->x0))
{
R5xxFIFOWait(2);
OUTREG(R5XX_DST_Y_X,(y0<<16)|x0);
OUTREG(R5XX_DST_WIDTH_HEIGHT,(1<<16)|h);
}
if( x1 == xend)
if( (h > 0) && (x1 == xend))
{
R5xxFIFOWait(2);
@ -332,14 +332,14 @@ int FillRect(io_fill_t *fill)
OUTREG(R5XX_DST_WIDTH_HEIGHT,(w<<16)|1);
h--;
}
if( x0 == fill->x)
if( (h > 0) && (x0 == fill->x))
{
R5xxFIFOWait(2);
OUTREG(R5XX_DST_Y_X,(y0<<16)|x0);
OUTREG(R5XX_DST_WIDTH_HEIGHT,(1<<16)|h);
}
if( x1 == xend)
if( (h > 0) && (x1 == xend))
{
R5xxFIFOWait(2);