mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-06 14:16:39 +08:00
Handle 2x scaling in plot drawing
old-commit-hash: e816467eb5a6fb7b933225a871dc8ad339a17e68
This commit is contained in:
@@ -173,8 +173,14 @@ def init_plots(arr, name_to_arr_idx, plot_xlims, plot_ylims, plot_names, plot_co
|
||||
fig.canvas.flush_events()
|
||||
|
||||
raw_data = renderer.tostring_rgb()
|
||||
#print fig.canvas.get_width_height()
|
||||
plot_surface = pygame.image.frombuffer(raw_data, fig.canvas.get_width_height(), "RGB").convert()
|
||||
x, y = fig.canvas.get_width_height()
|
||||
|
||||
# Handle 2x scaling
|
||||
if len(raw_data) == 4 * x * y * 3:
|
||||
plot_surface = pygame.image.frombuffer(raw_data, (2*x, 2*y), "RGB").convert()
|
||||
plot_surface = pygame.transform.scale(plot_surface, (x, y))
|
||||
else:
|
||||
plot_surface = pygame.image.frombuffer(raw_data, fig.canvas.get_width_height(), "RGB").convert()
|
||||
return plot_surface
|
||||
|
||||
return draw_plots
|
||||
|
||||
Reference in New Issue
Block a user