mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-27 04:41:06 -07:00
Merge pull request #6577 from Ultimaker/litho_alpha
make lithophane alpha channel control total final width multiplier.
This commit is contained in:
commit
ed838baafa
1 changed files with 6 additions and 1 deletions
|
|
@ -5,7 +5,7 @@ import numpy
|
||||||
|
|
||||||
import math
|
import math
|
||||||
|
|
||||||
from PyQt5.QtGui import QImage, qRed, qGreen, qBlue
|
from PyQt5.QtGui import QImage, qRed, qGreen, qBlue, qAlpha
|
||||||
from PyQt5.QtCore import Qt
|
from PyQt5.QtCore import Qt
|
||||||
|
|
||||||
from UM.Mesh.MeshReader import MeshReader
|
from UM.Mesh.MeshReader import MeshReader
|
||||||
|
|
@ -138,6 +138,11 @@ class ImageReader(MeshReader):
|
||||||
height_data *= scale_vector.y
|
height_data *= scale_vector.y
|
||||||
height_data += base_height
|
height_data += base_height
|
||||||
|
|
||||||
|
if img.hasAlphaChannel():
|
||||||
|
for x in range(0, width):
|
||||||
|
for y in range(0, height):
|
||||||
|
height_data[y, x] *= qAlpha(img.pixel(x, y)) / 255.0
|
||||||
|
|
||||||
heightmap_face_count = 2 * height_minus_one * width_minus_one
|
heightmap_face_count = 2 * height_minus_one * width_minus_one
|
||||||
total_face_count = heightmap_face_count + (width_minus_one * 2) * (height_minus_one * 2) + 2
|
total_face_count = heightmap_face_count + (width_minus_one * 2) * (height_minus_one * 2) + 2
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue