image_gen 0.2.1 copy "image_gen: ^0.2.1" to clipboard
image_gen: ^0.2.1 copied to clipboard

discontinued
SDKDart

A tool to generate images from dart code.

example/lib/main.dart

import 'package:image_gen/image_gen.dart';

@ImageGen()
class Abc extends ImageGenerator {
  @override
  GenImage generate() {
    const width = 512;
    const height = 512;
    final rt = GenImage(width: width, height: height);
    final layer = Layer(width: width, height: height);
    layer.draw(Img(path: 'assets/resource/hamster.png'));

    // change s of hsv on all pixels.
    layer.draw(Mapper.byFunction(mapp: (_) => 0, type: MapperType.s));

    // change v of hsv on all pixels.
    layer.draw(
        Mapper.byFunction(mapp: (v) => v < 128 ? 0 : 255, type: MapperType.v));

    // remove comment out to draw rect
    // layer.draw(const Rect(
    //   left: PercentQuantity(0),
    //   right: PercentQuantity(0.5),
    //   top: PercentQuantity(0),
    //   bottom: PercentQuantity(0.5),
    //   color: Uint8Color(),
    //   roundCorner: 0.5,
    // ));
    rt.addLayer(layer);
    return rt;
  }
}
1
likes
120
points
75
downloads

Publisher

unverified uploader

Weekly Downloads

A tool to generate images from dart code.

Homepage

Documentation

API reference

License

GPL-3.0 (license)

Dependencies

analyzer, build, dart_eval, image, source_gen

More

Packages that depend on image_gen