I'm tidying up the tile rendering in the Cocoa front end and had some questions about how blending should be handled with the tile sets in Angband.
1) How should the alphablend field in the graphics mode structure be interpreted? The comment about the alphablend field in the graphics mode structure says "Bool whether or not the tileset needs alpha blending". Based on how it's set for the current tile sets, it looks like it is zero if the alpha channel only has values of zero and 255 (i.e. either completely transparent or completely opaque) and nonzero if the alpha channel takes on values that are not zero and 255. Is that the correct interpretation? If so, why does the Gervais tile set have a value of zero for alphablend? From what I see (read in the PNG file in Python with PIL and examine the alpha channel with numpy), it has some values in the alpha channel that are not zero or 255.
In terms of providing hints to the front ends, it may be useful to have something in the graphics mode structure (either more possible values for alphablend or a separate field) that says a tile set has no alpha channel. The front end could use a faster rendering path for those tile sets. Of the current tile sets, the Nomad tiles don't have an alpha channel (at least from what I see using Python with PIL to look at the PNG file).
2) What's the appropriate rendering strategy for double-height tiles used as background or terrain? From what I see in the Windows front end, the top half of such a tile is blended with what's already been rendered for the cell in the previous row. So it can obscure both the foreground and background for that cell. An alternative would be to render the background parts first (first the background tile for this cell and then the top half of the double-height background tile from the next row if present) and then the foreground (first the foreground for this cell and then the top half of the double-height foreground tile from the next row if present).
1) How should the alphablend field in the graphics mode structure be interpreted? The comment about the alphablend field in the graphics mode structure says "Bool whether or not the tileset needs alpha blending". Based on how it's set for the current tile sets, it looks like it is zero if the alpha channel only has values of zero and 255 (i.e. either completely transparent or completely opaque) and nonzero if the alpha channel takes on values that are not zero and 255. Is that the correct interpretation? If so, why does the Gervais tile set have a value of zero for alphablend? From what I see (read in the PNG file in Python with PIL and examine the alpha channel with numpy), it has some values in the alpha channel that are not zero or 255.
In terms of providing hints to the front ends, it may be useful to have something in the graphics mode structure (either more possible values for alphablend or a separate field) that says a tile set has no alpha channel. The front end could use a faster rendering path for those tile sets. Of the current tile sets, the Nomad tiles don't have an alpha channel (at least from what I see using Python with PIL to look at the PNG file).
2) What's the appropriate rendering strategy for double-height tiles used as background or terrain? From what I see in the Windows front end, the top half of such a tile is blended with what's already been rendered for the cell in the previous row. So it can obscure both the foreground and background for that cell. An alternative would be to render the background parts first (first the background tile for this cell and then the top half of the double-height background tile from the next row if present) and then the foreground (first the foreground for this cell and then the top half of the double-height foreground tile from the next row if present).
Comment