equal
deleted
inserted
replaced
34 size_t width, height |
34 size_t width, height |
35 |
35 |
36 struct pt_tile_info : |
36 struct pt_tile_info : |
37 size_t width, height |
37 size_t width, height |
38 size_t x, y |
38 size_t x, y |
|
39 int zoom |
39 |
40 |
40 int pt_image_open (pt_image **image_ptr, pt_ctx *ctx, char *png_path, int cache_mode) |
41 int pt_image_open (pt_image **image_ptr, pt_ctx *ctx, char *png_path, int cache_mode) |
41 int pt_image_info_func "pt_image_info" (pt_image *image, pt_image_info **info_ptr) |
42 int pt_image_info_func "pt_image_info" (pt_image *image, pt_image_info **info_ptr) |
42 int pt_image_status (pt_image *image) |
43 int pt_image_status (pt_image *image) |
43 int pt_image_update (pt_image *image) |
44 int pt_image_update (pt_image *image) |
88 def update (self) : |
89 def update (self) : |
89 trap_err("pt_image_update", |
90 trap_err("pt_image_update", |
90 pt_image_update(self.image) |
91 pt_image_update(self.image) |
91 ) |
92 ) |
92 |
93 |
93 def tile_file (self, size_t width, size_t height, size_t x, size_t y, object out) : |
94 def tile_file (self, size_t width, size_t height, size_t x, size_t y, int zoom, object out) : |
94 cdef stdio.FILE *outf |
95 cdef stdio.FILE *outf |
95 cdef pt_tile_info ti |
96 cdef pt_tile_info ti |
96 |
97 |
97 if not PyFile_Check(out) : |
98 if not PyFile_Check(out) : |
98 raise TypeError("out: must be a file object") |
99 raise TypeError("out: must be a file object") |
104 |
105 |
105 ti.width = width |
106 ti.width = width |
106 ti.height = height |
107 ti.height = height |
107 ti.x = x |
108 ti.x = x |
108 ti.y = y |
109 ti.y = y |
|
110 ti.zoom = zoom |
109 |
111 |
110 trap_err("pt_image_tile_file", |
112 trap_err("pt_image_tile_file", |
111 pt_image_tile_file(self.image, &ti, outf) |
113 pt_image_tile_file(self.image, &ti, outf) |
112 ) |
114 ) |
113 |
115 |
114 def tile_mem (self, size_t width, size_t height, size_t x, size_t y) : |
116 def tile_mem (self, size_t width, size_t height, size_t x, size_t y, int zoom) : |
115 cdef pt_tile_info ti |
117 cdef pt_tile_info ti |
116 cdef char *buf |
118 cdef char *buf |
117 cdef size_t len |
119 cdef size_t len |
118 |
120 |
119 ti.width = width |
121 ti.width = width |
120 ti.height = height |
122 ti.height = height |
121 ti.x = x |
123 ti.x = x |
122 ti.y = y |
124 ti.y = y |
|
125 ti.zoom = zoom |
123 |
126 |
124 # render and return ptr to buffer |
127 # render and return ptr to buffer |
125 trap_err("pt_image_tile_mem", |
128 trap_err("pt_image_tile_mem", |
126 pt_image_tile_mem(self.image, &ti, &buf, &len) |
129 pt_image_tile_mem(self.image, &ti, &buf, &len) |
127 ) |
130 ) |