|
| 1 | +# [QB64_GJ_LIB](../README.md) |
| 2 | +## GRYMMJACK'S ASEPRITE LIBRARY |
| 3 | + |
| 4 | +Adds native [ASEPRITE](https://www.aseprite.org/) support to QB64! |
| 5 | + |
| 6 | +### USAGE for Dict Object (separately) |
| 7 | +```basic |
| 8 | +'Insert at top of file: |
| 9 | +'$INCLUDE:'path_to_GJ_LIB/ASEPRITE/ASEPRITE.BI' at the top of file |
| 10 | +
|
| 11 | +' ...your code here... |
| 12 | +
|
| 13 | +'Insert at bottom of file: |
| 14 | +'$INCLUDE:'path_to_GJ_LIB/ASEPRITE/ASEPRITE.BM' at the bottom of file |
| 15 | +``` |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | +## WHAT'S IN THE LIBRARY (WIP) |
| 20 | +| SUB / FUNCTION | NOTES | |
| 21 | +|----------------|-------| |
| 22 | +| load_aseprite_image | Loads a .ase/.aseprite file into an ASEPRITE_IMAGE structure |
| 23 | +| get_aseprite_info$ | Returns human-readable information about an ASEPRITE_IMAGE |
| 24 | +| is_valid_aseprite_file | Checks whether a file is a valid Aseprite file |
| 25 | +| get_aseprite_extension$ | Returns the canonical Aseprite file extension (".ase") |
| 26 | +| get_blend_mode_name$ | Maps blend mode constant to descriptive string |
| 27 | +| get_animation_direction_name$ | Maps animation direction constant to descriptive string |
| 28 | +| create_image_from_aseprite&| Creates a QB64PE image handle from loaded Aseprite pixel data |
| 29 | +| display_aseprite_image | Draws an ASEPRITE_IMAGE to the screen (with scale/centering) |
| 30 | +| preview_aseprite_image | Quick preview helper (original size) |
| 31 | +| preview_aseprite_scaled | Scaled preview helper (e.g. 2x) |
| 32 | +| load_aseprite_pixels% | Attempts to load pixel data from file chunks into an image |
| 33 | +| load_raw_pixel_data% | Reads uncompressed pixel data into a target image |
| 34 | +| load_compressed_pixel_data% | Decompresses zlib-compressed cel data into an image |
| 35 | +| load_compressed_pixel_data_for_layer% | Specialized loader for layer extraction (positions at 0,0) |
| 36 | +| create_compressed_placeholder% | Fallback placeholder renderer for compressed data (uses _INFLATE$) |
| 37 | +| get_indexed_color& | Returns RGB color for an indexed palette entry |
| 38 | +| load_aseprite_enhanced | Loads enhanced ASEPRITE data with layers and animation metadata |
| 39 | +| parse_layer_chunks% | Parses layer chunk data from file into structures |
| 40 | +| parse_frame_chunks% | Parses frame and timing chunks from file |
| 41 | +| init_aseprite_animation | Initializes animation timing/state for enhanced images |
| 42 | +| update_aseprite_animation| Advances animation timing and handles frame progression |
| 43 | +| play_aseprite_animation | Starts/resumes animation playback |
| 44 | +| pause_aseprite_animation | Pauses animation playback |
| 45 | +| set_aseprite_frame | Sets the current animation frame (by index) |
| 46 | +| get_aseprite_layer_count%| Returns number of layers in ASEPRITE_IMAGE |
| 47 | +| get_aseprite_frame_count%| Returns number of frames in ASEPRITE_IMAGE |
| 48 | +| get_aseprite_cel_count% | Returns total number of cels in ASEPRITE_IMAGE |
| 49 | +| get_aseprite_tag_count% | Returns number of animation tags in ASEPRITE_IMAGE |
| 50 | +| is_valid_layer_index% | Validates a layer index against an ASEPRITE_IMAGE |
| 51 | +| is_valid_frame_index% | Validates a frame index against an ASEPRITE_IMAGE |
| 52 | +| get_layer_count% | Returns layer count for ASEPRITE_ENHANCED_IMAGE |
| 53 | +| get_layer_name$ | Returns the name of a layer in an enhanced image |
| 54 | +| is_layer_visible% | Checks whether a layer is currently visible |
| 55 | +| set_layer_visibility | Set visibility for a layer and update composite image |
| 56 | +| update_composite_image | Rebuilds composite image from visible layers |
| 57 | +| load_specific_layer_image& | Extracts a single layer's pixels into a QB64PE image |
| 58 | +| load_specific_layer_image_enhanced& | Enhanced layer extraction with improved scope handling |
| 59 | +| create_aseprite_image_from_layer& | High-level wrapper to create an image from a named/indexed layer |
| 60 | +| create_full_composite_image& | Composites all layers for a given frame into a single image handle |
| 61 | +| load_aseprite_file& | Top-level convenience loader that returns a composite image handle |
| 62 | + |
| 63 | +### SAMPLE PROGRAMS |
| 64 | +- [ASEPRITE.BAS](ASEPRITE.BAS) - Simple implementation to load a `.aseprite` image |
| 65 | +- [WORKING-KEEP-debug_layers_example.bas](WORKING-KEEP-debug_layers_example.bas) - WIP on showing how to load layers |
| 66 | +- [WORKING-KEEP-visual_pumpkin_viewer.bas](WORKING-KEEP-visual_pumpkin_viewer.bas) - WIP on showing how to load a single layer at various sizes |
| 67 | + |
| 68 | +### SCREENSHOTS |
| 69 | +> Screenshot of output from [ASEPRITE.BAS](ASEPRITE.BAS) |
| 70 | +](ASEPRITE.png) |
| 71 | + |
| 72 | +> Screenshot of output from [WORKING-KEEP-visual_pumpkin_viewer.BAS](WORKING-KEEP-visual_pumpkin_viewer.BAS) |
| 73 | +](WORKING-KEEP-visual_pumpkin_viewer.png) |
| 74 | + |
0 commit comments