mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-25 16:30:47 +00:00
final MORPHGRADIENT fix
This commit is contained in:
@@ -2288,9 +2288,11 @@ public class SWFInputStream extends InputStream {
|
||||
*/
|
||||
public MORPHGRADIENT readMORPHGRADIENT() throws IOException {
|
||||
MORPHGRADIENT ret = new MORPHGRADIENT();
|
||||
int numGradients = (int) readUI8();
|
||||
ret.numGradientsExtra = numGradients & 0xf0; //some extra data. Are these the same as in GRADIENT or just obfuscator junk???
|
||||
numGradients = numGradients & 0x0f;
|
||||
//Despite of documentation (UI8 1-8), there are two fields
|
||||
// spreadMode and interPolationMode which are same as in GRADIENT
|
||||
ret.spreadMode = (int) readUB(2);
|
||||
ret.interPolationMode = (int) readUB(2);
|
||||
int numGradients = (int) readUB(4);
|
||||
ret.gradientRecords = new MORPHGRADRECORD[numGradients];
|
||||
for (int i = 0; i < numGradients; i++) {
|
||||
ret.gradientRecords[i] = readMORPHGRADRECORD();
|
||||
|
||||
@@ -1471,7 +1471,11 @@ public class SWFOutputStream extends OutputStream {
|
||||
* @throws IOException
|
||||
*/
|
||||
public void writeMORPHGRADIENT(MORPHGRADIENT value, int shapeNum) throws IOException {
|
||||
writeUI8(value.gradientRecords.length + value.numGradientsExtra);
|
||||
//Despite of documentation (UI8 1-8), there are two fields
|
||||
// spreadMode and interPolationMode which are same as in GRADIENT
|
||||
writeUB(2, value.spreadMode);
|
||||
writeUB(2, value.interPolationMode);
|
||||
writeUB(4, value.gradientRecords.length);
|
||||
for (int i = 0; i < value.gradientRecords.length; i++) {
|
||||
writeMORPHGRADRECORD(value.gradientRecords[i]);
|
||||
}
|
||||
|
||||
@@ -22,11 +22,17 @@ package com.jpexs.decompiler.flash.types;
|
||||
*/
|
||||
public class GRADIENT {
|
||||
|
||||
/**
|
||||
* Spread mode
|
||||
*/
|
||||
public int spreadMode;
|
||||
public static final int SPREAD_PAD_MODE = 0;
|
||||
public static final int SPREAD_REFLECT_MODE = 1;
|
||||
public static final int SPREAD_REPEAT_MODE = 2;
|
||||
public static final int SPREAD_RESERVED = 3;
|
||||
/**
|
||||
* Interpolation mode
|
||||
*/
|
||||
public int interPolationMode;
|
||||
public static final int INTERPOLATION_RGB_MODE = 0;
|
||||
public static final int INTERPOLATION_LINEAR_RGB_MODE = 1;
|
||||
|
||||
@@ -22,9 +22,16 @@ package com.jpexs.decompiler.flash.types;
|
||||
*/
|
||||
public class MORPHGRADIENT {
|
||||
|
||||
/**
|
||||
* Spread mode. See GRADIENT.SPREAD_* constants
|
||||
*/
|
||||
public int spreadMode;
|
||||
/**
|
||||
* Interpolation mode. See GRADIENT.INTERPOLATION_* constants
|
||||
*/
|
||||
public int interPolationMode;
|
||||
public int numGradients;
|
||||
public MORPHGRADRECORD gradientRecords[];
|
||||
public int numGradientsExtra;
|
||||
|
||||
public static RGBA morphColor(RGBA c1, RGBA c2, int ratio) {
|
||||
int r = (c1.red + (c2.red - c1.red) * ratio / 65535);
|
||||
|
||||
Reference in New Issue
Block a user