Implement support for drawing any SVG file to map
This commit is contained in:
parent
130cffaa26
commit
3ca6078cd1
1 changed files with 11 additions and 5 deletions
|
@ -29,14 +29,20 @@ class EquirectMap():
|
|||
self.map_width = bounds[1] - bounds[3]
|
||||
self.map_height = bounds[0] - bounds[2]
|
||||
|
||||
def draw_from_file(self, cr: cairo.Context, path: str):
|
||||
def draw_from_file(self,
|
||||
cr: cairo.Context,
|
||||
path: str,
|
||||
x: float,
|
||||
y: float,
|
||||
width: float,
|
||||
height: float):
|
||||
svg = Rsvg.Handle.new_from_file(path)
|
||||
|
||||
rect = Rsvg.Rectangle()
|
||||
rect.x = 0
|
||||
rect.y = 0
|
||||
rect.width = self.width
|
||||
rect.height = self.height
|
||||
rect.x = x
|
||||
rect.y = y
|
||||
rect.width = width
|
||||
rect.height = height
|
||||
|
||||
svg.render_layer(cr, None, rect)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue