Skip to content

Commit

Permalink
- rectangle masks support
Browse files Browse the repository at this point in the history
  • Loading branch information
antonnefjodov committed Jan 24, 2020
1 parent 7d3e1db commit b0a950b
Show file tree
Hide file tree
Showing 13 changed files with 83 additions and 22 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
Flump: Changelog
================

version 1.5.6-SNAPSHOT - 2020-01-22
version 1.5.6-SNAPSHOT - 2020-01-24
--------------------------
Exporter:
- Rectangle masks support
- Color transform support added
- Layers, that contain "$" in name won't be exported

version 1.5.6 - 2018-01-31
Expand Down
Binary file modified bin/exporter/Flump.exe
Binary file not shown.
1 change: 1 addition & 0 deletions bin/exporter/META-INF/AIR/application.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<architecture>64</architecture>
<initialWindow>
<renderMode>direct</renderMode>
<depthAndStencil>true</depthAndStencil>
<content>flump-exporter.swf</content>
</initialWindow>
<icon>
Expand Down
2 changes: 1 addition & 1 deletion bin/exporter/META-INF/AIR/hash
Original file line number Diff line number Diff line change
@@ -1 +1 @@
��L�� }#�Du'�g}\�HO���9<=Z�
Di@�Mo��bSᴿ@xY�A_��'�X�"M�8
34 changes: 17 additions & 17 deletions bin/exporter/META-INF/signatures.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
<Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
<DigestValue>UNRirET1M2Kpy99zQSbMKoWPdm1yZJM68SNgRSRnVPo=</DigestValue>
<DigestValue>aIcERmxR6ee6BpY50lrZDmeLhBPx1KqN3vX7vJ+FpCg=</DigestValue>
</Reference>
</SignedInfo>
<SignatureValue Id="PackageSignatureValue">f0XkceOlF0hjTRv2hOBvINU6FFk9PbV4KzTxp8XNSHuxkAgcSRIjST2nSd4y28LxaYLWE3weW8+c
ZbYoocKV6szY8x4kiFXYaHDrp8iNOCwhKXW7Rbkf/upel6YxUKAvVvuaE66zrxkZLKhPFerzcVv3
3NQ7KTxE70nUol5M5E7N92vUYsMUtTo7fHQvt/SjWJINtyjit3B5fFvgPh3rYz23T3plrsyHudbz
kKJiS1Irw1tBnKMhQoIJAJTu3/8xWOmm4BpZfJU1HcdnLnVOGvkz/yVRP9xd8c3UN7pqn7gpZ+L/
CdfHQ3GS6Mv4J3AqkraeJxKBEw4oDI/41PfQ7Q==</SignatureValue>
<SignatureValue Id="PackageSignatureValue">d5XEsIL/Cb81xUMT772H0V8nwKHI1kiUIbxB7zHdCauu/jQxYljatjO4fPZ+yGGvIKInEcVhbTgX
Zz9twnJrQXgPVVntyb5J03opllbNGWPZXE0Mmwa5vVF8x5/sYB6a/GgTzNyKd7MRNfjZPPmlOz+a
AzK3kgzwZt2pI1eQJjZElqe3cCsztWiAVceK0ZVC+QU81WW1X9cbIdk4qv/lJWdU2pLcEZIv6w6u
8tRAR0ylOxEjWvWgb5LtncLoSp2gYGkrPE2yLdBgxtCT4wj3c9dBIvyM9sjyfEHNyufkWl8Yr7sc
ga+6zo5UgO4vBZxTyiZxR2LgqHWu3ZtYv7P65Q==</SignatureValue>
<KeyInfo>
<X509Data>
<X509Certificate>MIIDBDCCAeygAwIBAgIbLTY4OTgxNWUyOjE2MTRjYTUwOThiOi04MDAwMA0GCSqGSIb3DQEBBQUA
Expand All @@ -36,7 +36,7 @@ Z/JcNgXxTYUSxaWCztjiXTdMmXYPs0M6w88jocsY6eA8rJI=</X509Certificate>
</KeyInfo>
<Object>
<Manifest Id="PackageContents">
<Reference URI="mimetype"><DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod><DigestValue>0/oCb84THKMagtI0Dy0KogEu92TegdesqRr/clXct1c=</DigestValue></Reference><Reference URI="META-INF/AIR/application.xml"><DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod><DigestValue>wXGW9vKzUuJdtNbrTRN2zF3SNHwh9RcK2lTvorhqjIU=</DigestValue></Reference><Reference URI="flump-exporter.swf"><DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod><DigestValue>mg24H2OzEGkIfdY4JLfdiXxWi3QgDbIJQF3kz2VOA7Y=</DigestValue></Reference><Reference URI="icons/icon_128.png"><DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod><DigestValue>YZHHPJZTG65mU6hb9S4736zXEdfMBiFwAwja8j6Rbo4=</DigestValue></Reference><Reference URI="icons/icon_16.png"><DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod><DigestValue>eQig8S6obnixVAoh//61364OXEiap0cmE1yTnmrqu3w=</DigestValue></Reference><Reference URI="icons/icon_32.png"><DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod><DigestValue>HACoZNxq6Bwq4o9IFpSIjDFQtsKQ6SA+rEDD/nhcCJs=</DigestValue></Reference><Reference URI="icons/icon_48.png"><DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod><DigestValue>AOYIvGEDJOY3kQbiZUUA3dsicQ21iGBprPy2aKP0cXQ=</DigestValue></Reference>
<Reference URI="mimetype"><DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod><DigestValue>0/oCb84THKMagtI0Dy0KogEu92TegdesqRr/clXct1c=</DigestValue></Reference><Reference URI="META-INF/AIR/application.xml"><DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod><DigestValue>JUY7VaF6/710+DuwesbqX+BUxv5n8tQ9gO8lmh8oBI4=</DigestValue></Reference><Reference URI="flump-exporter.swf"><DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod><DigestValue>1gyxGufGZVnzw/KQTiAyZABY3LLAvHNfLK65kX6Uxx4=</DigestValue></Reference><Reference URI="icons/icon_128.png"><DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod><DigestValue>YZHHPJZTG65mU6hb9S4736zXEdfMBiFwAwja8j6Rbo4=</DigestValue></Reference><Reference URI="icons/icon_16.png"><DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod><DigestValue>eQig8S6obnixVAoh//61364OXEiap0cmE1yTnmrqu3w=</DigestValue></Reference><Reference URI="icons/icon_32.png"><DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod><DigestValue>HACoZNxq6Bwq4o9IFpSIjDFQtsKQ6SA+rEDD/nhcCJs=</DigestValue></Reference><Reference URI="icons/icon_48.png"><DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod><DigestValue>AOYIvGEDJOY3kQbiZUUA3dsicQ21iGBprPy2aKP0cXQ=</DigestValue></Reference>
</Manifest>
</Object>
<Object xmlns:xades="http://uri.etsi.org/01903/v1.1.1#" >
Expand All @@ -50,8 +50,8 @@ Z/JcNgXxTYUSxaWCztjiXTdMmXYPs0M6w88jocsY6eA8rJI=</X509Certificate>
</Transforms>
<xades:EncapsulatedTimeStamp>
MIIOFAYJKoZIhvcNAQcCoIIOBTCCDgECAQMxDTALBglghkgBZQMEAgEwgf8GCyqGSIb3DQEJEAEE
oIHvBIHsMIHpAgEBBgtghkgBhvhFAQcXAzAhMAkGBSsOAwIaBQAEFAgDOeVZOWJHR76C7FG8QNow
2G9OAhUAy2aPQ3HM3LZolMQapkgyXbkRM+AYDzIwMjAwMTIzMTMxMDQyWjADAgEeoIGGpIGDMIGA
oIHvBIHsMIHpAgEBBgtghkgBhvhFAQcXAzAhMAkGBSsOAwIaBQAEFDAZBuPZMgbUxkjv40HS/nxO
UIpZAhUAnbMSU1rIlb4tFcvnWIvH6p/zrroYDzIwMjAwMTI0MDc1MDI0WjADAgEeoIGGpIGDMIGA
MQswCQYDVQQGEwJVUzEdMBsGA1UEChMUU3ltYW50ZWMgQ29ycG9yYXRpb24xHz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FWdEHa9s2Kk=
9w0BCRABBDAcBgkqhkiG9w0BCQUxDxcNMjAwMTI0MDc1MDI0WjAvBgkqhkiG9w0BCQQxIgQgy3Sk
9DxBxAYSYChW3z/qhqHSw7/s0mWMTMOzHL1FoNowNwYLKoZIhvcNAQkQAi8xKDAmMCQwIgQgxHTO
dgB9AjlODaXk3nwUxoD54oIBPP72U+9dtx/fYfgwCwYJKoZIhvcNAQEBBIIBAFmGeP9TMuCVkgC1
S8gQUAkxVhDpkYN0yBjTdD4LcutxnjzsPkmzRYm5RuakI32VZapAzhQ0swM0Si03JVl+fUhRfmjR
u7bkhUXNyA73iwHFjzSFF3rzT5xe618o62/O7zA4ozDH8ySuXaajGprNmbOKGNiTGNoC/KYL3iPX
Eldw6abW3mdISgnPumNuyF85olq3qfRK0z0Lsn35Vr24R+hNcurW1kj0oXdZ+pebjujlZJeNw65Z
vz8TMLbR2FWESExrwO57/O/SbPNmxj8XvFu8XPYfMZjWM24udFsG3niMjYAeQJyZn45HnLjFxklL
ryj9o0M3NbWXcgSVf7F4rDw=
</xades:EncapsulatedTimeStamp>
</xades:HashDataInfo>
</xades:SignatureTimeStamp>
Expand Down
Binary file modified bin/exporter/flump-exporter.swf
Binary file not shown.
1 change: 1 addition & 0 deletions exporter/etc/airdesc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<architecture>64</architecture>
<initialWindow>
<renderMode>direct</renderMode>
<depthAndStencil>true</depthAndStencil>
<content>flump-exporter.swf</content>
</initialWindow>
<icon>
Expand Down
8 changes: 8 additions & 0 deletions exporter/src/main/as/flump/xfl/XflLayer.as
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,24 @@ import flump.mold.LayerMold;

public class XflLayer
{
public static const PARENT_INDEX :String = "parentLayerIndex";
public static const NAME :String = "name";
public static const TYPE :String = "layerType";

public static const TYPE_GUIDE :String = "guide";
public static const TYPE_FOLDER :String = "folder";
public static const TYPE_MASK :String = "mask";

use namespace xflns;

public static function parse (lib :XflLibrary, baseLocation :String, xml :XML, flipbook :Boolean) :LayerMold {
const layer :LayerMold = new LayerMold();
var type:String = XmlUtil.getStringAttr(xml, TYPE, null);

if (type != null && type == TYPE_MASK)
{
layer.isMask = true;
}

layer.name = XmlUtil.getStringAttr(xml, NAME, null);
if (layer.name == null) {
Expand Down
15 changes: 14 additions & 1 deletion exporter/src/main/as/flump/xfl/XflMovie.as
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,26 @@ public class XflMovie extends XflSymbol
var layerName:String = XmlUtil.getStringAttr(layerEl, XflLayer.NAME, "");
if (layerName.indexOf("$") == -1)
{
movie.layers.unshift(XflLayer.parse(lib, location, layerEl, false));
var layerMold:LayerMold = XflLayer.parse(lib, location, layerEl, false);
// movie.layers.unshift(layerMold);
movie.layers.push(layerMold);

var parentLayerIndex:int = XmlUtil.getIntAttr(layerEl, XflLayer.PARENT_INDEX, -1);
if (parentLayerIndex != -1)
{
var parentLayer:LayerMold = movie.layers[parentLayerIndex];
if (parentLayer.isMask)
{
layerMold.mask = parentLayer.name;
}
}
} else
{
lib.addError(location, ParseError.INFO, layerName + " will be ignored");
}
}
}
movie.layers.reverse();
}
movie.fillLabels();

Expand Down
4 changes: 2 additions & 2 deletions haxelib.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"tags": [
],
"description": "Flump",
"version": "1.0.3",
"releasenote": "Color transform support added",
"version": "1.0.4",
"releasenote": "Rectangle masks support",
"contributors": [
"CrazyFlasher",
"tconkling"
Expand Down
16 changes: 16 additions & 0 deletions runtime/src/main/as/flump/display/Layer.as
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@ import starling.filters.ColorMatrixFilter;
* this layer on each frame.
*/
internal class Layer {
private var _maskId:String;

public function Layer(movie:Movie, src:LayerMold, library:Library, flipbook:Boolean) {
_movie = movie;

_keyframes = src.keyframes;
_maskId = src.mask;

var childMovie:Movie;
var display:DisplayObject;
Expand Down Expand Up @@ -79,6 +82,19 @@ internal class Layer {
_currentDisplay.name = _name;
}

internal function applyMask(mask:DisplayObject):void
{
for each (var display:DisplayObject in _displays)
{
display.mask = mask;
}
}

public function get maskId():String
{
return _maskId;
}

public function get numDisplays():int {
return _numDisplays;
}
Expand Down
14 changes: 14 additions & 0 deletions runtime/src/main/as/flump/display/Movie.as
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,27 @@ public class Movie extends Sprite
_numFrames = Math.max(src.layers[ii].frames, _numFrames);
}
}

createMasks();

_duration = _numFrames / _frameRate;

updateFrame(0, 0);

addEventListener(Event.REMOVED_FROM_STAGE, onRemovedFromStage);
}

private function createMasks():void
{
for each (var layer:Layer in _layers)
{
if (layer.maskId != null)
{
layer.applyMask(getChildByName(layer.maskId));
}
}
}

/** Called when our REMOVED_FROM_STAGE event is fired. */
protected function onRemovedFromStage (e :Event) :void {
// When we're removed from the stage, remove ourselves from any juggler animating us,
Expand Down
6 changes: 6 additions & 0 deletions runtime/src/main/as/flump/mold/LayerMold.as
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ package flump.mold {
public class LayerMold
{
public var name :String;
public var mask :String;
public var isMask :Boolean;
public var keyframes :Vector.<KeyframeMold> = new <KeyframeMold>[];
public var flipbook :Boolean;
public var baseScale:Number;
Expand Down Expand Up @@ -40,12 +42,16 @@ public class LayerMold
keyframes: keyframes
};
if (flipbook) json.flipbook = flipbook;
if (mask) json.mask = mask;
if (isMask) json.isMask = isMask;
return json;
}

public function toXML () :XML {
var xml :XML = <layer name={name}/>;
if (flipbook) xml.@flipbook = flipbook;
if (mask) xml.@mask = mask;
if (isMask) xml.@isMask = isMask;
for each (var kf :KeyframeMold in keyframes) xml.appendChild(kf.toXML());
return xml;
}
Expand Down

0 comments on commit b0a950b

Please sign in to comment.