2D Vector Graphics Engine Powered by a JIT Compiler

Overview
Comments
  • draw issue

    draw issue

    I find one problem. Firstly, I use red color to draw a rect, the color's alpha is 255, then I draw image, the image has zeor alpha, but rgb has value in same pixel, the draw result is the region of source image is transparent, I hope it display background image. I want to why?

    opened by miaotianlei 14
  • Systematic use of uint32_t instead of enum

    Systematic use of uint32_t instead of enum

    The systematic use of uint32_t instead of the enum type is making the API very painful to use. I do not care much that the compiler cannot check that I am using the right enum but I am spending far more time than acceptable trying to figure out which enum type I should use for each function parameter.

    I do not now why that was done like that but I assume that there must be a reason (backward compatibility? consistency with the C api? make bindings easier? ...)

    If keeping uint32_t is really important then I propose the following approach that should solve the problem for the C++ api by providing the required information to Doxygen without changing the ABI.

    1. Declare the following template type

       #include <type_traits>
       template<typename T> using bl_enum = typename std::underlying_type<T>::type;
      

    or if you know that all enums are uint32_t

        template<typename T> using bl_enum = uint32_t;
    
    1. And replace each uint32_t by bl_enum<XXX> where XXX is the required enum type.
    enhancement 
    opened by schauveau 11
  • how will multi-threading work

    how will multi-threading work

    What is the intention for multi-threading? I am currently contemplating having several BLContext objects connected to the same BLImage. This is to support multiple "windows" on the same "framebuffer". The challenge for the window manager will be in some way controller the ordering of blits into the framebuffer. Of course, having each window with its own backing store, and just bliting in z order will do the trick.

    Is the intention of multi-threading to simply deal with multiple threads within a single drawing context? Or is there any intention of helping to manager multiple contexts? I assume the former (multi-thread within single context).

    Just want to be clear so I don't waste time creating something that's already on the roadmap.

    opened by Wiladams 11
  • Change interface to make possible to use library on _d.impl" hacks">

    Change interface to make possible to use library on "old" compillers without "->_d.impl" hacks

    A lot of library functions can be accessed only using "internal" mecanics like casting from "_d.impl" pointers to actual implementation. Using such code in application may be huge problem if some internals changes in future. I think its needed to add all such functional to system headers and make them looks like functions.

    F.i. to get current stroke width value now I need to use something like this:

    BLContextCore *core;
    double old_width = ((BLContextImpl*)core->_d.impl)->state->strokeOptions.width;
    

    I think its much better to have something like:

    #define blGetStrokeWidth( ctx ) ((BLContextImpl*)(ctx)->_d.impl)->state->strokeOptions.width
    

    in system header for ANSI and inline function for C++ mode.

    opened by JouriM66 9
  • Flush denormals to zero problem

    Flush denormals to zero problem

    Blend2D has problems when the CPU's FPU is set to flush denormals to zero. This is mostly related to our quadratic and cubic roots functions where we compare with tMin and tMax.

    This issue originated from https://github.com/blend2d/blend2d-samples/issues/2

    bug 
    opened by kobalicek 9
  • C API Help

    C API Help

    This issue is provided for C-API users.

    If you think that something in C-API is not documented well please add a comment here and we will try to update the documentation.

    opened by kobalicek 9
  • Clang in MSVC 2019

    Clang in MSVC 2019

    Hello again

    Blend2D suggest to use Clang, so I did generate the build project files for MSVC 2019 with clang installed using the following command:

    cmake -T ClangCL .. -DBLEND2D_STATIC=True
    

    It did generate project with LLVM (clang-cl) as Platform Toolset, but there are some warnings:

    2>clang-cl : warning : unknown argument ignored in clang-cl: '-fno-exceptions' [-Wunknown-argument]
    2>clang-cl : warning : unknown argument ignored in clang-cl: '-fno-rtti' [-Wunknown-argument]
    2>clang-cl : warning : unknown argument ignored in clang-cl: '-fno-math-errno' [-Wunknown-argument]
    

    Which I suppose might be crucial for those optimizations mentioned on the website regarding choosing compiler.

    The project does compile fine though.

    opened by iryont 8
  • Is there an Easy way to measure text?

    Is there an Easy way to measure text?

    I am getting lost between font, metrics, glyph buffers and the like. Is there an obvious way to measure the size of a string?

    More specifically, the text bounding box for some text. I know it's an obviously complex thing, but looking for the Cairo equivalent "toy" interface.

    opened by Wiladams 8
  • Malformed BLRegion being formed after adding BLBoxI's

    Malformed BLRegion being formed after adding BLBoxI's

    The following operation:

    var region = BLRegion()
    region.combine(box: BLBoxI(x0: 20, y0: 50, x1: 260, y1: 270), operation: .or)
    region.combine(box: BLBoxI(x0: -56, y0: -169, x1: 185, y1: 52), operation: .or)
    region.combine(box: BLBoxI(x0: -46, y0: -134, x1: 29, y1: -118), operation: .or)
    

    results in an invalid region.

    Context: The combine method invokes blRegionCombineRB(this, this, &box, operation), like the combine method from BLRegion::combine.

    After these operations, the BLRegion pointer seems to be filled with garbage from the memory, but I'm not sure what exactly could be happening.

    opened by LuizZak 7
  • Build error MSVC 19.16.27030.1

    Build error MSVC 19.16.27030.1

    Visual Studio 15 2017 CMake creates project and all that. ultimately cl compiler will report error: D8016: '/Ox' and '/RTC1' command-line options are incompatible. I'm compiling for 32-bit also. Last time around I just went into the project and disabled either or both of these and moved along, but I think it's worth reporting if you want to fix this at the source.

    opened by Wiladams 7
  • Assertion failure when appending particular sequence of boxes to BLRegion

    Assertion failure when appending particular sequence of boxes to BLRegion

    The following code triggers an assertion in region.cpp line 1595:

    var region = BLRegion()
    region.combine(box: BLBoxI(x0: 174, y0: 92, x1: 506, y1: 463), operation: .or)
    region.combine(box: BLBoxI(x0: 189, y0: 466, x1: 482, y1: 478), operation: .or)
    region.combine(box: BLBoxI(x0: 189, y0: 478, x1: 482, y1: 484), operation: .or)
    
    // Bang!
    region.combine(box: BLBoxI(x0: 189, y0: 440, x1: 482, y1: 446), operation: .or)
    
    bug 
    opened by LuizZak 6
  • incorrect familyName

    incorrect familyName

    I'm experiencing some incorrect results with this font-file "Quicksand_Light.otf" regarding how details are extracted from its NAME table. The weird thing about this font-file is that its "familyName" is different on Windows/Linux. On Windows its familyName is "Quicksand Light", On Linux its familyName is "Quicksand" (as reported by the basic font-installator utilities)

    When inspected through Blend2d (BLFontFace ...), the resulting familyName is "Quicksand", independently of the running platform, and this is incoherent at least on Windows.

    I've examined the logic used in "opentype/otname.cpp" for selecting the best record in the NAME table, and I noticed some special heuristic assumptions such as ".. Prefer TypographicFamilyName over FamilyName and WWSFamilyName..."

    My question is:

    • is this font-file wrong ? (end of the story). or
    • are the heuristics used in "opentype/otname.cpp" flawed ?

    Quicksand_Light.zip

    opened by abu-irrational 1
  • Image save error

    Image save error

    I have a picture, I use BLImage to load it, then I save to test.png. The file test.png is different with origin image. Origin image: 123

    New image after save: kk

    opened by miaotianlei 2
  • Disable anti-aliasing option

    Disable anti-aliasing option

    Is there any way to disable edge anti-aliasing somehow? I'm trying to draw solids without a mask.

    Even a hack way to do it is fine for the moment.

    Use case: raterizing material IDs as colours, that can’t be antialiased or blended.

    opened by onehundredfeet 4
  • Issues with gradients in AARCH64 GNU/Linux

    Issues with gradients in AARCH64 GNU/Linux

           BLGradient linear(BLLinearGradientValues(0, 0, 0, 360*5));
    	linear.addStop(0.0, BLRgba32(0xFF0000FF));
    	linear.addStop(0.2, BLRgba32(0xFFFFFFFF));
    	ctx.setFillStyle(linear);
    	ctx.fillRect(100.0, 100.0, 20, 360);
    
    	BLGradient linear1(BLLinearGradientValues(0, 0, 0, 360));
    	linear1.addStop(0.0, BLRgba32(0xFF0000FF));
    	linear1.addStop(1.0, BLRgba32(0xFFFFFFFF));
    	ctx.setFillStyle(linear1);
    	ctx.fillRect(200.0, 100.0, 20, 360);
    
    	std::vector<BLRgba32> vecColor = {
    		BLRgba32(0xffff0000),
    		BLRgba32(0xffffff00),
    		BLRgba32(0xffffffff),
    		BLRgba32(0xff0000ff),
    		BLRgba32(0xffff00ff),
    		BLRgba32(0xff00ffff),
    		BLRgba32(0xff00ff00),
    	};
    		
    	for (int i = 0; i < 6; i++)
    	{
    		ctx.setFillStyle(vecColor[i]);
    		ctx.fillRect(230, 100 + i * 60, 20, 60);
    	}
    

    Snipaste_2022-06-10_09-49-06

    opened by HowToExpect 1
  • Clipping paths

    Clipping paths

    I would like to write a Rive renderer using Blend2D. It looks like BL supports all the required features, except I can't find reference to clipping paths (only clipRect) in the docs.

    Are clip paths planned for the future?

    This would be the only blocker to a Rive renderer at first glance.

    opened by projectitis 2
Owner
Blend2D
Blend2D project
Blend2D
Low Level Graphics Library (LLGL) is a thin abstraction layer for the modern graphics APIs OpenGL, Direct3D, Vulkan, and Metal

Low Level Graphics Library (LLGL) Documentation NOTE: This repository receives bug fixes only, but no major updates. Pull requests may still be accept

Lukas Hermanns 1.5k Nov 28, 2022
A terminal-based graphics library for both 2D and 3D graphics.

TermGL A terminal-based graphics library for both 2D and 3D graphics. Written in C, created for terminals supporting ANSI escape codes. Table of Conte

null 211 Oct 31, 2022
kaun is a replacement for löve's built-in love.graphics module intended for 3D graphics

kaun kaun is a replacement for löve's built-in love.graphics module intended for 3D graphics. It is a Lua module you can require from a shared library

Joel Schumacher 4 Apr 5, 2021
This repo contains the DirectX Graphics samples that demonstrate how to build graphics intensive applications on Windows.

DirectX-Graphics-Samples This repo contains the DirectX 12 Graphics samples that demonstrate how to build graphics intensive applications for Windows

Microsoft 4.9k Dec 4, 2022
The DirectX Shader Compiler project includes a compiler and related tools used to compile High-Level Shader Language (HLSL) programs into DirectX Intermediate Language (DXIL) representation

DirectX Shader Compiler The DirectX Shader Compiler project includes a compiler and related tools used to compile High-Level Shader Language (HLSL) pr

Microsoft 2.4k Dec 2, 2022
Cross-platform, graphics API agnostic, "Bring Your Own Engine/Framework" style rendering library.

bgfx - Cross-platform rendering library GitHub Discussions Discord Chat What is it? Cross-platform, graphics API agnostic, "Bring Your Own Engine/Fram

Бранимир Караџић 12.4k Nov 27, 2022
3D engine from scratch (without OpenGL or any other 3D graphics library)

Simple 3d engine based on SFML library. I tried to make this engine powerful and easy to understand.

Vectozavr 62 Nov 16, 2022
Dear PyGui 3D Engine (early development) and Graphics API demos.

Marvel This repo is the working location of the eventual Dear PyGui 3D Engine. It also contains several single file examples of creating a triangle wi

Jonathan Hoffstadt 85 Nov 23, 2022
Vire is a C++ voxel rendering engine. It is written in C++14 and uses OpenGL for graphics.

Vire Vire is a C++ voxel rendering engine. It is written in C++14 and uses OpenGL for graphics. Downloads If you'd just like to just download and try,

null 35 Jul 27, 2022
Antialiased 2D vector drawing library on top of OpenGL for UI and visualizations.

This project is not actively maintained. NanoVG NanoVG is small antialiased vector graphics rendering library for OpenGL. It has lean API modeled afte

Mikko Mononen 4.6k Dec 3, 2022
rlottie is a platform independent standalone c++ library for rendering vector based animations and art in realtime

rlottie rlottie is a platform independent standalone c++ library for rendering vector based animations and art in realtime. Lottie loads and renders a

Samsung 759 Nov 27, 2022
Horde3D is a small 3D rendering and animation engine. It is written in an effort to create an engine being as lightweight and conceptually clean as possible.

Horde3D Horde3D is a 3D rendering engine written in C++ with an effort being as lightweight and conceptually clean as possible. Horde3D requires a ful

Volker Vogelhuber 1.3k Nov 28, 2022
Open 3D Engine (O3DE) is an Apache 2.0-licensed multi-platform AAA Open 3D Engine

Open 3D Engine (O3DE) is an Apache 2.0-licensed multi-platform 3D engine that enables developers and content creators to build AAA games, cinema-quality 3D worlds, and high-fidelity simulations without any fees or commercial obligations.

O3DE 5.7k Dec 5, 2022
ORE (OpenGL Rendering Engine) is a rendering engine developed for my college minor project assessment.

ORE (OPENGL RENDERING ENGINE) What is ORE? ORE(OpenGL Rendering Engine) is a rendering engine with great and easy to use UI that allows the user to lo

HARSHIT BARGUJAR 3 Sep 23, 2022
A modern cross-platform low-level graphics library and rendering framework

Diligent Engine A Modern Cross-Platform Low-Level 3D Graphics Library Diligent Engine is a lightweight cross-platform graphics API abstraction library

Diligent Graphics 2.6k Nov 28, 2022
Lightweight and modular C++11 graphics middleware for games and data visualization

Magnum — Lightweight and modular C++11/C++14 graphics middleware for games and data visualization Looking for an open-source library that gives you gr

Vladimír Vondruš 4.3k Nov 28, 2022
Yocto/GL: Tiny C++ Libraries for Data-Driven Physically-based Graphics

Yocto/GL: Tiny C++ Libraries for Data-Oriented Physically-based Graphics Yocto/GL is a collection of small C++17 libraries for building physically-bas

Fabio Pellacini 2.4k Dec 4, 2022
📽 Highly Optimized Graphics Math (glm) for C

?? OpenGL Mathematics (glm) for C Documentation Almost all functions (inline versions) and parameters are documented inside the corresponding headers.

Recep Aslantas 1.5k Nov 27, 2022
A library for high-performance, modern 2D graphics with SDL written in C.

SDL_gpu, a library for making hardware-accelerated 2D graphics easy. by Jonathan Dearborn SDL_gpu is licensed under the terms of the MIT License. See

Jonathan Dearborn 1.1k Nov 30, 2022