Cairo__PatternGradientLinear.st
changeset 63 054f0513ea65
child 88 9d51db2ba641
equal deleted inserted replaced
62:a1280a796155 63:054f0513ea65
       
     1 "{ Package: 'stx:goodies/libcairo' }"
       
     2 
       
     3 "{ NameSpace: Cairo }"
       
     4 
       
     5 PatternGradient subclass:#PatternGradientLinear
       
     6 	instanceVariableNames:''
       
     7 	classVariableNames:''
       
     8 	poolDictionaries:''
       
     9 	category:'Cairo-Objects'
       
    10 !
       
    11 
       
    12 !PatternGradientLinear methodsFor:'accessing'!
       
    13 
       
    14 points
       
    15     "Gets the gradient endpoints."
       
    16 
       
    17     | x0CellPtr y0CellPtr x1CellPtr y1CellPtr points |
       
    18 
       
    19     x0CellPtr := ExternalBytes basicNew allocateBytes: ExternalBytes sizeofDouble.
       
    20     y0CellPtr := ExternalBytes basicNew allocateBytes: ExternalBytes sizeofDouble.
       
    21     x1CellPtr := ExternalBytes basicNew allocateBytes: ExternalBytes sizeofDouble.
       
    22     y1CellPtr := ExternalBytes basicNew allocateBytes: ExternalBytes sizeofDouble.
       
    23     [ 
       
    24         CPrimitives cairo_pattern_get_linear_points: self _: x0CellPtr _: y0CellPtr _: x1CellPtr _: y1CellPtr.
       
    25         points := Array with: (x0CellPtr doubleAt:1) @ (y0CellPtr doubleAt:1) 
       
    26                         with: (x1CellPtr doubleAt:1) @ (y1CellPtr doubleAt:1) 
       
    27     ] ensure:[ 
       
    28         x0CellPtr free.
       
    29         y0CellPtr free.
       
    30         x1CellPtr free.
       
    31         y1CellPtr free.
       
    32     ].
       
    33     ^ points
       
    34 
       
    35     "Created: / 15-03-2016 / 21:35:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    36 ! !
       
    37