256Variable *
images_load(
Environment * _environment,
char * _filename,
char * _alias,
int _mode,
int _frame_width,
int _frame_height,
int _flags,
int _transparent_color,
int _background_color,
int _bank_expansion,
int _origin_x,
int _origin_y,
int _offset_x,
int _offset_y ) {
265 final->valueBuffer =
malloc( 3 );
278 char *lookfor = _filename;
283 if ( strcmp(lookfor, first->
fileName ) == 0 ) {
301 for(
int i=0; i<atlasDescriptor->
count; ++i ) {
302 partial =
image_converter( _environment, frame->
data, frame->
width, frame->
height, frame->
depth, 0, 0, frame->
width, frame->
height, _mode, _transparent_color, _flags );
303 if ( !firstImage && !lastImage ) {
304 firstImage = partial;
305 lastImage = firstImage;
307 lastImage->
next = partial;
308 lastImage = lastImage->
next;
310 bufferSize += partial->
size;
318 char * buffer =
malloc( bufferSize );
320 ptr[0] = atlasDescriptor->
count;
321 ptr[1] = ( _frame_width & 0xff );
322 ptr[2] = ( _frame_width >> 8 ) & 0xff;
324 if ( ( firstImage->
size * atlasDescriptor->
count ) > 0xffff ) {
332 lastImage = firstImage;
333 for(
int i=0; i<atlasDescriptor->
count; ++i ) {
335 ptr += lastImage->
size;
336 lastImage = lastImage->
next;
340 final->originalBitmap = atlasDescriptor->
image->
data;
341 final->originalWidth = atlasDescriptor->
image->
width;
342 final->originalHeight = atlasDescriptor->
image->
height;
343 final->originalDepth = atlasDescriptor->
image->
depth;
346 final->frameWidth = _frame_width;
347 final->frameHeight = _frame_height;
348 final->frameSize = firstImage->
size;
349 final->frameCount = atlasDescriptor->
count;
351 lastImage = firstImage;
352 for(
int i=0; i<atlasDescriptor->
count; ++i ) {
354 lastImage = lastImage->
next;
363 if ( !
banks_store( _environment,
final, _bank_expansion ) ) {
374 final->uncompressedSize =
final->size;
379 if ( memcmp( outputCheck, final->valueBuffer, final->uncompressedSize ) != 0 ) {
390 if ( final->uncompressedSize < final->size ) {
391 final->size =
final->uncompressedSize;
392 final->uncompressedSize = 0;
398 final->valueBuffer = output;
402 free( final->valueBuffer );
403 final->valueBuffer = NULL;
409 loaded->
next = first;
#define BITMAP_MODE_STANDARD
void const_define_numeric(Environment *_environment, char *_name, int _value)
void variable_temporary_remove(Environment *_environment, char *_name)
void offsetting_add_variable_reference(Environment *_environment, Offsetting *_first, Variable *_var, int _sequence)
Variable * variable_temporary(Environment *_environment, VariableType _type, char *_meaning)
Define a temporary variable.
Offsetting * offsetting_size_count(Environment *_environment, int _size, int _count)
Variable * variable_store_buffer(Environment *_environment, char *_destination, unsigned char *_buffer, int _size, int _at)
Variable * image_converter(Environment *_environment, char *_data, int _width, int _height, int _depth, int _offset_x, int _offset_y, int _frame_width, int _frame_height, int _mode, int _transparent_color, int _flags)
AtlasDescriptor * atlas_descriptor_create(Environment *_environment, char *_filename, int _flags, int _image_origin_x, int _image_origin_y, int _frame_width, int _frame_height, int _frame_offset_x, int _frame_offset_y)
int banks_store(Environment *_environment, Variable *_variable, int _resident)
Variable * images_load(Environment *_environment, char *_filename, char *_alias, int _mode, int _frame_width, int _frame_height, int _flags, int _transparent_color, int _background_color, int _bank_expansion, int _origin_x, int _origin_y, int _offset_x, int _offset_y)
Emit code for LOAD IMAGE(...).
MSC1Compressor * msc1_create(int _maximum_repeated_sequences)
void msc1_free(MSC1Compressor *_msc1)
MemoryBlock * msc1_uncompress(MSC1Compressor *_msc1, MemoryBlock *_input, int _size, int *_output_size)
MemoryBlock * msc1_compress(MSC1Compressor *_msc1, MemoryBlock *_input, int _size, int *_output_size)
unsigned char MemoryBlock
struct _MSC1Compressor MSC1Compressor
struct _ImageDescriptor * frames
struct _ImageDescriptor * image
int tenLinerRulesEnforced
struct _ImageDescriptor * next
struct _LoadedFile * next
unsigned char * valueBuffer
#define CRITICAL_10_LINE_RULES_ENFORCED(v)
struct _ImageDescriptor ImageDescriptor
struct _RGBi RGBi
Structure to store color components (red, green and blue).
#define UNIQUE_RESOURCE_ID
struct _Variable Variable
Structure of a single variable.
struct _Environment Environment
Structure of compilation environment.
#define CRITICAL_IMAGES_LOAD_IMAGE_TOO_BIG(v)
#define adiline3(s, a, b, c)
struct _AtlasDescriptor AtlasDescriptor
#define CRITICAL_EXPANSION_OUT_OF_MEMORY_LOADING(v)
#define CRITICAL_SANDBOX_ENFORCED(v)
struct _LoadedFile LoadedFile
#define CRITICAL_COMPRESSION_FAILED(v)