|
|
@ -137,6 +137,10 @@ class RasterView: |
|
|
|
tmp_doc = App.newDocument('tmp_raster', hidden=False, temp=False) |
|
|
|
tmp_doc = App.newDocument('tmp_raster', hidden=False, temp=False) |
|
|
|
close_tmp_doc = True |
|
|
|
close_tmp_doc = True |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
transparent_background = True |
|
|
|
|
|
|
|
if 'Assembly_handbook_TransparentBackground' in view.PropertiesList: |
|
|
|
|
|
|
|
transparent_background = view.Assembly_handbook_TransparentBackground |
|
|
|
|
|
|
|
|
|
|
|
objects_to_reset = {} |
|
|
|
objects_to_reset = {} |
|
|
|
duplicated_parts = {} |
|
|
|
duplicated_parts = {} |
|
|
|
try: |
|
|
|
try: |
|
|
@ -305,6 +309,8 @@ class RasterView: |
|
|
|
bg_img = Image.new(composite_img.mode, composite_img.size, color = '#ffffff') |
|
|
|
bg_img = Image.new(composite_img.mode, composite_img.size, color = '#ffffff') |
|
|
|
bg_img.paste(composite_img.convert('RGB'), composite_img) |
|
|
|
bg_img.paste(composite_img.convert('RGB'), composite_img) |
|
|
|
final_alpha = composite_img.split()[3].point(lambda p: 0 if p <= int(255/num_colors+0.5) else 255) |
|
|
|
final_alpha = composite_img.split()[3].point(lambda p: 0 if p <= int(255/num_colors+0.5) else 255) |
|
|
|
|
|
|
|
if not transparent_background: |
|
|
|
|
|
|
|
final_alpha = final_alpha.point(lambda p: 255) |
|
|
|
composite_img = bg_img |
|
|
|
composite_img = bg_img |
|
|
|
composite_img.putalpha(final_alpha) |
|
|
|
composite_img.putalpha(final_alpha) |
|
|
|
|
|
|
|
|
|
|
@ -419,8 +425,8 @@ class RasterView: |
|
|
|
link.ViewObject.Visibility = False |
|
|
|
link.ViewObject.Visibility = False |
|
|
|
|
|
|
|
|
|
|
|
print_verbose('Rendering lines...') |
|
|
|
print_verbose('Rendering lines...') |
|
|
|
#temp_file_name = tempfile.gettempdir() + "/ahb_temp_image.png" |
|
|
|
temp_file_name = tempfile.gettempdir() + "/ahb_temp_image.png" |
|
|
|
temp_file_name = "/home/youen/tmp/ahb_temp_image.png" |
|
|
|
#temp_file_name = "/home/youen/tmp/ahb_temp_image.png" |
|
|
|
doc_view.saveImage(temp_file_name, resolution[0]+2, resolution[1]+2, "#ff00ff") # we add 1 pixel border that we will need to crop later |
|
|
|
doc_view.saveImage(temp_file_name, resolution[0]+2, resolution[1]+2, "#ff00ff") # we add 1 pixel border that we will need to crop later |
|
|
|
lines_bands_img = self._read_image(temp_file_name) |
|
|
|
lines_bands_img = self._read_image(temp_file_name) |
|
|
|
|
|
|
|
|
|
|
|