Code Monkey home page Code Monkey logo

bitmappers-companion's Introduction

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
  • Loading graphics files in Rust
  • 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
  • Bรฉzier curves
  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
  1. Addendum
  • 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

Samples

cover_sample

thumb_sample

Cover

Thumb index overview

frontmatter_sample

frontmatter_sample2

Frontmattercontents

page_sample

bezier interactive demo

Page spreadBezier interactive demo

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.

bitmappers-companion's People

Contributors

epilys avatar joseluis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

joseluis

bitmappers-companion's Issues

Please replace image of Lena Forsรฉn

Hey there. Thank you for writing this book. It is interesting and helpful.

In the section on Atkinson Dithering, you use a detail from a photograph of Lena Forsรฉn that was an old standard example for graphics texts. Lena has requested that her image no longer be used for this purpose. It is also an image that many see as disrespectful to women when used in this way. See https://en.wikipedia.org/wiki/Lenna

For that reason I request that you replace that example with a different image.

Thanks again for your work on this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.