瀏覽代碼

Generate no_tile.png

Johannes Hofmann 8 年之前
父節點
當前提交
295760f5c6
共有 4 個文件被更改,包括 24 次插入1 次删除
  1. 二進制
      img/no_tile.png
  2. 23
    0
      img/no_tile.py
  3. 二進制
      no_tile.png
  4. 1
    1
      src/map_view_gl.rs

二進制
img/no_tile.png 查看文件


+ 23
- 0
img/no_tile.py 查看文件

@@ -0,0 +1,23 @@
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')

二進制
no_tile.png 查看文件


+ 1
- 1
src/map_view_gl.rs 查看文件

@@ -36,7 +36,7 @@ impl<'a> MapViewGl<'a> {
36 36
             let mut tex = Texture::empty(cx, 2048, 2048, TextureFormat::Rgb8);
37 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 40
                 tex.sub_image(0, 0, &img);
41 41
                 check_gl_errors!(cx);
42 42
             }