mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-28 04:35:35 +00:00
Added alpha and Erase blend modes support
This commit is contained in:
@@ -3048,7 +3048,7 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
renderContext.cursorPosition = cursorPosition;
|
||||
renderContext.mouseButton = mouseButton;
|
||||
ExportRectangle viewRect = new ExportRectangle(rect);
|
||||
timeline.toImage(frame, time, renderContext, image, image, false, m, new Matrix(), m, colorTransform, zoom, false, viewRect, m, true, Timeline.DRAW_MODE_ALL);
|
||||
timeline.toImage(frame, time, renderContext, image, image, false, m, new Matrix(), m, colorTransform, zoom, false, viewRect, m, true, Timeline.DRAW_MODE_ALL, 0);
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
@@ -551,7 +551,7 @@ public class FrameExporter {
|
||||
renderContext.stateUnderCursor = new ArrayList<>();
|
||||
|
||||
try {
|
||||
tim.toImage(fframe, fframe, renderContext, image, image, false, m, new Matrix(), m, null, zoom, true, new ExportRectangle(rect), m, true, Timeline.DRAW_MODE_ALL);
|
||||
tim.toImage(fframe, fframe, renderContext, image, image, false, m, new Matrix(), m, null, zoom, true, new ExportRectangle(rect), m, true, Timeline.DRAW_MODE_ALL, 0);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ public class ShapeExporter {
|
||||
}
|
||||
Matrix m = Matrix.getScaleInstance(settings.zoom);
|
||||
m.translate(-rect.Xmin, -rect.Ymin);
|
||||
st.toImage(0, 0, 0, new RenderContext(), img, img, false, m, m, m, m, new CXFORMWITHALPHA(), unzoom, false, new ExportRectangle(rect), true, Timeline.DRAW_MODE_ALL);
|
||||
st.toImage(0, 0, 0, new RenderContext(), img, img, false, m, m, m, m, new CXFORMWITHALPHA(), unzoom, false, new ExportRectangle(rect), true, Timeline.DRAW_MODE_ALL, 0);
|
||||
if (settings.mode == ShapeExportMode.PNG) {
|
||||
ImageHelper.write(img.getBufferedImage(), ImageFormat.PNG, file);
|
||||
} else {
|
||||
|
||||
@@ -985,7 +985,7 @@ public class DefineEditTextTag extends TextTag {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toImage(int frame, int time, int ratio, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, boolean isClip, Matrix transformation, Matrix strokeTransformation, Matrix absoluteTransformation, Matrix fullTransformation, ColorTransform colorTransform, double unzoom, boolean sameImage, ExportRectangle viewRect, boolean scaleStrokes, int drawMode) {
|
||||
public void toImage(int frame, int time, int ratio, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, boolean isClip, Matrix transformation, Matrix strokeTransformation, Matrix absoluteTransformation, Matrix fullTransformation, ColorTransform colorTransform, double unzoom, boolean sameImage, ExportRectangle viewRect, boolean scaleStrokes, int drawMode, int blendMode) {
|
||||
render(TextRenderMode.BITMAP, image, null, null, transformation, colorTransform, 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -379,8 +379,8 @@ public class DefineSpriteTag extends DrawableTag implements Timelined {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toImage(int frame, int time, int ratio, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, boolean isClip, Matrix transformation, Matrix strokeTransformation, Matrix absoluteTransformation, Matrix fullTransformation, ColorTransform colorTransform, double unzoom, boolean sameImage, ExportRectangle viewRect, boolean scaleStrokes, int drawMode) {
|
||||
getTimeline().toImage(frame, time, renderContext, image, fullImage, isClip, transformation, strokeTransformation, absoluteTransformation, colorTransform, unzoom, sameImage, viewRect, fullTransformation, scaleStrokes, drawMode);
|
||||
public void toImage(int frame, int time, int ratio, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, boolean isClip, Matrix transformation, Matrix strokeTransformation, Matrix absoluteTransformation, Matrix fullTransformation, ColorTransform colorTransform, double unzoom, boolean sameImage, ExportRectangle viewRect, boolean scaleStrokes, int drawMode, int blendMode) {
|
||||
getTimeline().toImage(frame, time, renderContext, image, fullImage, isClip, transformation, strokeTransformation, absoluteTransformation, colorTransform, unzoom, sameImage, viewRect, fullTransformation, scaleStrokes, drawMode, blendMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -93,8 +93,8 @@ public abstract class ButtonTag extends DrawableTag implements Timelined {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toImage(int frame, int time, int ratio, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, boolean isClip, Matrix transformation, Matrix strokeTransformation, Matrix absoluteTransformation, Matrix fullTransformation, ColorTransform colorTransform, double unzoom, boolean sameImage, ExportRectangle viewRect, boolean scaleStrokes, int drawMode) {
|
||||
getTimeline().toImage(frame, time, renderContext, image, fullImage, isClip, transformation, strokeTransformation, absoluteTransformation, colorTransform, unzoom, sameImage, viewRect, fullTransformation, scaleStrokes, drawMode);
|
||||
public void toImage(int frame, int time, int ratio, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, boolean isClip, Matrix transformation, Matrix strokeTransformation, Matrix absoluteTransformation, Matrix fullTransformation, ColorTransform colorTransform, double unzoom, boolean sameImage, ExportRectangle viewRect, boolean scaleStrokes, int drawMode, int blendMode) {
|
||||
getTimeline().toImage(frame, time, renderContext, image, fullImage, isClip, transformation, strokeTransformation, absoluteTransformation, colorTransform, unzoom, sameImage, viewRect, fullTransformation, scaleStrokes, drawMode, blendMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -46,7 +46,7 @@ public abstract class DrawableTag extends CharacterTag implements BoundedTag {
|
||||
|
||||
public abstract Shape getOutline(int frame, int time, int ratio, RenderContext renderContext, Matrix transformation, boolean stroked);
|
||||
|
||||
public abstract void toImage(int frame, int time, int ratio, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, boolean isClip, Matrix transformation, Matrix prevTransformation, Matrix absoluteTransformation, Matrix fullTransformation, ColorTransform colorTransform, double unzoom, boolean sameImage, ExportRectangle viewRect, boolean scaleStrokes, int drawMode);
|
||||
public abstract void toImage(int frame, int time, int ratio, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, boolean isClip, Matrix transformation, Matrix prevTransformation, Matrix absoluteTransformation, Matrix fullTransformation, ColorTransform colorTransform, double unzoom, boolean sameImage, ExportRectangle viewRect, boolean scaleStrokes, int drawMode, int blendMode);
|
||||
|
||||
public abstract void toSVG(SVGExporter exporter, int ratio, ColorTransform colorTransform, int level) throws IOException;
|
||||
|
||||
|
||||
@@ -433,7 +433,7 @@ public abstract class FontTag extends DrawableTag implements AloneTag {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toImage(int frame, int time, int ratio, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, boolean isClip, Matrix transformation, Matrix strokeTransformation, Matrix absoluteTransformation, Matrix fullTransformation, ColorTransform colorTransform, double unzoom, boolean sameImage, ExportRectangle viewRect, boolean scaleStrokes, int drawMode) {
|
||||
public void toImage(int frame, int time, int ratio, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, boolean isClip, Matrix transformation, Matrix strokeTransformation, Matrix absoluteTransformation, Matrix fullTransformation, ColorTransform colorTransform, double unzoom, boolean sameImage, ExportRectangle viewRect, boolean scaleStrokes, int drawMode, int blendMode) {
|
||||
SHAPERECORD.shapeListToImage(1, swf, getGlyphShapeTable(), image, frame, Color.black, colorTransform);
|
||||
}
|
||||
|
||||
|
||||
@@ -233,7 +233,7 @@ public abstract class ImageTag extends DrawableTag {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toImage(int frame, int time, int ratio, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, boolean isClip, Matrix transformation, Matrix strokeTransformation, Matrix absoluteTransformation, Matrix fullTransformation, ColorTransform colorTransform, double unzoom, boolean sameImage, ExportRectangle viewRect, boolean scaleStrokes, int drawMode) {
|
||||
public void toImage(int frame, int time, int ratio, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, boolean isClip, Matrix transformation, Matrix strokeTransformation, Matrix absoluteTransformation, Matrix fullTransformation, ColorTransform colorTransform, double unzoom, boolean sameImage, ExportRectangle viewRect, boolean scaleStrokes, int drawMode, int blendMode) {
|
||||
BitmapExporter.export(1, swf, getShape(), null, image, unzoom, transformation, strokeTransformation, colorTransform, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -314,7 +314,7 @@ public abstract class MorphShapeTag extends DrawableTag {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toImage(int frame, int time, int ratio, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, boolean isClip, Matrix transformation, Matrix strokeTransformation, Matrix absoluteTransformation, Matrix fullTransformation, ColorTransform colorTransform, double unzoom, boolean sameImage, ExportRectangle viewRect, boolean scaleStrokes, int drawMode) {
|
||||
public void toImage(int frame, int time, int ratio, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, boolean isClip, Matrix transformation, Matrix strokeTransformation, Matrix absoluteTransformation, Matrix fullTransformation, ColorTransform colorTransform, double unzoom, boolean sameImage, ExportRectangle viewRect, boolean scaleStrokes, int drawMode, int blendMode) {
|
||||
SHAPEWITHSTYLE shape = getShapeAtRatio(ratio);
|
||||
// morphShape using shapeNum=3, morphShape2 using shapeNum=4
|
||||
// todo: Currently the generated image is not cached, because the cache
|
||||
|
||||
@@ -188,7 +188,7 @@ public abstract class ShapeTag extends DrawableTag implements LazyObject {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toImage(int frame, int time, int ratio, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, boolean isClip, Matrix transformation, Matrix strokeTransformation, Matrix absoluteTransformation, Matrix fullTransformation, ColorTransform colorTransform, double unzoom, boolean sameImage, ExportRectangle viewRect, boolean scaleStrokes, int drawMode) {
|
||||
public void toImage(int frame, int time, int ratio, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, boolean isClip, Matrix transformation, Matrix strokeTransformation, Matrix absoluteTransformation, Matrix fullTransformation, ColorTransform colorTransform, double unzoom, boolean sameImage, ExportRectangle viewRect, boolean scaleStrokes, int drawMode, int blendMode) {
|
||||
BitmapExporter.export(getShapeNum(), swf, getShapes(), null, image, unzoom, transformation, strokeTransformation, colorTransform, scaleStrokes);
|
||||
if (Configuration._debugMode.get()) { // show control points
|
||||
List<GeneralPath> paths = PathExporter.export(getShapeNum(), swf, getShapes());
|
||||
|
||||
@@ -652,7 +652,7 @@ public abstract class StaticTextTag extends TextTag {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toImage(int frame, int time, int ratio, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, boolean isClip, Matrix transformation, Matrix strokeTransformation, Matrix absoluteTransformation, Matrix fullTransformation, ColorTransform colorTransform, double unzoom, boolean sameImage, ExportRectangle viewRect, boolean scaleStrokes, int drawMode) {
|
||||
public void toImage(int frame, int time, int ratio, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, boolean isClip, Matrix transformation, Matrix strokeTransformation, Matrix absoluteTransformation, Matrix fullTransformation, ColorTransform colorTransform, double unzoom, boolean sameImage, ExportRectangle viewRect, boolean scaleStrokes, int drawMode, int blendMode) {
|
||||
staticTextToImage(swf, textRecords, getTextNum(), image, textMatrix, transformation, colorTransform);
|
||||
/*try {
|
||||
TextTag originalTag = (TextTag) getOriginalTag();
|
||||
|
||||
@@ -615,7 +615,7 @@ public class Timeline {
|
||||
toImage(frame, time, renderContext, image, isClip, transforms[i], absoluteTransformation, colorTransform, targetRect[i]);
|
||||
}
|
||||
}*/
|
||||
private void drawDrawable(Matrix strokeTransform, DepthState layer, Matrix layerMatrix, Graphics2D g, ColorTransform colorTransForm, int blendMode, List<Clip> clips, Matrix transformation, boolean isClip, int clipDepth, Matrix absMat, int time, int ratio, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, DrawableTag drawable, List<FILTER> filters, double unzoom, ColorTransform clrTrans, boolean sameImage, ExportRectangle viewRect, Matrix fullTransformation, boolean scaleStrokes, int drawMode) {
|
||||
private void drawDrawable(Matrix strokeTransform, DepthState layer, Matrix layerMatrix, Graphics2D g, ColorTransform colorTransForm, int blendMode, int parentBlendMode, List<Clip> clips, Matrix transformation, boolean isClip, int clipDepth, Matrix absMat, int time, int ratio, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, DrawableTag drawable, List<FILTER> filters, double unzoom, ColorTransform clrTrans, boolean sameImage, ExportRectangle viewRect, Matrix fullTransformation, boolean scaleStrokes, int drawMode) {
|
||||
Matrix drawMatrix = new Matrix();
|
||||
int drawableFrameCount = drawable.getNumFrames();
|
||||
if (drawableFrameCount == 0) {
|
||||
@@ -795,7 +795,7 @@ public class Timeline {
|
||||
|
||||
if (blendMode > 1) {
|
||||
clrTrans2 = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (clipDepth > -1) {
|
||||
//Make transparent colors opaque, mask should be only made by shapes
|
||||
@@ -810,7 +810,7 @@ public class Timeline {
|
||||
}
|
||||
|
||||
if (!(drawable instanceof ImageTag) || (swf.isAS3() && layer.hasImage)) {
|
||||
drawable.toImage(dframe, time, ratio, renderContext, img, fullImage, isClip || clipDepth > -1, m, strokeTransform, absMat, mfull, clrTrans2, unzoom, sameImage, viewRect2, scaleStrokes, drawMode);
|
||||
drawable.toImage(dframe, time, ratio, renderContext, img, fullImage, isClip || clipDepth > -1, m, strokeTransform, absMat, mfull, clrTrans2, unzoom, sameImage, viewRect2, scaleStrokes, drawMode, layer.blendMode);
|
||||
} else {
|
||||
// todo: show one time warning
|
||||
}
|
||||
@@ -923,27 +923,16 @@ public class Timeline {
|
||||
Shape shape = drawable.getOutline(dframe, time, layer.ratio, renderContext, absMat.preConcatenate(Matrix.getScaleInstance(1 / SWF.unitDivisor)), true);
|
||||
g2.draw(shape);
|
||||
}
|
||||
|
||||
/*if (sameImage && canUseSameImage) {
|
||||
if (g instanceof GraphicsGroupable) {
|
||||
((GraphicsGroupable) g).drawGroup(img.getGraphics());
|
||||
}
|
||||
}*/
|
||||
if (!(sameImage && canUseSameImage)) {
|
||||
g.setTransform(drawMatrix.toTransform());
|
||||
|
||||
if (blendMode > 1 && clrTrans != null) {
|
||||
img = clrTrans.apply(img);
|
||||
}
|
||||
|
||||
g.drawImage(img.getBufferedImage(), 0, 0, null);
|
||||
//g.setColor(Color.red);
|
||||
//g.drawRect(0, 0, img.getWidth(), img.getHeight());
|
||||
/*try {
|
||||
ImageIO.write(img.getBufferedImage(), "PNG", new File("out.png"));
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(Timeline.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}*/
|
||||
|
||||
if (!((blendMode == 11 || blendMode == 12) && parentBlendMode <= 1)) { //alpha and erase modes require parent blendmode not normal
|
||||
g.drawImage(img.getBufferedImage(), 0, 0, null);
|
||||
}
|
||||
}
|
||||
if (g instanceof BlendModeSetable) {
|
||||
((BlendModeSetable) g).setBlendMode(0);
|
||||
@@ -951,7 +940,7 @@ public class Timeline {
|
||||
}
|
||||
}
|
||||
|
||||
public void toImage(int frame, int time, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, boolean isClip, Matrix transformation, Matrix strokeTransformation, Matrix absoluteTransformation, ColorTransform colorTransform, double unzoom, boolean sameImage, ExportRectangle viewRect, Matrix fullTransformation, boolean scaleStrokes, int drawMode) {
|
||||
public void toImage(int frame, int time, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, boolean isClip, Matrix transformation, Matrix strokeTransformation, Matrix absoluteTransformation, ColorTransform colorTransform, double unzoom, boolean sameImage, ExportRectangle viewRect, Matrix fullTransformation, boolean scaleStrokes, int drawMode, int blendMode) {
|
||||
//double unzoom = SWF.unitDivisor;
|
||||
//unzoom = SWF.unitDivisor;
|
||||
if (getFrameCount() <= frame) {
|
||||
@@ -1087,7 +1076,7 @@ public class Timeline {
|
||||
Rectangle2D r = new Rectangle2D.Double(p1.xMin, p1.yMin, p1.getWidth(), p1.getHeight());
|
||||
|
||||
g.setClip(r);
|
||||
drawDrawable(strokeTransformation, layer, transforms[s], g, colorTransform, layer.blendMode, clips, transformation, isClip, layer.clipDepth, absMat, layer.time + time, layer.ratio, renderContext, image, fullImage, (DrawableTag) character, layer.filters, unzoom, clrTrans, sameImage, viewRect, fullTransformation, false, DRAW_MODE_SHAPES);
|
||||
drawDrawable(strokeTransformation, layer, transforms[s], g, colorTransform, layer.blendMode, blendMode, clips, transformation, isClip, layer.clipDepth, absMat, layer.time + time, layer.ratio, renderContext, image, fullImage, (DrawableTag) character, layer.filters, unzoom, clrTrans, sameImage, viewRect, fullTransformation, false, DRAW_MODE_SHAPES);
|
||||
s++;
|
||||
}
|
||||
}
|
||||
@@ -1096,13 +1085,13 @@ public class Timeline {
|
||||
g.setTransform(origTransform);
|
||||
|
||||
//draw all nonshapes (normally scaled) next
|
||||
drawDrawable(strokeTransformation, layer, layerMatrix, g, colorTransform, layer.blendMode, clips, transformation, isClip, layer.clipDepth, absMat, layer.time + time, layer.ratio, renderContext, image, fullImage, (DrawableTag) character, layer.filters, unzoom, clrTrans, sameImage, viewRect, fullTransformation, scaleStrokes, DRAW_MODE_SPRITES);
|
||||
drawDrawable(strokeTransformation, layer, layerMatrix, g, colorTransform, layer.blendMode, blendMode, clips, transformation, isClip, layer.clipDepth, absMat, layer.time + time, layer.ratio, renderContext, image, fullImage, (DrawableTag) character, layer.filters, unzoom, clrTrans, sameImage, viewRect, fullTransformation, scaleStrokes, DRAW_MODE_SPRITES);
|
||||
} else {
|
||||
boolean subScaleStrokes = scaleStrokes;
|
||||
if (character instanceof DefineSpriteTag) {
|
||||
subScaleStrokes = true;
|
||||
}
|
||||
drawDrawable(strokeTransformation, layer, layerMatrix, g, colorTransform, layer.blendMode, clips, transformation, isClip, layer.clipDepth, absMat, layer.time + time, layer.ratio, renderContext, image, fullImage, (DrawableTag) character, layer.filters, unzoom, clrTrans, sameImage, viewRect, fullTransformation, subScaleStrokes, DRAW_MODE_ALL);
|
||||
drawDrawable(strokeTransformation, layer, layerMatrix, g, colorTransform, layer.blendMode, blendMode, clips, transformation, isClip, layer.clipDepth, absMat, layer.time + time, layer.ratio, renderContext, image, fullImage, (DrawableTag) character, layer.filters, unzoom, clrTrans, sameImage, viewRect, fullTransformation, subScaleStrokes, DRAW_MODE_ALL);
|
||||
}
|
||||
} else if (character instanceof BoundedTag) {
|
||||
showPlaceholder = true;
|
||||
|
||||
@@ -190,34 +190,59 @@ public final class BlendComposite implements Composite {
|
||||
srcPixel[1] = (pixel >> 8) & 0xFF;
|
||||
srcPixel[2] = (pixel) & 0xFF;
|
||||
srcPixel[3] = (pixel >> 24) & 0xFF;
|
||||
|
||||
|
||||
|
||||
if (srcPixel[3] != 1 && srcPixel[3] != 0) {
|
||||
srcPixel[0] = srcPixel[0] * 255 / srcPixel[3];
|
||||
srcPixel[1] = srcPixel[1] * 255 / srcPixel[3];
|
||||
srcPixel[2] = srcPixel[2] * 255 / srcPixel[3];
|
||||
}
|
||||
|
||||
|
||||
pixel = dstPixels[x];
|
||||
dstPixel[0] = (pixel >> 16) & 0xFF;
|
||||
dstPixel[1] = (pixel >> 8) & 0xFF;
|
||||
dstPixel[2] = (pixel) & 0xFF;
|
||||
dstPixel[3] = (pixel >> 24) & 0xFF;
|
||||
|
||||
blender.blend(srcPixel, dstPixel, result);
|
||||
|
||||
result[3] = 255;
|
||||
if (composite.mode == BlendingMode.ALPHA) {
|
||||
retPixel[0] = dstPixel[0];
|
||||
retPixel[1] = dstPixel[1];
|
||||
retPixel[2] = dstPixel[2];
|
||||
if (srcPixel[3] != 0) {
|
||||
retPixel[0] = retPixel[0] * srcPixel[3] / 255;
|
||||
retPixel[1] = retPixel[1] * srcPixel[3] / 255;
|
||||
retPixel[2] = retPixel[2] * srcPixel[3] / 255;
|
||||
retPixel[3] = srcPixel[3];
|
||||
} else {
|
||||
retPixel[3] = 255;
|
||||
}
|
||||
} else if (composite.mode == BlendingMode.ERASE) {
|
||||
retPixel[0] = dstPixel[0];
|
||||
retPixel[1] = dstPixel[1];
|
||||
retPixel[2] = dstPixel[2];
|
||||
if (srcPixel[3] != 0) {
|
||||
int a = 255 - srcPixel[3];
|
||||
retPixel[0] = retPixel[0] * a / 255;
|
||||
retPixel[1] = retPixel[1] * a / 255;
|
||||
retPixel[2] = retPixel[2] * a / 255;
|
||||
retPixel[3] = a;
|
||||
} else {
|
||||
retPixel[3] = 255;
|
||||
}
|
||||
} else {
|
||||
blender.blend(srcPixel, dstPixel, result);
|
||||
|
||||
retPixel[0] = ((int) (dstPixel[0] + (result[0] - dstPixel[0]) * alpha) & 0xFF);
|
||||
retPixel[1] = ((int) (dstPixel[1] + (result[1] - dstPixel[1]) * alpha) & 0xFF);
|
||||
retPixel[2] = (int) (dstPixel[2] + (result[2] - dstPixel[2]) * alpha) & 0xFF;
|
||||
retPixel[3] = ((int) (dstPixel[3] + (result[3] - dstPixel[3]) * alpha) & 0xFF);
|
||||
|
||||
float af = ((float) srcPixel[3]) / 255f;
|
||||
retPixel[0] = (int) ((1f - af) * dstPixel[0] + af * retPixel[0]);
|
||||
retPixel[1] = (int) ((1f - af) * dstPixel[1] + af * retPixel[1]);
|
||||
retPixel[2] = (int) ((1f - af) * dstPixel[2] + af * retPixel[2]);
|
||||
retPixel[3] = (int) ((1f - af) * dstPixel[3] + af * retPixel[3]);
|
||||
result[3] = 255;
|
||||
retPixel[0] = ((int) (dstPixel[0] + (result[0] - dstPixel[0]) * alpha) & 0xFF);
|
||||
retPixel[1] = ((int) (dstPixel[1] + (result[1] - dstPixel[1]) * alpha) & 0xFF);
|
||||
retPixel[2] = (int) (dstPixel[2] + (result[2] - dstPixel[2]) * alpha) & 0xFF;
|
||||
retPixel[3] = ((int) (dstPixel[3] + (result[3] - dstPixel[3]) * alpha) & 0xFF);
|
||||
|
||||
float af = ((float) srcPixel[3]) / 255f;
|
||||
retPixel[0] = (int) ((1f - af) * dstPixel[0] + af * retPixel[0]);
|
||||
retPixel[1] = (int) ((1f - af) * dstPixel[1] + af * retPixel[1]);
|
||||
retPixel[2] = (int) ((1f - af) * dstPixel[2] + af * retPixel[2]);
|
||||
retPixel[3] = (int) ((1f - af) * dstPixel[3] + af * retPixel[3]);
|
||||
}
|
||||
|
||||
dstPixels[x] = (retPixel[3] << 24)
|
||||
| retPixel[0] << 16
|
||||
|
||||
Reference in New Issue
Block a user