Skip to content

Repository files navigation

BitmapPlusPlus

Ruby bindings for BitmapPlusPlus, a simple, fast, and lightweight C++ library for creating and manipulating 24-bit BMP images.

About This Project

This gem serves as both a useful library and a practical example of using Rice to create Ruby bindings for C++ libraries.

The binding code in ext/BitmapPlusPlus-rb.cpp is well-commented and can serve as a reference for your own Rice projects.

Features

  • Create and manipulate 24-bit BMP images
  • Drawing primitives: lines, rectangles, triangles, circles
  • Fill operations for shapes
  • Pixel-level access and manipulation
  • Image transformations: flip (horizontal/vertical), rotate (90 degrees)
  • Load and save BMP files
  • 32 predefined colors
  • Iterator support for pixel enumeration

Quick Start

require'bitmap-plus-plus'# Create a new 640x480 bitmapimage=Bmp::Bitmap.new(640,480)# Clear with a background colorimage.clear(Bmp::White)# Draw a red rectangleimage.draw_rect(10,10,100,50,Bmp::Red)# Draw a filled blue circleimage.fill_circle(200,200,50,Bmp::Blue)# Save to fileimage.save("output.bmp")

Installation

gem install bitmap-plus-plus --preset <linux-release|macos-release|windows-release>

For detailed installation options including building from source and CMake builds, see the Installation Guide.

Documentation

Full documentation is available at https://ruby-rice.github.io/BitmapPlusPlus-ruby/

License

This gem is available under the BSD-2-Clause License.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Acknowledgments

  • BitmapPlusPlus - The original C++ library by Bader Ouaich
  • Rice - C++ to Ruby binding library

About

Ruby extension for BitmapPlusPlus library

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages