mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-24 23:00:46 +00:00
Fixed: fontFace html attribute in DefineEditText can be also an exportName
Fixed: BUTTONRECORD preview not showing in situations like GFX or importAssets Changed: ImportAssets tag reorganized - now imported items are not in the tag tree, but when referenced it works
This commit is contained in:
+4
-1
@@ -65,6 +65,8 @@ All notable changes to this project will be documented in this file.
|
|||||||
- Outputstreams position calculation (ABCOutputStream, ...)
|
- Outputstreams position calculation (ABCOutputStream, ...)
|
||||||
- [#2260] Reading end of file on old GFX format (1.x)
|
- [#2260] Reading end of file on old GFX format (1.x)
|
||||||
- [#2260] DefineExternalImage on old GFX format (1.x)
|
- [#2260] DefineExternalImage on old GFX format (1.x)
|
||||||
|
- fontFace html attribute in DefineEditText can be also an exportName
|
||||||
|
- BUTTONRECORD preview not showing in situations like GFX or importAssets
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- [#2185] MochiCrypt no longer offered for auto decrypt, user needs to choose variant from "Use unpacker" menu
|
- [#2185] MochiCrypt no longer offered for auto decrypt, user needs to choose variant from "Use unpacker" menu
|
||||||
@@ -72,7 +74,8 @@ All notable changes to this project will be documented in this file.
|
|||||||
- Information in the tag node title now has abbreviated prefix of type for each bit of info.
|
- Information in the tag node title now has abbreviated prefix of type for each bit of info.
|
||||||
Example: `DefineSprite (chid: 27, cls: pkg.MySprite)` instead of `DefineSprite (27, pkg.MySprite)`
|
Example: `DefineSprite (chid: 27, cls: pkg.MySprite)` instead of `DefineSprite (27, pkg.MySprite)`
|
||||||
- Information in the tag node title - separated exportName from assigned class
|
- Information in the tag node title - separated exportName from assigned class
|
||||||
|
- ImportAssets tag reorganized - now imported items are not in the tag tree, but when referenced it works
|
||||||
|
|
||||||
## [20.1.0] - 2023-12-30
|
## [20.1.0] - 2023-12-30
|
||||||
### Added
|
### Added
|
||||||
- Configurable tab size (formatting must be set to use tabs) - default matches indent size of 3
|
- Configurable tab size (formatting must be set to use tabs) - default matches indent size of 3
|
||||||
|
|||||||
@@ -207,6 +207,7 @@ import java.util.Date;
|
|||||||
import java.util.EmptyStackException;
|
import java.util.EmptyStackException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.IdentityHashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
@@ -323,7 +324,14 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
|
|||||||
|
|
||||||
@Internal
|
@Internal
|
||||||
private volatile Map<Integer, CharacterTag> characters;
|
private volatile Map<Integer, CharacterTag> characters;
|
||||||
|
|
||||||
|
@Internal
|
||||||
|
private volatile Map<Integer, CharacterTag> charactersWithImported;
|
||||||
|
|
||||||
|
|
||||||
|
@Internal
|
||||||
|
private volatile Map<CharacterIdTag, Integer> characterToId;
|
||||||
|
|
||||||
@Internal
|
@Internal
|
||||||
private volatile Map<Integer, DefineExternalImage2> externalImages2;
|
private volatile Map<Integer, DefineExternalImage2> externalImages2;
|
||||||
|
|
||||||
@@ -417,6 +425,9 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
|
|||||||
@Internal
|
@Internal
|
||||||
private Map<String, Integer> exportNameToCharacter = new HashMap<>();
|
private Map<String, Integer> exportNameToCharacter = new HashMap<>();
|
||||||
|
|
||||||
|
@Internal
|
||||||
|
private Map<String, Integer> importedNameToCharacter = new HashMap<>();
|
||||||
|
|
||||||
@Internal
|
@Internal
|
||||||
private AbcIndexing abcIndex;
|
private AbcIndexing abcIndex;
|
||||||
|
|
||||||
@@ -430,7 +441,11 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
|
|||||||
|
|
||||||
@Internal
|
@Internal
|
||||||
public String debuggerPackage = null;
|
public String debuggerPackage = null;
|
||||||
|
|
||||||
|
private Map<Integer, SWF> importedCharacterSourceSwfs = new HashMap<>();
|
||||||
|
private Map<Integer, Integer> importedCharacterIds = new HashMap<>();
|
||||||
|
|
||||||
|
|
||||||
private static AbcIndexing playerGlobalAbcIndex;
|
private static AbcIndexing playerGlobalAbcIndex;
|
||||||
|
|
||||||
private static AbcIndexing airGlobalAbcIndex;
|
private static AbcIndexing airGlobalAbcIndex;
|
||||||
@@ -572,6 +587,8 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
|
|||||||
|
|
||||||
public void updateCharacters() {
|
public void updateCharacters() {
|
||||||
characters = null;
|
characters = null;
|
||||||
|
charactersWithImported = null;
|
||||||
|
characterToId = null;
|
||||||
characterIdTags = null;
|
characterIdTags = null;
|
||||||
externalImages2 = null;
|
externalImages2 = null;
|
||||||
}
|
}
|
||||||
@@ -628,6 +645,8 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
|
|||||||
clearAbcListCache();
|
clearAbcListCache();
|
||||||
|
|
||||||
characters = null;
|
characters = null;
|
||||||
|
charactersWithImported = null;
|
||||||
|
characterToId = null;
|
||||||
characterIdTags = null;
|
characterIdTags = null;
|
||||||
externalImages2 = null;
|
externalImages2 = null;
|
||||||
|
|
||||||
@@ -647,31 +666,59 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
|
|||||||
|
|
||||||
di.getChildInfos().clear();
|
di.getChildInfos().clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<Integer, CharacterTag> getCharacters() {
|
public Map<Integer, CharacterTag> getCharacters(boolean withImported) {
|
||||||
if (characters == null) {
|
if (characters == null) {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
if (characters == null) {
|
if (characters == null) {
|
||||||
if (destroyed) {
|
if (destroyed) {
|
||||||
return new HashMap<>();
|
return new HashMap<>();
|
||||||
}
|
}
|
||||||
Map<Integer, CharacterTag> chars = new HashMap<>();
|
Map<Integer, CharacterTag> chars = new HashMap<>();
|
||||||
|
Map<Integer, CharacterTag> charsWithImported = new HashMap<>();
|
||||||
Map<Integer, List<CharacterIdTag>> charIdtags = new HashMap<>();
|
Map<Integer, List<CharacterIdTag>> charIdtags = new HashMap<>();
|
||||||
Map<Integer, DefineExternalImage2> eimages = new HashMap<>();
|
Map<Integer, DefineExternalImage2> eimages = new HashMap<>();
|
||||||
parseCharacters(getTags(), eimages, chars, charIdtags);
|
parseCharacters(getTags(), eimages, chars, charIdtags);
|
||||||
|
charsWithImported.putAll(chars);
|
||||||
|
for (int importedCharacterId : importedCharacterIds.keySet()) {
|
||||||
|
int exportedCharacterId = importedCharacterIds.get(importedCharacterId);
|
||||||
|
SWF importedSwf = importedCharacterSourceSwfs.get(importedCharacterId);
|
||||||
|
charsWithImported.put(importedCharacterId, importedSwf.getCharacter(exportedCharacterId));
|
||||||
|
charIdtags.put(importedCharacterId, importedSwf.getCharacterIdTags(exportedCharacterId));
|
||||||
|
//FIXME? eimages
|
||||||
|
|
||||||
|
charsWithImported.get(importedCharacterId).setImported(true, true);
|
||||||
|
for (CharacterIdTag chi : charIdtags.get(importedCharacterId)) {
|
||||||
|
if (chi instanceof Tag) {
|
||||||
|
((Tag) chi).setImported(true, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Map<CharacterIdTag, Integer> charToId = new IdentityHashMap<>();
|
||||||
|
for (int id : charsWithImported.keySet()) {
|
||||||
|
charToId.put(charsWithImported.get(id), id);
|
||||||
|
}
|
||||||
|
for (int id : charIdtags.keySet()) {
|
||||||
|
for (CharacterIdTag ch : charIdtags.get(id)) {
|
||||||
|
charToId.put(ch, id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
characters = Collections.unmodifiableMap(chars);
|
characters = Collections.unmodifiableMap(chars);
|
||||||
|
charactersWithImported = Collections.unmodifiableMap(charsWithImported);
|
||||||
|
characterToId = Collections.unmodifiableMap(charToId);
|
||||||
characterIdTags = Collections.unmodifiableMap(charIdtags);
|
characterIdTags = Collections.unmodifiableMap(charIdtags);
|
||||||
externalImages2 = Collections.unmodifiableMap(eimages);
|
externalImages2 = Collections.unmodifiableMap(eimages);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return characters;
|
return withImported ? charactersWithImported : characters;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<Integer, DefineExternalImage2> getExternalImages2() {
|
public Map<Integer, DefineExternalImage2> getExternalImages2() {
|
||||||
if (externalImages2 == null) {
|
if (externalImages2 == null) {
|
||||||
getCharacters();
|
getCharacters(true);
|
||||||
}
|
}
|
||||||
return externalImages2;
|
return externalImages2;
|
||||||
}
|
}
|
||||||
@@ -683,12 +730,12 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
|
|||||||
|
|
||||||
public List<CharacterIdTag> getCharacterIdTags(int characterId) {
|
public List<CharacterIdTag> getCharacterIdTags(int characterId) {
|
||||||
if (characterIdTags == null) {
|
if (characterIdTags == null) {
|
||||||
getCharacters();
|
getCharacters(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return characterIdTags.get(characterId);
|
return characterIdTags.get(characterId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CharacterIdTag getCharacterIdTag(int characterId, int tagId) {
|
public CharacterIdTag getCharacterIdTag(int characterId, int tagId) {
|
||||||
List<CharacterIdTag> characterIdTags = getCharacterIdTags(characterId);
|
List<CharacterIdTag> characterIdTags = getCharacterIdTags(characterId);
|
||||||
if (characterIdTags != null) {
|
if (characterIdTags != null) {
|
||||||
@@ -760,7 +807,7 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
|
|||||||
for (int chId : dependents2) {
|
for (int chId : dependents2) {
|
||||||
if (!visited.contains(chId)) {
|
if (!visited.contains(chId)) {
|
||||||
visited.add(chId);
|
visited.add(chId);
|
||||||
if (getCharacters().containsKey(chId)) {
|
if (getCharacters(true).containsKey(chId)) {
|
||||||
deps = getDependentCharacters().get(chId);
|
deps = getDependentCharacters().get(chId);
|
||||||
if (deps != null) {
|
if (deps != null) {
|
||||||
dependents2.addAll(deps);
|
dependents2.addAll(deps);
|
||||||
@@ -774,7 +821,7 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
|
|||||||
|
|
||||||
Set<Integer> dependents = new LinkedHashSet<>();
|
Set<Integer> dependents = new LinkedHashSet<>();
|
||||||
for (Integer chId : dependents2) {
|
for (Integer chId : dependents2) {
|
||||||
if (getCharacters().containsKey(chId)) {
|
if (getCharacters(true).containsKey(chId)) {
|
||||||
dependents.add(chId);
|
dependents.add(chId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -816,7 +863,7 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public CharacterTag getCharacter(int characterId) {
|
public CharacterTag getCharacter(int characterId) {
|
||||||
return getCharacters().get(characterId);
|
return getCharacters(true).get(characterId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CharacterTag getCharacterByClass(String className) {
|
public CharacterTag getCharacterByClass(String className) {
|
||||||
@@ -828,15 +875,19 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public CharacterTag getCharacterByExportName(String exportName) {
|
public CharacterTag getCharacterByExportName(String exportName) {
|
||||||
if (!exportNameToCharacter.containsKey(exportName)) {
|
int charId;
|
||||||
return null;
|
if (importedNameToCharacter.containsKey(exportName)) {
|
||||||
|
charId = importedNameToCharacter.get(exportName);
|
||||||
|
} else if (exportNameToCharacter.containsKey(exportName)){
|
||||||
|
charId = exportNameToCharacter.get(exportName);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
int charId = exportNameToCharacter.get(exportName);
|
|
||||||
return getCharacter(charId);
|
return getCharacter(charId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getExportName(int characterId) {
|
public String getExportName(int characterId) {
|
||||||
CharacterTag characterTag = getCharacters().get(characterId);
|
CharacterTag characterTag = getCharacters(true).get(characterId);
|
||||||
String exportName = characterTag != null ? characterTag.getExportName() : null;
|
String exportName = characterTag != null ? characterTag.getExportName() : null;
|
||||||
return exportName;
|
return exportName;
|
||||||
}
|
}
|
||||||
@@ -884,8 +935,24 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This gets real character id of a character tag on this SWF.
|
||||||
|
* Normal .getCharacterId method od the CharacterTag does not work for imported characters
|
||||||
|
* @param tag
|
||||||
|
* @return Character id or -1 if not found
|
||||||
|
*/
|
||||||
|
public int getCharacterId(CharacterIdTag tag) {
|
||||||
|
if (characterToId == null) {
|
||||||
|
getCharacters(true);
|
||||||
|
}
|
||||||
|
if (!characterToId.containsKey(tag)) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return characterToId.get(tag);
|
||||||
|
}
|
||||||
|
|
||||||
public FontTag getFont(int fontId) {
|
public FontTag getFont(int fontId) {
|
||||||
CharacterTag characterTag = getCharacters().get(fontId);
|
CharacterTag characterTag = getCharacters(true).get(fontId);
|
||||||
if (characterTag instanceof FontTag) {
|
if (characterTag instanceof FontTag) {
|
||||||
return (FontTag) characterTag;
|
return (FontTag) characterTag;
|
||||||
}
|
}
|
||||||
@@ -898,7 +965,7 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ImageTag getImage(int imageId) {
|
public ImageTag getImage(int imageId) {
|
||||||
CharacterTag characterTag = getCharacters().get(imageId);
|
CharacterTag characterTag = getCharacters(true).get(imageId);
|
||||||
if (characterTag instanceof ImageTag) {
|
if (characterTag instanceof ImageTag) {
|
||||||
return (ImageTag) characterTag;
|
return (ImageTag) characterTag;
|
||||||
}
|
}
|
||||||
@@ -911,7 +978,7 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public DefineSoundTag getSound(int soundId) {
|
public DefineSoundTag getSound(int soundId) {
|
||||||
CharacterTag characterTag = getCharacters().get(soundId);
|
CharacterTag characterTag = getCharacters(true).get(soundId);
|
||||||
if (characterTag instanceof DefineSoundTag) {
|
if (characterTag instanceof DefineSoundTag) {
|
||||||
return (DefineSoundTag) characterTag;
|
return (DefineSoundTag) characterTag;
|
||||||
}
|
}
|
||||||
@@ -924,7 +991,7 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public TextTag getText(int textId) {
|
public TextTag getText(int textId) {
|
||||||
CharacterTag characterTag = getCharacters().get(textId);
|
CharacterTag characterTag = getCharacters(true).get(textId);
|
||||||
if (characterTag instanceof TextTag) {
|
if (characterTag instanceof TextTag) {
|
||||||
return (TextTag) characterTag;
|
return (TextTag) characterTag;
|
||||||
}
|
}
|
||||||
@@ -996,7 +1063,7 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
|
|||||||
|
|
||||||
public int getNextCharacterId() {
|
public int getNextCharacterId() {
|
||||||
int max = 0;
|
int max = 0;
|
||||||
Set<Integer> ids = new HashSet<>(getCharacters().keySet());
|
Set<Integer> ids = new HashSet<>(getCharacters(false).keySet());
|
||||||
for (Tag t : tags) {
|
for (Tag t : tags) {
|
||||||
if (t instanceof ImportTag) {
|
if (t instanceof ImportTag) {
|
||||||
ids.addAll(((ImportTag) t).getAssets().keySet());
|
ids.addAll(((ImportTag) t).getAssets().keySet());
|
||||||
@@ -1505,7 +1572,7 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void resolveImported(UrlResolver resolver) {
|
private synchronized void resolveImported(UrlResolver resolver) {
|
||||||
for (int p = 0; p < tags.size(); p++) {
|
for (int p = 0; p < tags.size(); p++) {
|
||||||
Tag t = tags.get(p);
|
Tag t = tags.get(p);
|
||||||
if (t instanceof ImportTag) {
|
if (t instanceof ImportTag) {
|
||||||
@@ -1513,186 +1580,33 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
|
|||||||
|
|
||||||
SWF iSwf = resolver.resolveUrl(importTag.getUrl());
|
SWF iSwf = resolver.resolveUrl(importTag.getUrl());
|
||||||
if (iSwf != null) {
|
if (iSwf != null) {
|
||||||
Map<Integer, String> exportedMap1 = new HashMap<>();
|
|
||||||
Map<Integer, String> classesMap1 = new HashMap<>();
|
Map<Integer, String> importedIdToNameMap = importTag.getAssets();
|
||||||
|
|
||||||
|
Map<String, Integer> exportedNameToIdsMap = new HashMap<>();
|
||||||
|
|
||||||
for (Tag t2 : iSwf.tags) {
|
for (Tag t2 : iSwf.tags) {
|
||||||
if (t2 instanceof ExportAssetsTag) {
|
if (t2 instanceof ExportAssetsTag) {
|
||||||
ExportAssetsTag sc = (ExportAssetsTag) t2;
|
ExportAssetsTag sc = (ExportAssetsTag) t2;
|
||||||
Map<Integer, String> m2 = sc.getTagToNameMap();
|
for (int i = 0; i < sc.names.size(); i++) {
|
||||||
for (int key : m2.keySet()) {
|
exportedNameToIdsMap.put(sc.names.get(i), sc.tags.get(i));
|
||||||
if (!exportedMap1.containsKey(key)) {
|
}
|
||||||
exportedMap1.put(key, m2.get(key));
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (t2 instanceof SymbolClassTag) {
|
|
||||||
SymbolClassTag sc = (SymbolClassTag) t2;
|
|
||||||
Map<Integer, String> m2 = sc.getTagToNameMap();
|
|
||||||
for (int key : m2.keySet()) {
|
|
||||||
if (!classesMap1.containsKey(key)) {
|
|
||||||
classesMap1.put(key, m2.get(key));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Map<String, Integer> exportedMap2 = new HashMap<>();
|
|
||||||
for (int k : exportedMap1.keySet()) {
|
for (int importedId : importedIdToNameMap.keySet()) {
|
||||||
exportedMap2.put(exportedMap1.get(k), k);
|
String importedName = importedIdToNameMap.get(importedId);
|
||||||
}
|
if (exportedNameToIdsMap.containsKey(importedName)) {
|
||||||
|
int exportedId = exportedNameToIdsMap.get(importedName);
|
||||||
Map<String, Integer> classesMap2 = new HashMap<>();
|
importedCharacterSourceSwfs.put(importedId, iSwf);
|
||||||
for (int k : classesMap1.keySet()) {
|
importedCharacterIds.put(importedId, exportedId);
|
||||||
classesMap2.put(classesMap1.get(k), k);
|
importedNameToCharacter.put(importedName, importedId);
|
||||||
}
|
|
||||||
|
|
||||||
Map<Integer, String> importedMap1 = importTag.getAssets();
|
|
||||||
Map<String, Integer> importedMap2 = new HashMap<>();
|
|
||||||
for (int k : importedMap1.keySet()) {
|
|
||||||
importedMap2.put(importedMap1.get(k), k);
|
|
||||||
}
|
|
||||||
|
|
||||||
int pos = 0;
|
|
||||||
Set<Integer> importedCharIds = new HashSet<>();
|
|
||||||
Set<Integer> importedTagPos = new HashSet<>();
|
|
||||||
List<CharacterTag> importedCharacters = new ArrayList<>();
|
|
||||||
for (String key : importedMap2.keySet()) {
|
|
||||||
if (!exportedMap2.containsKey(key)) {
|
|
||||||
continue; //?
|
|
||||||
}
|
|
||||||
int exportedId = exportedMap2.get(key);
|
|
||||||
int importedId = importedMap2.get(key);
|
|
||||||
int ip = 0;
|
|
||||||
for (Tag cht : iSwf.tags) {
|
|
||||||
if ((cht instanceof CharacterIdTag) && (((CharacterIdTag) cht).getCharacterId() == exportedId) && !(cht instanceof PlaceObjectTypeTag) && !(cht instanceof RemoveTag)) {
|
|
||||||
|
|
||||||
importedCharIds.add(exportedId);
|
|
||||||
Tag chtCopy = null;
|
|
||||||
try {
|
|
||||||
chtCopy = cht.cloneTag();
|
|
||||||
CharacterIdTag ch = (CharacterIdTag) chtCopy;
|
|
||||||
ch.setCharacterId(importedId);
|
|
||||||
setImportedDeep(chtCopy, false);
|
|
||||||
|
|
||||||
tags.add(p + 1 + pos, chtCopy);
|
|
||||||
} catch (InterruptedException | IOException ex) {
|
|
||||||
Logger.getLogger(SWF.class.getName()).log(Level.SEVERE, null, ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
importedTagPos.add(ip);
|
|
||||||
if (cht instanceof CharacterTag) {
|
|
||||||
importedCharacters.add((CharacterTag) chtCopy);
|
|
||||||
String exportName = ((CharacterTag) cht).getExportName();
|
|
||||||
LinkedHashSet<String> classNames = ((CharacterTag) cht).getClassNames();
|
|
||||||
if (exportName != null) {
|
|
||||||
importedTagToExportNameMapping.put(importedId, exportName);
|
|
||||||
}
|
|
||||||
if (!classNames.isEmpty()) {
|
|
||||||
importedTagToClassesMapping.put(importedId, classNames);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
chtCopy.setTimelined(this);
|
|
||||||
chtCopy.setSwf(this);
|
|
||||||
}
|
|
||||||
pos++;
|
|
||||||
}
|
|
||||||
ip++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int newId = getNextCharacterId();
|
|
||||||
pos = 0;
|
|
||||||
for (String key : classesMap2.keySet()) {
|
|
||||||
int exportedId = classesMap2.get(key);
|
|
||||||
int importedId = newId++;
|
|
||||||
int ip = 0;
|
|
||||||
for (Tag cht : iSwf.tags) {
|
|
||||||
if (!importedTagPos.contains(ip) && (cht instanceof CharacterIdTag) && (((CharacterIdTag) cht).getCharacterId() == exportedId) && !(cht instanceof PlaceObjectTypeTag) && !(cht instanceof RemoveTag)) {
|
|
||||||
|
|
||||||
importedCharIds.add(exportedId);
|
|
||||||
Tag chtCopy = null;
|
|
||||||
try {
|
|
||||||
chtCopy = cht.cloneTag();
|
|
||||||
CharacterIdTag ch = (CharacterIdTag) chtCopy;
|
|
||||||
ch.setCharacterId(importedId);
|
|
||||||
setImportedDeep(chtCopy, false);
|
|
||||||
|
|
||||||
tags.add(p + 1 + pos, chtCopy);
|
|
||||||
} catch (InterruptedException | IOException ex) {
|
|
||||||
Logger.getLogger(SWF.class.getName()).log(Level.SEVERE, null, ex);
|
|
||||||
}
|
|
||||||
if (cht instanceof CharacterTag) {
|
|
||||||
importedCharacters.add((CharacterTag) chtCopy);
|
|
||||||
String exportName = ((CharacterTag) cht).getExportName();
|
|
||||||
LinkedHashSet<String> classNames = ((CharacterTag) cht).getClassNames();
|
|
||||||
if (exportName != null) {
|
|
||||||
importedTagToExportNameMapping.put(importedId, exportName);
|
|
||||||
}
|
|
||||||
if (!classNames.isEmpty()) {
|
|
||||||
importedTagToClassesMapping.put(importedId, classNames);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
chtCopy.setSwf(this);
|
|
||||||
chtCopy.setTimelined(this);
|
|
||||||
}
|
|
||||||
pos++;
|
|
||||||
}
|
|
||||||
ip++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pos = 0;
|
|
||||||
for (CharacterTag ich : importedCharacters) {
|
|
||||||
Set<Integer> needed = new LinkedHashSet<>();
|
|
||||||
ich.getNeededCharactersDeep(needed);
|
|
||||||
Map<Integer, Integer> replaceCharactersMap = new HashMap<>();
|
|
||||||
for (int n : needed) {
|
|
||||||
if (importedCharIds.contains(n)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
CharacterTag cht = iSwf.getCharacter(n);
|
|
||||||
int importedId = newId++;
|
|
||||||
CharacterTag chtCopy = null;
|
|
||||||
try {
|
|
||||||
chtCopy = (CharacterTag) cht.cloneTag();
|
|
||||||
} catch (InterruptedException | IOException ex) {
|
|
||||||
Logger.getLogger(SWF.class.getName()).log(Level.SEVERE, null, ex);
|
|
||||||
}
|
|
||||||
chtCopy.setSwf(this);
|
|
||||||
replaceCharactersMap.put(n, importedId);
|
|
||||||
chtCopy.setCharacterId(importedId);
|
|
||||||
setImportedDeep(chtCopy, true);
|
|
||||||
tags.add(p + 1 + pos, chtCopy);
|
|
||||||
pos++;
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<Integer, Integer> replaceCharactersMap2 = new HashMap<>();
|
|
||||||
|
|
||||||
//first map to non existing ids
|
|
||||||
int iNewId = iSwf.getNextCharacterId();
|
|
||||||
for (int from : replaceCharactersMap.keySet()) {
|
|
||||||
int to = iNewId++;
|
|
||||||
replaceCharactersMap2.put(to, replaceCharactersMap.get(from));
|
|
||||||
ich.replaceCharacter(from, to);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int from : replaceCharactersMap2.keySet()) {
|
|
||||||
int to = replaceCharactersMap2.get(from);
|
|
||||||
ich.replaceCharacter(from, to);
|
|
||||||
}
|
|
||||||
//ich.setModified(false);
|
|
||||||
setSwfDeep(ich);
|
|
||||||
ich.setTimelined(this);
|
|
||||||
}
|
|
||||||
updateCharacters();
|
|
||||||
for (CharacterTag ich : importedCharacters) {
|
|
||||||
if (ich instanceof DefineSpriteTag) {
|
|
||||||
((DefineSpriteTag) ich).resetTimeline();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
updateCharacters();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setSwfDeep(Tag t) {
|
private void setSwfDeep(Tag t) {
|
||||||
@@ -2663,7 +2577,7 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
|
|||||||
if (ch instanceof FontTag) {
|
if (ch instanceof FontTag) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("function ").append(getTypePrefix(ch)).append(c).append("(ctx,ch,textColor){\r\n");
|
sb.append("function ").append(getTypePrefix(ch)).append(c).append("(ctx,ch,textColor){\r\n");
|
||||||
((FontTag) ch).toHtmlCanvas(sb, 1);
|
((FontTag) ch).toHtmlCanvas(fswf, sb, 1);
|
||||||
sb.append("}\r\n\r\n");
|
sb.append("}\r\n\r\n");
|
||||||
fos.write(Utf8Helper.getBytes(sb.toString()));
|
fos.write(Utf8Helper.getBytes(sb.toString()));
|
||||||
} else {
|
} else {
|
||||||
@@ -2677,7 +2591,7 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
|
|||||||
fos.write(Utf8Helper.getBytes("function " + getTypePrefix(ch) + c + "(ctx,ctrans,frame,ratio,time){\r\n"));
|
fos.write(Utf8Helper.getBytes("function " + getTypePrefix(ch) + c + "(ctx,ctrans,frame,ratio,time){\r\n"));
|
||||||
if (ch instanceof DrawableTag) {
|
if (ch instanceof DrawableTag) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
((DrawableTag) ch).toHtmlCanvas(sb, 1);
|
((DrawableTag) ch).toHtmlCanvas(fswf, sb, 1);
|
||||||
fos.write(Utf8Helper.getBytes(sb.toString()));
|
fos.write(Utf8Helper.getBytes(sb.toString()));
|
||||||
}
|
}
|
||||||
fos.write(Utf8Helper.getBytes("}\r\n\r\n"));
|
fos.write(Utf8Helper.getBytes("}\r\n\r\n"));
|
||||||
@@ -3351,6 +3265,8 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
|
|||||||
|
|
||||||
public void clearAllCache() {
|
public void clearAllCache() {
|
||||||
characters = null;
|
characters = null;
|
||||||
|
charactersWithImported = null;
|
||||||
|
characterToId = null;
|
||||||
characterIdTags = null;
|
characterIdTags = null;
|
||||||
externalImages2 = null;
|
externalImages2 = null;
|
||||||
timeline = null;
|
timeline = null;
|
||||||
@@ -3857,13 +3773,13 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ReadOnlyTagList getLocalTags() {
|
public ReadOnlyTagList getLocalTags() {
|
||||||
List<Tag> localTags = new ArrayList<>();
|
/*List<Tag> localTags = new ArrayList<>();
|
||||||
for (Tag t : tags) {
|
for (Tag t : tags) {
|
||||||
if (!t.isImported()) {
|
if (!t.isImported()) {
|
||||||
localTags.add(t);
|
localTags.add(t);
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
return new ReadOnlyTagList(localTags);
|
return new ReadOnlyTagList(tags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ public class InstanceInfo {
|
|||||||
FontTag ft = (FontTag) ct;
|
FontTag ft = (FontTag) ct;
|
||||||
|
|
||||||
boolean hasFontAlignZones = false;
|
boolean hasFontAlignZones = false;
|
||||||
List<CharacterIdTag> sameIdTags = ft.getSwf().getCharacterIdTags(ft.getFontId());
|
List<CharacterIdTag> sameIdTags = ft.getSwf().getCharacterIdTags(abc.getSwf().getCharacterId(ft));
|
||||||
for (CharacterIdTag sit : sameIdTags) {
|
for (CharacterIdTag sit : sameIdTags) {
|
||||||
if (sit instanceof DefineFontAlignZonesTag) {
|
if (sit instanceof DefineFontAlignZonesTag) {
|
||||||
hasFontAlignZones = true;
|
hasFontAlignZones = true;
|
||||||
|
|||||||
@@ -610,7 +610,7 @@ public class DualPdfGraphics2D extends Graphics2D implements BlendModeSetable, G
|
|||||||
char ch = font.glyphToChar(entry.glyphIndex);
|
char ch = font.glyphToChar(entry.glyphIndex);
|
||||||
if (spacing != 0) {
|
if (spacing != 0) {
|
||||||
text.append(currentChar);
|
text.append(currentChar);
|
||||||
drawText(x, y, trans, textColor, existingFonts, font, text.toString(), textHeight, pdfGraphics);
|
drawText(swf, x, y, trans, textColor, existingFonts, font, text.toString(), textHeight, pdfGraphics);
|
||||||
text = new StringBuilder();
|
text = new StringBuilder();
|
||||||
x = x + deltaX + entry.glyphAdvance;
|
x = x + deltaX + entry.glyphAdvance;
|
||||||
deltaX = 0;
|
deltaX = 0;
|
||||||
@@ -626,14 +626,14 @@ public class DualPdfGraphics2D extends Graphics2D implements BlendModeSetable, G
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (text.length() > 0) {
|
if (text.length() > 0) {
|
||||||
drawText(x, y, trans, textColor, existingFonts, font, text.toString(), textHeight, pdfGraphics);
|
drawText(swf, x, y, trans, textColor, existingFonts, font, text.toString(), textHeight, pdfGraphics);
|
||||||
}
|
}
|
||||||
x = x + deltaX;
|
x = x + deltaX;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void drawText(float x, float y, Matrix trans, int textColor, Map<Integer, Font> existingFonts, FontTag font, String text, int textHeight, PDFGraphics g) {
|
private static void drawText(SWF swf, float x, float y, Matrix trans, int textColor, Map<Integer, Font> existingFonts, FontTag font, String text, int textHeight, PDFGraphics g) {
|
||||||
int fontId = font.getFontId();
|
int fontId = swf.getCharacterId(font);
|
||||||
if (existingFonts.containsKey(fontId)) {
|
if (existingFonts.containsKey(fontId)) {
|
||||||
g.setExistingTtfFont(existingFonts.get(fontId).deriveFont((float) textHeight));
|
g.setExistingTtfFont(existingFonts.get(fontId).deriveFont((float) textHeight));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -641,8 +641,8 @@ public class FrameExporter {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void drawText(float x, float y, Matrix trans, int textColor, Map<Integer, Font> existingFonts, FontTag font, String text, int textHeight, Graphics g) {
|
private static void drawText(SWF swf, float x, float y, Matrix trans, int textColor, Map<Integer, Font> existingFonts, FontTag font, String text, int textHeight, Graphics g) {
|
||||||
int fontId = font.getFontId();
|
int fontId = swf.getCharacterId(font);
|
||||||
PDFGraphics g2 = (PDFGraphics) g;
|
PDFGraphics g2 = (PDFGraphics) g;
|
||||||
if (existingFonts.containsKey(fontId)) {
|
if (existingFonts.containsKey(fontId)) {
|
||||||
g2.setExistingTtfFont(existingFonts.get(fontId).deriveFont((float) textHeight));
|
g2.setExistingTtfFont(existingFonts.get(fontId).deriveFont((float) textHeight));
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ public class MorphShapeExporter {
|
|||||||
rect.xMin *= settings.zoom;
|
rect.xMin *= settings.zoom;
|
||||||
rect.yMin *= settings.zoom;
|
rect.yMin *= settings.zoom;
|
||||||
SVGExporter exporter = new SVGExporter(rect, settings.zoom, "shape");
|
SVGExporter exporter = new SVGExporter(rect, settings.zoom, "shape");
|
||||||
mst.getStartShapeTag().toSVG(exporter, -2, new CXFORMWITHALPHA(), 0);
|
mst.getStartShapeTag().toSVG(mst.getSwf(), exporter, -2, new CXFORMWITHALPHA(), 0);
|
||||||
fos.write(Utf8Helper.getBytes(exporter.getSVG()));
|
fos.write(Utf8Helper.getBytes(exporter.getSVG()));
|
||||||
}
|
}
|
||||||
try (OutputStream fos = new BufferedOutputStream(new FileOutputStream(fileEnd))) {
|
try (OutputStream fos = new BufferedOutputStream(new FileOutputStream(fileEnd))) {
|
||||||
@@ -130,7 +130,7 @@ public class MorphShapeExporter {
|
|||||||
rect.xMin *= settings.zoom;
|
rect.xMin *= settings.zoom;
|
||||||
rect.yMin *= settings.zoom;
|
rect.yMin *= settings.zoom;
|
||||||
SVGExporter exporter = new SVGExporter(rect, settings.zoom, "shape");
|
SVGExporter exporter = new SVGExporter(rect, settings.zoom, "shape");
|
||||||
mst.getEndShapeTag().toSVG(exporter, -2, new CXFORMWITHALPHA(), 0);
|
mst.getEndShapeTag().toSVG(mst.getSwf(), exporter, -2, new CXFORMWITHALPHA(), 0);
|
||||||
fos.write(Utf8Helper.getBytes(exporter.getSVG()));
|
fos.write(Utf8Helper.getBytes(exporter.getSVG()));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -142,7 +142,7 @@ public class MorphShapeExporter {
|
|||||||
rect.xMin *= settings.zoom;
|
rect.xMin *= settings.zoom;
|
||||||
rect.yMin *= settings.zoom;
|
rect.yMin *= settings.zoom;
|
||||||
SVGExporter exporter = new SVGExporter(rect, settings.zoom, "morphshape");
|
SVGExporter exporter = new SVGExporter(rect, settings.zoom, "morphshape");
|
||||||
mst.toSVG(exporter, -2, new CXFORMWITHALPHA(), 0);
|
mst.toSVG(mst.getSwf(), exporter, -2, new CXFORMWITHALPHA(), 0);
|
||||||
fos.write(Utf8Helper.getBytes(exporter.getSVG()));
|
fos.write(Utf8Helper.getBytes(exporter.getSVG()));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -165,7 +165,7 @@ public class MorphShapeExporter {
|
|||||||
}
|
}
|
||||||
Matrix m = Matrix.getScaleInstance(settings.zoom);
|
Matrix m = Matrix.getScaleInstance(settings.zoom);
|
||||||
m.translate(-rect.Xmin, -rect.Ymin);
|
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, 0, true);
|
st.toImage(st.getSwf(), 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, true);
|
||||||
if (settings.mode == MorphShapeExportMode.PNG_START_END) {
|
if (settings.mode == MorphShapeExportMode.PNG_START_END) {
|
||||||
ImageHelper.write(img.getBufferedImage(), ImageFormat.PNG, fileStart);
|
ImageHelper.write(img.getBufferedImage(), ImageFormat.PNG, fileStart);
|
||||||
} else {
|
} else {
|
||||||
@@ -188,7 +188,7 @@ public class MorphShapeExporter {
|
|||||||
}
|
}
|
||||||
m = Matrix.getScaleInstance(settings.zoom);
|
m = Matrix.getScaleInstance(settings.zoom);
|
||||||
m.translate(-rect.Xmin, -rect.Ymin);
|
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, 0, true);
|
st.toImage(st.getSwf(), 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, true);
|
||||||
if (settings.mode == MorphShapeExportMode.PNG_START_END) {
|
if (settings.mode == MorphShapeExportMode.PNG_START_END) {
|
||||||
ImageHelper.write(img.getBufferedImage(), ImageFormat.PNG, fileEnd);
|
ImageHelper.write(img.getBufferedImage(), ImageFormat.PNG, fileEnd);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -456,7 +456,7 @@ public class PreviewExporter {
|
|||||||
|
|
||||||
int countGlyphsTotal = ft.getGlyphShapeTable().size();
|
int countGlyphsTotal = ft.getGlyphShapeTable().size();
|
||||||
int countGlyphs = Math.min(SHAPERECORD.MAX_CHARACTERS_IN_FONT_PREVIEW, countGlyphsTotal);
|
int countGlyphs = Math.min(SHAPERECORD.MAX_CHARACTERS_IN_FONT_PREVIEW, countGlyphsTotal);
|
||||||
int fontId = ft.getFontId();
|
int fontId = swf.getCharacterId(ft);
|
||||||
int cols = (int) Math.ceil(Math.sqrt(countGlyphs));
|
int cols = (int) Math.ceil(Math.sqrt(countGlyphs));
|
||||||
int rows = (int) Math.ceil(((float) countGlyphs) / ((float) cols));
|
int rows = (int) Math.ceil(((float) countGlyphs) / ((float) cols));
|
||||||
if (rows == 0) {
|
if (rows == 0) {
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ public class ShapeExporter {
|
|||||||
rect.xMin *= settings.zoom;
|
rect.xMin *= settings.zoom;
|
||||||
rect.yMin *= settings.zoom;
|
rect.yMin *= settings.zoom;
|
||||||
SVGExporter exporter = new SVGExporter(rect, settings.zoom, "shape");
|
SVGExporter exporter = new SVGExporter(rect, settings.zoom, "shape");
|
||||||
st.toSVG(exporter, -2, new CXFORMWITHALPHA(), 0);
|
st.toSVG(st.getSwf(), exporter, -2, new CXFORMWITHALPHA(), 0);
|
||||||
fos.write(Utf8Helper.getBytes(exporter.getSVG()));
|
fos.write(Utf8Helper.getBytes(exporter.getSVG()));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -130,7 +130,7 @@ public class ShapeExporter {
|
|||||||
}
|
}
|
||||||
Matrix m = Matrix.getScaleInstance(settings.zoom);
|
Matrix m = Matrix.getScaleInstance(settings.zoom);
|
||||||
m.translate(-rect.Xmin, -rect.Ymin);
|
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, 0, true);
|
st.toImage(st.getSwf(), 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, true);
|
||||||
if (settings.mode == ShapeExportMode.PNG) {
|
if (settings.mode == ShapeExportMode.PNG) {
|
||||||
ImageHelper.write(img.getBufferedImage(), ImageFormat.PNG, file);
|
ImageHelper.write(img.getBufferedImage(), ImageFormat.PNG, file);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ public class TextExporter {
|
|||||||
try (OutputStream fos = new BufferedOutputStream(new FileOutputStream(file))) {
|
try (OutputStream fos = new BufferedOutputStream(new FileOutputStream(file))) {
|
||||||
ExportRectangle rect = new ExportRectangle(textTag.getRect());
|
ExportRectangle rect = new ExportRectangle(textTag.getRect());
|
||||||
SVGExporter exporter = new SVGExporter(rect, settings.zoom, "text");
|
SVGExporter exporter = new SVGExporter(rect, settings.zoom, "text");
|
||||||
textTag.toSVG(exporter, -2, new CXFORMWITHALPHA(), 0);
|
textTag.toSVG(textTag.getSwf(), exporter, -2, new CXFORMWITHALPHA(), 0);
|
||||||
fos.write(Utf8Helper.getBytes(exporter.getSVG()));
|
fos.write(Utf8Helper.getBytes(exporter.getSVG()));
|
||||||
}
|
}
|
||||||
}, handler).run();
|
}, handler).run();
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public class GfxConvertor {
|
|||||||
|
|
||||||
public DefineFont2Tag convertDefineCompactedFont(DefineCompactedFont compactedFont) {
|
public DefineFont2Tag convertDefineCompactedFont(DefineCompactedFont compactedFont) {
|
||||||
DefineFont2Tag ret = new DefineFont2Tag(compactedFont.getSwf());
|
DefineFont2Tag ret = new DefineFont2Tag(compactedFont.getSwf());
|
||||||
ret.fontID = compactedFont.getFontId();
|
ret.fontID = compactedFont.getCharacterId();
|
||||||
ret.fontFlagsBold = compactedFont.isBold();
|
ret.fontFlagsBold = compactedFont.isBold();
|
||||||
ret.fontFlagsItalic = compactedFont.isItalic();
|
ret.fontFlagsItalic = compactedFont.isItalic();
|
||||||
ret.fontFlagsWideOffsets = true;
|
ret.fontFlagsWideOffsets = true;
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ public class ImageImporter extends TagImporter {
|
|||||||
|
|
||||||
public int bulkImport(File imagesDir, SWF swf, boolean printOut) {
|
public int bulkImport(File imagesDir, SWF swf, boolean printOut) {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
Map<Integer, CharacterTag> characters = swf.getCharacters();
|
Map<Integer, CharacterTag> characters = swf.getCharacters(false);
|
||||||
List<String> extensions = Arrays.asList("png", "jpg", "jpeg", "gif", "bmp");
|
List<String> extensions = Arrays.asList("png", "jpg", "jpeg", "gif", "bmp");
|
||||||
List<String> alphaExtensions = Arrays.asList("png");
|
List<String> alphaExtensions = Arrays.asList("png");
|
||||||
File[] allFiles = imagesDir.listFiles(new FilenameFilter() {
|
File[] allFiles = imagesDir.listFiles(new FilenameFilter() {
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ import java.util.logging.Logger;
|
|||||||
public class MovieImporter {
|
public class MovieImporter {
|
||||||
|
|
||||||
public int bulkImport(File moviesDir, SWF swf, boolean printOut) {
|
public int bulkImport(File moviesDir, SWF swf, boolean printOut) {
|
||||||
Map<Integer, CharacterTag> characters = swf.getCharacters();
|
Map<Integer, CharacterTag> characters = swf.getCharacters(false);
|
||||||
int movieCount = 0;
|
int movieCount = 0;
|
||||||
List<String> extensions = Arrays.asList("flv");
|
List<String> extensions = Arrays.asList("flv");
|
||||||
File[] allFiles = moviesDir.listFiles(new FilenameFilter() {
|
File[] allFiles = moviesDir.listFiles(new FilenameFilter() {
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ public class ShapeImporter {
|
|||||||
public int bulkImport(File shapesDir, SWF swf, boolean noFill, boolean printOut) {
|
public int bulkImport(File shapesDir, SWF swf, boolean noFill, boolean printOut) {
|
||||||
SvgImporter svgImporter = new SvgImporter();
|
SvgImporter svgImporter = new SvgImporter();
|
||||||
|
|
||||||
Map<Integer, CharacterTag> characters = swf.getCharacters();
|
Map<Integer, CharacterTag> characters = swf.getCharacters(false);
|
||||||
int shapeCount = 0;
|
int shapeCount = 0;
|
||||||
List<String> extensions = Arrays.asList("svg", "png", "jpg", "jpeg", "gif", "bmp");
|
List<String> extensions = Arrays.asList("svg", "png", "jpg", "jpeg", "gif", "bmp");
|
||||||
File[] allFiles = shapesDir.listFiles(new FilenameFilter() {
|
File[] allFiles = shapesDir.listFiles(new FilenameFilter() {
|
||||||
|
|||||||
@@ -483,7 +483,7 @@ public class SoundImporter {
|
|||||||
|
|
||||||
public int bulkImport(File soundDir, SWF swf, boolean printOut) {
|
public int bulkImport(File soundDir, SWF swf, boolean printOut) {
|
||||||
|
|
||||||
Map<Integer, CharacterTag> characters = swf.getCharacters();
|
Map<Integer, CharacterTag> characters = swf.getCharacters(false);
|
||||||
int soundCount = 0;
|
int soundCount = 0;
|
||||||
List<String> extensions = Arrays.asList("mp3", "wav");
|
List<String> extensions = Arrays.asList("mp3", "wav");
|
||||||
File[] allFiles = soundDir.listFiles(new FilenameFilter() {
|
File[] allFiles = soundDir.listFiles(new FilenameFilter() {
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ public class SpriteImporter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int bulkImport(File spritesDir, SWF swf, boolean printOut) {
|
public int bulkImport(File spritesDir, SWF swf, boolean printOut) {
|
||||||
Map<Integer, CharacterTag> characters = swf.getCharacters();
|
Map<Integer, CharacterTag> characters = swf.getCharacters(false);
|
||||||
int spriteCount = 0;
|
int spriteCount = 0;
|
||||||
List<String> extensions = Arrays.asList("gif");
|
List<String> extensions = Arrays.asList("gif");
|
||||||
File[] allFiles = spritesDir.listFiles(new FilenameFilter() {
|
File[] allFiles = spritesDir.listFiles(new FilenameFilter() {
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import com.jpexs.decompiler.flash.helpers.HighlightedText;
|
|||||||
import com.jpexs.decompiler.flash.helpers.HighlightedTextWriter;
|
import com.jpexs.decompiler.flash.helpers.HighlightedTextWriter;
|
||||||
import com.jpexs.decompiler.flash.helpers.hilight.HighlightSpecialType;
|
import com.jpexs.decompiler.flash.helpers.hilight.HighlightSpecialType;
|
||||||
import com.jpexs.decompiler.flash.tags.base.BoundedTag;
|
import com.jpexs.decompiler.flash.tags.base.BoundedTag;
|
||||||
|
import com.jpexs.decompiler.flash.tags.base.CharacterTag;
|
||||||
import com.jpexs.decompiler.flash.tags.base.FontTag;
|
import com.jpexs.decompiler.flash.tags.base.FontTag;
|
||||||
import com.jpexs.decompiler.flash.tags.base.MissingCharacterHandler;
|
import com.jpexs.decompiler.flash.tags.base.MissingCharacterHandler;
|
||||||
import com.jpexs.decompiler.flash.tags.base.RenderContext;
|
import com.jpexs.decompiler.flash.tags.base.RenderContext;
|
||||||
@@ -516,7 +517,12 @@ public class DefineEditTextTag extends TextTag {
|
|||||||
String txt = unescape(new String(ch, start, length));
|
String txt = unescape(new String(ch, start, length));
|
||||||
TextStyle style = styles.peek();
|
TextStyle style = styles.peek();
|
||||||
if (style.fontFace != null && useOutlines) {
|
if (style.fontFace != null && useOutlines) {
|
||||||
style.font = swf.getFontByNameInTag(style.fontFace, style.bold, style.italic);
|
CharacterTag ct = swf.getCharacterByExportName(style.fontFace);
|
||||||
|
if (ct != null && (ct instanceof FontTag)) {
|
||||||
|
style.font = (FontTag) ct;
|
||||||
|
} else {
|
||||||
|
style.font = swf.getFontByNameInTag(style.fontFace, style.bold, style.italic);
|
||||||
|
}
|
||||||
if (style.font == null) {
|
if (style.font == null) {
|
||||||
style.fontFace = null;
|
style.fontFace = null;
|
||||||
}
|
}
|
||||||
@@ -974,7 +980,7 @@ public class DefineEditTextTag extends TextTag {
|
|||||||
List<CharacterWithStyle> chs = getTextWithStyle();
|
List<CharacterWithStyle> chs = getTextWithStyle();
|
||||||
for (CharacterWithStyle ch : chs) {
|
for (CharacterWithStyle ch : chs) {
|
||||||
if (ch.style.font != null) {
|
if (ch.style.font != null) {
|
||||||
needed.add(ch.style.font.getFontId());
|
needed.add(swf.getCharacterId(ch.style.font));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1007,21 +1013,21 @@ public class DefineEditTextTag extends TextTag {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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, int blendMode, boolean canUseSmoothing) {
|
public void toImage(SWF swf, 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, boolean canUseSmoothing) {
|
||||||
render(TextRenderMode.BITMAP, image, null, null, transformation, colorTransform, 1);
|
render(swf, TextRenderMode.BITMAP, image, null, null, transformation, colorTransform, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void toSVG(SVGExporter exporter, int ratio, ColorTransform colorTransform, int level) {
|
public void toSVG(SWF swf, SVGExporter exporter, int ratio, ColorTransform colorTransform, int level) {
|
||||||
render(TextRenderMode.SVG, null, exporter, null, new Matrix(), colorTransform, 1);
|
render(swf, TextRenderMode.SVG, null, exporter, null, new Matrix(), colorTransform, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void toHtmlCanvas(StringBuilder result, double unitDivisor) {
|
public void toHtmlCanvas(SWF swf, StringBuilder result, double unitDivisor) {
|
||||||
render(TextRenderMode.HTML5_CANVAS, null, null, result, new Matrix(), null, unitDivisor);
|
render(swf, TextRenderMode.HTML5_CANVAS, null, null, result, new Matrix(), null, unitDivisor);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void render(TextRenderMode renderMode, SerializableImage image, SVGExporter svgExporter, StringBuilder htmlCanvasBuilder, Matrix transformation, ColorTransform colorTransform, double zoom) {
|
private void render(SWF swf, TextRenderMode renderMode, SerializableImage image, SVGExporter svgExporter, StringBuilder htmlCanvasBuilder, Matrix transformation, ColorTransform colorTransform, double zoom) {
|
||||||
if (border) {
|
if (border) {
|
||||||
// border is always black, fill color is always white?
|
// border is always black, fill color is always white?
|
||||||
RGB borderColor = new RGBA(Color.black);
|
RGB borderColor = new RGBA(Color.black);
|
||||||
@@ -1039,7 +1045,7 @@ public class DefineEditTextTag extends TextTag {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (hasText) {
|
if (hasText) {
|
||||||
List<TEXTRECORD> allTextRecords = getTextRecords();
|
List<TEXTRECORD> allTextRecords = getTextRecords(swf);
|
||||||
switch (renderMode) {
|
switch (renderMode) {
|
||||||
case BITMAP:
|
case BITMAP:
|
||||||
staticTextToImage(swf, allTextRecords, 2, image, getTextMatrix(), transformation, colorTransform);
|
staticTextToImage(swf, allTextRecords, 2, image, getTextMatrix(), transformation, colorTransform);
|
||||||
@@ -1054,7 +1060,7 @@ public class DefineEditTextTag extends TextTag {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<TEXTRECORD> getTextRecords() {
|
public List<TEXTRECORD> getTextRecords(SWF swf) {
|
||||||
DynamicTextModel textModel = new DynamicTextModel();
|
DynamicTextModel textModel = new DynamicTextModel();
|
||||||
List<CharacterWithStyle> txt = getTextWithStyle();
|
List<CharacterWithStyle> txt = getTextWithStyle();
|
||||||
TextStyle lastStyle = null;
|
TextStyle lastStyle = null;
|
||||||
@@ -1279,11 +1285,11 @@ public class DefineEditTextTag extends TextTag {
|
|||||||
if (fontClass != null) {
|
if (fontClass != null) {
|
||||||
FontTag ft = swf.getFontByClass(fontClass);
|
FontTag ft = swf.getFontByClass(fontClass);
|
||||||
if (ft != null) {
|
if (ft != null) {
|
||||||
fid = ft.getFontId();
|
fid = swf.getCharacterId(ft);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (tr.style.font != null) {
|
if (tr.style.font != null) {
|
||||||
fid = tr.style.font.getFontId();
|
fid = swf.getCharacterId(tr.style.font);
|
||||||
}
|
}
|
||||||
|
|
||||||
tr2.styleFlagsHasFont = fid != 0;
|
tr2.styleFlagsHasFont = fid != 0;
|
||||||
|
|||||||
@@ -415,17 +415,17 @@ public class DefineSpriteTag extends DrawableTag implements Timelined {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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, int blendMode, boolean canUseSmoothing) {
|
public void toImage(SWF swf, 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, boolean canUseSmoothing) {
|
||||||
getTimeline().toImage(frame, time, renderContext, image, fullImage, isClip, transformation, strokeTransformation, absoluteTransformation, colorTransform, unzoom, sameImage, viewRect, fullTransformation, scaleStrokes, drawMode, blendMode, canUseSmoothing);
|
getTimeline().toImage(frame, time, renderContext, image, fullImage, isClip, transformation, strokeTransformation, absoluteTransformation, colorTransform, unzoom, sameImage, viewRect, fullTransformation, scaleStrokes, drawMode, blendMode, canUseSmoothing);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void toSVG(SVGExporter exporter, int ratio, ColorTransform colorTransform, int level) throws IOException {
|
public void toSVG(SWF swf, SVGExporter exporter, int ratio, ColorTransform colorTransform, int level) throws IOException {
|
||||||
getTimeline().toSVG(0, 0, null, 0, exporter, colorTransform, level + 1);
|
getTimeline().toSVG(0, 0, null, 0, exporter, colorTransform, level + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void toHtmlCanvas(StringBuilder result, double unitDivisor) {
|
public void toHtmlCanvas(SWF swf, StringBuilder result, double unitDivisor) {
|
||||||
getTimeline().toHtmlCanvas(result, unitDivisor, null);
|
getTimeline().toHtmlCanvas(result, unitDivisor, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -334,7 +334,7 @@ public class DefineVideoStreamTag extends DrawableTag implements BoundedTag, Tim
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized 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, boolean canUseSmoothing) {
|
public synchronized void toImage(SWF swf, 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, boolean canUseSmoothing) {
|
||||||
|
|
||||||
if (renderingPaused || !SimpleMediaPlayer.isAvailable()) {
|
if (renderingPaused || !SimpleMediaPlayer.isAvailable()) {
|
||||||
Graphics2D g = (Graphics2D) image.getBufferedImage().getGraphics();
|
Graphics2D g = (Graphics2D) image.getBufferedImage().getGraphics();
|
||||||
@@ -419,11 +419,11 @@ public class DefineVideoStreamTag extends DrawableTag implements BoundedTag, Tim
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void toSVG(SVGExporter exporter, int ratio, ColorTransform colorTransform, int level) throws IOException {
|
public void toSVG(SWF swf, SVGExporter exporter, int ratio, ColorTransform colorTransform, int level) throws IOException {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void toHtmlCanvas(StringBuilder result, double unitDivisor) {
|
public void toHtmlCanvas(SWF swf, StringBuilder result, double unitDivisor) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import com.jpexs.decompiler.flash.tags.base.BoundedTag;
|
|||||||
import com.jpexs.decompiler.flash.tags.base.CharacterIdTag;
|
import com.jpexs.decompiler.flash.tags.base.CharacterIdTag;
|
||||||
import com.jpexs.decompiler.flash.tags.base.CharacterTag;
|
import com.jpexs.decompiler.flash.tags.base.CharacterTag;
|
||||||
import com.jpexs.decompiler.flash.tags.base.Exportable;
|
import com.jpexs.decompiler.flash.tags.base.Exportable;
|
||||||
|
import com.jpexs.decompiler.flash.tags.base.ImportTag;
|
||||||
import com.jpexs.decompiler.flash.tags.base.NeedsCharacters;
|
import com.jpexs.decompiler.flash.tags.base.NeedsCharacters;
|
||||||
import com.jpexs.decompiler.flash.tags.gfx.DefineCompactedFont;
|
import com.jpexs.decompiler.flash.tags.gfx.DefineCompactedFont;
|
||||||
import com.jpexs.decompiler.flash.tags.gfx.DefineExternalGradient;
|
import com.jpexs.decompiler.flash.tags.gfx.DefineExternalGradient;
|
||||||
@@ -639,6 +640,13 @@ public abstract class Tag implements NeedsCharacters, Exportable, Serializable {
|
|||||||
}
|
}
|
||||||
ReadOnlyTagList tags = tim.getTags();
|
ReadOnlyTagList tags = tim.getTags();
|
||||||
for (int i = tags.indexOf(this) - 1; i >= 0; i--) {
|
for (int i = tags.indexOf(this) - 1; i >= 0; i--) {
|
||||||
|
if (tags.get(i) instanceof ImportTag) {
|
||||||
|
ImportTag it = (ImportTag) tags.get(i);
|
||||||
|
needed2.removeAll(it.getAssets().keySet());
|
||||||
|
if (needed2.isEmpty()) {
|
||||||
|
return needed2;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (tags.get(i) instanceof CharacterTag) {
|
if (tags.get(i) instanceof CharacterTag) {
|
||||||
int charId = ((CharacterTag) tags.get(i)).getCharacterId();
|
int charId = ((CharacterTag) tags.get(i)).getCharacterId();
|
||||||
needed2.remove(charId);
|
needed2.remove(charId);
|
||||||
@@ -670,9 +678,12 @@ public abstract class Tag implements NeedsCharacters, Exportable, Serializable {
|
|||||||
if (swf == null) {
|
if (swf == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (swf.getCharacters().containsKey(characterId) && !swf.getCyclicCharacters().contains(characterId)) {
|
if (swf.getCharacters(true).containsKey(characterId) && !swf.getCyclicCharacters().contains(characterId)) {
|
||||||
Set<Integer> needed4 = new LinkedHashSet<>();
|
Set<Integer> needed4 = new LinkedHashSet<>();
|
||||||
CharacterTag character = swf.getCharacter(characterId);
|
CharacterTag character = swf.getCharacter(characterId);
|
||||||
|
if (character.isImported()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
character.getNeededCharacters(needed4, swf);
|
character.getNeededCharacters(needed4, swf);
|
||||||
List<Integer> newItems = new ArrayList<>();
|
List<Integer> newItems = new ArrayList<>();
|
||||||
for (int n : needed4) {
|
for (int n : needed4) {
|
||||||
@@ -695,7 +706,7 @@ public abstract class Tag implements NeedsCharacters, Exportable, Serializable {
|
|||||||
if (swf == null) {
|
if (swf == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (swf.getCharacters().containsKey(characterId)) {
|
if (swf.getCharacters(true).containsKey(characterId)) {
|
||||||
needed.add(characterId);
|
needed.add(characterId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,12 +93,12 @@ public abstract class ButtonTag extends DrawableTag implements Timelined {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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, int blendMode, boolean canUseSmoothing) {
|
public void toImage(SWF swf, 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, boolean canUseSmoothing) {
|
||||||
getTimeline().toImage(frame, time, renderContext, image, fullImage, isClip, transformation, strokeTransformation, absoluteTransformation, colorTransform, unzoom, sameImage, viewRect, fullTransformation, scaleStrokes, drawMode, blendMode, canUseSmoothing);
|
getTimeline().toImage(frame, time, renderContext, image, fullImage, isClip, transformation, strokeTransformation, absoluteTransformation, colorTransform, unzoom, sameImage, viewRect, fullTransformation, scaleStrokes, drawMode, blendMode, canUseSmoothing);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void toSVG(SVGExporter exporter, int ratio, ColorTransform colorTransform, int level) throws IOException {
|
public void toSVG(SWF swf, SVGExporter exporter, int ratio, ColorTransform colorTransform, int level) throws IOException {
|
||||||
getTimeline().toSVG(0, 0, null, 0, exporter, colorTransform, level + 1);
|
getTimeline().toSVG(0, 0, null, 0, exporter, colorTransform, level + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,7 +110,7 @@ public abstract class ButtonTag extends DrawableTag implements Timelined {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void toHtmlCanvas(StringBuilder result, double unitDivisor) {
|
public void toHtmlCanvas(SWF swf, StringBuilder result, double unitDivisor) {
|
||||||
getTimeline().toHtmlCanvas(result, unitDivisor, Arrays.asList(0)); //TODO: handle states?
|
getTimeline().toHtmlCanvas(result, unitDivisor, Arrays.asList(0)); //TODO: handle states?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,11 +61,11 @@ public abstract class DrawableTag extends CharacterTag implements BoundedTag {
|
|||||||
*/
|
*/
|
||||||
public abstract Shape getOutline(boolean fast, int frame, int time, int ratio, RenderContext renderContext, Matrix transformation, boolean stroked, ExportRectangle viewRect, double unzoom);
|
public abstract Shape getOutline(boolean fast, int frame, int time, int ratio, RenderContext renderContext, Matrix transformation, boolean stroked, ExportRectangle viewRect, double unzoom);
|
||||||
|
|
||||||
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, boolean canUseSmoothing);
|
public abstract void toImage(SWF swf, 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, boolean canUseSmoothing);
|
||||||
|
|
||||||
public abstract void toSVG(SVGExporter exporter, int ratio, ColorTransform colorTransform, int level) throws IOException;
|
public abstract void toSVG(SWF swf, SVGExporter exporter, int ratio, ColorTransform colorTransform, int level) throws IOException;
|
||||||
|
|
||||||
public abstract void toHtmlCanvas(StringBuilder result, double unitDivisor);
|
public abstract void toHtmlCanvas(SWF swf, StringBuilder result, double unitDivisor);
|
||||||
|
|
||||||
public abstract int getNumFrames();
|
public abstract int getNumFrames();
|
||||||
|
|
||||||
|
|||||||
@@ -175,11 +175,7 @@ public abstract class FontTag extends DrawableTag implements AloneTag {
|
|||||||
reload();
|
reload();
|
||||||
}
|
}
|
||||||
firstLoaded = true;
|
firstLoaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getFontId() {
|
|
||||||
return getCharacterId();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasLayout() {
|
public boolean hasLayout() {
|
||||||
return false;
|
return false;
|
||||||
@@ -226,7 +222,7 @@ public abstract class FontTag extends DrawableTag implements AloneTag {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getSystemFontName() {
|
public String getSystemFontName() {
|
||||||
int fontId = getFontId();
|
int fontId = getCharacterId();
|
||||||
String selectedFont = swf.sourceFontNamesMap.get(fontId);
|
String selectedFont = swf.sourceFontNamesMap.get(fontId);
|
||||||
if (selectedFont == null) {
|
if (selectedFont == null) {
|
||||||
SwfSpecificConfiguration swfConf = Configuration.getSwfSpecificConfiguration(swf.getShortPathTitle());
|
SwfSpecificConfiguration swfConf = Configuration.getSwfSpecificConfiguration(swf.getShortPathTitle());
|
||||||
@@ -429,16 +425,16 @@ public abstract class FontTag extends DrawableTag implements AloneTag {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized 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, boolean canUseSmoothing) {
|
public synchronized void toImage(SWF swf, 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, boolean canUseSmoothing) {
|
||||||
SHAPERECORD.shapeListToImage(ShapeTag.WIND_EVEN_ODD, 1, swf, getGlyphShapeTable(), image, frame, Color.black, colorTransform);
|
SHAPERECORD.shapeListToImage(ShapeTag.WIND_EVEN_ODD, 1, swf, getGlyphShapeTable(), image, frame, Color.black, colorTransform);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void toSVG(SVGExporter exporter, int ratio, ColorTransform colorTransform, int level) {
|
public void toSVG(SWF swf, SVGExporter exporter, int ratio, ColorTransform colorTransform, int level) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void toHtmlCanvas(StringBuilder result, double unitDivisor) {
|
public void toHtmlCanvas(SWF swf, StringBuilder result, double unitDivisor) {
|
||||||
List<SHAPE> shapes = getGlyphShapeTable();
|
List<SHAPE> shapes = getGlyphShapeTable();
|
||||||
result.append("\tdefaultFill = textColor;\r\n");
|
result.append("\tdefaultFill = textColor;\r\n");
|
||||||
result.append("\tswitch(ch){\r\n");
|
result.append("\tswitch(ch){\r\n");
|
||||||
@@ -496,7 +492,7 @@ public abstract class FontTag extends DrawableTag implements AloneTag {
|
|||||||
for (Tag t : swf.getTags()) {
|
for (Tag t : swf.getTags()) {
|
||||||
if (t instanceof DefineFontNameTag) {
|
if (t instanceof DefineFontNameTag) {
|
||||||
DefineFontNameTag dfn = (DefineFontNameTag) t;
|
DefineFontNameTag dfn = (DefineFontNameTag) t;
|
||||||
if (dfn.fontId == getFontId()) {
|
if (dfn.fontId == getCharacterId()) {
|
||||||
return dfn;
|
return dfn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -262,18 +262,18 @@ public abstract class ImageTag extends DrawableTag {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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, int blendMode, boolean canUseSmoothing) {
|
public void toImage(SWF swf, 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, boolean canUseSmoothing) {
|
||||||
BitmapExporter.export(ShapeTag.WIND_EVEN_ODD, 1, swf, getShape(1), null, image, unzoom, transformation, strokeTransformation, colorTransform, true, canUseSmoothing);
|
BitmapExporter.export(ShapeTag.WIND_EVEN_ODD, 1, swf, getShape(1), null, image, unzoom, transformation, strokeTransformation, colorTransform, true, canUseSmoothing);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void toSVG(SVGExporter exporter, int ratio, ColorTransform colorTransform, int level) throws IOException {
|
public void toSVG(SWF swf, SVGExporter exporter, int ratio, ColorTransform colorTransform, int level) throws IOException {
|
||||||
SVGShapeExporter shapeExporter = new SVGShapeExporter(ShapeTag.WIND_EVEN_ODD, 1, swf, getShape(1), getCharacterId(), exporter, null, colorTransform, 1);
|
SVGShapeExporter shapeExporter = new SVGShapeExporter(ShapeTag.WIND_EVEN_ODD, 1, swf, getShape(1), getCharacterId(), exporter, null, colorTransform, 1);
|
||||||
shapeExporter.export();
|
shapeExporter.export();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void toHtmlCanvas(StringBuilder result, double unitDivisor) {
|
public void toHtmlCanvas(SWF swf, StringBuilder result, double unitDivisor) {
|
||||||
CanvasShapeExporter cse = new CanvasShapeExporter(ShapeTag.WIND_EVEN_ODD, 1, null, unitDivisor, swf, getShape(1), null, 0, 0);
|
CanvasShapeExporter cse = new CanvasShapeExporter(ShapeTag.WIND_EVEN_ODD, 1, null, unitDivisor, swf, getShape(1), null, 0, 0);
|
||||||
cse.export();
|
cse.export();
|
||||||
result.append(cse.getShapeData());
|
result.append(cse.getShapeData());
|
||||||
|
|||||||
@@ -331,7 +331,7 @@ public abstract class MorphShapeTag extends DrawableTag {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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, int blendMode, boolean canUseSmoothing) {
|
public void toImage(SWF swf, 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, boolean canUseSmoothing) {
|
||||||
SHAPEWITHSTYLE shape = getShapeAtRatio(ratio);
|
SHAPEWITHSTYLE shape = getShapeAtRatio(ratio);
|
||||||
// morphShape using shapeNum=3, morphShape2 using shapeNum=4
|
// morphShape using shapeNum=3, morphShape2 using shapeNum=4
|
||||||
// todo: Currently the generated image is not cached, because the cache
|
// todo: Currently the generated image is not cached, because the cache
|
||||||
@@ -341,7 +341,7 @@ public abstract class MorphShapeTag extends DrawableTag {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void toSVG(SVGExporter exporter, int ratio, ColorTransform colorTransform, int level) {
|
public void toSVG(SWF swf, SVGExporter exporter, int ratio, ColorTransform colorTransform, int level) {
|
||||||
if (ratio == -2) {
|
if (ratio == -2) {
|
||||||
SHAPEWITHSTYLE beginShapes = getShapeAtRatio(0);
|
SHAPEWITHSTYLE beginShapes = getShapeAtRatio(0);
|
||||||
SHAPEWITHSTYLE endShapes = getShapeAtRatio(65535);
|
SHAPEWITHSTYLE endShapes = getShapeAtRatio(65535);
|
||||||
@@ -371,7 +371,7 @@ public abstract class MorphShapeTag extends DrawableTag {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void toHtmlCanvas(StringBuilder result, double unitDivisor) {
|
public void toHtmlCanvas(SWF swf, StringBuilder result, double unitDivisor) {
|
||||||
CanvasMorphShapeExporter cmse = new CanvasMorphShapeExporter(getShapeNum(), swf, getShapeAtRatio(0), getShapeAtRatio(MAX_RATIO), null, unitDivisor, 0, 0);
|
CanvasMorphShapeExporter cmse = new CanvasMorphShapeExporter(getShapeNum(), swf, getShapeAtRatio(0), getShapeAtRatio(MAX_RATIO), null, unitDivisor, 0, 0);
|
||||||
cmse.export();
|
cmse.export();
|
||||||
result.append(cmse.getShapeData());
|
result.append(cmse.getShapeData());
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ public abstract class ShapeTag extends DrawableTag implements LazyObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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, int blendMode, boolean canUseSmoothing) {
|
public void toImage(SWF swf, 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, boolean canUseSmoothing) {
|
||||||
BitmapExporter.export(getWindingRule(), getShapeNum(), swf, getShapes(), null, image, unzoom, transformation, strokeTransformation, colorTransform, scaleStrokes, canUseSmoothing);
|
BitmapExporter.export(getWindingRule(), getShapeNum(), swf, getShapes(), null, image, unzoom, transformation, strokeTransformation, colorTransform, scaleStrokes, canUseSmoothing);
|
||||||
if (Configuration._debugMode.get()) { // show control points
|
if (Configuration._debugMode.get()) { // show control points
|
||||||
List<GeneralPath> paths = PathExporter.export(getWindingRule(), getShapeNum(), swf, getShapes());
|
List<GeneralPath> paths = PathExporter.export(getWindingRule(), getShapeNum(), swf, getShapes());
|
||||||
@@ -238,13 +238,13 @@ public abstract class ShapeTag extends DrawableTag implements LazyObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void toSVG(SVGExporter exporter, int ratio, ColorTransform colorTransform, int level) throws IOException {
|
public void toSVG(SWF swf, SVGExporter exporter, int ratio, ColorTransform colorTransform, int level) throws IOException {
|
||||||
SVGShapeExporter shapeExporter = new SVGShapeExporter(getWindingRule(), getShapeNum(), swf, getShapes(), getCharacterId(), exporter, null, colorTransform, 1);
|
SVGShapeExporter shapeExporter = new SVGShapeExporter(getWindingRule(), getShapeNum(), swf, getShapes(), getCharacterId(), exporter, null, colorTransform, 1);
|
||||||
shapeExporter.export();
|
shapeExporter.export();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void toHtmlCanvas(StringBuilder result, double unitDivisor) {
|
public void toHtmlCanvas(SWF swf, StringBuilder result, double unitDivisor) {
|
||||||
CanvasShapeExporter cse = new CanvasShapeExporter(getWindingRule(), getShapeNum(), null, unitDivisor, swf, getShapes(), null, 0, 0);
|
CanvasShapeExporter cse = new CanvasShapeExporter(getWindingRule(), getShapeNum(), null, unitDivisor, swf, getShapes(), null, 0, 0);
|
||||||
cse.export();
|
cse.export();
|
||||||
result.append(cse.getShapeData());
|
result.append(cse.getShapeData());
|
||||||
|
|||||||
@@ -743,7 +743,7 @@ public abstract class StaticTextTag extends TextTag {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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, int blendMode, boolean canUseSmoothing) {
|
public void toImage(SWF swf, 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, boolean canUseSmoothing) {
|
||||||
staticTextToImage(swf, textRecords, getTextNum(), image, textMatrix, transformation, colorTransform);
|
staticTextToImage(swf, textRecords, getTextNum(), image, textMatrix, transformation, colorTransform);
|
||||||
/*try {
|
/*try {
|
||||||
TextTag originalTag = (TextTag) getOriginalTag();
|
TextTag originalTag = (TextTag) getOriginalTag();
|
||||||
@@ -757,12 +757,12 @@ public abstract class StaticTextTag extends TextTag {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void toSVG(SVGExporter exporter, int ratio, ColorTransform colorTransform, int level) {
|
public void toSVG(SWF swf, SVGExporter exporter, int ratio, ColorTransform colorTransform, int level) {
|
||||||
staticTextToSVG(swf, textRecords, getTextNum(), exporter, getRect(), textMatrix, colorTransform, 1);
|
staticTextToSVG(swf, textRecords, getTextNum(), exporter, getRect(), textMatrix, colorTransform, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void toHtmlCanvas(StringBuilder result, double unitDivisor) {
|
public void toHtmlCanvas(SWF swf, StringBuilder result, double unitDivisor) {
|
||||||
staticTextToHtmlCanvas(unitDivisor, swf, textRecords, getTextNum(), result, textBounds, textMatrix, null);
|
staticTextToHtmlCanvas(unitDivisor, swf, textRecords, getTextNum(), result, textBounds, textMatrix, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -768,7 +768,7 @@ public class Timeline {
|
|||||||
toImage(frame, time, renderContext, image, isClip, transforms[i], absoluteTransformation, colorTransform, targetRect[i]);
|
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, 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, boolean canUseSmoothing) {
|
private void drawDrawable(SWF swf, 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, boolean canUseSmoothing) {
|
||||||
Matrix drawMatrix = new Matrix();
|
Matrix drawMatrix = new Matrix();
|
||||||
int drawableFrameCount = drawable.getNumFrames();
|
int drawableFrameCount = drawable.getNumFrames();
|
||||||
if (drawableFrameCount == 0) {
|
if (drawableFrameCount == 0) {
|
||||||
@@ -967,7 +967,7 @@ public class Timeline {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!(drawable instanceof ImageTag) || (swf.isAS3() && layer.hasImage)) {
|
if (!(drawable instanceof ImageTag) || (swf.isAS3() && layer.hasImage)) {
|
||||||
drawable.toImage(dframe, dtime, ratio, renderContext, img, fullImage, isClip || clipDepth > -1, m, strokeTransform, absMat, mfull, clrTrans2, unzoom, sameImage, viewRect2, scaleStrokes, drawMode, layer.blendMode, canUseSmoothing);
|
drawable.toImage(swf, dframe, dtime, ratio, renderContext, img, fullImage, isClip || clipDepth > -1, m, strokeTransform, absMat, mfull, clrTrans2, unzoom, sameImage, viewRect2, scaleStrokes, drawMode, layer.blendMode, canUseSmoothing);
|
||||||
} else {
|
} else {
|
||||||
// todo: show one time warning
|
// todo: show one time warning
|
||||||
}
|
}
|
||||||
@@ -1236,7 +1236,7 @@ public class Timeline {
|
|||||||
Rectangle2D r = new Rectangle2D.Double(p1.xMin, p1.yMin, p1.getWidth(), p1.getHeight());
|
Rectangle2D r = new Rectangle2D.Double(p1.xMin, p1.yMin, p1.getWidth(), p1.getHeight());
|
||||||
|
|
||||||
g.setClip(r);
|
g.setClip(r);
|
||||||
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, canUseSmoothing);
|
drawDrawable(swf, 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, canUseSmoothing);
|
||||||
s++;
|
s++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1245,13 +1245,13 @@ public class Timeline {
|
|||||||
g.setTransform(origTransform);
|
g.setTransform(origTransform);
|
||||||
|
|
||||||
//draw all nonshapes (normally scaled) next
|
//draw all nonshapes (normally scaled) next
|
||||||
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, canUseSmoothing);
|
drawDrawable(swf, 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, canUseSmoothing);
|
||||||
} else {
|
} else {
|
||||||
boolean subScaleStrokes = scaleStrokes;
|
boolean subScaleStrokes = scaleStrokes;
|
||||||
if (character instanceof DefineSpriteTag) {
|
if (character instanceof DefineSpriteTag) {
|
||||||
subScaleStrokes = true;
|
subScaleStrokes = true;
|
||||||
}
|
}
|
||||||
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, canUseSmoothing);
|
drawDrawable(swf, 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, canUseSmoothing);
|
||||||
}
|
}
|
||||||
} else if (character instanceof BoundedTag) {
|
} else if (character instanceof BoundedTag) {
|
||||||
showPlaceholder = true;
|
showPlaceholder = true;
|
||||||
@@ -1357,12 +1357,12 @@ public class Timeline {
|
|||||||
exporter.createClipPath(mat, clipName);
|
exporter.createClipPath(mat, clipName);
|
||||||
SvgClip clip = new SvgClip(clipName, layer.clipDepth);
|
SvgClip clip = new SvgClip(clipName, layer.clipDepth);
|
||||||
clips.add(clip);
|
clips.add(clip);
|
||||||
drawable.toSVG(exporter, layer.ratio, clrTrans, level + 1);
|
drawable.toSVG(swf, exporter, layer.ratio, clrTrans, level + 1);
|
||||||
exporter.endGroup();
|
exporter.endGroup();
|
||||||
} else {
|
} else {
|
||||||
if (createNew) {
|
if (createNew) {
|
||||||
exporter.createDefGroup(new ExportRectangle(boundRect), assetName);
|
exporter.createDefGroup(new ExportRectangle(boundRect), assetName);
|
||||||
drawable.toSVG(exporter, layer.ratio, clrTrans, level + 1);
|
drawable.toSVG(swf, exporter, layer.ratio, clrTrans, level + 1);
|
||||||
exporter.endGroup();
|
exporter.endGroup();
|
||||||
}
|
}
|
||||||
Matrix mat = Matrix.getTranslateInstance(rect.xMin, rect.yMin).preConcatenate(new Matrix(layer.matrix));
|
Matrix mat = Matrix.getTranslateInstance(rect.xMin, rect.yMin).preConcatenate(new Matrix(layer.matrix));
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ public class BUTTONRECORD implements Serializable, TreeItem, HasSwfAndTag, HasCh
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "BUTTONRECORD (" + characterId + ") Depth:" + placeDepth + " State:" + ((buttonStateDown ? "down " : "") + (buttonStateHitTest ? "hit " : "") + (buttonStateOver ? "over " : "") + (buttonStateUp ? "up " : ""));
|
return "BUTTONRECORD (chid: " + characterId + ", dpt: " + placeDepth + ", state: " + ((buttonStateDown ? "down " : "") + (buttonStateHitTest ? "hit " : "") + (buttonStateOver ? "over " : "") + (buttonStateUp ? "up " : "")).trim() + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -2906,7 +2906,7 @@ public class XFLConverter {
|
|||||||
statusStack.pushStatus(t.toString());
|
statusStack.pushStatus(t.toString());
|
||||||
SWF swf = t.getSwf();
|
SWF swf = t.getSwf();
|
||||||
FontTag font = (FontTag) t;
|
FontTag font = (FontTag) t;
|
||||||
int fontId = font.getFontId();
|
int fontId = font.getCharacterId();
|
||||||
DefineFontNameTag fontNameTag = (DefineFontNameTag) swf.getCharacterIdTag(fontId, DefineFontNameTag.ID);
|
DefineFontNameTag fontNameTag = (DefineFontNameTag) swf.getCharacterIdTag(fontId, DefineFontNameTag.ID);
|
||||||
String fontName = fontNameTag == null ? null : fontNameTag.fontName;
|
String fontName = fontNameTag == null ? null : fontNameTag.fontName;
|
||||||
if (fontName == null) {
|
if (fontName == null) {
|
||||||
@@ -5576,7 +5576,7 @@ public class XFLConverter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (u instanceof FontTag) {
|
if (u instanceof FontTag) {
|
||||||
if (((FontTag) u).getFontId() == det.fontId) {
|
if (((FontTag) u).getCharacterId()== det.fontId) {
|
||||||
ft = (FontTag) u;
|
ft = (FontTag) u;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5694,7 +5694,7 @@ public class XFLConverter {
|
|||||||
if (f.equals(ft.getFontNameIntag())) {
|
if (f.equals(ft.getFontNameIntag())) {
|
||||||
for (Tag u : tags) {
|
for (Tag u : tags) {
|
||||||
if (u instanceof DefineFontNameTag) {
|
if (u instanceof DefineFontNameTag) {
|
||||||
if (((DefineFontNameTag) u).fontId == ft.getFontId()) {
|
if (((DefineFontNameTag) u).fontId == ft.getCharacterId()) {
|
||||||
fontName = ((DefineFontNameTag) u).fontName;
|
fontName = ((DefineFontNameTag) u).fontName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2932,7 +2932,7 @@ public class CommandLineArgumentParser {
|
|||||||
CharacterTag characterTag = null;
|
CharacterTag characterTag = null;
|
||||||
if (characterId == -1) {
|
if (characterId == -1) {
|
||||||
//replacing soundstreamhead on main timeline
|
//replacing soundstreamhead on main timeline
|
||||||
} else if (swf.getCharacters().containsKey(characterId)) {
|
} else if (swf.getCharacters(false).containsKey(characterId)) {
|
||||||
characterTag = swf.getCharacter(characterId);
|
characterTag = swf.getCharacter(characterId);
|
||||||
} else {
|
} else {
|
||||||
System.err.println("CharacterId does not exist");
|
System.err.println("CharacterId does not exist");
|
||||||
@@ -3163,7 +3163,7 @@ public class CommandLineArgumentParser {
|
|||||||
System.err.println("ImageId should be integer");
|
System.err.println("ImageId should be integer");
|
||||||
badArguments("replacealpha");
|
badArguments("replacealpha");
|
||||||
}
|
}
|
||||||
if (!swf.getCharacters().containsKey(imageId)) {
|
if (!swf.getCharacters(false).containsKey(imageId)) {
|
||||||
System.err.println("ImageId does not exist");
|
System.err.println("ImageId does not exist");
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
@@ -3219,7 +3219,7 @@ public class CommandLineArgumentParser {
|
|||||||
System.err.println("CharacterId should be integer");
|
System.err.println("CharacterId should be integer");
|
||||||
badArguments("replacecharacter");
|
badArguments("replacecharacter");
|
||||||
}
|
}
|
||||||
if (!swf.getCharacters().containsKey(characterId)) {
|
if (!swf.getCharacters(false).containsKey(characterId)) {
|
||||||
System.err.println("CharacterId does not exist");
|
System.err.println("CharacterId does not exist");
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
@@ -3234,7 +3234,7 @@ public class CommandLineArgumentParser {
|
|||||||
System.err.println("NewCharacterId should be integer");
|
System.err.println("NewCharacterId should be integer");
|
||||||
badArguments("replacecharacter");
|
badArguments("replacecharacter");
|
||||||
}
|
}
|
||||||
if (!swf.getCharacters().containsKey(newCharacterId)) {
|
if (!swf.getCharacters(false).containsKey(newCharacterId)) {
|
||||||
System.err.println("NewCharacterId does not exist");
|
System.err.println("NewCharacterId does not exist");
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
@@ -3337,7 +3337,7 @@ public class CommandLineArgumentParser {
|
|||||||
System.err.println("CharacterId should be integer");
|
System.err.println("CharacterId should be integer");
|
||||||
badArguments("convert");
|
badArguments("convert");
|
||||||
}
|
}
|
||||||
if (!swf.getCharacters().containsKey(characterId)) {
|
if (!swf.getCharacters(false).containsKey(characterId)) {
|
||||||
System.err.println("CharacterId does not exist");
|
System.err.println("CharacterId does not exist");
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
@@ -3535,7 +3535,7 @@ public class CommandLineArgumentParser {
|
|||||||
System.err.println("CharacterId should be integer");
|
System.err.println("CharacterId should be integer");
|
||||||
badArguments("removecharacter");
|
badArguments("removecharacter");
|
||||||
}
|
}
|
||||||
if (!swf.getCharacters().containsKey(characterId)) {
|
if (!swf.getCharacters(false).containsKey(characterId)) {
|
||||||
System.err.println("CharacterId does not exist");
|
System.err.println("CharacterId does not exist");
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
@@ -3808,7 +3808,7 @@ public class CommandLineArgumentParser {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(TextTag textTag, final FontTag font, final char character) {
|
public boolean handle(TextTag textTag, final FontTag font, final char character) {
|
||||||
String fontName = font.getSwf().sourceFontNamesMap.get(font.getFontId());
|
String fontName = font.getSwf().sourceFontNamesMap.get(font.getCharacterId());
|
||||||
if (fontName == null) {
|
if (fontName == null) {
|
||||||
fontName = font.getFontName();
|
fontName = font.getFontName();
|
||||||
}
|
}
|
||||||
@@ -4222,7 +4222,7 @@ public class CommandLineArgumentParser {
|
|||||||
pw.println("[tags]");
|
pw.println("[tags]");
|
||||||
pw.println("tagCount=" + swf.getTags().size());
|
pw.println("tagCount=" + swf.getTags().size());
|
||||||
pw.println("hasEndTag=" + swf.hasEndTag);
|
pw.println("hasEndTag=" + swf.hasEndTag);
|
||||||
pw.println("characterCount=" + (swf.getCharacters().size()));
|
pw.println("characterCount=" + (swf.getCharacters(true).size()));
|
||||||
pw.println("maxCharacterId=" + (swf.getNextCharacterId() - 1));
|
pw.println("maxCharacterId=" + (swf.getNextCharacterId() - 1));
|
||||||
pw.println();
|
pw.println();
|
||||||
|
|
||||||
|
|||||||
@@ -383,7 +383,7 @@ public class FolderPreviewPanel extends JPanel {
|
|||||||
if (imgSrc == null) {
|
if (imgSrc == null) {
|
||||||
DrawableTag drawable = (DrawableTag) treeItem;
|
DrawableTag drawable = (DrawableTag) treeItem;
|
||||||
ExportRectangle viewRectangle = new ExportRectangle(0, 0, ow, oh);
|
ExportRectangle viewRectangle = new ExportRectangle(0, 0, ow, oh);
|
||||||
drawable.toImage(0, 0, 0, new RenderContext(), image, image, false, m, new Matrix(), m, m, null, scale, false, viewRectangle, true, Timeline.DRAW_MODE_ALL, 0, !Configuration.disableBitmapSmoothing.get());
|
drawable.toImage(swf, 0, 0, 0, new RenderContext(), image, image, false, m, new Matrix(), m, m, null, scale, false, viewRectangle, true, Timeline.DRAW_MODE_ALL, 0, !Configuration.disableBitmapSmoothing.get());
|
||||||
} else {
|
} else {
|
||||||
Graphics2D g = (Graphics2D) image.getGraphics();
|
Graphics2D g = (Graphics2D) image.getGraphics();
|
||||||
g.setTransform(m.toTransform());
|
g.setTransform(m.toTransform());
|
||||||
|
|||||||
@@ -230,7 +230,7 @@ public class FontPanel extends JPanel implements TagEditorPanel {
|
|||||||
|
|
||||||
if (replaced) {
|
if (replaced) {
|
||||||
if (ViewMessages.showConfirmDialog(FontPanel.this, translate("message.font.replace.updateTexts"), translate("message.warning"), JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE) == JOptionPane.YES_OPTION) {
|
if (ViewMessages.showConfirmDialog(FontPanel.this, translate("message.font.replace.updateTexts"), translate("message.warning"), JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE) == JOptionPane.YES_OPTION) {
|
||||||
int fontId = ft.getFontId();
|
int fontId = ft.getCharacterId();
|
||||||
SWF swf = ft.getSwf();
|
SWF swf = ft.getSwf();
|
||||||
for (Tag tag : swf.getTags()) {
|
for (Tag tag : swf.getTags()) {
|
||||||
if (tag instanceof TextTag) {
|
if (tag instanceof TextTag) {
|
||||||
@@ -678,8 +678,8 @@ public class FontPanel extends JPanel implements TagEditorPanel {
|
|||||||
FontTag f = (FontTag) item;
|
FontTag f = (FontTag) item;
|
||||||
SWF swf = f.getSwf();
|
SWF swf = f.getSwf();
|
||||||
String selectedName = ((FontFace) fontFaceSelection.getSelectedItem()).font.getFontName(Locale.ENGLISH);
|
String selectedName = ((FontFace) fontFaceSelection.getSelectedItem()).font.getFontName(Locale.ENGLISH);
|
||||||
swf.sourceFontNamesMap.put(f.getFontId(), selectedName);
|
swf.sourceFontNamesMap.put(f.getCharacterId(), selectedName);
|
||||||
Configuration.addFontPair(swf.getShortPathTitle(), f.getFontId(), f.getFontNameIntag(), selectedName);
|
Configuration.addFontPair(swf.getShortPathTitle(), f.getCharacterId(), f.getFontNameIntag(), selectedName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2823,10 +2823,10 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
|||||||
image.fillTransparent();
|
image.fillTransparent();
|
||||||
Matrix m = Matrix.getTranslateInstance(-rect.Xmin * zoomDouble, -rect.Ymin * zoomDouble);
|
Matrix m = Matrix.getTranslateInstance(-rect.Xmin * zoomDouble, -rect.Ymin * zoomDouble);
|
||||||
m.scale(zoomDouble);
|
m.scale(zoomDouble);
|
||||||
textTag.toImage(0, 0, 0, new RenderContext(), image, image, false, m, m, m, m, new ConstantColorColorTransform(0xFFC0C0C0), zoomDouble, false, new ExportRectangle(rect), true, Timeline.DRAW_MODE_ALL, 0, false);
|
textTag.toImage(textTag.getSwf(), 0, 0, 0, new RenderContext(), image, image, false, m, m, m, m, new ConstantColorColorTransform(0xFFC0C0C0), zoomDouble, false, new ExportRectangle(rect), true, Timeline.DRAW_MODE_ALL, 0, false);
|
||||||
|
|
||||||
if (newTextTag != null) {
|
if (newTextTag != null) {
|
||||||
newTextTag.toImage(0, 0, 0, new RenderContext(), image, image, false, m, m, m, m, new ConstantColorColorTransform(0xFF000000), zoomDouble, false, new ExportRectangle(rect), true, Timeline.DRAW_MODE_ALL, 0, false);
|
newTextTag.toImage(textTag.getSwf(), 0, 0, 0, new RenderContext(), image, image, false, m, m, m, m, new ConstantColorColorTransform(0xFF000000), zoomDouble, false, new ExportRectangle(rect), true, Timeline.DRAW_MODE_ALL, 0, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
iconPanel.setImg(image);
|
iconPanel.setImg(image);
|
||||||
@@ -3376,7 +3376,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
|||||||
List<String> soundClasses = new ArrayList<>();
|
List<String> soundClasses = new ArrayList<>();
|
||||||
List<SOUNDINFO> soundInfos = new ArrayList<>();
|
List<SOUNDINFO> soundInfos = new ArrayList<>();
|
||||||
timeline.getSounds(frame, time, renderContext.mouseOverButton, mouseButton, sounds, soundClasses, soundInfos);
|
timeline.getSounds(frame, time, renderContext.mouseOverButton, mouseButton, sounds, soundClasses, soundInfos);
|
||||||
for (int cid : swf.getCharacters().keySet()) {
|
for (int cid : swf.getCharacters(true).keySet()) {
|
||||||
CharacterTag c = swf.getCharacter(cid);
|
CharacterTag c = swf.getCharacter(cid);
|
||||||
for (int k = 0; k < soundClasses.size(); k++) {
|
for (int k = 0; k < soundClasses.size(); k++) {
|
||||||
String cls = soundClasses.get(k);
|
String cls = soundClasses.get(k);
|
||||||
|
|||||||
@@ -2340,7 +2340,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
|||||||
|
|
||||||
if (export.isOptionEnabled(SpriteExportMode.class)) {
|
if (export.isOptionEnabled(SpriteExportMode.class)) {
|
||||||
SpriteExportSettings ses = new SpriteExportSettings(export.getValue(SpriteExportMode.class), export.getZoom());
|
SpriteExportSettings ses = new SpriteExportSettings(export.getValue(SpriteExportMode.class), export.getZoom());
|
||||||
for (CharacterTag c : swf.getCharacters().values()) {
|
for (CharacterTag c : swf.getCharacters(false).values()) {
|
||||||
if (c instanceof DefineSpriteTag) {
|
if (c instanceof DefineSpriteTag) {
|
||||||
frameExporter.exportSpriteFrames(handler, Path.combine(selFile, SpriteExportSettings.EXPORT_FOLDER_NAME), swf, c.getCharacterId(), null, ses, evl);
|
frameExporter.exportSpriteFrames(handler, Path.combine(selFile, SpriteExportSettings.EXPORT_FOLDER_NAME), swf, c.getCharacterId(), null, ses, evl);
|
||||||
}
|
}
|
||||||
@@ -2349,7 +2349,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
|||||||
|
|
||||||
if (export.isOptionEnabled(ButtonExportMode.class)) {
|
if (export.isOptionEnabled(ButtonExportMode.class)) {
|
||||||
ButtonExportSettings bes = new ButtonExportSettings(export.getValue(ButtonExportMode.class), export.getZoom());
|
ButtonExportSettings bes = new ButtonExportSettings(export.getValue(ButtonExportMode.class), export.getZoom());
|
||||||
for (CharacterTag c : swf.getCharacters().values()) {
|
for (CharacterTag c : swf.getCharacters(false).values()) {
|
||||||
if (c instanceof ButtonTag) {
|
if (c instanceof ButtonTag) {
|
||||||
frameExporter.exportButtonFrames(handler, Path.combine(selFile, ButtonExportSettings.EXPORT_FOLDER_NAME), swf, c.getCharacterId(), null, bes, evl);
|
frameExporter.exportButtonFrames(handler, Path.combine(selFile, ButtonExportSettings.EXPORT_FOLDER_NAME), swf, c.getCharacterId(), null, bes, evl);
|
||||||
}
|
}
|
||||||
@@ -2453,7 +2453,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
|||||||
if (export.isOptionEnabled(SpriteExportMode.class)) {
|
if (export.isOptionEnabled(SpriteExportMode.class)) {
|
||||||
for (SpriteExportMode exportMode : SpriteExportMode.values()) {
|
for (SpriteExportMode exportMode : SpriteExportMode.values()) {
|
||||||
SpriteExportSettings ses = new SpriteExportSettings(exportMode, export.getZoom());
|
SpriteExportSettings ses = new SpriteExportSettings(exportMode, export.getZoom());
|
||||||
for (CharacterTag c : swf.getCharacters().values()) {
|
for (CharacterTag c : swf.getCharacters(false).values()) {
|
||||||
if (c instanceof DefineSpriteTag) {
|
if (c instanceof DefineSpriteTag) {
|
||||||
frameExporter.exportSpriteFrames(handler, Path.combine(selFile, SpriteExportSettings.EXPORT_FOLDER_NAME, exportMode.name()), swf, c.getCharacterId(), null, ses, evl);
|
frameExporter.exportSpriteFrames(handler, Path.combine(selFile, SpriteExportSettings.EXPORT_FOLDER_NAME, exportMode.name()), swf, c.getCharacterId(), null, ses, evl);
|
||||||
}
|
}
|
||||||
@@ -2464,7 +2464,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
|||||||
if (export.isOptionEnabled(ButtonExportMode.class)) {
|
if (export.isOptionEnabled(ButtonExportMode.class)) {
|
||||||
for (ButtonExportMode exportMode : ButtonExportMode.values()) {
|
for (ButtonExportMode exportMode : ButtonExportMode.values()) {
|
||||||
ButtonExportSettings bes = new ButtonExportSettings(exportMode, export.getZoom());
|
ButtonExportSettings bes = new ButtonExportSettings(exportMode, export.getZoom());
|
||||||
for (CharacterTag c : swf.getCharacters().values()) {
|
for (CharacterTag c : swf.getCharacters(false).values()) {
|
||||||
if (c instanceof ButtonTag) {
|
if (c instanceof ButtonTag) {
|
||||||
frameExporter.exportButtonFrames(handler, Path.combine(selFile, ButtonExportSettings.EXPORT_FOLDER_NAME, exportMode.name()), swf, c.getCharacterId(), null, bes, evl);
|
frameExporter.exportButtonFrames(handler, Path.combine(selFile, ButtonExportSettings.EXPORT_FOLDER_NAME, exportMode.name()), swf, c.getCharacterId(), null, bes, evl);
|
||||||
}
|
}
|
||||||
@@ -4462,7 +4462,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(TextTag textTag, final FontTag font, final char character) {
|
public boolean handle(TextTag textTag, final FontTag font, final char character) {
|
||||||
String fontName = font.getSwf().sourceFontNamesMap.get(font.getFontId());
|
String fontName = font.getSwf().sourceFontNamesMap.get(font.getCharacterId());
|
||||||
if (fontName == null) {
|
if (fontName == null) {
|
||||||
fontName = font.getFontName();
|
fontName = font.getFontName();
|
||||||
}
|
}
|
||||||
@@ -5601,17 +5601,20 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
|||||||
} else if ((treeItem instanceof BUTTONRECORD) && (!((BUTTONRECORD) treeItem).getSwf().getCyclicCharacters().contains(((BUTTONRECORD) treeItem).characterId))) {
|
} else if ((treeItem instanceof BUTTONRECORD) && (!((BUTTONRECORD) treeItem).getSwf().getCyclicCharacters().contains(((BUTTONRECORD) treeItem).characterId))) {
|
||||||
BUTTONRECORD buttonRecord = (BUTTONRECORD) treeItem;
|
BUTTONRECORD buttonRecord = (BUTTONRECORD) treeItem;
|
||||||
previewPanel.setParametersPanelVisible(false);
|
previewPanel.setParametersPanelVisible(false);
|
||||||
SWF swf = new SWF(buttonRecord.getSwf().getCharset());
|
SWF origSwf = ((SWF)treeItem.getOpenable());
|
||||||
|
/*SWF swf = new SWF(buttonRecord.getSwf().getCharset());
|
||||||
swf.frameCount = 1;
|
swf.frameCount = 1;
|
||||||
swf.frameRate = buttonRecord.getSwf().frameRate;
|
swf.frameRate = buttonRecord.getSwf().frameRate;
|
||||||
swf.displayRect = buttonRecord.getTag().getRect();
|
swf.displayRect = buttonRecord.getTag().getRect();
|
||||||
|
swf.gfx = origSwf.gfx;
|
||||||
|
swf.setFile(origSwf.getFile()); // For GFX to properly load
|
||||||
if (swf.getBackgroundColor() != null) {
|
if (swf.getBackgroundColor() != null) {
|
||||||
SetBackgroundColorTag setBackgroundColorTag = new SetBackgroundColorTag(swf, swf.getBackgroundColor().backgroundColor);
|
SetBackgroundColorTag setBackgroundColorTag = new SetBackgroundColorTag(swf, swf.getBackgroundColor().backgroundColor);
|
||||||
swf.addTag(setBackgroundColorTag);
|
swf.addTag(setBackgroundColorTag);
|
||||||
setBackgroundColorTag.setTimelined(swf);
|
setBackgroundColorTag.setTimelined(swf);
|
||||||
}
|
}*/
|
||||||
CharacterTag character = buttonRecord.getSwf().getCharacter(buttonRecord.characterId);
|
CharacterTag character = buttonRecord.getSwf().getCharacter(buttonRecord.characterId);
|
||||||
Set<Integer> needed = new LinkedHashSet<>();
|
/*Set<Integer> needed = new LinkedHashSet<>();
|
||||||
character.getNeededCharactersDeep(needed);
|
character.getNeededCharactersDeep(needed);
|
||||||
needed.remove(buttonRecord.characterId);
|
needed.remove(buttonRecord.characterId);
|
||||||
needed.add(buttonRecord.characterId);
|
needed.add(buttonRecord.characterId);
|
||||||
@@ -5628,16 +5631,110 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
|||||||
neededCharacter.setTimelined(swf);
|
neededCharacter.setTimelined(swf);
|
||||||
swf.addTag(neededCharacter);
|
swf.addTag(neededCharacter);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
Timelined tim = new Timelined() {
|
||||||
|
|
||||||
|
ReadOnlyTagList cachedTags = null;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SWF getSwf() {
|
||||||
|
return origSwf;
|
||||||
|
}
|
||||||
|
|
||||||
PlaceObject3Tag placeTag = buttonRecord.toPlaceObject();
|
@Override
|
||||||
placeTag.setSwf(swf);
|
public Timeline getTimeline() {
|
||||||
|
return new Timeline(origSwf, this, Integer.MAX_VALUE,buttonRecord.getTag().getRect());
|
||||||
|
}
|
||||||
|
|
||||||
swf.addTag(placeTag);
|
@Override
|
||||||
placeTag.setTimelined(swf);
|
public void resetTimeline() {
|
||||||
ShowFrameTag showFrameTag = new ShowFrameTag(swf);
|
|
||||||
swf.addTag(showFrameTag);
|
}
|
||||||
showFrameTag.setTimelined(swf);
|
|
||||||
previewPanel.showImagePanel(swf, swf, 0, true, true, !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), true, false, true);
|
@Override
|
||||||
|
public void setModified(boolean value) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ReadOnlyTagList getTags() {
|
||||||
|
if (cachedTags == null) {
|
||||||
|
List<Tag> tags = new ArrayList<>();
|
||||||
|
PlaceObject3Tag placeTag = buttonRecord.toPlaceObject();
|
||||||
|
placeTag.setSwf(origSwf);
|
||||||
|
placeTag.setTimelined(this);
|
||||||
|
tags.add(placeTag);
|
||||||
|
|
||||||
|
ShowFrameTag showFrameTag = new ShowFrameTag(origSwf);
|
||||||
|
showFrameTag.setTimelined(this);
|
||||||
|
tags.add(showFrameTag);
|
||||||
|
cachedTags = new ReadOnlyTagList(tags);
|
||||||
|
}
|
||||||
|
return cachedTags;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeTag(int index) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeTag(Tag tag) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addTag(Tag tag) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addTag(int index, Tag tag) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void replaceTag(int index, Tag newTag) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void replaceTag(Tag oldTag, Tag newTag) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int indexOfTag(Tag tag) {
|
||||||
|
return getTags().indexOf(tag);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setFrameCount(int frameCount) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getFrameCount() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RECT getRect() {
|
||||||
|
return buttonRecord.getTag().getRect();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RECT getRect(Set<BoundedTag> added) {
|
||||||
|
return getRect();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RECT getRectWithStrokes() {
|
||||||
|
return getRect();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//swf.addTag(placeTag);
|
||||||
|
//placeTag.setTimelined(origSwf);
|
||||||
|
//ShowFrameTag showFrameTag = new ShowFrameTag(swf);
|
||||||
|
//swf.addTag(showFrameTag);
|
||||||
|
//showFrameTag.setTimelined(swf);
|
||||||
|
previewPanel.showImagePanel(tim, origSwf, 0, true, true, !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), true, false, true);
|
||||||
} else if (treeItem instanceof DefineFont4Tag) {
|
} else if (treeItem instanceof DefineFont4Tag) {
|
||||||
previewPanel.showGenericTagPanel((Tag) treeItem);
|
previewPanel.showGenericTagPanel((Tag) treeItem);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -184,11 +184,14 @@ public class ReplaceCharacterDialog extends AppDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int showDialog(SWF swf, int selectedCharacterId) {
|
public int showDialog(SWF swf, int selectedCharacterId) {
|
||||||
Map<Integer, CharacterTag> characters = swf.getCharacters();
|
Map<Integer, CharacterTag> characters = swf.getCharacters(false);
|
||||||
fullModel = new DefaultListModel<>();
|
fullModel = new DefaultListModel<>();
|
||||||
fullModel.clear();
|
fullModel.clear();
|
||||||
for (Integer key : characters.keySet()) {
|
for (Integer key : characters.keySet()) {
|
||||||
CharacterTag character = characters.get(key);
|
CharacterTag character = characters.get(key);
|
||||||
|
if (character.isImported()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
int characterId = character.getCharacterId();
|
int characterId = character.getCharacterId();
|
||||||
if (characterId != selectedCharacterId) {
|
if (characterId != selectedCharacterId) {
|
||||||
fullModel.addElement(new ComboBoxItem<>(character.getName(), character));
|
fullModel.addElement(new ComboBoxItem<>(character.getName(), character));
|
||||||
|
|||||||
@@ -2274,7 +2274,7 @@ public class TagTreeContextMenu extends JPopupMenu {
|
|||||||
}
|
}
|
||||||
|
|
||||||
targetSwf.updateCharacters();
|
targetSwf.updateCharacters();
|
||||||
targetSwf.getCharacters(); // force rebuild character id cache
|
targetSwf.getCharacters(true); // force rebuild character id cache
|
||||||
copyTag.setModified(true);
|
copyTag.setModified(true);
|
||||||
newTags.add(copyTag);
|
newTags.add(copyTag);
|
||||||
if (itemsSet.contains(tag)) {
|
if (itemsSet.contains(tag)) {
|
||||||
@@ -5132,7 +5132,7 @@ public class TagTreeContextMenu extends JPopupMenu {
|
|||||||
realTargetTimelined.addTag(positionInt, copyTag);
|
realTargetTimelined.addTag(positionInt, copyTag);
|
||||||
|
|
||||||
targetSwf.updateCharacters();
|
targetSwf.updateCharacters();
|
||||||
targetSwf.getCharacters(); // force rebuild character id cache
|
targetSwf.getCharacters(true); // force rebuild character id cache
|
||||||
copyTag.setModified(true);
|
copyTag.setModified(true);
|
||||||
newTags.add(copyTag);
|
newTags.add(copyTag);
|
||||||
if (move) {
|
if (move) {
|
||||||
|
|||||||
Reference in New Issue
Block a user