kobalicek on geometry
Geometry (compare)
kobalicek on master
[ABI] BLMatrix2D::determinant()… (compare)
kobalicek on master
Removed the remaining public AP… (compare)
kobalicek on api_fix
Removed the remaining public AP… (compare)
kobalicek on master
[Opt] Don't use AVX2 instrinsic… (compare)
#define BL_STATIC
#include <blend2d.h>
int main()
{
BLImage img(200, 5, BL_FORMAT_PRGB32);
BLContext ctx(img);
ctx.setCompOp(BL_COMP_OP_SRC_COPY);
ctx.fillAll();
ctx.setCompOp(BL_COMP_OP_SRC_OVER);
ctx.setStrokeStyle(BLRgba32(0xFFFFFFFF));
ctx.setStrokeWidth(1);
ctx.strokeLine(50, 3, 150, 3);
ctx.end();
BLImageCodec codec;
codec.findByName("PNG");
img.writeToFile("bl-getting-started-1.png", codec);
return 0;
}
// 'render()' is an entry-point, 'cci' would initialize the rendering context.
BLImage render(const BLContextCreateInfo& cci) {
// Create a destination image and rendering context.
BLImage img(220, 340, BL_FORMAT_PRGB32);
BLContext ctx(img, cci);
// The image data is not guaranteed to be empty, so clear it explicitly.
ctx.clearAll();
ctx.setStrokeStyle(BLRgba32(0xFFFFFFFF));
for (int i = 0; i < 32; i++) {
double y = double(i) * 10 + 10;
double f = double(i) / 32.0;
ctx.strokeLine(10 + f, y + f, 200 + f, y + f);
}
return img;
}
void rect(int x, int y, int w, int h) {
if (processing::shouldFill) {
BLRectI rect{x, y, w, h};
processing::ctx.fillGeometry(BLGeometryType::BL_GEOMETRY_TYPE_RECTI, &rect);
}
if (processing::shouldStroke) {
BLRect rect{x + 0.5, y + 0.5, static_cast<double>(w), static_cast<double>(h)};
processing::ctx.strokeGeometry(BLGeometryType::BL_GEOMETRY_TYPE_RECTD, &rect);
}
}
Just by ignoring the 3D-features of Processing, and the whole set of add-on libraries,
in my opinion these are the core features missing in Blend2d:
Except for Image Processing, all the missing features could be implemented as external libraries, but I think that filling these gaps within the Blend2d-core would provide a distinct advantage.
size
, rect
, fill
, stroke
, background
functions are supported. :-) You create a file, say, sketch1.cpp, include processing.h
and write setup
and draw
functions. After compiling, link it with Blend2D.lib MiniFB.lib, processing.cpp, and main.cpp. and the generated exe produces the image. ^_^