; _______________________________________________________________________________________
;| |
;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
;|_______________________________________________________________________________________|
;
; Description: Draw library contains procedures for drawing oprtations.
;
; Target OS: Win32
;
; Dependencies:
;
; Notes:
;_________________________________________________________________________________________
lsEndCapRound = PS_ENDCAP_ROUND
lsEndCapSquare = PS_ENDCAP_SQUARE
lsEndCapFlat = PS_ENDCAP_FLAT
lsJoinRound = PS_JOIN_ROUND
lsJoinBevel = PS_JOIN_BEVEL
lsJoinMiter = PS_JOIN_MITER
proc DrawLine, .context, .x1, .y1, .x2, .y2
begin
push eax ebx ecx edx
mov ebx, [.context]
invoke MoveToEx, [ebx+TContext.handle], [.x1], [.y1], 0
invoke LineTo, [ebx+TContext.handle], [.x2], [.y2]
pop edx ecx ebx eax
return
endp
proc DrawFillRect, .context, .x, .y, .width, .height, .color
begin
push eax ebx ecx edx esi
mov ebx, [.context]
mov eax, [.color]
bswap eax
ror eax, 8
mov esi, eax
invoke CreateSolidBrush, esi
invoke SelectObject, [ebx+TContext.handle], eax
push eax
invoke CreatePen, PS_SOLID, 0, esi
invoke SelectObject, [ebx+TContext.handle], eax
push eax
mov eax, [.x]
mov ecx, [.y]
add eax, [.width]
add ecx, [.height]
cmp [.width], 1
je .line1
cmp [.height], 1
jne .rect
dec ecx
jmp .line
.line1:
dec eax
.line:
invoke MoveToEx, [ebx+TContext.handle], eax, ecx, 0
invoke LineTo, [ebx+TContext.handle], [.x], [.y]
inc [.x]
invoke LineTo, [ebx+TContext.handle],[.x], [.y]
jmp .free
.rect:
invoke Rectangle, [ebx+TContext.handle], [.x], [.y], eax, ecx
; lea ecx, [.x]
; invoke FillRect, [ebx+TContext.handle], ecx, eax
.free:
invoke SelectObject, [ebx+TContext.handle] ; from the stack.
invoke DeleteObject, eax
invoke SelectObject, [ebx+TContext.handle] ; from the stack.
invoke DeleteObject, eax
pop esi edx ecx ebx eax
return
endp
macro Outline [type, x, y] {
common
local ..types, ..points, ..count
dd ..count
dd ..types
dd ..points
common
label ..types byte
forward
db type
common
label ..points dword
forward
dd x
dd y
}
proc Draw, .raster, .pDrawPoints
begin
return
endp