Ejemplo n.º 1
0
 def build_image(self, surface, node):
     img_bytes = StringIO.StringIO()
     img_id = tiletree.build_node_id(node.zoom_level, node.tile_x,
                                     node.tile_y)
     surface.write_to_png(img_bytes)
     img_bytes = tiletree.palette_png_bytes(
         StringIO.StringIO(img_bytes.getvalue()))
     return (img_id, img_bytes)
Ejemplo n.º 2
0
	def fetch_helper(self, tile_generator, do_palette=True):
		output_surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 256, 256)
		output_context = cairo.Context(output_surface)
		for tile in tile_generator:
			if(tile == None):
				continue

			tile_img = cairo.ImageSurface.create_from_png(tile)

			output_context.set_source_surface(tile_img, 0, 0)
			output_context.paint()

		output_bytes = StringIO.StringIO()
		output_surface.write_to_png(output_bytes)

		if(do_palette):
			return tiletree.palette_png_bytes(StringIO.StringIO(output_bytes.getvalue()))
		return StringIO.StringIO(output_bytes.getvalue())
Ejemplo n.º 3
0
    def fetch_helper(self, tile_generator, do_palette=True):
        output_surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 256, 256)
        output_context = cairo.Context(output_surface)
        for tile in tile_generator:
            if (tile == None):
                continue

            tile_img = cairo.ImageSurface.create_from_png(tile)

            output_context.set_source_surface(tile_img, 0, 0)
            output_context.paint()

        output_bytes = StringIO.StringIO()
        output_surface.write_to_png(output_bytes)

        if (do_palette):
            return tiletree.palette_png_bytes(
                StringIO.StringIO(output_bytes.getvalue()))
        return StringIO.StringIO(output_bytes.getvalue())
Ejemplo n.º 4
0
	def build_image(self, surface, node):
		img_bytes = StringIO.StringIO()
		img_id = tiletree.build_node_id(node.zoom_level, node.tile_x, node.tile_y)
		surface.write_to_png(img_bytes)
		img_bytes = tiletree.palette_png_bytes(StringIO.StringIO(img_bytes.getvalue()))
		return (img_id, img_bytes)