14
14
# pip imports
15
15
import wx
16
16
import wx .svg
17
- import skia
18
17
19
18
20
19
"""Enable high-res displays."""
25
24
pass # fail on non-windows
26
25
27
26
28
- class SkiaCPUCanvas (wx .Panel ):
29
- """A cpu based skia canvas"""
27
+ class CPUCanvas (wx .Panel ):
28
+ """A cpu based canvas"""
30
29
31
30
def __init__ (self , parent , size ):
32
31
super ().__init__ (parent , size = size )
@@ -40,7 +39,6 @@ def __init__(self, parent, size):
40
39
self .zoom = 1.0
41
40
42
41
self .svg_picture = None
43
- self .img_size = None
44
42
self .img_scale_enum = 0
45
43
self .img_zoom = 1.0
46
44
@@ -158,15 +156,15 @@ def set_size(self):
158
156
159
157
class MainFrame (wx .Frame ):
160
158
def __init__ (self ):
161
- super ().__init__ (None , title = "Skia Wx CPU Canvas" , size = (800 , 600 ))
159
+ super ().__init__ (None , title = "Wx CPU Canvas" , size = (800 , 600 ))
162
160
panel = wx .Panel (self )
163
161
sizer = wx .BoxSizer (wx .VERTICAL )
164
162
165
163
open_button = wx .Button (panel , label = 'Open File' )
166
164
open_button .Bind (wx .EVT_BUTTON , self .on_open_file )
167
165
sizer .Add (open_button , flag = wx .ALIGN_CENTER | wx .BOTTOM , border = 10 )
168
166
169
- self .canvas = SkiaCPUCanvas (panel , (800 , 600 ))
167
+ self .canvas = CPUCanvas (panel , (800 , 600 ))
170
168
sizer .Add (self .canvas , 1 , wx .EXPAND )
171
169
panel .SetSizer (sizer )
172
170
self .Show ()
@@ -181,9 +179,7 @@ def on_open_file(self, event):
181
179
# Proceed loading the file chosen by the user
182
180
path = fileDialog .GetPath ()
183
181
try :
184
- svgstream = skia .Stream .MakeFromFile (path )
185
182
self .canvas .svg_picture = wx .svg .SVGimage .CreateFromFile (path )
186
- self .canvas .img_size = skia .Size (self .canvas .svg_picture .width , self .canvas .svg_picture .height )
187
183
self .canvas .Refresh ()
188
184
self .canvas .SetFocus ()
189
185
except Exception as e :
0 commit comments