extensions.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Thu, 10 Jul 2008 21:10:31 +0000
changeset 3 f4f599f2a1b5
parent 2 c2f163833877
child 4 0bf0d8b6f4c5
permissions -rw-r--r--
Added FT font primitives

"{ Package: 'stx:goodies/libcairo' }"

!

!DeviceGraphicsContext methodsFor:'cairo support'!

drawableId

    ^drawableId

    "Created: / 10-07-2008 / 10:20:04 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !
!GraphicsDevice methodsFor:'cairo support'!

cairoSurfaceFor: view

    self error:'Graphics device not supported'

    "Created: / 10-07-2008 / 10:16:21 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !
!GraphicsDevice methodsFor:'accessing'!

displayId
    ^ displayId

    "Created: / 04-07-2008 / 12:58:56 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !
!GraphicsDevice methodsFor:'accessing'!

screen
    ^ screen

    "Created: / 04-07-2008 / 13:12:55 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !
!SimpleView methodsFor:'cairo support'!

cairoGC

    ^self cairoGraphicsContext

    "Created: / 10-07-2008 / 19:41:06 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !
!SimpleView methodsFor:'cairo support'!

cairoGraphicsContext

    ^self cairoSurface graphicsContext

    "Created: / 10-07-2008 / 19:40:31 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !
!SimpleView methodsFor:'cairo support'!

cairoSurface

    ^Cairo::Surface forView: self

    "Created: / 10-07-2008 / 19:39:58 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !
!XWorkstation methodsFor:'cairo support'!

cairoSurfaceFor: view

    | surface |
    surface := Cairo::Surface 
                forXlib: displayId
                drawable: view drawableId address 
                visual: self visualStructure 
                width: view width 
                height: view height.
    view addDependent: surface.
    ^surface

    "Created: / 10-07-2008 / 10:16:36 / Jan Vrany <vranyj1@fel.cvut.cz>"
    "Modified: / 10-07-2008 / 19:32:15 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !
!XWorkstation methodsFor:'cairo support'!

visualStructure

    | screenNumber |
    screenNumber := screen.

    %{
        return __MKEXTERNALADDRESS( DefaultVisual( myDpy , __intVal ( screenNumber ) ) );
    %}.
    ^self primitiveFailed

    "
        Screen current visualStructure    
    "

    "Created: / 10-07-2008 / 11:03:01 / Jan Vrany <vranyj1@fel.cvut.cz>"
    "Modified: / 10-07-2008 / 19:49:28 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !