Implemented fix to correct alpha on final image so that DDSTool for X-Plane works correctly
This commit is contained in:
parent
728b4aa9c6
commit
1df4cd2ffc
27
photogen.py
27
photogen.py
@ -129,6 +129,17 @@ class mstr_photogen:
|
|||||||
wp = wtr_pix[x,y]
|
wp = wtr_pix[x,y]
|
||||||
if wp[0] == 255 and wp[1] == 0 and wp[2] == 255 and wp[3] == 255:
|
if wp[0] == 255 and wp[1] == 0 and wp[2] == 255 and wp[3] == 255:
|
||||||
tilepix[x,y] = (0,0,0,0)
|
tilepix[x,y] = (0,0,0,0)
|
||||||
|
|
||||||
|
# Alpha correction on final image
|
||||||
|
corrpix = self._tile.load()
|
||||||
|
for y in range(0, self._tile.height):
|
||||||
|
for x in range(0, self._tile.width):
|
||||||
|
c = corrpix[x,y]
|
||||||
|
if c[3] > 0:
|
||||||
|
nc = (c[0], c[1], c[2], 255)
|
||||||
|
corrpix[x,y] = nc
|
||||||
|
if c[3] == 0:
|
||||||
|
corrpix[x,y] = (0,0,0,0)
|
||||||
|
|
||||||
# We are now in posession of the final image.
|
# We are now in posession of the final image.
|
||||||
|
|
||||||
@ -172,18 +183,18 @@ class mstr_photogen:
|
|||||||
|
|
||||||
# This returns a mask of the empty space to cover, should there be any
|
# This returns a mask of the empty space to cover, should there be any
|
||||||
def buildCompletionMask(self):
|
def buildCompletionMask(self):
|
||||||
mask = Image.new("RGBA", (self._imgsize, self._imgsize), (0,0,0,255))
|
mask = Image.new("RGBA", (self._imgsize, self._imgsize), (0,0,0,0))
|
||||||
#mask_pix = mask.load()
|
mask_pix = mask.load()
|
||||||
|
|
||||||
# Load photo
|
# Load photo
|
||||||
#layer_pix = self._tile.load()
|
layer_pix = self._tile.load()
|
||||||
|
|
||||||
# Scan!
|
# Scan!
|
||||||
#for y in range(self._tile.width-1):
|
for y in range(self._tile.width-1):
|
||||||
# for x in range(self._tile.height-1):
|
for x in range(self._tile.height-1):
|
||||||
# p = layer_pix[x,y]
|
p = layer_pix[x,y]
|
||||||
# if p[3] < 255: # <- Check for empty or non-complete alpha
|
if p[3] < 255: # <- Check for empty or non-complete alpha
|
||||||
# mask_pix[x,y] = (0,0,0,255)
|
mask_pix[x,y] = (0,0,0,255)
|
||||||
# We do not apply any blur or other effects here - we only want the
|
# We do not apply any blur or other effects here - we only want the
|
||||||
# exact pixel positions.
|
# exact pixel positions.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user