piano_keyboard

Crates.iopiano_keyboard
lib.rspiano_keyboard
version0.2.3
sourcesrc
created_at2019-02-16 18:06:47.851159
updated_at2020-04-07 13:48:24.631948
descriptionProvides graphical representation of a piano keyboard
homepagehttps://github.com/gin66/piano_keyboard
repositoryhttps://github.com/gin66/piano_keyboard
max_upload_size
id115198
size83,950
(gin66)

documentation

https://docs.rs/releases/search?query=piano_keyboard

README

Piano_Keyboard

Build Status

This crate provides the graphical elements in order to draw a piano keyboard with close to realistic, pixel accurate appearance.

Reference for the dimension is this internet image: octave drawing

The dimensions described have been used to create the elements of a piano keyboard like for an octave like this: img

It is visible, that between white keys and even between white and black keys a gap is ensured.

The graphical representation only provides the white and black areas for the keys. Those areas are represented by pixel accurate, non-overlapping rectangles. No aliasing or similar is done on this level.

Pixel accurate has the consequence, that in order to fill the requested width, any gaps, white or black keys may need to be modified by up to one pixel. Those changes may or may not be visible. If no adjustments have been made for a given width and key range is reported by the function is_perfect()

If the enlargement of various elements does not succeed, then as last resort technique the outter gaps are enlarged.

The gap between white and black keys can be removed by an option of the KeyboardBuilder.

The interface is prepared to be compatible for an extension towards a 3d keyboard. That's why the returned keyboard is called Keyboard2D and the related build function is called build2d().

Thanks for contribution

Commit count: 37

cargo fmt