DMT - Dynamically Mapping Textures
Using Flash one can develop applications in two ways: Using vector images or bitmaps.
Using vector images guarantee image sharpness while scaling, moving, etc - but suffer from poorer performance, which mean low FPS.
Using bitmap images allows the application to reach higher FPS (using 3rd party libs like starling) - but compromises image quality at scaling. For years developers had to live with this trade-off, and required developers to select one approach over the other. The DMT library make the best of both world by providing run-time dynamic rasterize vector images to bitmaps and generate the atlases.
Solving the Performance - Image Quality Trade-off
The current process
For higher performance applications the usual mobile development process, is to generate fixed size bitmaps and then manually pack them into an atlas. The application is then packaged with one or more atlases (usually something like sd/hd), and the applicable atlas and then used while the application is running.
This process has number of faults:
Manually generating the bitmaps from vector images is error-prone and time consuming.
Atlas generation requires 3rd party tools, and is a laborious task.
Mobile devices have different screen size, forcing developers to either repeat the process for each screen size, develop for smaller screen size and have balck border area around it, or use stretched bitmaps.
Generating multiple atlases consumes storage, resulting in much larger than necessary footprint and downloadable size.
deciding at run time the right texture needed to be used.
The DMT library solve all of these faults by providing run-time dynamic (and fast) rasterize vector images to bitmaps and generate the atlases.
This allow developers to focus on app logic and creating better user experience without having to take into account issues like pixelization, stretch effects, etc.
Benefitting from DMT is seamless! Running the application using vector images to generate initial textures and atlas, these are then cached for later runs. Then - when needed - it can get an instance of the DisplayObject with the entire hierarchical display tree.
This way, images are optimized for each screen resolution, avoiding ugly stretch marks and pixlezation. Having the display object tree allows you to manipulate each sub object separately (as in flash).
1. Dynamically generated at run-time
2. Storing the original Display Tree
a. Display Object manipulations is available as in the original Flash Display Object
This allows you to change any property like alpha, x, y, scaleX, scaleY, and rotation of any children, this also means you have the original PIVOT point and you can listen to events of any child object.
b. Keeping instance name, so getChildByName also works as usual.
3. Smart Effects
a. capturing Effects.
b. Scale effect support (Optional) - All the Display Object effects are being scaled to the proportional requested size
4. Automatically generates a packaged textures atlas.
a. All textures are being packed into a minimized atlas(s), optimized using bean packing algorithm (To save GPU memory, loading time, and draw calls!)
b. Dynamically packing.
c. Multiple instances of object with the same transformation matrix are treated as the same Texture. (No duplication)
5. Cache support - generate the device optimized images once, and saved for reuse in later runs.
a. Save/load all rasterized data to/from cache.
b. Cache contains all rasterized textures (PNG file format) and all Display Tree data, in one file.
6. Asynchronous support using pseudo thread. (Ready for workers when available on mobile.)
7. Rasterize MovieClips.
DMT is Open Source library, released under Apache License. Get the source from: https://github.com/XTDStudios/DMT/
Follow me on Twitter