mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-17 06:11:53 +00:00
convert image tags from command line
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 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.importers;
|
||||
|
||||
import com.jpexs.decompiler.flash.tags.DefineFont2Tag;
|
||||
import com.jpexs.decompiler.flash.tags.DefineFont3Tag;
|
||||
import com.jpexs.decompiler.flash.tags.DefineFont4Tag;
|
||||
import com.jpexs.decompiler.flash.tags.DefineFontTag;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class FontImporter {
|
||||
|
||||
public static int getFontTagType(String format) {
|
||||
int res = 0;
|
||||
switch (format) {
|
||||
case "font":
|
||||
res = DefineFontTag.ID;
|
||||
break;
|
||||
case "font2":
|
||||
res = DefineFont2Tag.ID;
|
||||
break;
|
||||
case "font3":
|
||||
res = DefineFont3Tag.ID;
|
||||
break;
|
||||
case "font4":
|
||||
res = DefineFont4Tag.ID;
|
||||
break;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,7 @@ import com.jpexs.decompiler.flash.tags.Tag;
|
||||
import com.jpexs.decompiler.flash.tags.base.ImageTag;
|
||||
import com.jpexs.decompiler.flash.tags.enums.ImageFormat;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
@@ -112,4 +113,31 @@ public class ImageImporter extends TagImporter {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void convertImage(ImageTag it, int tagType) throws IOException {
|
||||
importImage(it, Helper.readStream(it.getImageData()), tagType);
|
||||
}
|
||||
|
||||
public static int getImageTagType(String format) {
|
||||
int res = 0;
|
||||
switch (format) {
|
||||
case "lossless":
|
||||
res = DefineBitsLosslessTag.ID;
|
||||
break;
|
||||
case "lossless2":
|
||||
res = DefineBitsLossless2Tag.ID;
|
||||
break;
|
||||
case "jpeg2":
|
||||
res = DefineBitsJPEG2Tag.ID;
|
||||
break;
|
||||
case "jpeg3":
|
||||
res = DefineBitsJPEG3Tag.ID;
|
||||
break;
|
||||
case "jpeg4":
|
||||
res = DefineBitsJPEG4Tag.ID;
|
||||
break;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 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.importers;
|
||||
|
||||
import com.jpexs.decompiler.flash.tags.DefineMorphShape2Tag;
|
||||
import com.jpexs.decompiler.flash.tags.DefineMorphShapeTag;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class MorphShapeImporter {
|
||||
|
||||
public static int getMorphShapeTagType(String format) {
|
||||
int res = 0;
|
||||
switch (format) {
|
||||
case "morphshape":
|
||||
res = DefineMorphShapeTag.ID;
|
||||
break;
|
||||
case "morphshape2":
|
||||
res = DefineMorphShape2Tag.ID;
|
||||
break;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,10 @@ import com.jpexs.decompiler.flash.tags.DefineBitsJPEG3Tag;
|
||||
import com.jpexs.decompiler.flash.tags.DefineBitsJPEG4Tag;
|
||||
import com.jpexs.decompiler.flash.tags.DefineBitsLossless2Tag;
|
||||
import com.jpexs.decompiler.flash.tags.DefineBitsLosslessTag;
|
||||
import com.jpexs.decompiler.flash.tags.DefineShape2Tag;
|
||||
import com.jpexs.decompiler.flash.tags.DefineShape3Tag;
|
||||
import com.jpexs.decompiler.flash.tags.DefineShape4Tag;
|
||||
import com.jpexs.decompiler.flash.tags.DefineShapeTag;
|
||||
import com.jpexs.decompiler.flash.tags.Tag;
|
||||
import com.jpexs.decompiler.flash.tags.base.ImageTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.ShapeTag;
|
||||
@@ -113,4 +117,24 @@ public class ShapeImporter {
|
||||
st.shapes = shapes;
|
||||
return (Tag) st;
|
||||
}
|
||||
|
||||
public static int getShapeTagType(String format) {
|
||||
int res = 0;
|
||||
switch (format) {
|
||||
case "shape":
|
||||
res = DefineShapeTag.ID;
|
||||
break;
|
||||
case "shape2":
|
||||
res = DefineShape2Tag.ID;
|
||||
break;
|
||||
case "shape3":
|
||||
res = DefineShape3Tag.ID;
|
||||
break;
|
||||
case "shape4":
|
||||
res = DefineShape4Tag.ID;
|
||||
break;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,9 @@ package com.jpexs.decompiler.flash.importers;
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import com.jpexs.decompiler.flash.exporters.settings.TextExportSettings;
|
||||
import com.jpexs.decompiler.flash.tags.DefineEditTextTag;
|
||||
import com.jpexs.decompiler.flash.tags.DefineText2Tag;
|
||||
import com.jpexs.decompiler.flash.tags.DefineTextTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.MissingCharacterHandler;
|
||||
import com.jpexs.decompiler.flash.tags.base.TextImportErrorHandler;
|
||||
import com.jpexs.decompiler.flash.tags.base.TextTag;
|
||||
@@ -167,4 +170,21 @@ public class TextImporter {
|
||||
return !errorHandler.handle(textTag, ex.text, ex.line);
|
||||
}
|
||||
}
|
||||
|
||||
public static int getTextTagType(String format) {
|
||||
int res = 0;
|
||||
switch (format) {
|
||||
case "text":
|
||||
res = DefineTextTag.ID;
|
||||
break;
|
||||
case "text2":
|
||||
res = DefineText2Tag.ID;
|
||||
break;
|
||||
case "edittext":
|
||||
res = DefineEditTextTag.ID;
|
||||
break;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user