value lime_audio_load (value data) { AudioBuffer audioBuffer; Resource resource; Bytes bytes; if (val_is_string (data)) { resource = Resource (val_string (data)); } else { bytes = Bytes (); bytes.Set (data); resource = Resource (&bytes); } if (WAV::Decode (&resource, &audioBuffer)) { return audioBuffer.Value (); } #ifdef LIME_OGG if (OGG::Decode (&resource, &audioBuffer)) { return audioBuffer.Value (); } #endif return alloc_null (); }
void lime_al_buffer_data (int buffer, int format, value data, int size, int freq) { Bytes bytes; bytes.Set (data); alBufferData (buffer, format, bytes.Data (), size, freq); }
value lime_gzip_decompress (value buffer) { #ifdef LIME_ZLIB Bytes data; data.Set (buffer); Bytes result; Zlib::Decompress (GZIP, &data, &result); return result.Value (); #else return alloc_null (); #endif }
value lime_deflate_compress (value buffer) { #ifdef LIME_ZLIB Bytes data; data.Set (buffer); Bytes result; Zlib::Compress (DEFLATE, &data, &result); return result.Value (); #else return alloc_null(); #endif }
value lime_lzma_decompress (value buffer) { #ifdef LIME_LZMA Bytes data; data.Set (buffer); Bytes result; LZMA::Decompress (&data, &result); return result.Value (); #else return alloc_null (); #endif }
value lime_text_layout_position (value textHandle, value fontHandle, int size, HxString textString, value data) { #if defined(LIME_FREETYPE) && defined(LIME_HARFBUZZ) TextLayout *text = (TextLayout*)val_data (textHandle); Font *font = (Font*)val_data (fontHandle); Bytes bytes; bytes.Set (data); text->Position (font, size, textString.__s, &bytes); return bytes.Value (); #endif return alloc_null (); }
value lime_jpeg_decode_bytes (value data, bool decodeData) { ImageBuffer imageBuffer; Bytes bytes; bytes.Set (data); Resource resource = Resource (&bytes); #ifdef LIME_JPEG if (JPEG::Decode (&resource, &imageBuffer, decodeData)) { return imageBuffer.Value (); } #endif return alloc_null (); }
value lime_font_load (value data) { #ifdef LIME_FREETYPE Resource resource; Bytes bytes; if (val_is_string (data)) { resource = Resource (val_string (data)); } else { bytes.Set (data); resource = Resource (&bytes); } Font *font = new Font (&resource, 0); if (font) { if (font->face) { return CFFIPointer (font, gc_font); } else { delete font; } } #endif return alloc_null (); }
value lime_image_load (value data) { ImageBuffer buffer; Resource resource; Bytes bytes; if (val_is_string (data)) { resource = Resource (val_string (data)); } else { bytes.Set (data); resource = Resource (&bytes); } #ifdef LIME_PNG if (PNG::Decode (&resource, &buffer)) { return buffer.Value (); } #endif #ifdef LIME_JPEG if (JPEG::Decode (&resource, &buffer)) { return buffer.Value (); } #endif return alloc_null (); }