bitmap-plus-plus 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +40 -0
- data/LICENSE +25 -0
- data/README.md +75 -0
- data/examples/colormaps.rb +1857 -0
- data/examples/draw_primitives.rb +53 -0
- data/examples/julia.rb +68 -0
- data/examples/mandelbrot.rb +68 -0
- data/examples/random_colors.rb +37 -0
- data/examples/transformations.rb +84 -0
- data/ext/BitmapPlusPlus-rb.cpp +420 -0
- data/ext/BitmapPlusPlus-rb.hpp +11 -0
- data/ext/BitmapPlusPlus.hpp +659 -0
- data/ext/CMakeLists.txt +170 -0
- data/ext/CMakePresets.json +209 -0
- data/lib/bitmap-plus-plus/version.rb +3 -0
- data/lib/bitmap-plus-plus.rb +3 -0
- data/sig/Bmp/Bitmap.rbs +39 -0
- data/sig/Bmp/BitmapHeader.rbs +22 -0
- data/sig/Bmp/Exception.rbs +5 -0
- data/sig/Bmp/Pixel.rbs +16 -0
- data/sig/Rice/Arg.rbs +6 -0
- data/sig/Rice/Buffer/342/211/272Rice/352/236/211/352/236/211detail/352/236/211/352/236/211ParameterAbstract/342/210/227/342/211/273.rbs +15 -0
- data/sig/Rice/Buffer/342/211/272char/342/211/273.rbs +16 -0
- data/sig/Rice/ModuleRegistry.rbs +5 -0
- data/sig/Rice/Native.rbs +9 -0
- data/sig/Rice/NativeKind.rbs +20 -0
- data/sig/Rice/NativeRegistry.rbs +5 -0
- data/sig/Rice/Parameter.rbs +7 -0
- data/sig/Rice/Pointer/342/211/272Rice/352/236/211/352/236/211detail/352/236/211/352/236/211ParameterAbstract/342/210/227/342/211/273.rbs +5 -0
- data/sig/Rice/Pointer/342/211/272char/342/211/273.rbs +5 -0
- data/sig/Rice/Reference/342/211/272char/342/211/273.rbs +6 -0
- data/sig/Rice/Reference/342/211/272int/342/211/273.rbs +6 -0
- data/sig/Rice/Reference/342/211/272unsigned/302/240Int64/342/211/273.rbs +6 -0
- data/sig/Rice/Registries.rbs +8 -0
- data/sig/Rice/TypeRegistry.rbs +5 -0
- data/sig/Std/Exception.rbs +6 -0
- data/sig/Std/Filesystem/Path.rbs +6 -0
- data/sig/Std/RuntimeError.rbs +6 -0
- data/sig/Std/Vector/342/211/272Rice/352/236/211/352/236/211detail/352/236/211/352/236/211ParameterAbstract/302/240const/342/210/227/342/211/273.rbs +33 -0
- metadata +116 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 26cc798a428abcd5dfb6804b130b93edd71bb29af43a8216c0ef0dca5ee8c507
|
|
4
|
+
data.tar.gz: b8d86daa2e8a0365f797bfd19072474dc8fdb5990b4d53848ba926f23d70d32d
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 8e16e38f6d6062c00a89f5a02ec861adedd8042a895c57180442a335d68cfea5633251a1dff8879758da1a4fb3f0ee007802b4af309ca607503a4f35a3bafa86
|
|
7
|
+
data.tar.gz: db0ae17cd9a1898cae31ccdef8442e0fbfbb462809f4e6909060ddbb6cc3aeb14a84c655bab701a5ae9841dd77b50c4fedeb911f25a5f512e7af5dc374146090
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [1.0.0] - 2025-12-29
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- Initial release of BitmapPlusPlus Ruby bindings
|
|
7
|
+
- Complete Ruby bindings for the BitmapPlusPlus C++ library using Rice
|
|
8
|
+
- Support for creating and manipulating 24-bit BMP images
|
|
9
|
+
- Drawing primitives:
|
|
10
|
+
- `draw_line` - Draw lines using Bresenham's algorithm
|
|
11
|
+
- `draw_rect` / `fill_rect` - Draw rectangle outlines and filled rectangles
|
|
12
|
+
- `draw_triangle` / `fill_triangle` - Draw triangle outlines and filled triangles
|
|
13
|
+
- `draw_circle` / `fill_circle` - Draw circle outlines and filled circles using midpoint algorithm
|
|
14
|
+
- Pixel manipulation:
|
|
15
|
+
- `get(x, y)` / `set(x, y, color)` - Get/set pixels by coordinates
|
|
16
|
+
- `[]` / `[]=` - Array-style access by linear index
|
|
17
|
+
- `Bmp::Pixel` class with RGB component access
|
|
18
|
+
- Image transformations (immutable, return new bitmaps):
|
|
19
|
+
- `flip_v` - Vertical flip
|
|
20
|
+
- `flip_h` - Horizontal flip
|
|
21
|
+
- `rotate_90_left` - 90-degree counter-clockwise rotation
|
|
22
|
+
- `rotate_90_right` - 90-degree clockwise rotation
|
|
23
|
+
- File I/O:
|
|
24
|
+
- `save(filename)` - Save to BMP file
|
|
25
|
+
- `load(filename)` - Load from BMP file
|
|
26
|
+
- Constructor accepts filename to load on creation
|
|
27
|
+
- Iterator support:
|
|
28
|
+
- `each` - Iterate over all pixels
|
|
29
|
+
- `each_reverse` - Reverse iteration
|
|
30
|
+
- 32 predefined color constants (Aqua, Beige, Black, Blue, etc.)
|
|
31
|
+
- `Bmp::BitmapHeader` struct for accessing BMP file header information
|
|
32
|
+
- `Bmp::Exception` for error handling
|
|
33
|
+
- RBS type signatures for static type checking
|
|
34
|
+
- Minitest test suite
|
|
35
|
+
- Example scripts (fractals, random colors, drawing primitives)
|
|
36
|
+
|
|
37
|
+
### Dependencies
|
|
38
|
+
- Ruby >= 3.0.0
|
|
39
|
+
- Rice >= 4.8 (C++ binding library)
|
|
40
|
+
- C++17 compatible compiler
|
data/LICENSE
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
Copyright (C) 2025 Charlie Savage
|
|
2
|
+
|
|
3
|
+
All rights reserved.
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions
|
|
7
|
+
are met:
|
|
8
|
+
|
|
9
|
+
1. Redistributions of source code must retain the above copyright
|
|
10
|
+
notice, this list of conditions and the following disclaimer.
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
12
|
+
notice, this list of conditions and the following disclaimer in the
|
|
13
|
+
documentation and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
16
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
17
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
18
|
+
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
19
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
20
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
21
|
+
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
22
|
+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
23
|
+
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
24
|
+
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
25
|
+
SUCH DAMAGE.
|
data/README.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# BitmapPlusPlus
|
|
2
|
+
|
|
3
|
+
Ruby bindings for [BitmapPlusPlus](https://github.com/baderouaich/BitmapPlusPlus), a simple, fast, and lightweight C++ library for creating and manipulating 24-bit BMP images.
|
|
4
|
+
|
|
5
|
+
## About This Project
|
|
6
|
+
|
|
7
|
+
This gem serves as both a useful library and a **practical example of using [Rice](https://github.com/ruby-rice/rice) to create Ruby bindings for C++ libraries**.
|
|
8
|
+
|
|
9
|
+
The binding code in `ext/BitmapPlusPlus-rb.cpp` is well-commented and can serve as a reference for your own Rice projects.
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- Create and manipulate 24-bit BMP images
|
|
14
|
+
- Drawing primitives: lines, rectangles, triangles, circles
|
|
15
|
+
- Fill operations for shapes
|
|
16
|
+
- Pixel-level access and manipulation
|
|
17
|
+
- Image transformations: flip (horizontal/vertical), rotate (90 degrees)
|
|
18
|
+
- Load and save BMP files
|
|
19
|
+
- 32 predefined colors
|
|
20
|
+
- Iterator support for pixel enumeration
|
|
21
|
+
|
|
22
|
+
## Quick Start
|
|
23
|
+
|
|
24
|
+
```ruby
|
|
25
|
+
require 'bitmap-plus-plus'
|
|
26
|
+
|
|
27
|
+
# Create a new 640x480 bitmap
|
|
28
|
+
image = Bmp::Bitmap.new(640, 480)
|
|
29
|
+
|
|
30
|
+
# Clear with a background color
|
|
31
|
+
image.clear(Bmp::White)
|
|
32
|
+
|
|
33
|
+
# Draw a red rectangle
|
|
34
|
+
image.draw_rect(10, 10, 100, 50, Bmp::Red)
|
|
35
|
+
|
|
36
|
+
# Draw a filled blue circle
|
|
37
|
+
image.fill_circle(200, 200, 50, Bmp::Blue)
|
|
38
|
+
|
|
39
|
+
# Save to file
|
|
40
|
+
image.save("output.bmp")
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Installation
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
gem install bitmap-plus-plus --preset <linux-release|macos-release|windows-release>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
For detailed installation options including building from source and CMake builds, see the [Installation Guide](https://ruby-rice.github.io/BitmapPlusPlus-ruby/installation/).
|
|
50
|
+
|
|
51
|
+
## Documentation
|
|
52
|
+
|
|
53
|
+
Full documentation is available at **[https://ruby-rice.github.io/BitmapPlusPlus-ruby/](https://ruby-rice.github.io/BitmapPlusPlus-ruby/)**
|
|
54
|
+
|
|
55
|
+
- [Usage Guide](https://ruby-rice.github.io/BitmapPlusPlus-ruby/usage/) - Complete usage documentation
|
|
56
|
+
- [Examples](https://ruby-rice.github.io/BitmapPlusPlus-ruby/examples/) - Runnable example scripts
|
|
57
|
+
- [API Reference](https://ruby-rice.github.io/BitmapPlusPlus-ruby/api/Bmp/Bitmap/) - Detailed API documentation
|
|
58
|
+
- [Rice Guide](https://ruby-rice.github.io/BitmapPlusPlus-ruby/rice-guide/) - Rice features demonstrated in this project
|
|
59
|
+
|
|
60
|
+
## License
|
|
61
|
+
|
|
62
|
+
This gem is available under the [BSD-2-Clause License](LICENSE).
|
|
63
|
+
|
|
64
|
+
## Contributing
|
|
65
|
+
|
|
66
|
+
1. Fork it
|
|
67
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
68
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
69
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
|
70
|
+
5. Create new Pull Request
|
|
71
|
+
|
|
72
|
+
## Acknowledgments
|
|
73
|
+
|
|
74
|
+
- [BitmapPlusPlus](https://github.com/baderouaich/BitmapPlusPlus) - The original C++ library by Bader Ouaich
|
|
75
|
+
- [Rice](https://github.com/ruby-rice/rice) - C++ to Ruby binding library
|