Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/k-s-a/2d-bitmap-fun
https://github.com/k-s-a/2d-bitmap-fun
Last synced: 5 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/k-s-a/2d-bitmap-fun
- Owner: K-S-A
- License: mit
- Created: 2018-08-27T15:41:18.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-02-05T15:20:31.000Z (11 months ago)
- Last Synced: 2024-12-29T13:26:01.527Z (10 days ago)
- Language: Ruby
- Size: 43 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.com/K-S-A/2d-bitmap-fun.svg?branch=master)](https://travis-ci.com/K-S-A/2d-bitmap-fun)
[![Test Coverage](https://api.codeclimate.com/v1/badges/79dfc961451bdb33db81/test_coverage)](https://codeclimate.com/github/K-S-A/2d-bitmap-fun/test_coverage)
[![Maintainability](https://api.codeclimate.com/v1/badges/79dfc961451bdb33db81/maintainability)](https://codeclimate.com/github/K-S-A/2d-bitmap-fun/maintainability)
[![Depfu](https://badges.depfu.com/badges/98b38f769188cb97c7968a2ea8951db3/overview.svg)](https://depfu.com/github/K-S-A/2d-bitmap-fun?project=Bundler)
[![Inch CI](https://inch-ci.org/github/K-S-A/2d-bitmap-fun.svg?branch=master&style=flat)](https://inch-ci.org/github/K-S-A/2d-bitmap-fun)# 2D-bitmap-fun
`Bitmap` class implements some primitive operations on images.
Image is a rectangle canvas where (`0`, `0`) is the top left coordinate and (`width - 1`, `height - 1`) is bottom right coordinate. Color is a character of latin alphabet. At the beginning all images are transperent.## Installation
Execute:```console
$ bundle insall
```## Usage
Open console:
```console
$ irb -I lib -r bitmap.rb
```Basic usage:
```ruby
bitmap = Bitmap.new(10, 10)
# => #>bitmap.draw_pixel(2, 6, 'K')
# => "K"bitmap.pixel(3, 7)
# => " "bitmap.draw_line(3, 7, 1, 2, 'Y')
# => [[1, 2], [1, 3], [2, 4], [2, 5], [3, 6], [3, 7]]bitmap.picture
# => " \n \n Y \n Y \n Y \n Y \n KY \n Y \n \n "bitmap.picture(3, 3, 7, 7)
# => " \n \n \nY \nY "bitmap.clear
# => #>bitmap.picture
# => " \n \n \n \n \n \n \n \n \n "
```
## TestsTo run RSpec tests
* `bundle exec rspec` or just `rspec`
* run any test file directly, e.g. `rspec spec/area_spec.rb`## Development
After checking out the repo, run `bundle install` to install dependencies. Then, run `rspec` to run the tests. You can also run `irb -I lib` for an interactive prompt that will allow you to experiment.
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/K-S-A/2d-bitmap-fun. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
## License
The lib is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
## Code of Conduct
Everyone interacting in the A project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/K-S-A/2d-bitmap-fun/blob/master/CODE_OF_CONDUCT.md).