@@ -8,7 +8,7 @@ import aseprite.Aseprite;
8
8
9
9
class Parser
10
10
{
11
- public static function parse (bytes : Bytes ) : Aseprite
11
+ public static function parse < Texture > (bytes : Bytes ) : Aseprite < Texture >
12
12
{
13
13
var reader = new Reader (bytes );
14
14
var header = readHeader (reader );
@@ -39,7 +39,7 @@ class Parser
39
39
return new Header (frames , width , height , colorDepth , flags , transparentColor , numberOfColors , pixelWidth , pixelHeight );
40
40
}
41
41
42
- static function readFrame (reader : Reader ) : Frame
42
+ static function readFrame < Texture > (reader : Reader ) : Frame < Texture >
43
43
{
44
44
var bytesLength : Int = reader .getDWord ();
45
45
var magicNumber : Int = reader .getWord ();
@@ -59,15 +59,16 @@ class Parser
59
59
return frame ;
60
60
}
61
61
62
- static function getChunk (frame : Frame , reader : Reader ) : Void
62
+ static function getChunk < Texture > (frame : Frame < Texture > , reader : Reader ) : Void
63
63
{
64
64
var chunkSize = reader .getDWord ();
65
65
var chunkType : ChunkType = reader .getWord ();
66
66
switch chunkType {
67
67
case CEL_CHUNK :
68
68
frame .cels .push (readCel (reader ));
69
69
70
- case CEL_EXTRA_CHUNK : assert (false , " CEL_EXTRA_CHUNK" );
70
+ case CEL_EXTRA_CHUNK :
71
+ assert (false , " CEL_EXTRA_CHUNK" );
71
72
72
73
case COLOR_PROFILE_CHUNK :
73
74
assert (frame .colorProfile == null , " frame profile is already set" );
@@ -80,21 +81,27 @@ class Parser
80
81
case LAYER_CHUNK :
81
82
frame .layers .push (readLayer (reader ));
82
83
83
- case OLD_PALETTE_CHUNK_A : readOldPaletteA (reader );
84
+ case OLD_PALETTE_CHUNK_A :
85
+ readOldPaletteA (reader );
84
86
85
- case OLD_PALETTE_CHUNK_B : assert (false , " OLD_PALETTE_CHUNK_B" );
87
+ case OLD_PALETTE_CHUNK_B :
88
+ assert (false , " OLD_PALETTE_CHUNK_B" );
86
89
87
90
case PALETTE_CHUNK :
88
91
assert (frame .palette == null , " frame palette is already set" );
89
92
frame .palette = readPalette (reader );
90
93
91
- case PATH_CHUNK : assert (false , " PATH_CHUNK" );
94
+ case PATH_CHUNK :
95
+ assert (false , " PATH_CHUNK" );
92
96
93
- case SLICE_CHUNK : assert (false , " SLICE_CHUNK" );
97
+ case SLICE_CHUNK :
98
+ assert (false , " SLICE_CHUNK" );
94
99
95
- case USER_DATA_CHUNK : assert (false , " USER_DATA_CHUNK" );
100
+ case USER_DATA_CHUNK :
101
+ assert (false , " USER_DATA_CHUNK" );
96
102
97
- case _ : assert (false , " CHUNK NOT FOUND: " + chunkType );
103
+ case _ :
104
+ assert (false , " CHUNK NOT FOUND: " + chunkType );
98
105
}
99
106
}
100
107
@@ -164,7 +171,7 @@ class Parser
164
171
return {flags :flags , type :type , childLevel :childLevel , blendMode :blendMode , opacity :opacity , name :name };
165
172
}
166
173
167
- static function readCel (reader : Reader ) : Cel
174
+ static function readCel < Texture > (reader : Reader ) : Cel < Texture >
168
175
{
169
176
var layerIndex : Int = reader .getWord ();
170
177
var x : Int = reader .getShort ();
0 commit comments