{"id":33002995,"url":"https://github.com/micro-gl/micro-gl","last_synced_at":"2025-11-15T11:01:24.874Z","repository":{"id":182346460,"uuid":"340708136","full_name":"micro-gl/micro-gl","owner":"micro-gl","description":"Headers Only C++11 CPU Vector Graphics. no std-lib, no FPU and no GPU required !","archived":false,"fork":false,"pushed_at":"2024-08-24T08:19:25.000Z","size":13900,"stargazers_count":237,"open_issues_count":6,"forks_count":13,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-08-24T09:32:22.217Z","etag":null,"topics":["cpp","cpp11","embedded","graphics","svg"],"latest_commit_sha":null,"homepage":"http://micro-gl.github.io/docs/microgl","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/micro-gl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.MD","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-20T17:08:12.000Z","updated_at":"2024-08-24T08:19:29.000Z","dependencies_parsed_at":"2024-08-24T09:42:09.175Z","dependency_job_id":null,"html_url":"https://github.com/micro-gl/micro-gl","commit_stats":null,"previous_names":["micro-gl/micro-gl"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/micro-gl/micro-gl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micro-gl%2Fmicro-gl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micro-gl%2Fmicro-gl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micro-gl%2Fmicro-gl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micro-gl%2Fmicro-gl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/micro-gl","download_url":"https://codeload.github.com/micro-gl/micro-gl/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micro-gl%2Fmicro-gl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":284545264,"owners_count":27023524,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-15T02:00:06.050Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","cpp11","embedded","graphics","svg"],"created_at":"2025-11-13T14:00:38.905Z","updated_at":"2025-11-15T11:01:24.867Z","avatar_url":"https://github.com/micro-gl.png","language":"C++","funding_links":[],"categories":["Graphics","Geometry, Graphics Processing, and Game Development"],"sub_categories":[],"readme":"\u003cdiv align='center'\u003e\n\u003cimg src='microgl-512-logo-rounded.png' style='height: 200px;'/\u003e\n\u003c/div\u003e\n\n# micro{gl}\n[![mac-os](https://github.com/micro-gl/micro-gl/actions/workflows/compile_macos.yml/badge.svg)](https://github.com/micro-gl/micro-gl/actions/workflows/compile_macos.yml)\n[![ubuntu](https://github.com/micro-gl/micro-gl/actions/workflows/compile_ubuntu.yml/badge.svg)](https://github.com/micro-gl/micro-gl/actions/workflows/compile_ubuntu.yml)\n[![windows](https://github.com/micro-gl/micro-gl/actions/workflows/compile_windows.yml/badge.svg)](https://github.com/micro-gl/micro-gl/actions/workflows/compile_windows.yml)\n\n**Fast**, Super **Slim**, **Embeddable**, **Headers** only **`C++11`** vector graphics library, that can run on any 32/64 bits computer without **FPU** or **GPU**. **No standard library required**.\n\n\ncheck out our website at [micro-gl.github.io/docs/microgl](https://micro-gl.github.io/docs/microgl)\n\n\u003cdiv align='center'\u003e\n\u003cimg src='intro_1.png' style='opacity: 0.75; max-height: 200'/\u003e\n\u003c/div\u003e\n\u003cdiv align='center'\u003e\n\u003cimg src='intro_2.png' style='opacity: 0.75; max-height: 200'/\u003e\n\u003c/div\u003e\n\n## Examples\n\nA circle with Texture fill and Gradient stroke\n```cpp\nusing number = float;\n\nusing Canvas24= canvas\u003cbitmap\u003ccoder::RGB888_PACKED_32\u003e, CANVAS_OPT_32_BIT\u003e;\nusing Texture24= sampling::texture\u003cbitmap\u003ccoder::RGB888_ARRAY\u003e, sampling::texture_filter::NearestNeighboor\u003e;\n\nfast_radial_gradient\u003cnumber\u003e gradient{0.5, 0.5, 0.75};\nlinear_gradient_2_colors\u003c120\u003e gradient2Colors{{255,0,255},\n                                              {255,0,0}};\nflat_color\u003c\u003e flatColor{{133,133,133, 255}};\n\nauto img_2 = Resources::loadImageFromCompressedPath(\"images/uv_256.png\");\n\nCanvas24 canvas(W, H);;\nTexture24 tex_uv{new bitmap\u003ccoder::RGB888_ARRAY\u003e(img_2.data, img_2.width, img_2.height)};\n\ngradient.addStop(0.0f, {255,0,0});\ngradient.addStop(0.45f, {255,0,0});\ngradient.addStop(0.50f, {0,255,0});\ngradient.addStop(1.f, {255,0,255});\n\ncanvas.clear({255,255,255,255});\ncanvas.drawCircle\u003cblendmode::Normal, porterduff::FastSourceOverOnOpaque, true, number\u003e(\n   tex_uv, // fill\n   gradient2Colors, // stroke\n   200+0, 200+0,\n   150+t, 10, 255\n);\n\n```\n\nA Rectangle, that samples a circle\n```cpp\nusing Canvas24= canvas\u003cbitmap\u003ccoder::RGB888_PACKED_32\u003e\u003e;\nusing number = float;\n// using number = Q\u003c12\u003e;\n\ncircle_sampler\u003cnumber\u003e sampler{};\n\nsampler.updatePoints({0.50,0.5}, 0.5, 0.10);\nsampler.color_fill= {0, 0, 0, 255};\nsampler.color_background= {255, 255, 255, 0};\nsampler.color_stroke= {255, 255, 255, 255};\n\nCanvas24 canvas(512, 512);\n\ncanvas.clear({255,0,255,255});\ncanvas.drawRect\u003cblendmode::Normal, porterduff::FastSourceOverOnOpaque, false, number\u003e(\n        sampler,\n        0, 0, 300, 300);\n```\n\nA path tessellation with red color\n```cpp\ntemplate \u003ctypename number\u003e\npath_t\u003cnumber\u003e path_arc_animation() {\n  path_t\u003cnumber\u003e path{};\n\n  int div=32; //4\n\n  path.arc({200,200}, 100,\n           math::deg_to_rad(0.0f),\n           math::deg_to_rad(360.0f),\n           false, div).closePath();\n\n  path.arc({250,200}, 50,\n           math::deg_to_rad(0.0f),\n           math::deg_to_rad(360.0f),\n           true, div).closePath();\n\n  path.moveTo({150,150});\n  path.arc({150+0,150}, 50+t-0,\n           math::deg_to_rad(0.0f),\n           math::deg_to_rad(360.0f),\n           false, div);//.closePath();\n\n  return path;\n}\n\n// Choose your own number format\n// using number = float;\n// using number = double;\n// using number = Q\u003c15, long long\u003e;\nusing number = Q\u003c8, microgl::ints::int32_t, microgl::ints::int64_t, 1\u003e;\n// using number = Q\u003c2, microgl::ints::int64_t\u003e;\n// using number = Q\u003c4, microgl::ints::int32_t\u003e;\n// using number = Q\u003c12\u003e;\n\nusing Canvas24= canvas\u003cbitmap\u003cRGB888_PACKED_32\u003e\u003e;\n\nsampling::flat_color\u003c\u003e color_red {{ 255, 0, 255, 255}};\n\nCanvas24 canvas(255, 255);\n\ncanvas.clear({255, 255, 255, 255});\ncanvas.drawPathFill\u003cblendmode::Normal, porterduff::FastSourceOverOnOpaque, false, true\u003e(\n   color_red,\n   matrix_3x3\u003cnumber\u003e::identity(),\n   path,\n   microtess::fill_rule::even_odd,\n   microtess::tess_quality::prettier_with_extra_vertices,\n   255\n);\n\n```\n## Features\n\n\n\u003e **Language** \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\n- **`C++11`**, does not use any **`STL`** library and **standard library**.\n- **headers only** library\n- most functions are templates, which means you compile only what is used\n- compile-time polymorphism (no runtime virtual methods)\n- support for 32 bits and 64 bits\n- self contained and modular.\n\n\u003e **Graphics** \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\n- very modular design. if something does not exist, you can implement your own\n- over 10 blending modes implemented, you can wrote your own and supply as well\n- **`porter-duff`** alpha compositing\n- support for 2d sampler\n- can support any pixel coding you need, we implemented a lot out of the box\n- can render 3d geometries\n- we support 3d shaders\n- no need for **GPU**, it is all **CPU**\n- no need for **FPU**\n- support for any number system including **`Q`** numbers (fixed point), no need to use float points\n\n\u003e **Geometry** \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\n- fast implementation for common shapes (rect, rounded rectangles, circles, triangles)\n- batch triangles like **GPU** would\n- support polygons of any type convex, simple, and complex polygons \n- path fills (with even-odd or zero-one fill rule) in any precision\n- stroke fills\n- quadrilaterals\n- bezier patches\n- we providea dynamic array, but you can plug your own.\n\n## Installing `micro{gl}`\n`microgl` is a headers only library, which gives the following install possibilities:\n1. Using `cmake` to invoke the `install` target, that will copy everything in your system via\n```bash\n$ mkdir cmake-build-release\n$ cd cmake-build-release\n$ cmake -DCMAKE_BUILD_TYPE=Release ..\n$ cmake --install .\n```\n2. Copying the `include/microgl` to anywhere you want.\n3. Install via [vcpkg](https://vcpkg.io).\n\n## Consuming `micro{gl}`\nFollowing options are available:\n1. copy the project to a sub folder of your project. Inside your **`CMakeLists.txt`** add\n```cmake\nadd_subdirectory(/path/to/microgl)\ntarget_link_libraries(your_app microgl)\n```\n2. If you installed **`micro{gl}`** with option 1 (see above) at your system, you can instead\n```cmake\nfind_package(microgl CONFIG REQUIRED)\ntarget_link_libraries(your_app microgl::microgl)\n```\n3. If you have not installed, you can add in your app's `CMakeLists.txt`\n```cmake\ntarget_include_directories(app path/to/microgl/folder/include/)\n```\n4. If you manually copied the `include/microgl` to the default system include path,  \nyou can use `cmake/Findmicrogl.cmake` to automatically create the cmake targets\n```cmake\nlist(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/path/to/Findmicrogl/folder)\nfind_package(microgl REQUIRED)\ntarget_link_libraries(your_app microgl::microgl)\n```\n5. Just copy the `include/microgl` into a sub folder of your project and include the header  \nfiles you need with relative path in your source files.\n6. If you have vcpkg installed, install the `micro{gl}` using the `vcpkg install microgl` command, and then you can use option 2 (see above)\nto find it. See issue micro-gl/micro-gl#33 for more details.\n\n## Running Examples\nFirst make sure you have \n - [SDL2](https://www.libsdl.org/) installed at your system.  \n - [cmake](https://cmake.org/download/) installed at your system.\n\nThere are two ways:\n1. Use your favourite IDE to load the root `CMakeLists.txt` file, and then it   \n   will pick up all of the targets, including the examples\n2. Using the command line:\n```bash\n$ mkdir cmake-build-release\n$ cd cmake-build-release\n$ cmake -DCMAKE_BUILD_TYPE=Release ..\n$ cmake --build . --target \u003cexample_name\u003e\n$ ../examples/bin/example_name\n```\n\n```text\nAuthor: Tomer Shalev, tomer.shalev@gmail.com, all rights reserved (2021)\n```\n\n\u003e 🙏🏻 Thanks to [JetBrains cLion Support Team](https://jb.gg/OpenSourceSupport) for granting this project an **OSS** license of **cLion** \u003cimg src=\"https://resources.jetbrains.com/storage/products/company/brand/logos/CLion_icon.png\" height=\"24\" alt=\"CLion logo.\"\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicro-gl%2Fmicro-gl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicro-gl%2Fmicro-gl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicro-gl%2Fmicro-gl/lists"}