TIARa is simple rasterizer to draw shapes, like: points, lines, polygons, polylines and arcs.
- Points
- Lines
- DDA (thickness 1-N)
- Bresenham (thickness 1-N)
- Xiaolin
- Arcs
- Circle (thickness 1-N)
- Semicircle (thickness 1-N, degree 0-360)
- Fills
- Polygon scan-line
- Boundary fill
- Flood fill
- Antialiasing
- Convolution (with gamma correction)
- Palettes
- Viewport
The instructions below shows how to compile and execute the project.
mkdir build
cd build
cmake ..
cd ..
./bin/tiara [file_name_of_descriptor]The description below shows how to draw using tiara xml descriptor.
The default scenes produces an image with 800wx600h, with black background and have the following structure:
<scene>
</scene>- width: Width of image [OPTIONAL]
- height: Height of image [OPTIONAL]
- name: File path of image result [OPTIONAL]
- centerx : Define the center of image on axis-x [OPTIONAL]
- centery : Define the center of image on axis-y [OPTIONAL]
<scene width="300" height="200" name="scenes/images/circle" centerx="150" centery="100">
</scene>Paint a pixel (R,G,B) of a scene with specific color.
- x: Point on axis-x
- y: Point on axis-y
- color: Color of the point [OPTIONAL]
<scene width="10" height="10" name="scenes/images/point">
<point x="5" y="5" color="yellow"/>
</scene>Create a line between two points with specific color.
- x1: First point on axis-x
- y1: First point on axis-y
- x2: Second point on axis-x
- y2 : Second point on axis-y
- color : Color of the line [OPTIONAL]
- thickness : Define the thickness of line [OPTIONAL]
- alg : Define the line algorithm implementation (dda or bresenham) [OPTIONAL]
<scene width="300" height="200" name="scenes/images/line">
<line x1="10" y1="10" x2="150" y2="150" color="red" thickness="10" alg="Bresenham"/>
</scene>Create a closed segment of lines, where the last point connects to the first.
- border-color*: Define the color of border. [OPTIONAL]
- fill-color*: Define the inside color. [OPTIONAL]
- thickness : Define the thickness of polygon border [OPTIONAL]
- p : Define a vertex of polygon [OPTIONAL]
*: These parameter are optional, but it is necessary provide at least one of them.
<scene name="scenes/images/polygon">
<polygon border-color="white" fill-color="red" thickness="1">
<p x="600" y="200"/>
<p x="750" y="180"/>
<p x="400" y="500"/>
<p x="790" y="350"/>
</polygon>
</scene>Create a unclosed segment of lines. But it may be closed if the first and the last points are equals.
- color: Define the color of border. [OPTIONAL]
- thickness : Define the thickness border [OPTIONAL]
- p : Define a vertex of polygon [OPTIONAL]
<scene width="300" height="200" name="scenes/images/polyline">
<polyline color="red" thickness="1">
<p x="75" y="200"/>
<p x="75" y="50"/>
<p x="100" y="100"/>
<p x="200" y="100"/>
<p x="225" y="50"/>
<p x="225" y="200"/>
</polyline>
</scene>Create circles or arcs between 0-360 degrees.
- x: Center point on axis-x
- y: Center point on axis-y
- radius: Define the the radius of arc
- border-color*: Define the color of border. [OPTIONAL]
- fill-color*: Define the inside color. [OPTIONAL]
- thickness : Define the thickness of polygon border [OPTIONAL]
- trigger : Define a point to fire the filling. [OPTIONAL]
<scene width="300" height="200" name="scenes/images/arc" centerx="150" centery="100">
<arc x="0" y="0" radius="20" border-color="olive" fill-color="purple" thickness="5">
<trigger x="0" y="0"/>
</arc>
</scene>Provides for the scene a color palette* to use as names of colors.
*: Each color of file has to be the following structure: [color_name] [r_color] [g_color] [b_color]
Ex:
red 255 0 0
green 0 255 0
blue 0 0 255
- file: File path of color palete
<scene>
<pallete file="palletes/paleta.txt"/>
</scene>Fill the canvas with a color until find another, which was set as limit color. It can be used to fill the background color.
- x: Center point on axis-x
- y: Center point on axis-y
- fill-color*: Color of filling.
- limit-color*: Limit color of algorithm.
<scene>
<trigger x="0" y="0" limit-color="white" fill-color="white"/>
</scene>For more details, see the reference.
Vinicius Campos 👀 |
|---|
This project is licensed under the MIT License - see the LICENSE.md file for details