Browse Source

Generate no_tile.png

Johannes Hofmann 8 years ago
parent
commit
295760f5c6
4 changed files with 24 additions and 1 deletions
  1. BIN
      img/no_tile.png
  2. 23
    0
      img/no_tile.py
  3. BIN
      no_tile.png
  4. 1
    1
      src/map_view_gl.rs

BIN
img/no_tile.png View File


+ 23
- 0
img/no_tile.py View File

1
+#!/usr/bin/python3
2
+
3
+import cairo
4
+import math
5
+
6
+img = cairo.ImageSurface(cairo.FORMAT_ARGB32, 256, 256)
7
+cx = cairo.Context(img)
8
+cx.set_source_rgb(0.125, 0.125, 0.125)
9
+cx.paint()
10
+
11
+cx.set_source_rgb(0.25, 0.25, 0.25)
12
+
13
+for i in range(1, 8):
14
+    num = 2 ** i
15
+    for j in range(0, num + 1):
16
+        x = float(j) * 256.0 / num
17
+        w = 8.0 / num
18
+        cx.rectangle(x - w * 0.5, 0, w, 256)
19
+        cx.rectangle(0, x - w * 0.5, 256, w)
20
+
21
+cx.fill()
22
+
23
+img.write_to_png('no_tile.png')

BIN
no_tile.png View File


+ 1
- 1
src/map_view_gl.rs View File

36
             let mut tex = Texture::empty(cx, 2048, 2048, TextureFormat::Rgb8);
36
             let mut tex = Texture::empty(cx, 2048, 2048, TextureFormat::Rgb8);
37
             check_gl_errors!(cx);
37
             check_gl_errors!(cx);
38
             {
38
             {
39
-                let img = image::open("no_tile.png").unwrap();
39
+                let img = image::open("img/no_tile.png").unwrap();
40
                 tex.sub_image(0, 0, &img);
40
                 tex.sub_image(0, 0, &img);
41
                 check_gl_errors!(cx);
41
                 check_gl_errors!(cx);
42
             }
42
             }