# Bitmappers Companion

zine/book about bitmap drawing algorithms and math with code examples in Rust

# A Bitmapper's Companion - zine/book about bitmap drawing algorithms and math with code examples in Rust

A small zine/book written in LaTeX. In progress. See Building section below for how to build.

View current PDF build here

Click to show planned contents
1. Introduction
• Data representation
• Displaying pixels to your screen
• Bits to byte pixels
• Including xbm files in Rust
1. Points And Lines
• Distance between two points
• Equations of a line
• Line through a point π = (π₯π, π¦π) and a slope π
• Line through two points
• Distance from a point to a line
• Using the implicit equation form
• Using an πΏ defined by two points π1, π2
• Using an πΏ defined by a point ππ and angle Μπ
• Find perpendicular to line that passes through given point
• Angle between two lines
• Intersection of two lines
• Line equidistant from two points
• Normal to a line through a point
1. Points And Line Segments
• Drawing a line segment from its two endpoints
• Drawing line segments with width
• Intersection of two line segments
• Fast intersection of two line segments
• Points, Lines and Circles
• Equations of a circle
• Bounding circle
1. Curves other than circles
• Parametric elliptical arcs
1. Points, Lines and Shapes
• Union, intersection and difference of polygons
• Centroid of polygon
• Polygon clipping
• Triangle filling
• Flood filling
1. Vectors, matrices and transformations
• Rotation of a bitmap
• Fast 2D Rotation
• 90Β° Rotation of a bitmap by parallel recursive subdivision
• Magnification/Scaling
• Smoothing enlarged bitmaps
• Stretching lines of bitmaps
• Mirroring
• Shearing
• The relationship between shearing factor and angle
• Projections
• Faster Drawing a line segment from its two endpoints using Sym- metry
• Joining the ends of two wide line segments together
• Composing monochrome bitmaps with separate alpha channel data
• Orthogonal connection of two points
• Join segments with round corners
• Faster line clipping
• Space-filling Curves
• Hilbert curve
• SierpiΕski curve
• Peano curve
• Z-order curve
• flowsnake curve
• Dithering
• Floyd-Steinberg
• Atkinson dithering
• Marching squares

## Building

Run `make` (might need to run it twice), output will be in the `./build` directory.

To run the rust example binaries, first you can inspect them with `ls ./src/bin/`, for example:

``````\$ ls ./src/bin
atkinsondither.rs
beams.rs
bezierglyph.rs
bezier.rs
boundingcircle.rs
bresenham.rs
distance_between_two_points.rs
floyddither.rs
fonts.rs
hilbert.rs
introduction.rs
rotation.rs
scale.rs
shearing.rs
smooth_scale.rs
xbmtors.rs
zcurve.rs
``````

Then execute one with `cargo run --bin` for example `cargo run --bin atkinsondither`.

Open Source Agenda is not affiliated with "Bitmappers Companion" Project. README Source: epilys/bitmappers-companion
Stars
44
Open Issues
0
Last Commit
1 year ago
Repository