hx-astcenc

ASTC Encoder and OpenFL ASTC Texture BitmapData.

To install, run:

haxelib install hx-astcenc 1.0.0 

See using Haxelib in Haxelib documentation for more information.

README.md

hx-astcenc

Create ASTC format texture file.

About

Current only mac support now. About window, Need do haxe build-window.hxml to build window target.

Use

haxelib run hx-astcenc c -cl ./ChristGiftViewAtlas.png ./texture_zilb.astc 4x4 -exhaustive -pp-premultiply

Json Config

Use Json data create all ASTC file.

[
    {
        "zlib": true,
        "mode": "-cl",
        "defaultBlock": "6x6",
        "quality": "-exhaustive",
        "alphaPremultiply": true,
        "path": "Assets",
        "output": "Assets_astc",
        "igroneError": true
    },
    {
        "zlib": true,
        "mode": "-cl",
        "defaultBlock": "4x4",
        "quality": "-exhaustive",
        "alphaPremultiply": true,
        "path": "../../Assets2",
        "output": "Assets_astc",
        "igroneError": true
    }
]

Command:

haxelib run hx-astcenc file.json

OpenFL Target ASTC Texture Support

import openfl.display.ASTCBitmapData;

// Create from Bytes
ASTCBitmapData.fromBytes(bytes);
if (ASTCBitmapData.isSupportASTCConfig()) {
    trace("Support ASTC Config");
}
// Create from url or local path
ASTCBitmapData.loadFromFile("assets/4x4.astc").onComplete(data -> {
    var bitmap = new Bitmap(data);
    this.addChild(bitmap);
}).onError(err -> {
    trace("Load fail", err);
});
// Create from a BitmapData
ASTCBitmapData.fromBitmapData(bitmapData);
// Create from local path .png format, But it only IOS support.
ASTCBitmapData.loadFromPngFile("assets/4x4.png");
Display ASTCBitmapData
var bitmap = new Bitmap();
bitmap.bitmapData = ASTCBitmapData.fromBytes(bytes);
this.addChild(bitmap);
Contributors
rainy
barisyild
Version
1.0.0
Published
2 years ago
License
MIT

All libraries are free

Every month, more than a thousand developers use Haxelib to find, share, and reuse code — and assemble it in powerful new ways. Enjoy Haxe; It is great!

Explore Haxe

Haxe Manual

Haxe Code Cookbook

Haxe API documentation

You can try Haxe in the browser! try.haxe.org

Join us on GitHub!

Haxe is being developed on GitHub. Feel free to contribute or report issues to our projects.

Haxe on GitHub

⌂