From 097a391967bea52826a2ab836e648a5ee474e9aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Fri, 4 Nov 2022 06:12:01 +0100 Subject: [PATCH] Fixed Flash viewer - subtract blend mode --- CHANGELOG.md | 2 ++ .../flash/types/filters/BlendComposite.java | 11 ++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ad1faf19..9fa701a11 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +### Fixed +- Flash viewer - subtract blend mode ## [16.0.4] - 2022-11-03 ### Fixed diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/filters/BlendComposite.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/filters/BlendComposite.java index d42c54f66..9403dfe18 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/filters/BlendComposite.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/filters/BlendComposite.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.types.filters; import java.awt.Composite; @@ -350,10 +351,10 @@ public final class BlendComposite implements Composite { return new Blender() { @Override public void blend(int[] src, int[] dst, int[] result) { - result[0] = Math.max(0, src[0] + dst[0] - 256); - result[1] = Math.max(0, src[1] + dst[1] - 256); - result[2] = Math.max(0, src[2] + dst[2] - 256); - result[3] = Math.min(255, src[3] + dst[3] - (src[3] * dst[3]) / 255); + result[0] = Math.max(0, dst[0] - src[0]); + result[1] = Math.max(0, dst[1] - src[1]); + result[2] = Math.max(0, dst[2] - src[2]); + result[3] = Math.min(255, src[3] + dst[3] - 256 - (src[3] * dst[3]) / 255); } }; }