colorStop
This commit is contained in:
parent
38b3f3bc03
commit
c7421e3e85
5 changed files with 20 additions and 1 deletions
|
@ -77,7 +77,7 @@ exportObject Color:
|
||||||
discard
|
discard
|
||||||
|
|
||||||
exportObject ColorStop:
|
exportObject ColorStop:
|
||||||
discard
|
discard colorStop(Color(), 0)
|
||||||
|
|
||||||
exportObject TextMetrics:
|
exportObject TextMetrics:
|
||||||
discard
|
discard
|
||||||
|
|
|
@ -10,6 +10,9 @@ proc pixie_vector_2*(x: float32, y: float32): Vector2 {.raises: [], cdecl, expor
|
||||||
proc pixie_matrix_3*(): Matrix3 {.raises: [], cdecl, exportc, dynlib.} =
|
proc pixie_matrix_3*(): Matrix3 {.raises: [], cdecl, exportc, dynlib.} =
|
||||||
matrix3()
|
matrix3()
|
||||||
|
|
||||||
|
proc pixie_color_stop*(color: Color, position: float32): ColorStop {.raises: [], cdecl, exportc, dynlib.} =
|
||||||
|
colorStop(color, position)
|
||||||
|
|
||||||
type SeqFloat32* = ref object
|
type SeqFloat32* = ref object
|
||||||
s: seq[float32]
|
s: seq[float32]
|
||||||
|
|
||||||
|
|
|
@ -210,6 +210,11 @@ proc pixie_take_error(): cstring {.importc: "pixie_take_error", cdecl.}
|
||||||
proc takeError*(): cstring {.inline.} =
|
proc takeError*(): cstring {.inline.} =
|
||||||
result = pixie_take_error()
|
result = pixie_take_error()
|
||||||
|
|
||||||
|
proc pixie_color_stop(color: Color, position: float32): ColorStop {.importc: "pixie_color_stop", cdecl.}
|
||||||
|
|
||||||
|
proc colorStop*(color: Color, position: float32): ColorStop {.inline.} =
|
||||||
|
result = pixie_color_stop(color, position)
|
||||||
|
|
||||||
proc pixie_seq_float_32_len(s: SeqFloat32): int {.importc: "pixie_seq_float_32_len", cdecl.}
|
proc pixie_seq_float_32_len(s: SeqFloat32): int {.importc: "pixie_seq_float_32_len", cdecl.}
|
||||||
|
|
||||||
proc len*(s: SeqFloat32): int =
|
proc len*(s: SeqFloat32): int =
|
||||||
|
|
|
@ -164,6 +164,11 @@ class ColorStop(Structure):
|
||||||
("position", c_float)
|
("position", c_float)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
def __init__(self, color, position):
|
||||||
|
tmp = dll.pixie_color_stop(color, position)
|
||||||
|
self.color = tmp.color
|
||||||
|
self.position = tmp.position
|
||||||
|
|
||||||
def __eq__(self, obj):
|
def __eq__(self, obj):
|
||||||
self.color == obj.color and self.position == obj.position
|
self.color == obj.color and self.position == obj.position
|
||||||
|
|
||||||
|
@ -1288,6 +1293,9 @@ dll.pixie_vector_2.restype = Vector2
|
||||||
dll.pixie_matrix_3.argtypes = []
|
dll.pixie_matrix_3.argtypes = []
|
||||||
dll.pixie_matrix_3.restype = Matrix3
|
dll.pixie_matrix_3.restype = Matrix3
|
||||||
|
|
||||||
|
dll.pixie_color_stop.argtypes = [Color, c_float]
|
||||||
|
dll.pixie_color_stop.restype = ColorStop
|
||||||
|
|
||||||
dll.pixie_seq_float_32_unref.argtypes = [SeqFloat32]
|
dll.pixie_seq_float_32_unref.argtypes = [SeqFloat32]
|
||||||
dll.pixie_seq_float_32_unref.restype = None
|
dll.pixie_seq_float_32_unref.restype = None
|
||||||
|
|
||||||
|
|
|
@ -64,6 +64,9 @@ converter parseSomePaint*(
|
||||||
elif type(paint) is Paint:
|
elif type(paint) is Paint:
|
||||||
paint
|
paint
|
||||||
|
|
||||||
|
proc colorStop*(color: Color, position: float32): ColorStop =
|
||||||
|
ColorStop(color: color, position: position)
|
||||||
|
|
||||||
proc toLineSpace(at, to, point: Vec2): float32 {.inline.} =
|
proc toLineSpace(at, to, point: Vec2): float32 {.inline.} =
|
||||||
## Convert position on to where it would fall on a line between at and to.
|
## Convert position on to where it would fall on a line between at and to.
|
||||||
let
|
let
|
||||||
|
|
Loading…
Reference in a new issue