2022-01-13 05:24:03 +01:00
|
|
|
// Generated at 2020-10-11 11:48:54 (313ms) for vnull+
|
|
|
|
#region metatype
|
|
|
|
globalvar gif_std_haxe_type_markerValue; gif_std_haxe_type_markerValue = [];
|
|
|
|
globalvar mt_Gif; mt_Gif = new gif_std_haxe_class(-1, "Gif");
|
|
|
|
globalvar mt_GifFrame; mt_GifFrame = new gif_std_haxe_class(-1, "GifFrame");
|
|
|
|
globalvar mt_GifReader; mt_GifReader = new gif_std_haxe_class(-1, "GifReader");
|
|
|
|
globalvar mt_format_gif_Block; mt_format_gif_Block = new gif_std_haxe_enum(-1, "format_gif_Block");
|
|
|
|
globalvar mt_format_gif_Extension; mt_format_gif_Extension = new gif_std_haxe_enum(-1, "format_gif_Extension");
|
|
|
|
globalvar mt_format_gif_ApplicationExtension; mt_format_gif_ApplicationExtension = new gif_std_haxe_enum(-1, "format_gif_ApplicationExtension");
|
|
|
|
globalvar mt_format_gif_Version; mt_format_gif_Version = new gif_std_haxe_enum(-1, "format_gif_Version");
|
|
|
|
globalvar mt_format_gif_DisposalMethod; mt_format_gif_DisposalMethod = new gif_std_haxe_enum(-1, "format_gif_DisposalMethod");
|
|
|
|
globalvar mt_gif_std_haxe_class; mt_gif_std_haxe_class = new gif_std_haxe_class(-1, "gif_std_haxe_class");
|
|
|
|
globalvar mt_gif_std_haxe_enum; mt_gif_std_haxe_enum = new gif_std_haxe_class(-1, "gif_std_haxe_enum");
|
|
|
|
globalvar mt_gif_std_haxe_io_Bytes; mt_gif_std_haxe_io_Bytes = new gif_std_haxe_class(-1, "gif_std_haxe_io_Bytes");
|
|
|
|
globalvar mt_haxe_io_Input; mt_haxe_io_Input = new gif_std_haxe_class(-1, "haxe_io_Input");
|
|
|
|
globalvar mt_haxe_io_BytesInput; mt_haxe_io_BytesInput = new gif_std_haxe_class(-1, "haxe_io_BytesInput");
|
|
|
|
mt_haxe_io_BytesInput.superClass = mt_haxe_io_Input;
|
|
|
|
globalvar mt_haxe_io_Output; mt_haxe_io_Output = new gif_std_haxe_class(-1, "haxe_io_Output");
|
|
|
|
globalvar mt_haxe_io_BytesOutput; mt_haxe_io_BytesOutput = new gif_std_haxe_class(-1, "haxe_io_BytesOutput");
|
|
|
|
mt_haxe_io_BytesOutput.superClass = mt_haxe_io_Output;
|
|
|
|
#endregion
|
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
function gif_std_enum_toString() { return gif_std_Std_stringify(self); }
|
|
|
|
function gif_std_enum_getIndex() { return __enumIndex__; }
|
2022-01-13 05:24:03 +01:00
|
|
|
|
|
|
|
#region Gif
|
2023-11-18 03:47:11 +01:00
|
|
|
function Gif() constructor { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
static frames = undefined;
|
2023-11-18 03:47:11 +01:00
|
|
|
static width = undefined;
|
2022-01-13 05:24:03 +01:00
|
|
|
static height = undefined;
|
2023-11-18 03:47:11 +01:00
|
|
|
static loops = undefined;
|
|
|
|
static destroy = function() { #region
|
|
|
|
var __g = 0;
|
2022-01-13 05:24:03 +01:00
|
|
|
var __g1 = self.frames;
|
2023-11-18 03:47:11 +01:00
|
|
|
var len = array_length(__g1);
|
2022-01-13 05:24:03 +01:00
|
|
|
|
|
|
|
while (__g < len) {
|
|
|
|
var _frame = __g1[__g];
|
|
|
|
__g++;
|
|
|
|
_frame.destroy();
|
|
|
|
}
|
2023-11-18 03:47:11 +01:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
|
|
|
reader_data = undefined;
|
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
static readBegin = function(_gif_buffer) { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
var _n = buffer_get_size(_gif_buffer);
|
|
|
|
var _bytes = new gif_std_haxe_io_Bytes(array_create(_n, 0));
|
2023-11-18 03:47:11 +01:00
|
|
|
|
|
|
|
for (var _i = 0; _i < _n; _i++) {
|
2022-01-13 05:24:03 +01:00
|
|
|
var _v = buffer_peek(_gif_buffer, _i, buffer_u8);
|
|
|
|
_bytes.b[@_i] = (_v & 255);
|
|
|
|
}
|
2023-11-18 03:47:11 +01:00
|
|
|
|
|
|
|
var _input = new haxe_io_BytesInput(_bytes, 0, _n);
|
2022-01-13 05:24:03 +01:00
|
|
|
reader_data = new GifReader(_input);
|
|
|
|
reader_data.readBegin();
|
2023-11-18 03:47:11 +01:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
static reading = function() { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
var res = reader_data.reading(self);
|
|
|
|
if(res) readComplete();
|
|
|
|
return res;
|
2023-11-18 03:47:11 +01:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
static readComplete = function() { #region
|
|
|
|
width = reader_data.logicalScreenDescriptor.width;
|
2022-01-13 05:24:03 +01:00
|
|
|
height = reader_data.logicalScreenDescriptor.height;
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
var _gce = undefined;
|
|
|
|
var _globalColorTable = undefined;
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
if (reader_data.globalColorTable != undefined)
|
|
|
|
_globalColorTable = _Gif_GifTools_colorTableToVector(reader_data.globalColorTable, reader_data.logicalScreenDescriptor.globalColorTableSize);
|
2023-11-18 03:47:11 +01:00
|
|
|
|
|
|
|
var __g = 0;
|
2022-01-13 05:24:03 +01:00
|
|
|
var __g1 = reader_data.blocks;
|
2023-11-18 03:47:11 +01:00
|
|
|
var __break = false;
|
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
while (__g < array_length(__g1)) {
|
|
|
|
var _block = __g1[__g];
|
|
|
|
__g++;
|
2023-11-18 03:47:11 +01:00
|
|
|
|
|
|
|
switch (_block.__enumIndex__) { // format_gif_Block
|
|
|
|
case 0 : // BFrame
|
|
|
|
var _f = _block.frame;
|
2022-01-13 05:24:03 +01:00
|
|
|
var _gf = new GifFrame();
|
|
|
|
var _transparentIndex = -1;
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
if (_gce != undefined) {
|
|
|
|
_gf.delay = _gce.delay;
|
|
|
|
if (_gce.hasTransparentColor) _transparentIndex = _gce.transparentIndex;
|
2023-11-18 03:47:11 +01:00
|
|
|
switch (_gce.disposalMethod.__enumIndex__) { // format_gif_DisposalMethod
|
2022-01-13 05:24:03 +01:00
|
|
|
case 2/* FILL_BACKGROUND */: _gf.disposalMethod = 1; break;
|
|
|
|
case 3/* RENDER_PREVIOUS */: _gf.disposalMethod = 2; break;
|
|
|
|
}
|
|
|
|
}
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
_gf.x = _f.x;
|
|
|
|
_gf.y = _f.y;
|
2023-11-18 03:47:11 +01:00
|
|
|
_gf.width = _f.width;
|
2022-01-13 05:24:03 +01:00
|
|
|
_gf.height = _f.height;
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
var _colorTable = _globalColorTable;
|
|
|
|
if (_f.colorTable != undefined) _colorTable = _Gif_GifTools_colorTableToVector(_f.colorTable, _f.localColorTableSize);
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
var _buf = buffer_create(_f.width * _f.height * 4, buffer_fixed, 1);
|
|
|
|
var _i = 0;
|
|
|
|
for (var __g3 = array_length(_f.pixels.b); _i < __g3; _i++) {
|
|
|
|
var _col = _f.pixels.b[_i];
|
|
|
|
if (_col == _transparentIndex) buffer_write(_buf, buffer_s32, 0); else buffer_write(_buf, buffer_s32, _colorTable[_col]);
|
|
|
|
}
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
_gf.buffer = _buf;
|
2022-11-03 11:44:49 +01:00
|
|
|
var _sf = surface_create_valid(_f.width, _f.height);
|
2023-11-18 03:47:11 +01:00
|
|
|
buffer_set_surface(_buf, _sf, 0);
|
2022-01-13 05:24:03 +01:00
|
|
|
_gf.surface = _sf;
|
|
|
|
_gce = undefined;
|
2023-11-18 03:47:11 +01:00
|
|
|
|
|
|
|
array_push(self.frames, _gf);
|
2022-01-13 05:24:03 +01:00
|
|
|
break;
|
2023-11-18 03:47:11 +01:00
|
|
|
|
|
|
|
case 1 : // BExtension
|
2022-01-13 05:24:03 +01:00
|
|
|
var __g4 = _block.extension;
|
2023-11-18 03:47:11 +01:00
|
|
|
|
|
|
|
switch (__g4.__enumIndex__) { // format_gif_Extension
|
|
|
|
case 3 : // EApplicationExtension
|
2022-01-13 05:24:03 +01:00
|
|
|
var __g5 = __g4.ext;
|
2023-11-18 03:47:11 +01:00
|
|
|
if (__g5.__enumIndex__ /* format_gif_ApplicationExtension */ == 0 /* AENetscapeLooping */) {
|
2022-01-13 05:24:03 +01:00
|
|
|
var _n = __g5.loops;
|
|
|
|
self.loops = _n;
|
|
|
|
}
|
|
|
|
break;
|
2023-11-18 03:47:11 +01:00
|
|
|
case 0 : // EGraphicControl
|
|
|
|
_gce = __g4.gce;
|
|
|
|
break;
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
|
|
|
break;
|
2023-11-18 03:47:11 +01:00
|
|
|
case 2 : // BEOF
|
|
|
|
__break = true;
|
|
|
|
break;
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
|
|
|
if (__break) break;
|
|
|
|
}
|
2023-11-18 03:47:11 +01:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
|
|
|
self.loops = -1;
|
|
|
|
self.height = 0;
|
|
|
|
self.width = 0;
|
|
|
|
self.frames = [];
|
|
|
|
static __class__ = mt_Gif;
|
2023-11-18 03:47:11 +01:00
|
|
|
} #endregion
|
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
mt_Gif.i_constructor = Gif;
|
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
function sprite_add_gif(_path, _return_func, _error_message = "") { #region
|
2022-09-21 06:09:40 +02:00
|
|
|
if (false) throw _error_message;
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2022-09-21 06:09:40 +02:00
|
|
|
var _buf = buffer_load(_path);
|
2022-01-13 05:24:03 +01:00
|
|
|
var _gif = new Gif();
|
|
|
|
_gif.readBegin(_buf);
|
|
|
|
ds_list_add(GIF_READER, [_gif, _buf, _return_func] );
|
2023-11-18 03:47:11 +01:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
function __gif_sprite_builder(_gif) constructor { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
gif = _gif;
|
2022-11-03 11:44:49 +01:00
|
|
|
_sf = surface_create_valid(gif.width, gif.height);
|
2023-11-18 03:47:11 +01:00
|
|
|
//show_debug_message($"gif creation: {gif.width}, {gif.height}");
|
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
_restoreBuf = -1;
|
2023-11-18 03:47:11 +01:00
|
|
|
_spr = -1;
|
|
|
|
spr_size = 0;
|
|
|
|
_white32 = Gif_white32;
|
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
if (_white32 == -1) {
|
2022-11-03 11:44:49 +01:00
|
|
|
var _ws = surface_create_valid(32, 32);
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
surface_set_target(_ws);
|
2023-11-18 03:47:11 +01:00
|
|
|
draw_clear(c_white);
|
2022-01-13 05:24:03 +01:00
|
|
|
surface_reset_target();
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2023-09-08 21:37:36 +02:00
|
|
|
_white32 = sprite_create_from_surface(_ws, 0, 0, surface_get_width_safe(_ws), surface_get_height_safe(_ws), false, false, 0, 0);
|
2022-01-13 05:24:03 +01:00
|
|
|
surface_free(_ws);
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
Gif_white32 = _white32;
|
|
|
|
}
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
__color = draw_get_color();
|
|
|
|
__alpha = draw_get_alpha();
|
2023-11-18 03:47:11 +01:00
|
|
|
draw_set_color(c_white);
|
2022-01-13 05:24:03 +01:00
|
|
|
draw_set_alpha(1);
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
_firstDelay = 0;
|
2023-11-18 03:47:11 +01:00
|
|
|
__g = 0;
|
2022-01-13 05:24:03 +01:00
|
|
|
__g1 = gif.frames;
|
2023-11-18 03:47:11 +01:00
|
|
|
amo = array_length(__g1);
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
static building = function() { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
var _frame = __g1[__g++];
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
if (_frame.disposalMethod == 2) {
|
|
|
|
if (_restoreBuf == -1) _restoreBuf = buffer_create(gif.width * gif.height * 4, buffer_fixed, 1);
|
2023-11-18 03:47:11 +01:00
|
|
|
buffer_get_surface(_restoreBuf, _sf, 0);
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
|
|
|
surface_copy(_sf, _frame.x, _frame.y, _frame.surface);
|
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
var _sw = surface_get_width_safe(_sf);
|
|
|
|
var _sh = surface_get_height_safe(_sf);
|
|
|
|
if (_spr == -1) _spr = sprite_create_from_surface(_sf, 0, 0, _sw, _sh, false, false, 0, 0);
|
|
|
|
else sprite_add_from_surface(_spr, _sf, 0, 0, _sw, _sh, false, false);
|
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
var _fdelay = _frame.delay;
|
|
|
|
if (_firstDelay <= 0 && _fdelay > 0) _firstDelay = _fdelay;
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
switch (_frame.disposalMethod) {
|
2023-11-18 03:47:11 +01:00
|
|
|
case 2:
|
|
|
|
buffer_set_surface(_restoreBuf, _sf, 0);
|
|
|
|
break;
|
2022-01-13 05:24:03 +01:00
|
|
|
case 1:
|
|
|
|
surface_set_target(_sf);
|
2023-11-18 03:47:11 +01:00
|
|
|
var _mode = bm_subtract;
|
|
|
|
gpu_set_blendmode(_mode);
|
|
|
|
draw_sprite_stretched(_white32, 0, _frame.x, _frame.y, _frame.width, _frame.height);
|
|
|
|
|
|
|
|
var _mode1 = bm_normal;
|
|
|
|
gpu_set_blendmode(_mode1);
|
2022-01-13 05:24:03 +01:00
|
|
|
surface_reset_target();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(__g >= amo) {
|
|
|
|
buildComplete();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
2023-11-18 03:47:11 +01:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
static buildComplete = function() { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
if (_firstDelay > 0) sprite_set_speed(_spr, 100 / _firstDelay, spritespeed_framespersecond);
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
draw_set_color(__color);
|
|
|
|
draw_set_alpha(__alpha);
|
|
|
|
if (_restoreBuf != -1) buffer_delete(_restoreBuf);
|
|
|
|
gif.destroy();
|
|
|
|
surface_free(_sf);
|
2023-11-18 03:47:11 +01:00
|
|
|
} #endregion
|
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
function __gif_create_sprite(_gif) { #region
|
2022-11-03 11:44:49 +01:00
|
|
|
var _sf = surface_create_valid(_gif.width, _gif.height);
|
2022-01-13 05:24:03 +01:00
|
|
|
//show_debug_message("gif creation: width = " + string(_gif.width));
|
|
|
|
var _restoreBuf = -1;
|
2023-11-18 03:47:11 +01:00
|
|
|
var _spr = -1;
|
|
|
|
var spr_size = 0;
|
|
|
|
var _white32 = Gif_white32;
|
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
if (_white32 == -1) {
|
2022-11-03 11:44:49 +01:00
|
|
|
var _ws = surface_create_valid(32, 32);
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
surface_set_target(_ws);
|
2023-11-18 03:47:11 +01:00
|
|
|
draw_clear(c_white);
|
2022-01-13 05:24:03 +01:00
|
|
|
surface_reset_target();
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2023-09-08 21:37:36 +02:00
|
|
|
_white32 = sprite_create_from_surface(_ws, 0, 0, surface_get_width_safe(_ws), surface_get_height_safe(_ws), false, false, 0, 0);
|
2022-01-13 05:24:03 +01:00
|
|
|
surface_free(_ws);
|
|
|
|
Gif_white32 = _white32;
|
|
|
|
}
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
var __color = draw_get_color();
|
|
|
|
var __alpha = draw_get_alpha();
|
2023-11-18 03:47:11 +01:00
|
|
|
draw_set_color(c_white);
|
2022-01-13 05:24:03 +01:00
|
|
|
draw_set_alpha(1);
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
var _firstDelay = 0;
|
|
|
|
var __g1 = _gif.frames;
|
2023-11-18 03:47:11 +01:00
|
|
|
var amo = array_length(__g1);
|
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
for( var __g = 0; __g < amo; __g++ ) {
|
|
|
|
var _frame = __g1[__g];
|
|
|
|
if (_frame.disposalMethod == 2) {
|
|
|
|
if (_restoreBuf == -1) _restoreBuf = buffer_create(_gif.width * _gif.height * 4, buffer_fixed, 1);
|
2023-11-18 03:47:11 +01:00
|
|
|
buffer_get_surface(_restoreBuf, _sf, 0);
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
|
|
|
surface_copy(_sf, _frame.x, _frame.y, _frame.surface);
|
|
|
|
|
|
|
|
if (_spr == -1) {
|
2023-09-08 21:37:36 +02:00
|
|
|
_spr = sprite_create_from_surface(_sf, 0, 0, surface_get_width_safe(_sf), surface_get_height_safe(_sf), false, false, 0, 0);
|
2022-01-13 05:24:03 +01:00
|
|
|
} else {
|
2023-11-18 03:47:11 +01:00
|
|
|
//show_debug_message(sprite_get_width(_spr) * sprite_get_height(_spr) * sprite_get_number(_spr));
|
2023-09-08 21:37:36 +02:00
|
|
|
sprite_add_from_surface(_spr, _sf, 0, 0, surface_get_width_safe(_sf), surface_get_height_safe(_sf), false, false);
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
var _fdelay = _frame.delay;
|
|
|
|
if (_firstDelay <= 0 && _fdelay > 0) _firstDelay = _fdelay;
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
switch (_frame.disposalMethod) {
|
2023-11-18 03:47:11 +01:00
|
|
|
case 2:
|
|
|
|
buffer_set_surface(_restoreBuf, _sf, 0);
|
|
|
|
break;
|
2022-01-13 05:24:03 +01:00
|
|
|
case 1:
|
|
|
|
surface_set_target(_sf);
|
2023-11-18 03:47:11 +01:00
|
|
|
var _mode = bm_subtract;
|
|
|
|
gpu_set_blendmode(_mode);
|
|
|
|
draw_sprite_stretched(_white32, 0, _frame.x, _frame.y, _frame.width, _frame.height);
|
|
|
|
|
|
|
|
var _mode1 = bm_normal;
|
|
|
|
gpu_set_blendmode(_mode1);
|
2022-01-13 05:24:03 +01:00
|
|
|
surface_reset_target();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
if (_firstDelay > 0) sprite_set_speed(_spr, 100 / _firstDelay, spritespeed_framespersecond);
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
draw_set_color(__color);
|
|
|
|
draw_set_alpha(__alpha);
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
if (_restoreBuf != -1) buffer_delete(_restoreBuf);
|
|
|
|
_gif.destroy();
|
|
|
|
surface_free(_sf);
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
return _spr;
|
2023-11-18 03:47:11 +01:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
function GifFrame() constructor { #region
|
|
|
|
static delay = undefined;
|
2022-01-13 05:24:03 +01:00
|
|
|
static surface = undefined;
|
2023-11-18 03:47:11 +01:00
|
|
|
static buffer = undefined;
|
|
|
|
/* static */x = undefined;
|
|
|
|
/* static */y = undefined;
|
|
|
|
static width = undefined;
|
|
|
|
static height = undefined;
|
2022-01-13 05:24:03 +01:00
|
|
|
static disposalMethod = undefined;
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
static destroy = function() {
|
2023-11-18 03:47:11 +01:00
|
|
|
if (surface_exists(self.surface))
|
2022-01-13 05:24:03 +01:00
|
|
|
surface_free(self.surface);
|
|
|
|
buffer_delete(self.buffer);
|
|
|
|
}
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
self.disposalMethod = 0;
|
|
|
|
self.delay = 0;
|
|
|
|
static __class__ = mt_GifFrame;
|
2023-11-18 03:47:11 +01:00
|
|
|
} mt_GifFrame.i_constructor = GifFrame; #endregion
|
|
|
|
|
|
|
|
function _Gif_GifTools_colorTableToVector(_pal, _num) { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
var _r, _g, _b;
|
2023-11-18 03:47:11 +01:00
|
|
|
var _p = 0;
|
|
|
|
var _a = 255;
|
|
|
|
var _vec = array_create(_num, undefined);
|
|
|
|
|
|
|
|
for (var _i = 0; _i < _num; _i++) {
|
2022-01-13 05:24:03 +01:00
|
|
|
_r = _pal.b[_p];
|
|
|
|
_g = _pal.b[_p + 1];
|
|
|
|
_b = _pal.b[_p + 2];
|
|
|
|
var _val = ((((_a << 24) | (_b << 16)) | (_g << 8)) | _r);
|
2023-11-18 03:47:11 +01:00
|
|
|
_vec[@ _i] = _val;
|
2022-01-13 05:24:03 +01:00
|
|
|
_p += 3;
|
|
|
|
}
|
|
|
|
return _vec;
|
2023-11-18 03:47:11 +01:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region GifReader
|
|
|
|
function GifReader(_i) constructor {
|
|
|
|
static i = undefined;
|
|
|
|
block_index = 0;
|
|
|
|
blocks = [];
|
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
static readBegin = function() { #region
|
2023-12-09 10:49:02 +01:00
|
|
|
if (self.i.readByte() != 71) throw string("Gif loader: Invalid header");
|
|
|
|
if (self.i.readByte() != 73) throw string("Gif loader: Invalid header");
|
|
|
|
if (self.i.readByte() != 70) throw string("Gif loader: Invalid header");
|
2023-11-18 03:47:11 +01:00
|
|
|
|
|
|
|
var _gifVer = self.i.readString(3);
|
2022-01-13 05:24:03 +01:00
|
|
|
var _version = format_gif_Version_GIF89a;
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
switch (_gifVer) {
|
|
|
|
case "87a": _version = format_gif_Version_GIF87a; break;
|
|
|
|
case "89a": _version = format_gif_Version_GIF89a; break;
|
|
|
|
default: _version = format_gif_Version_Unknown(_gifVer);
|
|
|
|
}
|
2023-11-18 03:47:11 +01:00
|
|
|
|
|
|
|
var _width = self.i.readUInt16();
|
2022-01-13 05:24:03 +01:00
|
|
|
var _height = self.i.readUInt16();
|
|
|
|
var _packedField = self.i.readByte();
|
2023-11-18 03:47:11 +01:00
|
|
|
var _bgIndex = self.i.readByte();
|
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
var _pixelAspectRatio = self.i.readByte();
|
2023-11-18 03:47:11 +01:00
|
|
|
if (_pixelAspectRatio != 0) _pixelAspectRatio = (_pixelAspectRatio + 15) / 64;
|
|
|
|
else _pixelAspectRatio = 1;
|
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
var _lsd = {
|
2023-11-18 03:47:11 +01:00
|
|
|
width: _width,
|
2022-01-13 05:24:03 +01:00
|
|
|
height: _height,
|
|
|
|
hasGlobalColorTable: (_packedField & 128) == 128,
|
|
|
|
colorResolution: ((((_packedField & 112) & $FFFFFFFF) >> 4)),
|
|
|
|
sorted: (_packedField & 8) == 8,
|
|
|
|
globalColorTableSize: (2 << (_packedField & 7)),
|
|
|
|
backgroundColorIndex: _bgIndex,
|
|
|
|
pixelAspectRatio: _pixelAspectRatio
|
|
|
|
}
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
var _gct = undefined;
|
|
|
|
if (_lsd.hasGlobalColorTable) _gct = self.readColorTable(_lsd.globalColorTableSize);
|
|
|
|
|
|
|
|
version = _version;
|
|
|
|
logicalScreenDescriptor = _lsd;
|
|
|
|
globalColorTable = _gct;
|
2023-11-18 03:47:11 +01:00
|
|
|
} #endregion
|
|
|
|
|
|
|
|
static reading = function(_gif) { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
var _b = self.readBlock();
|
|
|
|
blocks[@ block_index++] = _b;
|
|
|
|
if (_b == format_gif_Block_BEOF)
|
|
|
|
return true;
|
|
|
|
return false;
|
2023-11-18 03:47:11 +01:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
static readBlock = function() { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
var _blockID = self.i.readByte();
|
|
|
|
switch (_blockID) {
|
|
|
|
case 44: return self.readImage();
|
|
|
|
case 33: return self.readExtension();
|
|
|
|
case 59: return format_gif_Block_BEOF;
|
|
|
|
}
|
|
|
|
return format_gif_Block_BEOF;
|
2023-11-18 03:47:11 +01:00
|
|
|
} #endregion
|
|
|
|
|
|
|
|
static readImage = function() { #region
|
|
|
|
var _x = self.i.readUInt16();
|
|
|
|
var _y = self.i.readUInt16();
|
|
|
|
var _width = self.i.readUInt16();
|
2022-01-13 05:24:03 +01:00
|
|
|
var _height = self.i.readUInt16();
|
|
|
|
var _packed = self.i.readByte();
|
2023-11-18 03:47:11 +01:00
|
|
|
|
|
|
|
var _sorted = (_packed & 32) == 32;
|
|
|
|
var _interlaced = (_packed & 64) == 64;
|
2022-01-13 05:24:03 +01:00
|
|
|
var _localColorTable = (_packed & 128) == 128;
|
|
|
|
var _localColorTableSize = (2 << (_packed & 7));
|
2023-11-18 03:47:11 +01:00
|
|
|
var _lct = _localColorTable? self.readColorTable(_localColorTableSize) : undefined;
|
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
return format_gif_Block_BFrame({
|
|
|
|
x: _x,
|
|
|
|
y: _y,
|
|
|
|
width: _width,
|
|
|
|
height: _height,
|
|
|
|
localColorTable: _localColorTable,
|
|
|
|
interlaced: _interlaced,
|
|
|
|
sorted: _sorted,
|
|
|
|
localColorTableSize: _localColorTableSize,
|
|
|
|
pixels: self.readPixels(_width, _height, _interlaced),
|
|
|
|
colorTable: _lct
|
|
|
|
});
|
2023-11-18 03:47:11 +01:00
|
|
|
} #endregion
|
|
|
|
|
|
|
|
static readPixels = function(_width, _height, _interlaced) { #region
|
|
|
|
var _input = self.i;
|
|
|
|
var _pixelsCount = _width * _height;
|
|
|
|
var _pixels = new gif_std_haxe_io_Bytes(array_create(_pixelsCount, 0));
|
|
|
|
var _minCodeSize = _input.readByte();
|
|
|
|
var _blockSize = _input.readByte() - 1;
|
|
|
|
var _bits = _input.readByte();
|
|
|
|
var _bitsCount = 8;
|
|
|
|
var _clearCode = (1 << _minCodeSize);
|
|
|
|
var _eoiCode = _clearCode + 1;
|
|
|
|
var _codeSize = _minCodeSize + 1;
|
2022-01-13 05:24:03 +01:00
|
|
|
var _codeSizeLimit = (1 << _codeSize);
|
2023-11-18 03:47:11 +01:00
|
|
|
var _codeMask = _codeSizeLimit - 1;
|
|
|
|
var _baseDict = [];
|
|
|
|
|
|
|
|
for (var _i = 0; _i < _clearCode; _i++)
|
2022-01-13 05:24:03 +01:00
|
|
|
_baseDict[@_i] = [_i];
|
2023-11-18 03:47:11 +01:00
|
|
|
|
|
|
|
var _dict = [];
|
2022-01-13 05:24:03 +01:00
|
|
|
var _dictLen = _clearCode + 2;
|
2023-11-18 03:47:11 +01:00
|
|
|
var _code = 0;
|
|
|
|
var _i = 0;
|
2022-01-13 05:24:03 +01:00
|
|
|
var _newRecord;
|
|
|
|
var _last;
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
while (_i < _pixelsCount) {
|
|
|
|
_last = _code;
|
|
|
|
while (_bitsCount < _codeSize) {
|
|
|
|
if (_blockSize == 0) break;
|
|
|
|
_bits |= (_input.readByte() << _bitsCount);
|
|
|
|
_bitsCount += 8;
|
|
|
|
_blockSize--;
|
2023-11-18 03:47:11 +01:00
|
|
|
if (_blockSize == 0)
|
|
|
|
_blockSize = _input.readByte();
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
_code = (_bits & _codeMask);
|
|
|
|
_bits = _bits >> _codeSize;
|
|
|
|
_bitsCount -= _codeSize;
|
|
|
|
if (_code == _clearCode) {
|
2023-11-18 03:47:11 +01:00
|
|
|
_dict = gif_std_gml_internal_ArrayImpl_copy(_baseDict);
|
|
|
|
_dictLen = _clearCode + 2;
|
2022-01-13 05:24:03 +01:00
|
|
|
_codeSize = _minCodeSize + 1;
|
|
|
|
_codeSizeLimit = (1 << _codeSize);
|
|
|
|
_codeMask = _codeSizeLimit - 1;
|
|
|
|
continue;
|
|
|
|
}
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
if (_code == _eoiCode) break;
|
|
|
|
if (_code < _dictLen) {
|
|
|
|
if (_last != _clearCode) {
|
|
|
|
_newRecord = gif_std_gml_internal_ArrayImpl_copy(_dict[_last]);
|
2023-11-18 03:47:11 +01:00
|
|
|
array_push(_newRecord, _dict[_code][0]);
|
2022-01-13 05:24:03 +01:00
|
|
|
_dict[@_dictLen++] = _newRecord;
|
|
|
|
}
|
|
|
|
} else {
|
2023-11-18 03:47:11 +01:00
|
|
|
if (_code != _dictLen) throw string($"Invalid LZW code. Excepted: {_dictLen}, got: {_code}");
|
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
_newRecord = gif_std_gml_internal_ArrayImpl_copy(_dict[_last]);
|
2023-11-18 03:47:11 +01:00
|
|
|
array_push(_newRecord, _newRecord[0]);
|
2022-01-13 05:24:03 +01:00
|
|
|
_dict[@_dictLen++] = _newRecord;
|
|
|
|
}
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
_newRecord = _dict[_code];
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
var __g = 0;
|
|
|
|
while (__g < array_length(_newRecord)) {
|
|
|
|
var _item = _newRecord[__g];
|
|
|
|
__g++;
|
2023-11-18 03:47:11 +01:00
|
|
|
_pixels.b[@ _i++] = (_item & 255);
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
if (_dictLen == _codeSizeLimit && _codeSize < 12) {
|
|
|
|
_codeSize++;
|
|
|
|
_codeSizeLimit = (1 << _codeSize);
|
2023-11-18 03:47:11 +01:00
|
|
|
_codeMask = _codeSizeLimit - 1;
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
|
|
|
}
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
while (_blockSize > 0) {
|
|
|
|
_input.readByte();
|
|
|
|
_blockSize--;
|
2023-11-18 03:47:11 +01:00
|
|
|
if (_blockSize == 0)
|
|
|
|
_blockSize = _input.readByte();
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
while (_i < _pixelsCount) {
|
|
|
|
_pixels.b[@_i++] = 0;
|
|
|
|
}
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
if (_interlaced) {
|
|
|
|
var _buffer1 = new gif_std_haxe_io_Bytes(array_create(_pixelsCount, 0));
|
2023-11-18 03:47:11 +01:00
|
|
|
var _offset = self.deinterlace(_pixels, _buffer1, 8, 0, 0, _width, _height);
|
2022-01-13 05:24:03 +01:00
|
|
|
_offset = self.deinterlace(_pixels, _buffer1, 8, 4, _offset, _width, _height);
|
|
|
|
_offset = self.deinterlace(_pixels, _buffer1, 4, 2, _offset, _width, _height);
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
self.deinterlace(_pixels, _buffer1, 2, 1, _offset, _width, _height);
|
|
|
|
_pixels = _buffer1;
|
|
|
|
}
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
return _pixels;
|
2023-11-18 03:47:11 +01:00
|
|
|
} #endregion
|
|
|
|
|
|
|
|
static deinterlace = function(_input, _output, _step, _y, _offset, _width, _height) { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
while (_y < _height) {
|
|
|
|
array_copy(_output.b, _y * _width, _input.b, _offset, _width);
|
|
|
|
_offset += _width;
|
2023-11-18 03:47:11 +01:00
|
|
|
_y += _step;
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
|
|
|
return _offset;
|
2023-11-18 03:47:11 +01:00
|
|
|
} #endregion
|
|
|
|
|
|
|
|
static readExtension = function() { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
var _subId = self.i.readByte();
|
|
|
|
switch (_subId) {
|
|
|
|
case 249:
|
|
|
|
if (self.i.readByte() != 4) throw string("Incorrect Graphic Control Extension block size!");
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
var _packed = self.i.readByte();
|
|
|
|
var _disposalMethod;
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
switch ((_packed & 28) >> 2) {
|
2023-11-18 03:47:11 +01:00
|
|
|
case 2: _disposalMethod = format_gif_DisposalMethod_FILL_BACKGROUND; break;
|
|
|
|
case 3: _disposalMethod = format_gif_DisposalMethod_RENDER_PREVIOUS; break;
|
|
|
|
case 1: _disposalMethod = format_gif_DisposalMethod_NO_ACTION; break;
|
|
|
|
case 0: _disposalMethod = format_gif_DisposalMethod_UNSPECIFIED; break;
|
2022-01-13 05:24:03 +01:00
|
|
|
default: _disposalMethod = format_gif_DisposalMethod_UNDEFINED(((_packed & 28) >> 2));
|
|
|
|
}
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
var _delay = self.i.readUInt16();
|
|
|
|
var _b = format_gif_Block_BExtension(format_gif_Extension_EGraphicControl({
|
|
|
|
disposalMethod: _disposalMethod,
|
|
|
|
userInput: (_packed & 2) == 2,
|
|
|
|
hasTransparentColor: (_packed & 1) == 1,
|
|
|
|
delay: _delay,
|
|
|
|
transparentIndex: self.i.readByte()
|
|
|
|
}));
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
self.i.readByte();
|
|
|
|
return _b;
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
case 1:
|
|
|
|
if (self.i.readByte() != 12) throw string("Incorrect size of Plain Text Extension introducer block.");
|
2023-11-18 03:47:11 +01:00
|
|
|
|
|
|
|
var _textGridX = self.i.readUInt16();
|
|
|
|
var _textGridY = self.i.readUInt16();
|
|
|
|
var _textGridWidth = self.i.readUInt16();
|
2022-01-13 05:24:03 +01:00
|
|
|
var _textGridHeight = self.i.readUInt16();
|
2023-11-18 03:47:11 +01:00
|
|
|
var _charCellWidth = self.i.readByte();
|
2022-01-13 05:24:03 +01:00
|
|
|
var _charCellHeight = self.i.readByte();
|
|
|
|
var _textForegroundColorIndex = self.i.readByte();
|
|
|
|
var _textBackgroundColorIndex = self.i.readByte();
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
var _buffer1 = new haxe_io_BytesOutput();
|
2023-11-18 03:47:11 +01:00
|
|
|
var _bytes = new gif_std_haxe_io_Bytes(array_create(255, 0));
|
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
for (var _len = self.i.readByte(); _len != 0; _len = self.i.readByte()) {
|
|
|
|
self.i.readBytes(_bytes, 0, _len);
|
|
|
|
_buffer1.writeBytes(_bytes, 0, _len);
|
|
|
|
}
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
_buffer1.flush();
|
|
|
|
_bytes = new gif_std_haxe_io_Bytes(_buffer1.data);
|
|
|
|
_buffer1.close();
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
return format_gif_Block_BExtension(format_gif_Extension_EText({
|
|
|
|
textGridX: _textGridX,
|
|
|
|
textGridY: _textGridY,
|
|
|
|
textGridWidth: _textGridWidth,
|
|
|
|
textGridHeight: _textGridHeight,
|
|
|
|
charCellWidth: _charCellWidth,
|
|
|
|
charCellHeight: _charCellHeight,
|
|
|
|
textForegroundColorIndex: _textForegroundColorIndex,
|
|
|
|
textBackgroundColorIndex: _textBackgroundColorIndex,
|
2023-11-18 03:47:11 +01:00
|
|
|
text: haxe_io__Bytes_BytesImpl_getString(_bytes.b, 0, array_length(_bytes.b))
|
2022-01-13 05:24:03 +01:00
|
|
|
}));
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
case 254:
|
|
|
|
var _buffer1 = new haxe_io_BytesOutput();
|
2023-11-18 03:47:11 +01:00
|
|
|
var _bytes = new gif_std_haxe_io_Bytes(array_create(255, 0));
|
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
for (var _len = self.i.readByte(); _len != 0; _len = self.i.readByte()) {
|
|
|
|
self.i.readBytes(_bytes, 0, _len);
|
|
|
|
_buffer1.writeBytes(_bytes, 0, _len);
|
|
|
|
}
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
_buffer1.flush();
|
|
|
|
_bytes = new gif_std_haxe_io_Bytes(_buffer1.data);
|
|
|
|
_buffer1.close();
|
2023-11-18 03:47:11 +01:00
|
|
|
|
|
|
|
return format_gif_Block_BExtension(format_gif_Extension_EComment(haxe_io__Bytes_BytesImpl_getString(_bytes.b, 0, array_length(_bytes.b))));
|
|
|
|
|
|
|
|
case 255:
|
|
|
|
return self.readApplicationExtension();
|
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
default:
|
|
|
|
var _buffer1 = new haxe_io_BytesOutput();
|
2023-11-18 03:47:11 +01:00
|
|
|
var _bytes = new gif_std_haxe_io_Bytes(array_create(255, 0));
|
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
for (var _len = self.i.readByte(); _len != 0; _len = self.i.readByte()) {
|
|
|
|
self.i.readBytes(_bytes, 0, _len);
|
|
|
|
_buffer1.writeBytes(_bytes, 0, _len);
|
|
|
|
}
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
_buffer1.flush();
|
|
|
|
_bytes = new gif_std_haxe_io_Bytes(_buffer1.data);
|
|
|
|
_buffer1.close();
|
|
|
|
return format_gif_Block_BExtension(format_gif_Extension_EUnknown(_subId, _bytes));
|
|
|
|
}
|
2023-11-18 03:47:11 +01:00
|
|
|
} #endregion
|
|
|
|
|
|
|
|
static readApplicationExtension = function() { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
if (self.i.readByte() != 11) throw string("Incorrect size of Application Extension introducer block.");
|
2023-11-18 03:47:11 +01:00
|
|
|
|
|
|
|
var _name = self.i.readString(8);
|
2022-01-13 05:24:03 +01:00
|
|
|
var _version = self.i.readString(3);
|
|
|
|
var _buffer1 = new haxe_io_BytesOutput();
|
2023-11-18 03:47:11 +01:00
|
|
|
var _bytes = new gif_std_haxe_io_Bytes(array_create(255, 0));
|
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
for (var _len = self.i.readByte(); _len != 0; _len = self.i.readByte()) {
|
|
|
|
self.i.readBytes(_bytes, 0, _len);
|
|
|
|
_buffer1.writeBytes(_bytes, 0, _len);
|
|
|
|
}
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
_buffer1.flush();
|
|
|
|
_bytes = new gif_std_haxe_io_Bytes(_buffer1.data);
|
|
|
|
_buffer1.close();
|
2023-11-18 03:47:11 +01:00
|
|
|
|
|
|
|
if (_name == "NETSCAPE" && _version == "2.0" && _bytes.b[0] == 1)
|
|
|
|
return format_gif_Block_BExtension(format_gif_Extension_EApplicationExtension(format_gif_ApplicationExtension_AENetscapeLooping((_bytes.b[1] | (_bytes.b[2] << 8)))));
|
|
|
|
return format_gif_Block_BExtension(format_gif_Extension_EApplicationExtension(format_gif_ApplicationExtension_AEUnknown(_name, _version, _bytes)));
|
|
|
|
} #endregion
|
|
|
|
|
|
|
|
static readColorTable = function(_size) { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
_size *= 3;
|
|
|
|
var _output = new gif_std_haxe_io_Bytes(array_create(_size, 0));
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
for (var _c = 0; _c < _size; _c += 3) {
|
|
|
|
var _v = self.i.readByte();
|
|
|
|
_output.b[@_c] = (_v & 255);
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
var _v1 = self.i.readByte();
|
|
|
|
_output.b[@_c + 1] = (_v1 & 255);
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
var _v2 = self.i.readByte();
|
|
|
|
_output.b[@_c + 2] = (_v2 & 255);
|
|
|
|
}
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
return _output;
|
2023-11-18 03:47:11 +01:00
|
|
|
} #endregion
|
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
self.i = _i;
|
|
|
|
_i.bigEndian = false;
|
|
|
|
static __class__ = mt_GifReader;
|
|
|
|
}
|
|
|
|
mt_GifReader.i_constructor = GifReader;
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region gif_std.Std
|
|
|
|
function gif_std_Std_stringify(_value) {
|
|
|
|
if (_value == undefined) return "null";
|
2023-11-18 03:47:11 +01:00
|
|
|
if (is_string(_value)) return _value;
|
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
var _n, _i, _s;
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
if (is_struct(_value)) {
|
|
|
|
var _e = variable_struct_get(_value, "__enum__");
|
|
|
|
if (_e == undefined) return string(_value);
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2023-03-19 09:17:39 +01:00
|
|
|
var _ects = _e._constructor;
|
2022-01-13 05:24:03 +01:00
|
|
|
if (_ects != undefined) {
|
|
|
|
_i = _value.__enumIndex__;
|
2023-11-18 03:47:11 +01:00
|
|
|
_s = (_i >= 0 && _i < array_length(_ects))? _ects[_i] : "?";
|
2022-01-13 05:24:03 +01:00
|
|
|
} else {
|
|
|
|
_s = instanceof(_value);
|
2023-11-18 03:47:11 +01:00
|
|
|
if (string_copy(_s, 1, 3) == "mc_")
|
|
|
|
_s = string_delete(_s, 1, 3);
|
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
_n = string_length(_e.name);
|
2023-11-18 03:47:11 +01:00
|
|
|
if (string_copy(_s, 1, _n) == _e.name)
|
|
|
|
_s = string_delete(_s, 1, _n + 1);
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
_s += "(";
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
var _fields = _value.__enumParams__;
|
|
|
|
_n = array_length(_fields);
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
for (_i = -1; ++_i < _n; _s += gif_std_Std_stringify(variable_struct_get(_value, _fields[_i]))) {
|
|
|
|
if (_i > 0) _s += ", ";
|
|
|
|
}
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
return _s + ")";
|
|
|
|
}
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
if (is_real(_value)) {
|
2022-12-18 03:20:38 +01:00
|
|
|
_s = string(_value);
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
if (os_browser != -1) {
|
|
|
|
_n = string_length(_s);
|
|
|
|
_i = _n;
|
|
|
|
while (_i > 0) {
|
|
|
|
switch (string_ord_at(_s, _i)) {
|
2023-11-18 03:47:11 +01:00
|
|
|
case 48: _i--; continue;
|
2022-01-13 05:24:03 +01:00
|
|
|
case 46: _i--; break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
_n = string_byte_length(_s);
|
|
|
|
_i = _n;
|
|
|
|
while (_i > 0) {
|
|
|
|
switch (string_byte_at(_s, _i)) {
|
2023-11-18 03:47:11 +01:00
|
|
|
case 48: _i--; continue;
|
2022-01-13 05:24:03 +01:00
|
|
|
case 46: _i--; break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
return string_copy(_s, 1, _i);
|
|
|
|
}
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
return string(_value);
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
#region format.gif
|
|
|
|
function mc_format_gif_Block() constructor { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
static getIndex = method(undefined, gif_std_enum_getIndex);
|
|
|
|
static toString = method(undefined, gif_std_enum_toString);
|
|
|
|
static __enum__ = mt_format_gif_Block;
|
2023-11-18 03:47:11 +01:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
function mc_format_gif_Block_BFrame() : mc_format_gif_Block() constructor { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
static __enumParams__ = ["frame"];
|
2023-11-18 03:47:11 +01:00
|
|
|
static __enumIndex__ = 0;
|
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
function format_gif_Block_BFrame(_frame) { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
var this = new mc_format_gif_Block_BFrame();
|
|
|
|
this.frame = _frame;
|
|
|
|
return this;
|
2023-11-18 03:47:11 +01:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
function mc_format_gif_Block_BExtension() : mc_format_gif_Block() constructor { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
static __enumParams__ = ["extension"];
|
2023-11-18 03:47:11 +01:00
|
|
|
static __enumIndex__ = 1;
|
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
function format_gif_Block_BExtension(_extension) { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
var this = new mc_format_gif_Block_BExtension();
|
|
|
|
this.extension = _extension;
|
|
|
|
return this;
|
2023-11-18 03:47:11 +01:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
function mc_format_gif_Block_BEOF() : mc_format_gif_Block() constructor { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
static __enumParams__ = [];
|
2023-11-18 03:47:11 +01:00
|
|
|
static __enumIndex__ = 2;
|
|
|
|
} #endregion
|
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
globalvar format_gif_Block_BEOF; format_gif_Block_BEOF = new mc_format_gif_Block_BEOF();
|
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
function mc_format_gif_Extension() constructor { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
static getIndex = method(undefined, gif_std_enum_getIndex);
|
|
|
|
static toString = method(undefined, gif_std_enum_toString);
|
|
|
|
static __enum__ = mt_format_gif_Extension;
|
2023-11-18 03:47:11 +01:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
function mc_format_gif_Extension_EGraphicControl() : mc_format_gif_Extension() constructor { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
static __enumParams__ = ["gce"];
|
2023-11-18 03:47:11 +01:00
|
|
|
static __enumIndex__ = 0;
|
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
function format_gif_Extension_EGraphicControl(_gce) { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
var this = new mc_format_gif_Extension_EGraphicControl();
|
|
|
|
this.gce = _gce;
|
|
|
|
return this;
|
2023-11-18 03:47:11 +01:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
function mc_format_gif_Extension_EComment() : mc_format_gif_Extension() constructor { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
static __enumParams__ = ["text"];
|
2023-11-18 03:47:11 +01:00
|
|
|
static __enumIndex__ = 1;
|
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
function format_gif_Extension_EComment(_text) { #region
|
|
|
|
var this = new mc_format_gif_Extension_EComment();
|
2022-01-13 05:24:03 +01:00
|
|
|
this.text = _text;
|
|
|
|
return this;
|
2023-11-18 03:47:11 +01:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
function mc_format_gif_Extension_EText() : mc_format_gif_Extension() constructor { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
static __enumParams__ = ["pte"];
|
2023-11-18 03:47:11 +01:00
|
|
|
static __enumIndex__ = 2;
|
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
function format_gif_Extension_EText(_pte) { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
var this = new mc_format_gif_Extension_EText();
|
|
|
|
this.pte = _pte;
|
|
|
|
return this;
|
2023-11-18 03:47:11 +01:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
function mc_format_gif_Extension_EApplicationExtension() : mc_format_gif_Extension() constructor { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
static __enumParams__ = ["ext"];
|
2023-11-18 03:47:11 +01:00
|
|
|
static __enumIndex__ = 3;
|
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
function format_gif_Extension_EApplicationExtension(_ext) { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
var this = new mc_format_gif_Extension_EApplicationExtension();
|
|
|
|
this.ext = _ext;
|
|
|
|
return this;
|
2023-11-18 03:47:11 +01:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
function mc_format_gif_Extension_EUnknown() : mc_format_gif_Extension() constructor { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
static __enumParams__ = ["id", "data"];
|
2023-11-18 03:47:11 +01:00
|
|
|
static __enumIndex__ = 4;
|
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
function format_gif_Extension_EUnknown(_id, _data) { #region
|
|
|
|
var this = new mc_format_gif_Extension_EUnknown();
|
|
|
|
this.id = _id;
|
2022-01-13 05:24:03 +01:00
|
|
|
this.data = _data;
|
|
|
|
return this;
|
2023-11-18 03:47:11 +01:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
function mc_format_gif_ApplicationExtension() constructor { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
static getIndex = method(undefined, gif_std_enum_getIndex);
|
|
|
|
static toString = method(undefined, gif_std_enum_toString);
|
|
|
|
static __enum__ = mt_format_gif_ApplicationExtension;
|
2023-11-18 03:47:11 +01:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
function mc_format_gif_ApplicationExtension_AENetscapeLooping() : mc_format_gif_ApplicationExtension() constructor { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
static __enumParams__ = ["loops"];
|
2023-11-18 03:47:11 +01:00
|
|
|
static __enumIndex__ = 0;
|
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
function format_gif_ApplicationExtension_AENetscapeLooping(_loops) { #region
|
|
|
|
var this = new mc_format_gif_ApplicationExtension_AENetscapeLooping();
|
2022-01-13 05:24:03 +01:00
|
|
|
this.loops = _loops;
|
|
|
|
return this;
|
2023-11-18 03:47:11 +01:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
function mc_format_gif_ApplicationExtension_AEUnknown() : mc_format_gif_ApplicationExtension() constructor { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
static __enumParams__ = ["name", "version", "data"];
|
2023-11-18 03:47:11 +01:00
|
|
|
static __enumIndex__ = 1;
|
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
function format_gif_ApplicationExtension_AEUnknown(_name, _version, _data) { #region
|
|
|
|
var this = new mc_format_gif_ApplicationExtension_AEUnknown();
|
|
|
|
this.name = _name;
|
2022-01-13 05:24:03 +01:00
|
|
|
this.version = _version;
|
2023-11-18 03:47:11 +01:00
|
|
|
this.data = _data;
|
2022-01-13 05:24:03 +01:00
|
|
|
return this;
|
2023-11-18 03:47:11 +01:00
|
|
|
} #endregion
|
|
|
|
|
|
|
|
function mc_format_gif_Version() constructor { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
static getIndex = method(undefined, gif_std_enum_getIndex);
|
|
|
|
static toString = method(undefined, gif_std_enum_toString);
|
|
|
|
static __enum__ = mt_format_gif_Version;
|
2023-11-18 03:47:11 +01:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
function mc_format_gif_Version_GIF87a() : mc_format_gif_Version() constructor { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
static __enumParams__ = [];
|
2023-11-18 03:47:11 +01:00
|
|
|
static __enumIndex__ = 0;
|
|
|
|
} #endregion
|
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
globalvar format_gif_Version_GIF87a; format_gif_Version_GIF87a = new mc_format_gif_Version_GIF87a();
|
2023-11-18 03:47:11 +01:00
|
|
|
|
|
|
|
function mc_format_gif_Version_GIF89a() : mc_format_gif_Version() constructor { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
static __enumParams__ = [];
|
2023-11-18 03:47:11 +01:00
|
|
|
static __enumIndex__ = 1;
|
|
|
|
} #endregion
|
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
globalvar format_gif_Version_GIF89a; format_gif_Version_GIF89a = new mc_format_gif_Version_GIF89a();
|
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
function mc_format_gif_Version_Unknown() : mc_format_gif_Version() constructor { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
static __enumParams__ = ["version"];
|
2023-11-18 03:47:11 +01:00
|
|
|
static __enumIndex__ = 2;
|
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
function format_gif_Version_Unknown(_version) { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
var this = new mc_format_gif_Version_Unknown();
|
|
|
|
this.version = _version;
|
|
|
|
return this;
|
2023-11-18 03:47:11 +01:00
|
|
|
} #endregion
|
|
|
|
|
|
|
|
function mc_format_gif_DisposalMethod() constructor { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
static getIndex = method(undefined, gif_std_enum_getIndex);
|
|
|
|
static toString = method(undefined, gif_std_enum_toString);
|
|
|
|
static __enum__ = mt_format_gif_DisposalMethod;
|
2023-11-18 03:47:11 +01:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
function mc_format_gif_DisposalMethod_UNSPECIFIED() : mc_format_gif_DisposalMethod() constructor { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
static __enumParams__ = [];
|
2023-11-18 03:47:11 +01:00
|
|
|
static __enumIndex__ = 0;
|
|
|
|
} #endregion
|
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
globalvar format_gif_DisposalMethod_UNSPECIFIED; format_gif_DisposalMethod_UNSPECIFIED = new mc_format_gif_DisposalMethod_UNSPECIFIED();
|
2023-11-18 03:47:11 +01:00
|
|
|
|
|
|
|
function mc_format_gif_DisposalMethod_NO_ACTION() : mc_format_gif_DisposalMethod() constructor { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
static __enumParams__ = [];
|
2023-11-18 03:47:11 +01:00
|
|
|
static __enumIndex__ = 1;
|
|
|
|
} #endregion
|
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
globalvar format_gif_DisposalMethod_NO_ACTION; format_gif_DisposalMethod_NO_ACTION = new mc_format_gif_DisposalMethod_NO_ACTION();
|
2023-11-18 03:47:11 +01:00
|
|
|
|
|
|
|
function mc_format_gif_DisposalMethod_FILL_BACKGROUND() : mc_format_gif_DisposalMethod() constructor { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
static __enumParams__ = [];
|
2023-11-18 03:47:11 +01:00
|
|
|
static __enumIndex__ = 2;
|
|
|
|
} #endregion
|
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
globalvar format_gif_DisposalMethod_FILL_BACKGROUND; format_gif_DisposalMethod_FILL_BACKGROUND = new mc_format_gif_DisposalMethod_FILL_BACKGROUND();
|
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
function mc_format_gif_DisposalMethod_RENDER_PREVIOUS() : mc_format_gif_DisposalMethod() constructor { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
static __enumParams__ = [];
|
2023-11-18 03:47:11 +01:00
|
|
|
static __enumIndex__ = 3;
|
|
|
|
} #endregion
|
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
globalvar format_gif_DisposalMethod_RENDER_PREVIOUS; format_gif_DisposalMethod_RENDER_PREVIOUS = new mc_format_gif_DisposalMethod_RENDER_PREVIOUS();
|
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
function mc_format_gif_DisposalMethod_UNDEFINED() : mc_format_gif_DisposalMethod() constructor { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
static __enumParams__ = ["index"];
|
2023-11-18 03:47:11 +01:00
|
|
|
static __enumIndex__ = 4;
|
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
function format_gif_DisposalMethod_UNDEFINED(_index) { #region
|
|
|
|
var this = new mc_format_gif_DisposalMethod_UNDEFINED();
|
2022-01-13 05:24:03 +01:00
|
|
|
this.index = _index;
|
|
|
|
return this;
|
2023-11-18 03:47:11 +01:00
|
|
|
} #endregion
|
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
#endregion
|
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
#region gif.std
|
|
|
|
function gif_std_haxe_class(_id, _name) constructor { #region
|
|
|
|
static superClass = undefined;
|
2022-01-13 05:24:03 +01:00
|
|
|
static i_constructor = undefined;
|
2023-11-18 03:47:11 +01:00
|
|
|
static marker = undefined;
|
|
|
|
static index = undefined;
|
|
|
|
static name = undefined;
|
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
self.superClass = undefined;
|
2023-11-18 03:47:11 +01:00
|
|
|
self.marker = gif_std_haxe_type_markerValue;
|
|
|
|
self.index = _id;
|
|
|
|
self.name = _name;
|
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
static __class__ = "class";
|
2023-11-18 03:47:11 +01:00
|
|
|
} mt_gif_std_haxe_class.i_constructor = gif_std_haxe_class; #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
function gif_std_haxe_enum(_id, _name, _constructor) constructor { #region
|
2023-03-19 09:17:39 +01:00
|
|
|
static _constructor = undefined;
|
2023-11-18 03:47:11 +01:00
|
|
|
static marker = undefined;
|
|
|
|
static index = undefined;
|
|
|
|
static name = undefined;
|
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
if (false) throw argument[2];
|
2023-11-18 03:47:11 +01:00
|
|
|
|
|
|
|
self.marker = gif_std_haxe_type_markerValue;
|
|
|
|
self.index = _id;
|
|
|
|
self.name = _name;
|
2023-03-19 09:17:39 +01:00
|
|
|
self._constructor = _constructor;
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
static __class__ = "enum";
|
2023-11-18 03:47:11 +01:00
|
|
|
} mt_gif_std_haxe_enum.i_constructor = gif_std_haxe_enum; #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
function gif_std_gml_internal_ArrayImpl_copy(_arr) { #region
|
|
|
|
var _out = [];
|
2022-01-13 05:24:03 +01:00
|
|
|
var _len = array_length(_arr);
|
2023-11-18 03:47:11 +01:00
|
|
|
|
|
|
|
if (_len > 0)
|
2022-01-13 05:24:03 +01:00
|
|
|
array_copy(_out, 0, _arr, 0, _len);
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
return _out;
|
2023-11-18 03:47:11 +01:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
function gif_std_haxe_io_Bytes(_b) constructor { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
static b = undefined;
|
2023-11-18 03:47:11 +01:00
|
|
|
self.b = _b;
|
2022-01-13 05:24:03 +01:00
|
|
|
static __class__ = mt_gif_std_haxe_io_Bytes;
|
2023-11-18 03:47:11 +01:00
|
|
|
} mt_gif_std_haxe_io_Bytes.i_constructor = gif_std_haxe_io_Bytes; #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
#endregion
|
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
#region haxe.io
|
|
|
|
function haxe_io__Bytes_BytesImpl_getString(_d, _pos, _len) { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
var _b = haxe_io__Bytes_BytesImpl_buffer;
|
|
|
|
buffer_seek(_b, buffer_seek_start, 0);
|
|
|
|
while (--_len >= 0) {
|
|
|
|
buffer_write(_b, buffer_u8, _d[_pos++]);
|
|
|
|
}
|
|
|
|
buffer_write(_b, buffer_u8, 0);
|
|
|
|
buffer_seek(_b, buffer_seek_start, 0);
|
|
|
|
return buffer_read(_b, buffer_string);
|
2023-11-18 03:47:11 +01:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
function haxe_io_Input_new() { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
self.bigEndian = false;
|
|
|
|
self.dataPos = 0;
|
2023-11-18 03:47:11 +01:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
function haxe_io_Input() constructor { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
static data = undefined;
|
|
|
|
static dataPos = undefined;
|
|
|
|
static dataLen = undefined;
|
|
|
|
static bigEndian = undefined;
|
|
|
|
static readByte = method(undefined, haxe_io_Input_readByte);
|
|
|
|
static readUInt16 = method(undefined, haxe_io_Input_readUInt16);
|
|
|
|
static readBytes = method(undefined, haxe_io_Input_readBytes);
|
|
|
|
static readString = method(undefined, haxe_io_Input_readString);
|
|
|
|
method(self, haxe_io_Input_new)();
|
|
|
|
static __class__ = mt_haxe_io_Input;
|
2023-11-18 03:47:11 +01:00
|
|
|
} mt_haxe_io_Input.i_constructor = haxe_io_Input; #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
function haxe_io_Input_readByte() { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
var _d = self.data;
|
|
|
|
return _d[self.dataPos++];
|
2023-11-18 03:47:11 +01:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
function haxe_io_Input_readUInt16() { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
var _d = self.data;
|
|
|
|
var _p = self.dataPos;
|
|
|
|
var _c1 = _d[_p++];
|
|
|
|
var _c2 = _d[_p++];
|
|
|
|
self.dataPos = _p;
|
|
|
|
if (self.bigEndian) return ((_c1 << 8) | _c2); else return (_c1 | (_c2 << 8));
|
2023-11-18 03:47:11 +01:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
function haxe_io_Input_readBytes(_to, _pos, _len) { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
var _start = self.dataPos;
|
|
|
|
var _avail = self.dataLen - _start;
|
|
|
|
if (_len > _avail) _len = _avail;
|
|
|
|
array_copy(_to.b, _pos, self.data, _start, _len);
|
|
|
|
self.dataPos = _start + _len;
|
|
|
|
return _len;
|
2023-11-18 03:47:11 +01:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
function haxe_io_Input_readString(_count) { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
var _pos = self.dataPos;
|
|
|
|
var _data = self.data;
|
|
|
|
var _maxLen = self.dataLen - _pos;
|
|
|
|
if (_count > _maxLen) _count = _maxLen;
|
|
|
|
var _buf = haxe_io_Input_buffer;
|
|
|
|
buffer_seek(_buf, buffer_seek_start, 0);
|
|
|
|
repeat (_count) buffer_write(_buf, buffer_u8, _data[_pos++]);
|
|
|
|
buffer_write(_buf, buffer_u8, 0);
|
|
|
|
buffer_seek(_buf, buffer_seek_start, 0);
|
|
|
|
self.dataPos = _pos;
|
|
|
|
return buffer_read(_buf, buffer_string);
|
2023-11-18 03:47:11 +01:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
function haxe_io_BytesInput(_sourceBytes, _sourcePos, _sourceLen) constructor { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
static data = undefined;
|
|
|
|
static dataPos = undefined;
|
|
|
|
static dataLen = undefined;
|
|
|
|
static bigEndian = undefined;
|
|
|
|
static readByte = method(undefined, haxe_io_Input_readByte);
|
|
|
|
static readUInt16 = method(undefined, haxe_io_Input_readUInt16);
|
|
|
|
static readBytes = method(undefined, haxe_io_Input_readBytes);
|
|
|
|
static readString = method(undefined, haxe_io_Input_readString);
|
2023-10-01 06:17:39 +02:00
|
|
|
_sourcePos ??= 0;
|
2022-01-13 05:24:03 +01:00
|
|
|
if (false) throw argument[2];
|
|
|
|
method(self, haxe_io_Input_new)();
|
2023-11-18 03:47:11 +01:00
|
|
|
_sourceLen ??= array_length(_sourceBytes.b) - _sourcePos;
|
2022-01-13 05:24:03 +01:00
|
|
|
self.data = _sourceBytes.b;
|
|
|
|
self.dataPos = _sourcePos;
|
|
|
|
self.dataLen = _sourceLen;
|
|
|
|
static __class__ = mt_haxe_io_BytesInput;
|
2023-11-18 03:47:11 +01:00
|
|
|
} mt_haxe_io_BytesInput.i_constructor = haxe_io_BytesInput; #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
function haxe_io_Output_new() { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
self.dataLen = 32;
|
|
|
|
self.dataPos = 0;
|
|
|
|
self.data = array_create(32);
|
2023-11-18 03:47:11 +01:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
function haxe_io_Output() constructor { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
static data = undefined;
|
|
|
|
static dataPos = undefined;
|
|
|
|
static dataLen = undefined;
|
|
|
|
static flush = method(undefined, haxe_io_Output_flush);
|
|
|
|
static close = method(undefined, haxe_io_Output_close);
|
|
|
|
static writeBytes = method(undefined, haxe_io_Output_writeBytes);
|
|
|
|
method(self, haxe_io_Output_new)();
|
|
|
|
static __class__ = mt_haxe_io_Output;
|
2023-11-18 03:47:11 +01:00
|
|
|
} mt_haxe_io_Output.i_constructor = haxe_io_Output; #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
function haxe_io_Output_flush() {}
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
function haxe_io_Output_close() {}
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
function haxe_io_Output_writeBytes(_b, _pos, _len) { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
var _bd = _b.b;
|
|
|
|
var _p0 = self.dataPos;
|
|
|
|
var _p1 = _p0 + _len;
|
|
|
|
var _d = self.data;
|
|
|
|
var _dlen = self.dataLen;
|
|
|
|
if (_p1 > _dlen) {
|
|
|
|
while (true) {
|
|
|
|
_dlen *= 2;
|
|
|
|
if (!(_p1 > _dlen)) break;
|
|
|
|
}
|
|
|
|
_dlen *= 2;
|
|
|
|
_d[@_dlen - 1] = 0;
|
|
|
|
self.dataLen = _dlen;
|
|
|
|
}
|
|
|
|
array_copy(_d, _p0, _bd, _pos, _len);
|
|
|
|
self.dataPos = _p1;
|
|
|
|
return _len;
|
2023-11-18 03:47:11 +01:00
|
|
|
} #endregion
|
|
|
|
|
|
|
|
function haxe_io_BytesOutput() constructor { #region
|
|
|
|
static data = undefined;
|
|
|
|
static dataPos = undefined;
|
|
|
|
static dataLen = undefined;
|
|
|
|
static flush = method(undefined, haxe_io_Output_flush);
|
|
|
|
static close = method(undefined, haxe_io_Output_close);
|
2022-01-13 05:24:03 +01:00
|
|
|
static writeBytes = method(undefined, haxe_io_Output_writeBytes);
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
method(self, haxe_io_Output_new)();
|
2023-11-18 03:47:11 +01:00
|
|
|
|
|
|
|
static __class__ = mt_haxe_io_BytesOutput;
|
|
|
|
} mt_haxe_io_BytesOutput.i_constructor = haxe_io_BytesOutput; #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
#endregion
|
|
|
|
|
|
|
|
// Gif:
|
|
|
|
globalvar Gif_white32; Gif_white32 = -1;
|
|
|
|
// haxe.io._Bytes.BytesImpl:
|
|
|
|
globalvar haxe_io__Bytes_BytesImpl_buffer; haxe_io__Bytes_BytesImpl_buffer = buffer_create(128, buffer_grow, 1);
|
|
|
|
// haxe.io.Input:
|
|
|
|
globalvar haxe_io_Input_buffer; haxe_io_Input_buffer = buffer_create(32, buffer_grow, 1);
|
|
|
|
|