lsEndCapRound = CapRound
lsEndCapSquare = CapButt
lsEndCapFlat   = CapProjecting

lsJoinRound = JoinRound shl 8
lsJoinBevel = JoinBevel shl 8
lsJoinMiter = JoinMiter shl 8



;finalize _DestroyDefaultGC
;begin
;        cinvoke XFreeGC, [hApplicationDisplay], [_DefaultGC]
;        return
;endp
;
;
;
;proc _FixGC
;begin
;
;        cmp     [_DefaultGC], 0
;        jne     .exit
;
;        cmp     [hApplicationDisplay], 0
;        je      .exit
;
;        push    eax
;        cinvoke XDefaultRootWindow, [hApplicationDisplay]
;        cinvoke XCreateGC, [hApplicationDisplay], eax, 0, 0
;        mov     [_DefaultGC], eax
;        pop     eax
;
;.exit:
;        return
;endp
;
;
;
;proc _FixCurrentPos, .raster
;begin
;        push    eax
;        mov     eax, [.raster]
;        cmp     eax, [_CurrentRaster]
;        je      .fixed
;        push    eax 0 0
;        pop     [_CurrentY] [_CurrentX] [_CurrentRaster]
;.fixed:
;        pop     eax
;        return
;endp
;



proc DrawLine, .context, .x1, .y1, .x2, .y2
begin
        push    eax ebx ecx edx

        mov     ebx, [.context]
        cinvoke XDrawLine, [hApplicationDisplay], [ebx+TContext.raster], [ebx+TContext.handle], [.x1], [.y1], [.x2], [.y2]
        pop     edx ecx ebx eax
        return
endp


proc DrawFillRect, .context, .x, .y, .width, .height, .color
begin
        push    eax ebx ecx edx
        mov     ebx, [.context]
        cinvoke XSetForeground, [hApplicationDisplay], [ebx+TContext.handle], [.color]
        cinvoke XFillRectangle, [hApplicationDisplay], [ebx+TContext.raster], [ebx+TContext.handle], [.x], [.y], [.width], [.height]
        pop     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, .context, .pDrawPoints
begin

        return
endp

