summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2019-01-23 20:16:14 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2019-01-23 20:16:14 (GMT)
commitd0a287a4e57b299cec22c94b028e3553d5b36fcd (patch)
tree86a274d6c894ec6506f0b5d55436d958a556f9fc /tools
parentf251814cf0fd10a767972530c119f8f109613c48 (diff)
Prepared a toolbar for actions on basic blocks.
Diffstat (limited to 'tools')
-rw-r--r--tools/icons/collapse.py46
-rw-r--r--tools/icons/expand.py46
-rwxr-xr-xtools/icons/gen.sh9
-rw-r--r--tools/icons/palette.py53
4 files changed, 154 insertions, 0 deletions
diff --git a/tools/icons/collapse.py b/tools/icons/collapse.py
new file mode 100644
index 0000000..c3fe508
--- /dev/null
+++ b/tools/icons/collapse.py
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+
+import cairo
+import sys
+
+
+WIDTH, HEIGHT = 256, 256
+WIDTH, HEIGHT = 12, 12
+
+surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, WIDTH, HEIGHT)
+ctx = cairo.Context(surface)
+
+ctx.scale(WIDTH, HEIGHT)
+
+if len(sys.argv) > 1 and sys.argv[1] == '--dark':
+ ctx.set_source_rgb(1.0, 1.0, 1.0)
+ dark = '_dark'
+else:
+ ctx.set_source_rgb(0.0, 0.0, 0.0)
+ dark = ''
+
+ctx.move_to(0.4, 0.4)
+ctx.line_to(0.4, 0.0)
+ctx.line_to(0.0, 0.4)
+
+ctx.fill()
+
+ctx.move_to(0.6, 0.4)
+ctx.line_to(0.6, 0.0)
+ctx.line_to(1.0, 0.4)
+
+ctx.fill()
+
+ctx.move_to(0.6, 0.6)
+ctx.line_to(1.0, 0.6)
+ctx.line_to(0.6, 1.0)
+
+ctx.fill()
+
+ctx.move_to(0.4, 0.6)
+ctx.line_to(0.4, 1.0)
+ctx.line_to(0.0, 0.6)
+
+ctx.fill()
+
+surface.write_to_png('../../pixmaps/collapse%s.png' % dark)
diff --git a/tools/icons/expand.py b/tools/icons/expand.py
new file mode 100644
index 0000000..854bbc6
--- /dev/null
+++ b/tools/icons/expand.py
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+
+import cairo
+import sys
+
+
+WIDTH, HEIGHT = 256, 256
+WIDTH, HEIGHT = 12, 12
+
+surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, WIDTH, HEIGHT)
+ctx = cairo.Context(surface)
+
+ctx.scale(WIDTH, HEIGHT)
+
+if len(sys.argv) > 1 and sys.argv[1] == '--dark':
+ ctx.set_source_rgb(1.0, 1.0, 1.0)
+ dark = '_dark'
+else:
+ ctx.set_source_rgb(0.0, 0.0, 0.0)
+ dark = ''
+
+ctx.move_to(0.0, 0.0)
+ctx.line_to(0.4, 0.0)
+ctx.line_to(0.0, 0.4)
+
+ctx.fill()
+
+ctx.move_to(1.0, 0.0)
+ctx.line_to(0.6, 0.0)
+ctx.line_to(1.0, 0.4)
+
+ctx.fill()
+
+ctx.move_to(1.0, 1.0)
+ctx.line_to(1.0, 0.6)
+ctx.line_to(0.6, 1.0)
+
+ctx.fill()
+
+ctx.move_to(0.0, 1.0)
+ctx.line_to(0.4, 1.0)
+ctx.line_to(0.0, 0.6)
+
+ctx.fill()
+
+surface.write_to_png('../../pixmaps/expand%s.png' % dark)
diff --git a/tools/icons/gen.sh b/tools/icons/gen.sh
new file mode 100755
index 0000000..a09bacb
--- /dev/null
+++ b/tools/icons/gen.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+python3 ./palette.py
+
+python3 ./expand.py
+python3 ./expand.py --dark
+
+python3 ./collapse.py
+python3 ./collapse.py --dark
diff --git a/tools/icons/palette.py b/tools/icons/palette.py
new file mode 100644
index 0000000..4227964
--- /dev/null
+++ b/tools/icons/palette.py
@@ -0,0 +1,53 @@
+#!/usr/bin/env python
+
+import math
+import cairo
+
+
+WIDTH, HEIGHT = 256, 256
+WIDTH, HEIGHT = 12, 12
+
+surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, WIDTH, HEIGHT)
+ctx = cairo.Context(surface)
+
+ctx.scale(WIDTH, HEIGHT)
+
+ctx.arc(0.5, 0.5, 0.40, 0, 2 * math.pi)
+ctx.set_source_rgb(1.0, 1.0, 1.0)
+ctx.fill()
+
+colors = [
+ 'fefe33',
+ 'fabc02',
+ 'fb9902',
+ 'fd5308',
+ 'fe2712',
+ 'a7194b',
+ '8601af',
+ '3d01a4',
+ '0247fe',
+ '0391ce',
+ '66b032',
+ 'd0ea2b'
+]
+
+angle = (2 * math.pi) / len(colors)
+
+for i in range(len(colors)):
+
+ hval = int(colors[i], 16)
+
+ red = ((hval & 0xff0000) >> 16) / 256
+ green = ((hval & 0x00ff00) >> 8) / 256
+ blue = ((hval & 0x0000ff) >> 0) / 256
+
+ start = angle / 2 - i * angle
+
+ ctx.arc(0.5, 0.5, 0.5, start - angle, start)
+
+ ctx.arc_negative(0.5, 0.5, 0.15, start, start - angle)
+
+ ctx.set_source_rgb(red, green, blue)
+ ctx.fill()
+
+surface.write_to_png('../../pixmaps/palette.png')