fix image alpha scaling with summed color table
This commit is contained in:
parent
6c05ec3b2a
commit
01554bf1fb
@ -686,6 +686,7 @@ public class CFICommands extends MethodCommands {
|
||||
usage = "<url>",
|
||||
desc = "Color terrain using glass"
|
||||
)
|
||||
// ![79,174,212,5:3,5:4,18,161,20]
|
||||
@CommandPermissions("worldedit.anvil.cfi")
|
||||
public void glass(FawePlayer fp, BufferedImage image, @Optional BufferedImage imageMask, @Optional Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException, WorldEditException {
|
||||
CFISettings settings = assertSettings(fp);
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.boydti.fawe.object.collection;
|
||||
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.DataBufferInt;
|
||||
|
||||
@ -172,7 +173,7 @@ public class SummedColorTable {
|
||||
float factor = this.areaInverses[area - 1];
|
||||
float alpha = (totAlpha * factor);
|
||||
factor = (factor * 256) / alpha;
|
||||
return ((int) alpha << 24) + (((int) (totRed * factor)) << 16) + (((int) (totGreen * factor)) << 8) + (((int) (totBlue * factor)) << 0);
|
||||
return (MathMan.clamp((int) alpha, 0, 255) << 24) + (((int) (totRed * factor)) << 16) + (((int) (totGreen * factor)) << 8) + (((int) (totBlue * factor)) << 0);
|
||||
}
|
||||
|
||||
private long getVal(int row, int col, int index, long curr, long[] summed) {
|
||||
|
Loading…
Reference in New Issue
Block a user