File: gegl_linear-gradient.lua

package info (click to toggle)
gegl 1%3A0.4.66-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 33,032 kB
  • sloc: ansic: 241,723; cpp: 4,529; lisp: 3,614; xml: 2,724; python: 1,208; ruby: 1,205; sh: 182; makefile: 35; javascript: 6
file content (33 lines) | stat: -rw-r--r-- 1,156 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

local start_x = active:get_property("start-x").value
local start_y = active:get_property("start-y").value
local end_x = active:get_property("end-x").value
local end_y = active:get_property("end-y").value

touch_point(start_x, start_y)
mrg:listen(Mrg.DRAG, function(ev)
  if ev.type == Mrg.DRAG_MOTION then
    local start_x = active:get_property("start-x").value
    local start_y = active:get_property("start-y").value
    start_x = start_x + ev.delta_x
    start_y = start_y + ev.delta_y
    active:set_property("start-y", GObject.Value(GObject.Type.DOUBLE, start_y))
    active:set_property("start-x", GObject.Value(GObject.Type.DOUBLE, start_x))
    ev:stop_propagate();
  end
end)

touch_point(end_x, end_y)
mrg:listen(Mrg.DRAG, function(ev)
  if ev.type == Mrg.DRAG_MOTION then
    local end_x = active:get_property("end-x").value
    local end_y = active:get_property("end-y").value
    end_x = end_x + ev.delta_x
    end_y = end_y + ev.delta_y
    active:set_property("end-y", GObject.Value(GObject.Type.DOUBLE, end_y))
    active:set_property("end-x", GObject.Value(GObject.Type.DOUBLE, end_x))
    ev:stop_propagate();
  end
end)
cr:new_path()