bl_sample_6.cpp (729B)
1 #include <blend2d.h> 2 3 int main() { 4 BLImage img(480, 480, BL_FORMAT_PRGB32); 5 BLContext ctx(img); 6 7 ctx.clear_all(); 8 9 BLGradient linear(BLLinearGradientValues(0, 0, 0, 480)); 10 linear.add_stop(0.0, BLRgba32(0xFFFFFFFF)); 11 linear.add_stop(0.5, BLRgba32(0xFFFF1F7F)); 12 linear.add_stop(1.0, BLRgba32(0xFF1F7FFF)); 13 14 BLPath path; 15 path.move_to(119, 49); 16 path.cubic_to(259, 29, 99, 279, 275, 267); 17 path.cubic_to(537, 245, 300, -170, 274, 430); 18 19 // Use 'setStrokeXXX' to change stroke options. 20 ctx.set_stroke_width(15); 21 ctx.set_stroke_start_cap(BL_STROKE_CAP_ROUND); 22 ctx.set_stroke_end_cap(BL_STROKE_CAP_BUTT); 23 24 ctx.stroke_path(path, linear); 25 26 ctx.end(); 27 28 img.write_to_file("bl_sample_6.png"); 29 return 0; 30 }