sample_1.odin (901B)
1 package main 2 3 import blend2d "../binding" 4 5 main :: proc() { 6 img: blend2d.ImageCore 7 8 blend2d.image_init(&img) 9 blend2d.image_create(&img, 480, 480, .PRGB32) 10 11 ctx: blend2d.ContextCore 12 ctx_cfg: blend2d.ContextCreateInfo 13 14 blend2d.context_init(&ctx) 15 blend2d.context_begin(&ctx, &img, &ctx_cfg) 16 blend2d.context_clear_all(&ctx) 17 18 path: blend2d.PathCore 19 blend2d.path_init(&path) 20 blend2d.path_move_to(&path, 26, 31) 21 blend2d.path_cubic_to(&path, 642, 132, 587, -136, 25, 464) 22 blend2d.path_cubic_to(&path, 882, 404, 144, 267, 27, 31) 23 24 origin: blend2d.Point 25 26 blend2d.context_fill_path_d_rgba32(&ctx, &origin, &path, 0xFFFFFFFF) 27 blend2d.context_end(&ctx) 28 29 codec: blend2d.ImageCodecCore 30 codecs: blend2d.ArrayCore 31 32 blend2d.image_codec_array_init_built_in_codecs(&codecs) 33 blend2d.image_codec_init_by_name(&codec, "PNG", len("PNG"), nil) 34 blend2d.image_write_to_file(&img, "sample_1.png", &codec) 35 } 36