From 2fa3b7dd7274e83d04f6eb46e329cca52fd13772 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Sun, 13 Nov 2022 16:25:52 +0100 Subject: [PATCH] Added Raw editor - Edit blend modes as enum --- CHANGELOG.md | 1 + .../flash/tags/PlaceObject3Tag.java | 17 +++++++++ .../flash/tags/PlaceObject4Tag.java | 17 +++++++++ .../decompiler/flash/types/BUTTONRECORD.java | 16 ++++++++ .../decompiler/flash/types/BlendMode.java | 38 +++++++++++++++++++ 5 files changed, 89 insertions(+) create mode 100644 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/BlendMode.java diff --git a/CHANGELOG.md b/CHANGELOG.md index f2f63f0b9..a8033b49d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ All notable changes to this project will be documented in this file. - Show button records in the tree, preview them - Show in Hex dump for BUTTONCONDACTION, BUTTONRECORD, CLIPACTIONRECORD - Alpha and Erase blend modes support +- Raw editor - Edit blend modes as enum ### Fixed - Exception when bundle selected diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/PlaceObject3Tag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/PlaceObject3Tag.java index dc0200b47..d95ada12b 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/PlaceObject3Tag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/PlaceObject3Tag.java @@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.amf.amf3.Amf3Value; import com.jpexs.decompiler.flash.tags.base.ASMSourceContainer; import com.jpexs.decompiler.flash.tags.base.PlaceObjectTypeTag; import com.jpexs.decompiler.flash.types.BasicType; +import com.jpexs.decompiler.flash.types.BlendMode; import com.jpexs.decompiler.flash.types.CLIPACTIONRECORD; import com.jpexs.decompiler.flash.types.CLIPACTIONS; import com.jpexs.decompiler.flash.types.CXFORMWITHALPHA; @@ -31,6 +32,7 @@ import com.jpexs.decompiler.flash.types.ColorTransform; import com.jpexs.decompiler.flash.types.MATRIX; import com.jpexs.decompiler.flash.types.RGBA; import com.jpexs.decompiler.flash.types.annotations.Conditional; +import com.jpexs.decompiler.flash.types.annotations.EnumValue; import com.jpexs.decompiler.flash.types.annotations.Internal; import com.jpexs.decompiler.flash.types.annotations.Reserved; import com.jpexs.decompiler.flash.types.annotations.SWFArray; @@ -196,6 +198,21 @@ public class PlaceObject3Tag extends PlaceObjectTypeTag implements ASMSourceCont */ @SWFType(BasicType.UI8) @Conditional("placeFlagHasBlendMode") + @EnumValue(value = 0, text = "normal") + @EnumValue(value = BlendMode.NORMAL, text = "normal") + @EnumValue(value = BlendMode.LAYER, text = "layer") + @EnumValue(value = BlendMode.MULTIPLY, text = "multiply") + @EnumValue(value = BlendMode.SCREEN, text = "screen") + @EnumValue(value = BlendMode.LIGHTEN, text = "lighten") + @EnumValue(value = BlendMode.DARKEN, text = "darken") + @EnumValue(value = BlendMode.DIFFERENCE, text = "difference") + @EnumValue(value = BlendMode.ADD, text = "add") + @EnumValue(value = BlendMode.SUBTRACT, text = "subtract") + @EnumValue(value = BlendMode.INVERT, text = "invert") + @EnumValue(value = BlendMode.ALPHA, text = "alpha") + @EnumValue(value = BlendMode.ERASE, text = "erase") + @EnumValue(value = BlendMode.OVERLAY, text = "overlay") + @EnumValue(value = BlendMode.HARDLIGHT, text = "hardlight") public int blendMode; /** diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/PlaceObject4Tag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/PlaceObject4Tag.java index f918fc7a8..474391253 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/PlaceObject4Tag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/PlaceObject4Tag.java @@ -25,6 +25,7 @@ import com.jpexs.decompiler.flash.amf.amf3.NoSerializerExistsException; import com.jpexs.decompiler.flash.tags.base.ASMSourceContainer; import com.jpexs.decompiler.flash.tags.base.PlaceObjectTypeTag; import com.jpexs.decompiler.flash.types.BasicType; +import com.jpexs.decompiler.flash.types.BlendMode; import com.jpexs.decompiler.flash.types.CLIPACTIONRECORD; import com.jpexs.decompiler.flash.types.CLIPACTIONS; import com.jpexs.decompiler.flash.types.CXFORMWITHALPHA; @@ -32,6 +33,7 @@ import com.jpexs.decompiler.flash.types.ColorTransform; import com.jpexs.decompiler.flash.types.MATRIX; import com.jpexs.decompiler.flash.types.RGBA; import com.jpexs.decompiler.flash.types.annotations.Conditional; +import com.jpexs.decompiler.flash.types.annotations.EnumValue; import com.jpexs.decompiler.flash.types.annotations.Internal; import com.jpexs.decompiler.flash.types.annotations.Reserved; import com.jpexs.decompiler.flash.types.annotations.SWFArray; @@ -199,6 +201,21 @@ public class PlaceObject4Tag extends PlaceObjectTypeTag implements ASMSourceCont */ @SWFType(BasicType.UI8) @Conditional("placeFlagHasBlendMode") + @EnumValue(value = 0, text = "normal") + @EnumValue(value = BlendMode.NORMAL, text = "normal") + @EnumValue(value = BlendMode.LAYER, text = "layer") + @EnumValue(value = BlendMode.MULTIPLY, text = "multiply") + @EnumValue(value = BlendMode.SCREEN, text = "screen") + @EnumValue(value = BlendMode.LIGHTEN, text = "lighten") + @EnumValue(value = BlendMode.DARKEN, text = "darken") + @EnumValue(value = BlendMode.DIFFERENCE, text = "difference") + @EnumValue(value = BlendMode.ADD, text = "add") + @EnumValue(value = BlendMode.SUBTRACT, text = "subtract") + @EnumValue(value = BlendMode.INVERT, text = "invert") + @EnumValue(value = BlendMode.ALPHA, text = "alpha") + @EnumValue(value = BlendMode.ERASE, text = "erase") + @EnumValue(value = BlendMode.OVERLAY, text = "overlay") + @EnumValue(value = BlendMode.HARDLIGHT, text = "hardlight") public int blendMode; /** diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/BUTTONRECORD.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/BUTTONRECORD.java index 5d69f91fa..e807bafa8 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/BUTTONRECORD.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/BUTTONRECORD.java @@ -22,6 +22,7 @@ import com.jpexs.decompiler.flash.tags.Tag; import com.jpexs.decompiler.flash.tags.base.ButtonTag; import com.jpexs.decompiler.flash.treeitems.TreeItem; import com.jpexs.decompiler.flash.types.annotations.Conditional; +import com.jpexs.decompiler.flash.types.annotations.EnumValue; import com.jpexs.decompiler.flash.types.annotations.Internal; import com.jpexs.decompiler.flash.types.annotations.Reserved; import com.jpexs.decompiler.flash.types.annotations.SWFArray; @@ -107,6 +108,21 @@ public class BUTTONRECORD implements Serializable, TreeItem, HasSwfAndTag, HasCh */ @SWFType(BasicType.UI8) @Conditional(value = {"buttonHasBlendMode"}, tags = {DefineButton2Tag.ID}) + @EnumValue(value = 0, text = "normal") + @EnumValue(value = BlendMode.NORMAL, text = "normal") + @EnumValue(value = BlendMode.LAYER, text = "layer") + @EnumValue(value = BlendMode.MULTIPLY, text = "multiply") + @EnumValue(value = BlendMode.SCREEN, text = "screen") + @EnumValue(value = BlendMode.LIGHTEN, text = "lighten") + @EnumValue(value = BlendMode.DARKEN, text = "darken") + @EnumValue(value = BlendMode.DIFFERENCE, text = "difference") + @EnumValue(value = BlendMode.ADD, text = "add") + @EnumValue(value = BlendMode.SUBTRACT, text = "subtract") + @EnumValue(value = BlendMode.INVERT, text = "invert") + @EnumValue(value = BlendMode.ALPHA, text = "alpha") + @EnumValue(value = BlendMode.ERASE, text = "erase") + @EnumValue(value = BlendMode.OVERLAY, text = "overlay") + @EnumValue(value = BlendMode.HARDLIGHT, text = "hardlight") public int blendMode; @Internal diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/BlendMode.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/BlendMode.java new file mode 100644 index 000000000..3fd7df192 --- /dev/null +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/BlendMode.java @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2010-2022 JPEXS, All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3.0 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. + */ +package com.jpexs.decompiler.flash.types; + +/** + * + * @author JPEXS + */ +public class BlendMode { + public static final int NORMAL = 1; + public static final int LAYER = 2; + public static final int MULTIPLY = 3; + public static final int SCREEN = 4; + public static final int LIGHTEN = 5; + public static final int DARKEN = 6; + public static final int DIFFERENCE = 7; + public static final int ADD = 8; + public static final int SUBTRACT = 9; + public static final int INVERT = 10; + public static final int ALPHA = 11; + public static final int ERASE = 12; + public static final int OVERLAY = 13; + public static final int HARDLIGHT = 14; +}