Cairo__PatternSurface.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Tue, 05 Apr 2016 10:00:57 +0100
changeset 77 cdf856e78998
parent 63 054f0513ea65
child 88 9d51db2ba641
permissions -rw-r--r--
CairoGraphicsContext: Fixed paint setting Even though methods like #foreground: / #foreground:background: method are marked obsolete for quite some time, a lot of core widgets are still using them (!). Therefore CairoGraphicsContext must implement them to correctly update Cairo context. This fixes issues with EditField.

"{ 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>"
! !