Cairo__PatternSurface.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Tue, 05 Apr 2016 08:02:32 +0100
changeset 76 f3deda9cea3e
parent 63 054f0513ea65
child 88 9d51db2ba641
permissions -rw-r--r--
Oops, fixed CairoGraphicsContext>>width:height: Must test whether a Cairo context has been created. If not, we're done.

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

"{ NameSpace: Cairo }"

Pattern subclass:#PatternSurface
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'Cairo-Objects'
!

!PatternSurface methodsFor:'accessing'!

surface
    | surfacePtrCell surface |

    surfacePtrCell := ExternalBytes basicNew allocateBytes: ExternalBytes sizeofPointer clear: false.
    [ 
        CPrimitives cairo_pattern_get_surface: self _: surfacePtrCell.
        surface := Surface basicNew.
        surface setAddressFromBytes: surfacePtrCell asByteArray.
        surface := surface reference.
        surface initialize.
    ] ensure:[ 
        surfacePtrCell free.
    ].
    ^ surface.

    "Created: / 05-03-2016 / 23:05:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !