Cairo__PatternGradientLinear.st
author Jan Vrany <jan.vrany@labware.com>
Mon, 15 Jun 2020 15:16:56 +0100
changeset 90 b808c338d5c3
parent 88 9d51db2ba641
permissions -rw-r--r--
Fix `SimpleView >> redrawWithCairoBuffered:...` after an API change ...which happened a loong time ago but went unnoticed.

"
stx:goodies/libcairo - Cairo graphics bindings for Smalltalk/X

Copyright (C) 2008-2019 Jan Vrany

This code is licensed under Creative Commons Attribution-NonCommercial License.
For full text of the license, see file LICENSE.txt
"
"{ Package: 'stx:goodies/libcairo' }"

"{ NameSpace: Cairo }"

PatternGradient subclass:#PatternGradientLinear
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'Cairo-Objects'
!

!PatternGradientLinear class methodsFor:'documentation'!

copyright
"
stx:goodies/libcairo - Cairo graphics bindings for Smalltalk/X

Copyright (C) 2008-2019 Jan Vrany

This code is licensed under Creative Commons Attribution-NonCommercial License.
For full text of the license, see file LICENSE.txt
"
! !

!PatternGradientLinear methodsFor:'accessing'!

points
    "Gets the gradient endpoints."

    | x0CellPtr y0CellPtr x1CellPtr y1CellPtr points |

    x0CellPtr := ExternalBytes basicNew allocateBytes: ExternalBytes sizeofDouble.
    y0CellPtr := ExternalBytes basicNew allocateBytes: ExternalBytes sizeofDouble.
    x1CellPtr := ExternalBytes basicNew allocateBytes: ExternalBytes sizeofDouble.
    y1CellPtr := ExternalBytes basicNew allocateBytes: ExternalBytes sizeofDouble.
    [ 
        CPrimitives cairo_pattern_get_linear_points: self _: x0CellPtr _: y0CellPtr _: x1CellPtr _: y1CellPtr.
        points := Array with: (x0CellPtr doubleAt:1) @ (y0CellPtr doubleAt:1) 
                        with: (x1CellPtr doubleAt:1) @ (y1CellPtr doubleAt:1) 
    ] ensure:[ 
        x0CellPtr free.
        y0CellPtr free.
        x1CellPtr free.
        y1CellPtr free.
    ].
    ^ points

    "Created: / 15-03-2016 / 21:35:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !