Skip to content

Commit

Permalink
Merge pull request #2 from micro-gl/readme
Browse files Browse the repository at this point in the history
psd images
  • Loading branch information
HendrixString authored Aug 31, 2023
2 parents c5009f3 + 6e20130 commit c112051
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 23 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@

# micro{tess} [![compile](https://github.com/micro-gl/micro-tess/actions/workflows/compile.yml/badge.svg)](https://github.com/micro-gl/micro-tess/actions/workflows/compile.yml)

**Fast**, **Slim**, **Embeddable**, **Allocator-aware**, **Headers files** only **`C++11`** geometry tesselation
library for vector graphics, that can run on any 32/64 bits computer with or without **FPU**.
**Fast**, **Slim**, **Embeddable**, **Allocator-aware**, **Headers files** only **`C++11`** geometry tesselation library for **vector graphics**, that can run on any 32/64 bits computer with or without **FPU**.
**No standard library required**.

check out our website at [micro-gl.github.io/docs/micro-tess/](https://micro-gl.github.io/docs/micro-tess)

<div align='center'>
<img src='assets/intro.png' style='opacity: 0.75; max-height: 200'/>
</div>

## Features

> **Language** &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Expand Down
Binary file added assets/intro.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/intro.psd
Binary file not shown.
9 changes: 5 additions & 4 deletions examples/example_bezier_curve_divider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ int main() {

// microgl drawing setup START
using Canvas24= canvas<bitmap<coder::RGB888_PACKED_32>>;
sampling::flat_color<> red{{255, 0, 0, 255}};
sampling::flat_color<> red{{226, 63, 151 , 255}};
Canvas24 canvas(W, H);
// microgl drawing setup END

Expand All @@ -53,15 +53,16 @@ int main() {
curve_divider::compute(curve.data(), output_vertices, algo_type, curve_type);
// Algorithm END

canvas.clear({255,255,255,255});
canvas.clear({60,60,60,255});
canvas.drawWuLinePath(
{0,0,0,255},
{255,255,255,255},
output_vertices.data(), output_vertices.size(),
false);

for (auto & p : output_vertices)
canvas.drawCircle<blendmode::Normal, porterduff::FastSourceOverOnOpaque, true>(
red, red, p.x, p.y, number{5}, number{0});
red, red, p.x, p.y,
number{10}, number{0});
};

auto render = [&](void*, void*, void*) -> void {
Expand Down
8 changes: 5 additions & 3 deletions examples/example_monotone_triangulation.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#define MICROGL_USE_EXTERNAL_MICRO_TESS
#include "src/example.h"
#include <microgl/samplers/linear_gradient_2_colors.h>
#include <microgl/canvas.h>
#include <microgl/bitmaps/bitmap.h>
#include <microgl/pixel_coders/RGB888_PACKED_32.h>
Expand Down Expand Up @@ -127,6 +128,7 @@ int main() {
// microgl drawing setup START
using Canvas24= canvas<bitmap<coder::RGB888_PACKED_32>>;
sampling::flat_color<> color_red{{255,0,0,255}};
sampling::linear_gradient_2_colors<315> gradient{{220,0,0}, {141 ,53 ,255 }};
Canvas24 canvas(W, H);
float t = 0;

Expand Down Expand Up @@ -158,9 +160,9 @@ int main() {
allocator);

// draw triangles batch
canvas.clear({255,255,255,255});
canvas.clear({60,60,60,255});
canvas.drawTriangles(
color_red,
gradient,
matrix_3x3<number>::identity(),
polygon.data(),
(vertex2<number> *)nullptr,
Expand All @@ -172,7 +174,7 @@ int main() {

// draw triangulation
canvas.drawTrianglesWireframe(
{0,0,0,255},
{0,0,0,50},
matrix_3x3<number>::identity(),
polygon.data(),
output_indices.data(),
Expand Down
24 changes: 14 additions & 10 deletions examples/example_path_fill.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <microgl/bitmaps/bitmap.h>
#include <microgl/pixel_coders/RGB888_PACKED_32.h>
#include <microgl/samplers/flat_color.h>
#include <microgl/samplers/linear_gradient_2_colors.h>

#include <micro-tess/path.h>
#include <micro-tess/std_rebind_allocator.h>
Expand Down Expand Up @@ -128,6 +129,7 @@ int main() {
using index = unsigned int;
using Canvas24 = canvas<bitmap<RGB888_PACKED_32>, CANVAS_OPT_64_BIT_FREE>;
sampling::flat_color<> color_red {{255,0,255,255}};
sampling::linear_gradient_2_colors<315> gradient{{220,0,0}, {141 ,53 ,255 }};
Canvas24 canvas(640, 480);
// microgl drawing setup END

Expand All @@ -141,9 +143,10 @@ int main() {
microtess::tess_quality::prettier_with_extra_vertices,
true, debug);

canvas.clear({255, 255, 255, 255});
// canvas.clear({255, 255, 255, 255});
canvas.clear({60, 60, 60, 255});
canvas.drawTriangles<blendmode::Normal, porterduff::FastSourceOverOnOpaque, true>(
color_red,
gradient,
matrix_3x3<number>::identity(),
buffers.output_vertices.data(),
static_cast<vertex2<number> *>(nullptr),
Expand All @@ -153,26 +156,27 @@ int main() {
buffers.output_indices_type,
255);

if(debug) {
if(true) {
canvas.drawTrianglesWireframe(
{0, 0, 0, 255}, matrix_3x3<number>::identity(),
{38, 38, 38, 255},
matrix_3x3<number>::identity(),
buffers.output_vertices.data(),
buffers.output_indices.data(),
buffers.output_indices.size(),
buffers.output_indices_type,
40);
for (index ix = 0; ix < buffers.DEBUG_output_trapezes.size(); ix+=4)
canvas.drawWuLinePath<number>({0, 0, 0, 255},
&buffers.DEBUG_output_trapezes[ix], 4, true);
50);
// for (index ix = 0; ix < buffers.DEBUG_output_trapezes.size(); ix+=4)
// canvas.drawWuLinePath<number>({255, 255, 255, 255},
// &buffers.DEBUG_output_trapezes[ix], 4, true);
}
};

auto render = [&](void*, void*, void*) -> void {
// static auto path = path_star_2<number>();
// static auto path = path_star<number>();
static auto path = path_star<number>();
// static auto path = path_rects<number>();
// auto path = path_arc_animation<number>();
static auto path = path_test<number>();
// static auto path = path_test<number>();

render_path(path);
};
Expand Down
10 changes: 6 additions & 4 deletions examples/example_stroke_dash_tessellation.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#define MICROGL_USE_EXTERNAL_MICRO_TESS
#include "src/example.h"
#include <microgl/samplers/linear_gradient_2_colors.h>
#include <microgl/canvas.h>
#include <microgl/bitmaps/bitmap.h>
#include <microgl/math/Q.h>
Expand Down Expand Up @@ -122,6 +123,7 @@ int main() {
// microgl drawing setup START
using Canvas24= canvas<bitmap<coder::RGB888_PACKED_32>, CANVAS_OPT_64_BIT_FREE>;
sampling::flat_color<> color_red{{255,0,0,255}};
sampling::linear_gradient_2_colors<315> gradient{{220,0,0}, {141 ,53 ,255 }};
Canvas24 canvas(640, 480);
// microgl drawing setup END

Expand Down Expand Up @@ -167,22 +169,22 @@ int main() {
&output_boundary_buffer);

// draw triangles batch
canvas.clear({255,255,255,255});
canvas.clear({60,60,60,255});
canvas.drawTriangles<blendmode::Normal, porterduff::FastSourceOverOnOpaque, true>(
color_red,
gradient,
matrix_3x3<number>::identity(),
output_vertices.data(),
(vertex2<number> *)nullptr,
output_indices.data(),
output_boundary_buffer.data(),
output_indices.size(),
output_triangles_type,
255/2
255/1
);

// return;
canvas.drawTrianglesWireframe(
{0,0,0,255},
{0,0,0,50},
matrix_3x3<number>::identity(),
output_vertices.data(),
output_indices.data(),
Expand Down

0 comments on commit c112051

Please sign in to comment.