aboutsummaryrefslogtreecommitdiff
path: root/share/library/Passive
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2012-08-12 06:10:27 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2012-08-12 06:10:27 +0200
commita1b79a55d2d70660aa156da460ee2e55ebc99183 (patch)
tree974fa7c63c175d507f66599c5563345a87f5ffe1 /share/library/Passive
parent9366c420264bb48460ec606c3d77c7a504db52f0 (diff)
downloadlogdiag-a1b79a55d2d70660aa156da460ee2e55ebc99183.tar.gz
logdiag-a1b79a55d2d70660aa156da460ee2e55ebc99183.tar.xz
logdiag-a1b79a55d2d70660aa156da460ee2e55ebc99183.zip
Change how Cairo is presented to Lua scripts.
Makes the whole thing a bit more stable and less weird.
Diffstat (limited to 'share/library/Passive')
-rw-r--r--share/library/Passive/capacitor.lua18
-rw-r--r--share/library/Passive/diode.lua68
-rw-r--r--share/library/Passive/inductor.lua16
-rw-r--r--share/library/Passive/resistor.lua64
4 files changed, 83 insertions, 83 deletions
diff --git a/share/library/Passive/capacitor.lua b/share/library/Passive/capacitor.lua
index 121b01d..bd8c408 100644
--- a/share/library/Passive/capacitor.lua
+++ b/share/library/Passive/capacitor.lua
@@ -17,20 +17,20 @@ local terminals = {{-2, 0}, {2, 0}}
-- Rendering
local render = function (cr)
-- The vertical lines
- cr.move_to (-0.2, -1)
- cr.line_to (-0.2, 1)
+ cr:move_to (-0.2, -1)
+ cr:line_to (-0.2, 1)
- cr.move_to (0.2, -1)
- cr.line_to (0.2, 1)
+ cr:move_to (0.2, -1)
+ cr:line_to (0.2, 1)
-- The terminals
- cr.move_to (-2, 0)
- cr.line_to (-0.2, 0)
+ cr:move_to (-2, 0)
+ cr:line_to (-0.2, 0)
- cr.move_to (0.2, 0)
- cr.line_to (2, 0)
+ cr:move_to (0.2, 0)
+ cr:line_to (2, 0)
- cr.stroke ()
+ cr:stroke ()
end
-- Register the symbol
diff --git a/share/library/Passive/diode.lua b/share/library/Passive/diode.lua
index d480b46..46bfa99 100644
--- a/share/library/Passive/diode.lua
+++ b/share/library/Passive/diode.lua
@@ -45,79 +45,79 @@ local terminals = {{-2, 0}, {2, 0}}
-- Rendering
local render = function (cr)
-- The triangle
- cr.move_to (-1, -1)
- cr.line_to (1, 0)
- cr.line_to (-1, 1)
- cr.line_to (-1, -1)
+ cr:move_to (-1, -1)
+ cr:line_to (1, 0)
+ cr:line_to (-1, 1)
+ cr:line_to (-1, -1)
-- The vertical line
- cr.move_to (1, 1)
- cr.line_to (1, -1)
+ cr:move_to (1, 1)
+ cr:line_to (1, -1)
-- The terminals
- cr.move_to (-2, 0)
- cr.line_to (2, 0)
+ cr:move_to (-2, 0)
+ cr:line_to (2, 0)
- cr.stroke ()
+ cr:stroke ()
end
local render_zener = function (cr)
render (cr)
- cr.move_to (1, 1)
- cr.line_to (0.5, 1)
+ cr:move_to (1, 1)
+ cr:line_to (0.5, 1)
- cr.stroke ()
+ cr:stroke ()
end
local render_arrow = function (cr)
- cr.move_to (0, 0)
- cr.line_to (0, -1.5)
+ cr:move_to (0, 0)
+ cr:line_to (0, -1.5)
- cr.stroke ()
+ cr:stroke ()
- cr.move_to (-0.3, -0.7)
- cr.line_to (0, -1.5)
- cr.line_to (0.3, -0.7)
- cr.close_path ()
+ cr:move_to (-0.3, -0.7)
+ cr:line_to (0, -1.5)
+ cr:line_to (0.3, -0.7)
+ cr:close_path ()
- cr.fill ()
+ cr:fill ()
end
local render_radiation = function (cr)
- cr.save ()
- cr.translate (-0.4, 0)
+ cr:save ()
+ cr:translate (-0.4, 0)
render_arrow (cr)
- cr.restore ()
+ cr:restore ()
- cr.save ()
- cr.translate (0.4, 0)
+ cr:save ()
+ cr:translate (0.4, 0)
render_arrow (cr)
- cr.restore ()
+ cr:restore ()
end
local render_led = function (cr)
render (cr)
- cr.save ()
- cr.translate (-0.3, -1.0)
- cr.rotate (math.atan2 (1, 1))
+ cr:save ()
+ cr:translate (-0.3, -1.0)
+ cr:rotate (math.atan2 (1, 1))
render_radiation (cr)
- cr.restore ()
+ cr:restore ()
end
local render_photo = function (cr)
render (cr)
- cr.save ()
- cr.translate (0.75, -2.05)
- cr.rotate (math.atan2 (-1, -1))
+ cr:save ()
+ cr:translate (0.75, -2.05)
+ cr:rotate (math.atan2 (-1, -1))
render_radiation (cr)
- cr.restore ()
+ cr:restore ()
end
-- Register the symbol
diff --git a/share/library/Passive/inductor.lua b/share/library/Passive/inductor.lua
index b63a8f5..34a1cda 100644
--- a/share/library/Passive/inductor.lua
+++ b/share/library/Passive/inductor.lua
@@ -26,22 +26,22 @@ local terminals = {{-2, 0}, {2, 0}}
-- Rendering
local render = function (cr)
-- The arcs
- cr.arc (-1.5, 0, 0.5, math.pi, 0)
- cr.arc (-0.5, 0, 0.5, math.pi, 0)
- cr.arc (0.5, 0, 0.5, math.pi, 0)
- cr.arc (1.5, 0, 0.5, math.pi, 0)
+ cr:arc (-1.5, 0, 0.5, math.pi, 0)
+ cr:arc (-0.5, 0, 0.5, math.pi, 0)
+ cr:arc (0.5, 0, 0.5, math.pi, 0)
+ cr:arc (1.5, 0, 0.5, math.pi, 0)
- cr.stroke ()
+ cr:stroke ()
end
local render_core = function (cr)
render (cr)
-- The core
- cr.move_to (-2, -1)
- cr.line_to (2, -1)
+ cr:move_to (-2, -1)
+ cr:line_to (2, -1)
- cr.stroke ()
+ cr:stroke ()
end
-- Register the symbols
diff --git a/share/library/Passive/resistor.lua b/share/library/Passive/resistor.lua
index fdb1642..7c0b222 100644
--- a/share/library/Passive/resistor.lua
+++ b/share/library/Passive/resistor.lua
@@ -38,63 +38,63 @@ local terminals_pot = {{-2, 0}, {2, 0}, {2, -2}}
-- Rendering
local render = function (cr)
-- The rectangle
- cr.move_to (-1.5, -0.5)
- cr.line_to (1.5, -0.5)
- cr.line_to (1.5, 0.5)
- cr.line_to (-1.5, 0.5)
- cr.line_to (-1.5, -0.5)
+ cr:move_to (-1.5, -0.5)
+ cr:line_to (1.5, -0.5)
+ cr:line_to (1.5, 0.5)
+ cr:line_to (-1.5, 0.5)
+ cr:line_to (-1.5, -0.5)
-- The terminals
- cr.move_to (-2, 0)
- cr.line_to (-1.5, 0)
+ cr:move_to (-2, 0)
+ cr:line_to (-1.5, 0)
- cr.move_to (1.5, 0)
- cr.line_to (2, 0)
+ cr:move_to (1.5, 0)
+ cr:line_to (2, 0)
- cr.stroke ()
+ cr:stroke ()
end
local render_adj = function (cr)
render (cr)
-- The arrow
- cr.move_to (-1, 1)
- cr.line_to (1, -1)
+ cr:move_to (-1, 1)
+ cr:line_to (1, -1)
- cr.stroke ()
+ cr:stroke ()
- cr.save ()
- cr.translate (1.5, -1.5)
- cr.rotate (math.atan2 (1, 1))
+ cr:save ()
+ cr:translate (1.5, -1.5)
+ cr:rotate (math.atan2 (1, 1))
- cr.move_to (0, 0)
- cr.line_to (0.3, 0.8)
- cr.line_to (-0.3, 0.8)
- cr.close_path ()
+ cr:move_to (0, 0)
+ cr:line_to (0.3, 0.8)
+ cr:line_to (-0.3, 0.8)
+ cr:close_path ()
- cr.fill ()
- cr.restore ()
+ cr:fill ()
+ cr:restore ()
end
local render_pot = function (cr)
render (cr)
-- The contact
- cr.move_to (0, -2)
- cr.line_to (2, -2)
+ cr:move_to (0, -2)
+ cr:line_to (2, -2)
-- The arrow
- cr.move_to (0, -2)
- cr.line_to (0, -1)
+ cr:move_to (0, -2)
+ cr:line_to (0, -1)
- cr.stroke ()
+ cr:stroke ()
- cr.move_to (0, -0.5)
- cr.line_to (0.3, -1.3)
- cr.line_to (-0.3, -1.3)
- cr.close_path ()
+ cr:move_to (0, -0.5)
+ cr:line_to (0.3, -1.3)
+ cr:line_to (-0.3, -1.3)
+ cr:close_path ()
- cr.fill ()
+ cr:fill ()
end
-- Register the symbol