From 900322c1002375d597746855d451231c59ce1a30 Mon Sep 17 00:00:00 2001 From: Troy Sornson Date: Fri, 24 Mar 2023 08:55:19 -0600 Subject: [PATCH] Update README, update docs, support pluto and stumpy conversions --- Makefile | 2 +- README.md | 31 + docs/404.html | 116 +++- docs/CrImage.html | 148 +++-- docs/CrImage/ChannelType.html | 128 ++-- docs/CrImage/Color.html | 138 +++-- docs/CrImage/Exception.html | 126 ++-- docs/CrImage/Format.html | 120 ++-- docs/CrImage/Format/JPEG.html | 113 ++-- docs/CrImage/Format/Open.html | 120 ++-- docs/CrImage/Format/PNG.html | 113 ++-- docs/CrImage/Format/PPM.html | 120 ++-- docs/CrImage/Format/Save.html | 120 ++-- docs/CrImage/Format/WebP.html | 113 ++-- docs/CrImage/GrayscaleImage.html | 457 ++++++++++++-- docs/CrImage/GrayscaleImage/Pixel.html | 510 ++++++++++++++++ docs/CrImage/Image.html | 140 +++-- docs/CrImage/Mask.html | 178 ++++-- docs/CrImage/Operation.html | 120 ++-- docs/CrImage/Operation/BilinearResize.html | 122 ++-- docs/CrImage/Operation/BoxBlur.html | 122 ++-- docs/CrImage/Operation/Brightness.html | 122 ++-- docs/CrImage/Operation/ChannelSwap.html | 122 ++-- docs/CrImage/Operation/Contrast.html | 122 ++-- docs/CrImage/Operation/Crop.html | 128 ++-- docs/CrImage/Operation/Draw.html | 132 ++-- docs/CrImage/Operation/GaussianBlur.html | 122 ++-- docs/CrImage/Operation/HistogramEqualize.html | 124 ++-- .../HistogramEqualize/Histogram.html | 128 ++-- docs/CrImage/Operation/HorizontalBlur.html | 122 ++-- docs/CrImage/Operation/MaskApply.html | 130 ++-- docs/CrImage/Operation/VerticalBlur.html | 122 ++-- docs/CrImage/RGBAImage.html | 445 ++++++++++++-- docs/CrImage/RGBAImage/Pixel.html | 548 +++++++++++++++++ docs/CrImage/Region.html | 132 ++-- docs/Pluto.html | 331 ++++++++++ docs/Pluto/ImageGA.html | 567 ++++++++++++++++++ docs/Pluto/ImageRGBA.html | 567 ++++++++++++++++++ docs/StumpyCore.html | 414 +++++++++++++ docs/StumpyCore/Canvas.html | 429 +++++++++++++ docs/index.html | 144 +++-- docs/index.json | 2 +- docs/search-index.js | 2 +- sample.ppm | 79 +++ scripts/benchmark.cr | 2 + scripts/sample.cr | 2 +- scripts/stumpy_pluto_test.cr | 14 + shard.yml | 7 + src/all_formats.cr | 3 + src/cr-image/format/save.cr | 4 +- src/cr-image/grayscale_image.cr | 9 + src/cr-image/rgba_image.cr | 11 + src/docs.cr | 6 + src/lib-formats/bindings/lib_jpeg_turbo.cr | 92 +-- src/lib-formats/bindings/lib_spng.cr | 136 ++--- src/lib-formats/bindings/lib_webp.cr | 14 +- src/pluto.cr | 30 + src/stumpy.cr | 46 ++ 58 files changed, 7182 insertions(+), 1385 deletions(-) create mode 100644 docs/CrImage/GrayscaleImage/Pixel.html create mode 100644 docs/CrImage/RGBAImage/Pixel.html create mode 100644 docs/Pluto.html create mode 100644 docs/Pluto/ImageGA.html create mode 100644 docs/Pluto/ImageRGBA.html create mode 100644 docs/StumpyCore.html create mode 100644 docs/StumpyCore/Canvas.html create mode 100644 sample.ppm create mode 100644 scripts/stumpy_pluto_test.cr create mode 100644 src/all_formats.cr create mode 100644 src/docs.cr create mode 100644 src/pluto.cr create mode 100644 src/stumpy.cr diff --git a/Makefile b/Makefile index ee07b4e..67f6988 100644 --- a/Makefile +++ b/Makefile @@ -6,4 +6,4 @@ benchmark: .PHONY: docs docs: - crystal doc src/cr-image.cr + crystal doc src/docs.cr --project-name="Crystal Image" --source-refname=$(shell git rev-parse HEAD) diff --git a/README.md b/README.md index 359a971..e4127b2 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,9 @@ require "cr-image" require "cr-image/jpeg" require "cr-image/png" require "cr-image/webp" + +# Or, alternatively +require "cr-image/all_formats" ``` ### Example @@ -66,6 +69,34 @@ Yields this image: [See documentation](http://troy.sornson.io/cr-image/) for more examples. +### (Pluto)[https://github.com/phenopolis/pluto] and (Stumpy)[https://github.com/stumpycr/stumpy_core] Conversion + +If your library or application already uses Pluto or Stumpy and you want to use +some of the functionality of this library, CrImage also provides some optional +conversion methods: + +```crystal +require "cr-image/pluto" +pluto_image # => Pluto::ImageRGBA +pluto_image_rgba.to_crimage # => CrImage::RGBAImage + +cr_image # => CrImage::RGBAImage +cr_image.to_pluto # => Pluto::ImageRGBA +``` + +```crystal +require "cr-image/stumpy" +stumpy_canvas # => StumpyCore::Canvas +stumpy_canvas.to_crimage # => CrImage::RGBAImage + +cr_image # => CrImage::RGBAImage +cr_image.to_stumpy # => StumpyCore::Canvas +``` + +*NOTE:* Stumpy uses `UInt16` for its underlying raw image storage per channel per pixel, while Pluto and +CrImage uses `UInt8`. Converting from a Stumpy `Canvas` object to `RGBAImage` may lose quality if the original +image used 16 bit color channels (i.e. 16-bit PNG). Most image formats tend to use 8-bit color channels. + ## Development This requires `libwebp`, `libspng`, and `libturbojpeg` to run. Then: diff --git a/docs/404.html b/docs/404.html index cea4ff8..a27f97d 100644 --- a/docs/404.html +++ b/docs/404.html @@ -4,16 +4,16 @@ - - + + - - cr-image master + + Crystal Image master-dev @@ -34,12 +34,12 @@

- cr-image + Crystal Image

- master + master-dev
@@ -51,117 +51,142 @@

@@ -51,117 +51,142 @@

@@ -51,117 +51,142 @@

@@ -438,7 +488,7 @@


- [View source] + [View source]
@@ -454,7 +504,7 @@


- [View source] + [View source]
@@ -470,7 +520,7 @@


- [View source] + [View source]
@@ -486,7 +536,7 @@


- [View source] + [View source]
diff --git a/docs/CrImage/Color.html b/docs/CrImage/Color.html index 0cbdfb8..3d84dc3 100644 --- a/docs/CrImage/Color.html +++ b/docs/CrImage/Color.html @@ -4,16 +4,16 @@ - - + + - - CrImage::Color - cr-image master + + CrImage::Color - Crystal Image master-dev @@ -34,12 +34,12 @@

- cr-image + Crystal Image

- master + master-dev
@@ -51,117 +51,142 @@

@@ -434,7 +484,7 @@


- [View source] + [View source]
@@ -455,7 +505,7 @@


- [View source] + [View source]
@@ -485,7 +535,7 @@


- [View source] + [View source]
@@ -506,7 +556,7 @@


- [View source] + [View source]
@@ -522,7 +572,7 @@


- [View source] + [View source]
@@ -538,7 +588,7 @@


- [View source] + [View source]
@@ -559,7 +609,7 @@


- [View source] + [View source]
@@ -575,7 +625,7 @@


- [View source] + [View source]
@@ -591,7 +641,7 @@


- [View source] + [View source]
diff --git a/docs/CrImage/Exception.html b/docs/CrImage/Exception.html index c028f7f..62cef44 100644 --- a/docs/CrImage/Exception.html +++ b/docs/CrImage/Exception.html @@ -4,16 +4,16 @@ - - + + - - CrImage::Exception - cr-image master + + CrImage::Exception - Crystal Image master-dev @@ -34,12 +34,12 @@

- cr-image + Crystal Image

- master + master-dev
@@ -51,117 +51,142 @@

@@ -393,7 +443,7 @@


- [View source] + [View source]
@@ -409,7 +459,7 @@


- [View source] + [View source]
@@ -439,7 +489,7 @@


- [View source] + [View source]
diff --git a/docs/CrImage/Format.html b/docs/CrImage/Format.html index 9628e2e..7ae9ecd 100644 --- a/docs/CrImage/Format.html +++ b/docs/CrImage/Format.html @@ -4,16 +4,16 @@ - - + + - - CrImage::Format - cr-image master + + CrImage::Format - Crystal Image master-dev @@ -34,12 +34,12 @@

- cr-image + Crystal Image

- master + master-dev
@@ -51,117 +51,142 @@

@@ -51,57 +51,57 @@

diff --git a/docs/CrImage/Format/Open.html b/docs/CrImage/Format/Open.html index 4685cdf..e68f667 100644 --- a/docs/CrImage/Format/Open.html +++ b/docs/CrImage/Format/Open.html @@ -4,16 +4,16 @@ - - + + - - CrImage::Format::Open - cr-image master + + CrImage::Format::Open - Crystal Image master-dev @@ -34,12 +34,12 @@

- cr-image + Crystal Image

- master + master-dev
@@ -51,117 +51,142 @@

diff --git a/docs/CrImage/Format/PNG.html b/docs/CrImage/Format/PNG.html index 7cc5337..649dad8 100644 --- a/docs/CrImage/Format/PNG.html +++ b/docs/CrImage/Format/PNG.html @@ -4,16 +4,16 @@ - - + + - - CrImage::Format::PNG - cr-image master + + CrImage::Format::PNG - Crystal Image master-dev @@ -34,12 +34,12 @@

- cr-image + Crystal Image

- master + master-dev
@@ -51,57 +51,57 @@

diff --git a/docs/CrImage/Format/PPM.html b/docs/CrImage/Format/PPM.html index b7472a3..bb4d49d 100644 --- a/docs/CrImage/Format/PPM.html +++ b/docs/CrImage/Format/PPM.html @@ -4,16 +4,16 @@ - - + + - - CrImage::Format::PPM - cr-image master + + CrImage::Format::PPM - Crystal Image master-dev @@ -34,12 +34,12 @@

- cr-image + Crystal Image

- master + master-dev
@@ -51,117 +51,142 @@

diff --git a/docs/CrImage/Format/Save.html b/docs/CrImage/Format/Save.html index acfacd3..d80ae01 100644 --- a/docs/CrImage/Format/Save.html +++ b/docs/CrImage/Format/Save.html @@ -4,16 +4,16 @@ - - + + - - CrImage::Format::Save - cr-image master + + CrImage::Format::Save - Crystal Image master-dev @@ -34,12 +34,12 @@

- cr-image + Crystal Image

- master + master-dev
@@ -51,117 +51,142 @@

diff --git a/docs/CrImage/Format/WebP.html b/docs/CrImage/Format/WebP.html index 28097cb..c4c4981 100644 --- a/docs/CrImage/Format/WebP.html +++ b/docs/CrImage/Format/WebP.html @@ -4,16 +4,16 @@ - - + + - - CrImage::Format::WebP - cr-image master + + CrImage::Format::WebP - Crystal Image master-dev @@ -34,12 +34,12 @@

- cr-image + Crystal Image

- master + master-dev
@@ -51,57 +51,57 @@

diff --git a/docs/CrImage/GrayscaleImage.html b/docs/CrImage/GrayscaleImage.html index 1995e41..1050cad 100644 --- a/docs/CrImage/GrayscaleImage.html +++ b/docs/CrImage/GrayscaleImage.html @@ -4,16 +4,16 @@ - - + + - - CrImage::GrayscaleImage - cr-image master + + CrImage::GrayscaleImage - Crystal Image master-dev @@ -34,12 +34,12 @@

- cr-image + Crystal Image

- master + master-dev
@@ -51,117 +51,142 @@

@@ -1102,6 +1409,22 @@

Instance Method Detail

+
+
+ + def [](x : Int32, y : Int32) : Pixel + + # +
+ +
+
+ + [View source] + +
+
+
@@ -1118,7 +1441,7 @@


- [View source] + [View source]

@@ -1142,7 +1465,7 @@


- [View source] + [View source]

@@ -1163,7 +1486,7 @@


- [View source] + [View source]
@@ -1179,7 +1502,7 @@


- [View source] + [View source]
@@ -1200,7 +1523,7 @@


- [View source] + [View source]
@@ -1221,7 +1544,7 @@


- [View source] + [View source]
@@ -1242,7 +1565,7 @@


- [View source] + [View source]
@@ -1258,7 +1581,7 @@


- [View source] + [View source]
@@ -1274,7 +1597,7 @@


- [View source] + [View source]
@@ -1295,7 +1618,7 @@


- [View source] + [View source]
@@ -1320,7 +1643,7 @@


- [View source] + [View source]
@@ -1336,7 +1659,7 @@


- [View source] + [View source]
@@ -1360,7 +1683,7 @@


- [View source] + [View source]
@@ -1384,7 +1707,7 @@


- [View source] + [View source]
@@ -1414,7 +1737,7 @@


- [View source] + [View source]
@@ -1435,7 +1758,7 @@


- [View source] + [View source]
@@ -1456,7 +1779,7 @@


- [View source] + [View source]
@@ -1485,7 +1808,7 @@


- [View source] + [View source]
@@ -1506,7 +1829,7 @@


- [View source] + [View source]
@@ -1528,7 +1851,23 @@


- [View source] + [View source] + +
+ + +
+
+ + def to_stumpy : StumpyCore::Canvas + + # +
+ +
+
+ + [View source]
@@ -1553,7 +1892,7 @@


- [View source] + [View source]
@@ -1569,7 +1908,7 @@


- [View source] + [View source]
diff --git a/docs/CrImage/GrayscaleImage/Pixel.html b/docs/CrImage/GrayscaleImage/Pixel.html new file mode 100644 index 0000000..9e0d2eb --- /dev/null +++ b/docs/CrImage/GrayscaleImage/Pixel.html @@ -0,0 +1,510 @@ + + + + + + + + + + + + + + + + CrImage::GrayscaleImage::Pixel - Crystal Image master-dev + + + + + + + + +
+

+ + struct CrImage::GrayscaleImage::Pixel + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + cr-image/grayscale_image.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(gray : UInt8, alpha : UInt8) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def alpha : UInt8 + + # +
+ +
+
+ +
+
+ +
+
+ + def clone + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def copy_with(gray _gray = @gray, alpha _alpha = @alpha) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def gray : UInt8 + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/docs/CrImage/Image.html b/docs/CrImage/Image.html index 1f93cab..d07980d 100644 --- a/docs/CrImage/Image.html +++ b/docs/CrImage/Image.html @@ -4,16 +4,16 @@ - - + + - - CrImage::Image - cr-image master + + CrImage::Image - Crystal Image master-dev @@ -34,12 +34,12 @@

- cr-image + Crystal Image

- master + master-dev
@@ -51,117 +51,142 @@

@@ -469,7 +519,7 @@


- [View source] + [View source]
@@ -490,7 +540,7 @@


- [View source] + [View source]
@@ -511,7 +561,7 @@


- [View source] + [View source]
@@ -532,7 +582,7 @@


- [View source] + [View source]
@@ -553,7 +603,7 @@


- [View source] + [View source]
@@ -574,7 +624,7 @@


- [View source] + [View source]
@@ -595,7 +645,7 @@


- [View source] + [View source]
@@ -616,7 +666,7 @@


- [View source] + [View source]
@@ -637,7 +687,7 @@


- [View source] + [View source]
@@ -665,7 +715,7 @@


- [View source] + [View source]
diff --git a/docs/CrImage/Mask.html b/docs/CrImage/Mask.html index 32fdf60..6640260 100644 --- a/docs/CrImage/Mask.html +++ b/docs/CrImage/Mask.html @@ -4,16 +4,16 @@ - - + + - - CrImage::Mask - cr-image master + + CrImage::Mask - Crystal Image master-dev @@ -34,12 +34,12 @@

- cr-image + Crystal Image

- master + master-dev
@@ -51,117 +51,142 @@

@@ -599,7 +649,7 @@


- [View source] + [View source]
@@ -623,7 +673,7 @@


- [View source] + [View source]
@@ -644,7 +694,7 @@


- [View source] + [View source]
@@ -665,7 +715,7 @@


- [View source] + [View source]
@@ -686,7 +736,7 @@


- [View source] + [View source]
@@ -716,7 +766,7 @@


- [View source] + [View source]
@@ -737,7 +787,7 @@


- [View source] + [View source]
@@ -758,7 +808,7 @@


- [View source] + [View source]
@@ -779,7 +829,7 @@


- [View source] + [View source]
@@ -801,7 +851,7 @@


- [View source] + [View source]
@@ -826,7 +876,7 @@


- [View source] + [View source]
@@ -851,7 +901,7 @@


- [View source] + [View source]
@@ -876,7 +926,7 @@


- [View source] + [View source]
@@ -901,7 +951,7 @@


- [View source] + [View source]
@@ -922,7 +972,7 @@


- [View source] + [View source]
@@ -943,7 +993,7 @@


- [View source] + [View source]
@@ -964,7 +1014,7 @@


- [View source] + [View source]
@@ -980,7 +1030,7 @@


- [View source] + [View source]
@@ -1001,7 +1051,7 @@


- [View source] + [View source]
@@ -1017,7 +1067,7 @@


- [View source] + [View source]
@@ -1038,7 +1088,7 @@


- [View source] + [View source]
@@ -1062,7 +1112,7 @@


- [View source] + [View source]
@@ -1088,7 +1138,7 @@


- [View source] + [View source]
@@ -1133,7 +1183,7 @@


- [View source] + [View source]
@@ -1154,7 +1204,7 @@


- [View source] + [View source]
@@ -1175,7 +1225,7 @@


- [View source] + [View source]
@@ -1196,7 +1246,7 @@


- [View source] + [View source]
@@ -1217,7 +1267,7 @@


- [View source] + [View source]
@@ -1233,7 +1283,7 @@


- [View source] + [View source]
diff --git a/docs/CrImage/Operation.html b/docs/CrImage/Operation.html index a6585e9..49c2c00 100644 --- a/docs/CrImage/Operation.html +++ b/docs/CrImage/Operation.html @@ -4,16 +4,16 @@ - - + + - - CrImage::Operation - cr-image master + + CrImage::Operation - Crystal Image master-dev @@ -34,12 +34,12 @@

- cr-image + Crystal Image

- master + master-dev
@@ -51,117 +51,142 @@

@@ -51,117 +51,142 @@

@@ -380,7 +430,7 @@


- [View source] + [View source]
diff --git a/docs/CrImage/Operation/BoxBlur.html b/docs/CrImage/Operation/BoxBlur.html index ad10853..8436aa1 100644 --- a/docs/CrImage/Operation/BoxBlur.html +++ b/docs/CrImage/Operation/BoxBlur.html @@ -4,16 +4,16 @@ - - + + - - CrImage::Operation::BoxBlur - cr-image master + + CrImage::Operation::BoxBlur - Crystal Image master-dev @@ -34,12 +34,12 @@

- cr-image + Crystal Image

- master + master-dev
@@ -51,117 +51,142 @@

@@ -365,7 +415,7 @@


- [View source] + [View source]
diff --git a/docs/CrImage/Operation/Brightness.html b/docs/CrImage/Operation/Brightness.html index a42dc8c..c7ea586 100644 --- a/docs/CrImage/Operation/Brightness.html +++ b/docs/CrImage/Operation/Brightness.html @@ -4,16 +4,16 @@ - - + + - - CrImage::Operation::Brightness - cr-image master + + CrImage::Operation::Brightness - Crystal Image master-dev @@ -34,12 +34,12 @@

- cr-image + Crystal Image

- master + master-dev
@@ -51,117 +51,142 @@

@@ -363,7 +413,7 @@


- [View source] + [View source]
diff --git a/docs/CrImage/Operation/ChannelSwap.html b/docs/CrImage/Operation/ChannelSwap.html index 67a5e95..620c881 100644 --- a/docs/CrImage/Operation/ChannelSwap.html +++ b/docs/CrImage/Operation/ChannelSwap.html @@ -4,16 +4,16 @@ - - + + - - CrImage::Operation::ChannelSwap - cr-image master + + CrImage::Operation::ChannelSwap - Crystal Image master-dev @@ -34,12 +34,12 @@

- cr-image + Crystal Image

- master + master-dev
@@ -51,117 +51,142 @@

@@ -363,7 +413,7 @@


- [View source] + [View source]
diff --git a/docs/CrImage/Operation/Contrast.html b/docs/CrImage/Operation/Contrast.html index 4ca93a8..a355f2c 100644 --- a/docs/CrImage/Operation/Contrast.html +++ b/docs/CrImage/Operation/Contrast.html @@ -4,16 +4,16 @@ - - + + - - CrImage::Operation::Contrast - cr-image master + + CrImage::Operation::Contrast - Crystal Image master-dev @@ -34,12 +34,12 @@

- cr-image + Crystal Image

- master + master-dev
@@ -51,117 +51,142 @@

@@ -363,7 +413,7 @@


- [View source] + [View source]
diff --git a/docs/CrImage/Operation/Crop.html b/docs/CrImage/Operation/Crop.html index af14de2..217e39a 100644 --- a/docs/CrImage/Operation/Crop.html +++ b/docs/CrImage/Operation/Crop.html @@ -4,16 +4,16 @@ - - + + - - CrImage::Operation::Crop - cr-image master + + CrImage::Operation::Crop - Crystal Image master-dev @@ -34,12 +34,12 @@

- cr-image + Crystal Image

- master + master-dev
@@ -51,117 +51,142 @@

@@ -380,7 +430,7 @@


- [View source] + [View source]
@@ -396,7 +446,7 @@


- [View source] + [View source]
@@ -412,7 +462,7 @@


- [View source] + [View source]
@@ -428,7 +478,7 @@


- [View source] + [View source]
diff --git a/docs/CrImage/Operation/Draw.html b/docs/CrImage/Operation/Draw.html index 6592823..e574f54 100644 --- a/docs/CrImage/Operation/Draw.html +++ b/docs/CrImage/Operation/Draw.html @@ -4,16 +4,16 @@ - - + + - - CrImage::Operation::Draw - cr-image master + + CrImage::Operation::Draw - Crystal Image master-dev @@ -34,12 +34,12 @@

- cr-image + Crystal Image

- master + master-dev
@@ -51,117 +51,142 @@

@@ -400,7 +450,7 @@


- [View source] + [View source]
@@ -421,7 +471,7 @@


- [View source] + [View source]
@@ -437,7 +487,7 @@


- [View source] + [View source]
@@ -453,7 +503,7 @@


- [View source] + [View source]
@@ -469,7 +519,7 @@


- [View source] + [View source]
@@ -485,7 +535,7 @@


- [View source] + [View source]
diff --git a/docs/CrImage/Operation/GaussianBlur.html b/docs/CrImage/Operation/GaussianBlur.html index 795cec0..99f3f5e 100644 --- a/docs/CrImage/Operation/GaussianBlur.html +++ b/docs/CrImage/Operation/GaussianBlur.html @@ -4,16 +4,16 @@ - - + + - - CrImage::Operation::GaussianBlur - cr-image master + + CrImage::Operation::GaussianBlur - Crystal Image master-dev @@ -34,12 +34,12 @@

- cr-image + Crystal Image

- master + master-dev
@@ -51,117 +51,142 @@

@@ -365,7 +415,7 @@


- [View source] + [View source]
diff --git a/docs/CrImage/Operation/HistogramEqualize.html b/docs/CrImage/Operation/HistogramEqualize.html index 0488bfa..c142b5f 100644 --- a/docs/CrImage/Operation/HistogramEqualize.html +++ b/docs/CrImage/Operation/HistogramEqualize.html @@ -4,16 +4,16 @@ - - + + - - CrImage::Operation::HistogramEqualize - cr-image master + + CrImage::Operation::HistogramEqualize - Crystal Image master-dev @@ -34,12 +34,12 @@

- cr-image + Crystal Image

- master + master-dev
@@ -51,117 +51,142 @@

@@ -374,7 +424,7 @@


- [View source] + [View source]
@@ -390,7 +440,7 @@


- [View source] + [View source]
diff --git a/docs/CrImage/Operation/HistogramEqualize/Histogram.html b/docs/CrImage/Operation/HistogramEqualize/Histogram.html index 6d55e93..f4fc7af 100644 --- a/docs/CrImage/Operation/HistogramEqualize/Histogram.html +++ b/docs/CrImage/Operation/HistogramEqualize/Histogram.html @@ -4,16 +4,16 @@ - - + + - - CrImage::Operation::HistogramEqualize::Histogram - cr-image master + + CrImage::Operation::HistogramEqualize::Histogram - Crystal Image master-dev @@ -34,12 +34,12 @@

- cr-image + Crystal Image

- master + master-dev
@@ -51,117 +51,142 @@

@@ -415,7 +465,7 @@


- [View source] + [View source]
@@ -436,7 +486,7 @@


- [View source] + [View source]
@@ -457,7 +507,7 @@


- [View source] + [View source]
@@ -478,7 +528,7 @@


- [View source] + [View source]
diff --git a/docs/CrImage/Operation/HorizontalBlur.html b/docs/CrImage/Operation/HorizontalBlur.html index 7fb8fab..fc7c924 100644 --- a/docs/CrImage/Operation/HorizontalBlur.html +++ b/docs/CrImage/Operation/HorizontalBlur.html @@ -4,16 +4,16 @@ - - + + - - CrImage::Operation::HorizontalBlur - cr-image master + + CrImage::Operation::HorizontalBlur - Crystal Image master-dev @@ -34,12 +34,12 @@

- cr-image + Crystal Image

- master + master-dev
@@ -51,117 +51,142 @@

@@ -365,7 +415,7 @@


- [View source] + [View source]
diff --git a/docs/CrImage/Operation/MaskApply.html b/docs/CrImage/Operation/MaskApply.html index 2174747..c991f42 100644 --- a/docs/CrImage/Operation/MaskApply.html +++ b/docs/CrImage/Operation/MaskApply.html @@ -4,16 +4,16 @@ - - + + - - CrImage::Operation::MaskApply - cr-image master + + CrImage::Operation::MaskApply - Crystal Image master-dev @@ -34,12 +34,12 @@

- cr-image + Crystal Image

- master + master-dev
@@ -51,117 +51,142 @@

@@ -416,7 +466,7 @@


- [View source] + [View source]
@@ -437,7 +487,7 @@


- [View source] + [View source]
@@ -453,7 +503,7 @@


- [View source] + [View source]
@@ -474,7 +524,7 @@


- [View source] + [View source]
@@ -490,7 +540,7 @@


- [View source] + [View source]
diff --git a/docs/CrImage/Operation/VerticalBlur.html b/docs/CrImage/Operation/VerticalBlur.html index 07b14e1..b9335d6 100644 --- a/docs/CrImage/Operation/VerticalBlur.html +++ b/docs/CrImage/Operation/VerticalBlur.html @@ -4,16 +4,16 @@ - - + + - - CrImage::Operation::VerticalBlur - cr-image master + + CrImage::Operation::VerticalBlur - Crystal Image master-dev @@ -34,12 +34,12 @@

- cr-image + Crystal Image

- master + master-dev
@@ -51,117 +51,142 @@

@@ -365,7 +415,7 @@


- [View source] + [View source]
diff --git a/docs/CrImage/RGBAImage.html b/docs/CrImage/RGBAImage.html index 0e67811..afeabfa 100644 --- a/docs/CrImage/RGBAImage.html +++ b/docs/CrImage/RGBAImage.html @@ -4,16 +4,16 @@ - - + + - - CrImage::RGBAImage - cr-image master + + CrImage::RGBAImage - Crystal Image master-dev @@ -34,12 +34,12 @@

- cr-image + Crystal Image

- master + master-dev
@@ -51,117 +51,142 @@

@@ -1114,7 +1437,7 @@


- [View source] + [View source]
@@ -1130,7 +1453,7 @@


- [View source] + [View source]
@@ -1151,7 +1474,7 @@


- [View source] + [View source]
@@ -1172,7 +1495,7 @@


- [View source] + [View source]
@@ -1197,7 +1520,7 @@


- [View source] + [View source]
@@ -1213,7 +1536,7 @@


- [View source] + [View source]
@@ -1238,7 +1561,7 @@


- [View source] + [View source]
@@ -1254,7 +1577,7 @@


- [View source] + [View source]
@@ -1279,7 +1602,7 @@


- [View source] + [View source]
@@ -1295,7 +1618,7 @@


- [View source] + [View source]
@@ -1316,7 +1639,7 @@


- [View source] + [View source]
@@ -1340,7 +1663,23 @@


- [View source] + [View source] + +
+ + +
+
+ + def to_stumpy : StumpyCore::Canvas + + # +
+ +
+
+ + [View source]
@@ -1365,7 +1704,7 @@


- [View source] + [View source]
@@ -1381,7 +1720,7 @@


- [View source] + [View source]
diff --git a/docs/CrImage/RGBAImage/Pixel.html b/docs/CrImage/RGBAImage/Pixel.html new file mode 100644 index 0000000..cac6f5e --- /dev/null +++ b/docs/CrImage/RGBAImage/Pixel.html @@ -0,0 +1,548 @@ + + + + + + + + + + + + + + + + CrImage::RGBAImage::Pixel - Crystal Image master-dev + + + + + + + + +
+

+ + struct CrImage::RGBAImage::Pixel + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + cr-image/rgba_image.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(red : UInt8, green : UInt8, blue : UInt8, alpha : UInt8) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def alpha : UInt8 + + # +
+ +
+
+ +
+
+ +
+
+ + def blue : UInt8 + + # +
+ +
+
+ +
+
+ +
+
+ + def clone + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def copy_with(red _red = @red, green _green = @green, blue _blue = @blue, alpha _alpha = @alpha) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def green : UInt8 + + # +
+ +
+
+ +
+
+ +
+
+ + def red : UInt8 + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/docs/CrImage/Region.html b/docs/CrImage/Region.html index 9a25163..cdef1b4 100644 --- a/docs/CrImage/Region.html +++ b/docs/CrImage/Region.html @@ -4,16 +4,16 @@ - - + + - - CrImage::Region - cr-image master + + CrImage::Region - Crystal Image master-dev @@ -34,12 +34,12 @@

- cr-image + Crystal Image

- master + master-dev
@@ -51,117 +51,142 @@

@@ -435,7 +485,7 @@


- [View source] + [View source]
@@ -470,7 +520,7 @@


- [View source] + [View source]
@@ -486,7 +536,7 @@


- [View source] + [View source]
@@ -502,7 +552,7 @@


- [View source] + [View source]
@@ -523,7 +573,7 @@


- [View source] + [View source]
@@ -558,7 +608,7 @@


- [View source] + [View source]
diff --git a/docs/Pluto.html b/docs/Pluto.html new file mode 100644 index 0000000..a3a9a6e --- /dev/null +++ b/docs/Pluto.html @@ -0,0 +1,331 @@ + + + + + + + + + + + + + + + + Pluto - cr-image master-dev + + + + + + + + +
+

+ + module Pluto + +

+ + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + lib/pluto/src/pluto.cr + +
+ + + lib/pluto/src/pluto/channel_type.cr + +
+ + + pluto.cr + +
+ + + + + + + + + + + + + + +
+ +
+ + + + + + + + + +
+ + + diff --git a/docs/Pluto/ImageGA.html b/docs/Pluto/ImageGA.html new file mode 100644 index 0000000..fbb1866 --- /dev/null +++ b/docs/Pluto/ImageGA.html @@ -0,0 +1,567 @@ + + + + + + + + + + + + + + + + Pluto::ImageGA - cr-image master-dev + + + + + + + + +
+

+ + class Pluto::ImageGA + +

+ + + + + + + + + + + +

+ + + + Included Modules +

+
    + +
  • Pluto::Format::JPEG
  • + +
  • Pluto::Format::PNG
  • + +
  • Pluto::Format::PPM
  • + +
  • Pluto::Format::WebP
  • + +
  • Pluto::Operation::BilinearResize
  • + +
  • Pluto::Operation::BoxBlur
  • + +
  • Pluto::Operation::Brightness
  • + +
  • Pluto::Operation::ChannelSwap
  • + +
  • Pluto::Operation::Contrast
  • + +
  • Pluto::Operation::Crop
  • + +
  • Pluto::Operation::GaussianBlur
  • + +
  • Pluto::Operation::HorizontalBlur
  • + +
  • Pluto::Operation::VerticalBlur
  • + +
+ + + + + + + + + + +

+ + + + Defined in: +

+ + + lib/pluto/src/pluto/image_ga.cr + +
+ + + pluto.cr + +
+ + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def to_crimage : CrImage::GrayscaleImage + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/docs/Pluto/ImageRGBA.html b/docs/Pluto/ImageRGBA.html new file mode 100644 index 0000000..249189a --- /dev/null +++ b/docs/Pluto/ImageRGBA.html @@ -0,0 +1,567 @@ + + + + + + + + + + + + + + + + Pluto::ImageRGBA - cr-image master-dev + + + + + + + + +
+

+ + class Pluto::ImageRGBA + +

+ + + + + + + + + + + +

+ + + + Included Modules +

+
    + +
  • Pluto::Format::JPEG
  • + +
  • Pluto::Format::PNG
  • + +
  • Pluto::Format::PPM
  • + +
  • Pluto::Format::WebP
  • + +
  • Pluto::Operation::BilinearResize
  • + +
  • Pluto::Operation::BoxBlur
  • + +
  • Pluto::Operation::Brightness
  • + +
  • Pluto::Operation::ChannelSwap
  • + +
  • Pluto::Operation::Contrast
  • + +
  • Pluto::Operation::Crop
  • + +
  • Pluto::Operation::GaussianBlur
  • + +
  • Pluto::Operation::HorizontalBlur
  • + +
  • Pluto::Operation::VerticalBlur
  • + +
+ + + + + + + + + + +

+ + + + Defined in: +

+ + + lib/pluto/src/pluto/image_rgba.cr + +
+ + + pluto.cr + +
+ + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def to_crimage : CrImage::RGBAImage + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/docs/StumpyCore.html b/docs/StumpyCore.html new file mode 100644 index 0000000..4052d27 --- /dev/null +++ b/docs/StumpyCore.html @@ -0,0 +1,414 @@ + + + + + + + + + + + + + + + + StumpyCore - Crystal Image master-dev + + + + + + + + +
+

+ + module StumpyCore + +

+ + + + + +

+ + + + Overview +

+ +

A module owned by StumpyCr

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + lib/stumpy_core/src/stumpy_core/canvas.cr + + +
+ + + + lib/stumpy_core/src/stumpy_core/rgba.cr + + +
+ + + + lib/stumpy_core/src/stumpy_core/rgba/css_constants.cr + + +
+ + + + lib/stumpy_core/src/stumpy_core/rgba/from_grayscale.cr + + +
+ + + + lib/stumpy_core/src/stumpy_core/rgba/from_hex.cr + + +
+ + + + lib/stumpy_core/src/stumpy_core/rgba/from_hsl_hsv.cr + + +
+ + + + lib/stumpy_core/src/stumpy_core/rgba/from_relative.cr + + +
+ + + + lib/stumpy_core/src/stumpy_core/rgba/from_rgba.cr + + +
+ + + + lib/stumpy_core/src/stumpy_core/rgba/mixing.cr + + +
+ + + + lib/stumpy_core/src/stumpy_core/utils.cr + + +
+ + + + stumpy.cr + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + + + + + + +
+ + + diff --git a/docs/StumpyCore/Canvas.html b/docs/StumpyCore/Canvas.html new file mode 100644 index 0000000..693f0e3 --- /dev/null +++ b/docs/StumpyCore/Canvas.html @@ -0,0 +1,429 @@ + + + + + + + + + + + + + + + + StumpyCore::Canvas - Crystal Image master-dev + + + + + + + + +
+

+ + class StumpyCore::Canvas + +

+ + + + + + + +

+ + + + Overview +

+ +

A canvas is 2D array of RGBA pixels

+

To create a canvas of size 400 x 200

+
canvas = StumpyCore::Canvas.new(400, 200)
+

The default background color is transparent, +but it can be passed in as a parameter or as a block +that returns the color value for each {x, y} pair.

+
canvas2 = StumpyCore::Canvas.new(400, 200, RGBA::WHITE)
+
canvas3 = StumpyCore::Canvas.new(256, 256) do |x, y|
+  RGBA.from_rgb_n(x, y, 255, 8)
+end
+

image

+

Because of the way pixels are stored in a Slice, +Canvases are limited to Int32::MAX = 2147483647 pixels in total, +e.g. a maximal size of 46340x46340 for a square image.

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + lib/stumpy_core/src/stumpy_core/canvas.cr + + +
+ + + + stumpy.cr + + +
+ + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def to_crimage : CrImage::RGBAImage + + # +
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/docs/index.html b/docs/index.html index 618f1f7..cac858f 100644 --- a/docs/index.html +++ b/docs/index.html @@ -4,16 +4,16 @@ - - + + - - cr-image master + + Crystal Image master-dev @@ -34,12 +34,12 @@

- cr-image + Crystal Image

- master + master-dev
@@ -51,117 +51,142 @@

    -
  • +
  • CrImage
      -
    • +
    • ChannelType
    • -
    • +
    • Color
    • -
    • +
    • Exception
    • -
    • +
    • Format
    • -
    • +
    • GrayscaleImage + + +
    • -
    • +
    • Image
    • -
    • +
    • Mask
    • -
    • +
    • Operation
        -
      • +
      • BilinearResize
      • -
      • +
      • BoxBlur
      • -
      • +
      • Brightness
      • -
      • +
      • ChannelSwap
      • -
      • +
      • Contrast
      • -
      • +
      • Crop
      • -
      • +
      • Draw
      • -
      • +
      • GaussianBlur
      • -
      • +
      • HistogramEqualize + + +
      • + +
      • + StumpyCore + + @@ -251,7 +301,10 @@

        require "cr-image"
         require "cr-image/jpeg"
         require "cr-image/png"
        -require "cr-image/webp"
        +require "cr-image/webp" + +# Or, alternatively +require "cr-image/all_formats"

        Yields this image:

        Cropped example of moon

        See documentation for more examples.

        +

        + +(Pluto)[https://github.com/phenopolis/pluto] and (Stumpy)[https://github.com/stumpycr/stumpy_core] Conversion

        +

        If your library or application already uses Pluto or Stumpy and you want to use +some of the functionality of this library, CrImage also provides some optional +conversion methods:

        +
        require "cr-image/pluto"
        +pluto_image # => Pluto::ImageRGBA
        +pluto_image_rgba.to_crimage # => CrImage::RGBAImage
        +
        +cr_image # => CrImage::RGBAImage
        +cr_image.to_pluto # => Pluto::ImageRGBA
        +
        require "cr-image/stumpy"
        +stumpy_canvas # => StumpyCore::Canvas
        +stumpy_canvas.to_crimage # => CrImage::RGBAImage
        +
        +cr_image # => CrImage::RGBAImage
        +cr_image.to_stumpy # => StumpyCore::Canvas
        +

        NOTE: Stumpy uses UInt16 for its underlying raw image storage per channel per pixel, while Pluto and +CrImage uses UInt8. Converting from a Stumpy Canvas object to RGBAImage may lose quality if the original +image used 16 bit color channels (i.e. 16-bit PNG). Most image formats tend to use 8-bit color channels.

        Crystal Image (Processing)

        \n\nThis shard aims to provide feature rich image processing abilities, both for the purpose of\nimage manipulation as well as feature / information extraction from those images.\n\nThe code here takes imense inspiration from [Pluto](https://github.com/phenopolis/pluto) and [Stumpy](https://github.com/stumpycr/stumpy_core), with\nan eventual goal to be able to convert between images of this and those libraries.\n\nAll sample images used are from [Unsplash](https://unsplash.com/).\n\n## Installation\n\n1. Add the dependency to your `shard.yml`:\n\n ```yaml\n dependencies:\n cr-image:\n github: vici37/cr-image\n ```\n\n2. Run `shards install`\n\n## Usage\n\nCrImage supports the formats:\n* PPM\n* JPEG (requires `libturbojpeg`)\n* PNG (requirens `libspng`)\n* WebP (requires `libwebp`)\n\nFor the formats that require a linked library, they must be `require`d explicitly:\n\n```crystal\nrequire \"cr-image\"\nrequire \"cr-image/jpeg\"\nrequire \"cr-image/png\"\nrequire \"cr-image/webp\"\n```\n\n### Example\n\nAssuming an image `moon.jpg` already exists\n\n\"Picture\n\n```crystal\nrequire \"cr-image\"\n\nimage = CrImage::RGBAImage.open(\"moon.jpg\")\n\n# create a mask identifying all pixels with light (i.e. the moon)\nmoon_mask = image\n .to_gray\n .threshold(8) # pixels are UInt8, with 0 as black and 255 as white\n\n# Crop out the moon from the image, and save it to a new file\nimage.crop(\n moon_mask.region # smallest area that encompasses all true bits in mask\n).save(\"moon_cropped.jpg\")\n\n```\n\nYields this image:\n\n\"Cropped\n\n[See documentation](http://troy.sornson.io/cr-image/) for more examples.\n\n## Development\n\nThis requires `libwebp`, `libspng`, and `libturbojpeg` to run. Then:\n\n```\n> make test\n```\n\nTo ensure all tests run and pass.\n\n## Contributing\n\n1. [Fork it](https://github.com/Vici37/cr-image/fork)\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n- [Troy Sornson](https://github.com/Vici37) - creator and maintainer\n","program":{"html_id":"cr-image/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"locations":[],"repository_name":"cr-image","program":true,"enum":false,"alias":false,"const":false,"types":[{"html_id":"cr-image/CrImage","path":"CrImage.html","kind":"module","full_name":"CrImage","name":"CrImage","abstract":false,"locations":[{"filename":"src/cr-image/operation/bilinear_resize.cr","line_number":14,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/bilinear_resize.cr#L14"},{"filename":"src/cr-image/region.cr","line_number":1,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/region.cr#L1"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"types":[{"html_id":"cr-image/CrImage/ChannelType","path":"CrImage/ChannelType.html","kind":"enum","full_name":"CrImage::ChannelType","name":"ChannelType","abstract":false,"ancestors":[{"html_id":"cr-image/Enum","kind":"struct","full_name":"Enum","name":"Enum"},{"html_id":"cr-image/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"cr-image/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"cr-image/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cr-image/channel_type.cr","line_number":4,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/channel_type.cr#L4"}],"repository_name":"cr-image","program":false,"enum":true,"alias":false,"const":false,"constants":[{"id":"Red","name":"Red","value":"0"},{"id":"Green","name":"Green","value":"1"},{"id":"Blue","name":"Blue","value":"2"},{"id":"Gray","name":"Gray","value":"3"},{"id":"Alpha","name":"Alpha","value":"4"}],"namespace":{"html_id":"cr-image/CrImage","kind":"module","full_name":"CrImage","name":"CrImage"},"doc":"Enum representing different image channels supported by CrImage\n\nSee `RGBAImage#each_channel` and `GrayscaleImage#each_channel`","summary":"

        Enum representing different image channels supported by CrImage

        ","instance_methods":[{"html_id":"alpha?-instance-method","name":"alpha?","abstract":false,"location":{"filename":"src/cr-image/channel_type.cr","line_number":9,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/channel_type.cr#L9"},"def":{"name":"alpha?","visibility":"Public","body":"self == Alpha"}},{"html_id":"blue?-instance-method","name":"blue?","abstract":false,"location":{"filename":"src/cr-image/channel_type.cr","line_number":7,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/channel_type.cr#L7"},"def":{"name":"blue?","visibility":"Public","body":"self == Blue"}},{"html_id":"gray?-instance-method","name":"gray?","abstract":false,"location":{"filename":"src/cr-image/channel_type.cr","line_number":8,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/channel_type.cr#L8"},"def":{"name":"gray?","visibility":"Public","body":"self == Gray"}},{"html_id":"green?-instance-method","name":"green?","abstract":false,"location":{"filename":"src/cr-image/channel_type.cr","line_number":6,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/channel_type.cr#L6"},"def":{"name":"green?","visibility":"Public","body":"self == Green"}},{"html_id":"red?-instance-method","name":"red?","abstract":false,"location":{"filename":"src/cr-image/channel_type.cr","line_number":5,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/channel_type.cr#L5"},"def":{"name":"red?","visibility":"Public","body":"self == Red"}}]},{"html_id":"cr-image/CrImage/Color","path":"CrImage/Color.html","kind":"class","full_name":"CrImage::Color","name":"Color","abstract":false,"superclass":{"html_id":"cr-image/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"cr-image/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"cr-image/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cr-image/color.cr","line_number":5,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/color.cr#L5"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"cr-image/CrImage","kind":"module","full_name":"CrImage","name":"CrImage"},"doc":"Utility class for parsing and representing colors that can be used for certain\nmethods in CrImage.\n\nSee `Operation::MaskApply#apply_color`, `Operation::Draw#draw_square`, or `Operation::Draw#draw_circle`","summary":"

        Utility class for parsing and representing colors that can be used for certain methods in CrImage.

        ","constructors":[{"html_id":"new(red:UInt8,green:UInt8,blue:UInt8,alpha:UInt8=255)-class-method","name":"new","abstract":false,"args":[{"name":"red","external_name":"red","restriction":"UInt8"},{"name":"green","external_name":"green","restriction":"UInt8"},{"name":"blue","external_name":"blue","restriction":"UInt8"},{"name":"alpha","default_value":"255","external_name":"alpha","restriction":"UInt8"}],"args_string":"(red : UInt8, green : UInt8, blue : UInt8, alpha : UInt8 = 255)","args_html":"(red : UInt8, green : UInt8, blue : UInt8, alpha : UInt8 = 255)","location":{"filename":"src/cr-image/color.cr","line_number":8,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/color.cr#L8"},"def":{"name":"new","args":[{"name":"red","external_name":"red","restriction":"UInt8"},{"name":"green","external_name":"green","restriction":"UInt8"},{"name":"blue","external_name":"blue","restriction":"UInt8"},{"name":"alpha","default_value":"255","external_name":"alpha","restriction":"UInt8"}],"visibility":"Public","body":"_ = allocate\n_.initialize(red, green, blue, alpha)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"of(color:String):Color-class-method","name":"of","doc":"Parse color from a hex string:\n\n```\nColor.of(\"#1\") # same as \"#11\" => Color.new(17, 17, 17, 255)\nColor.of(\"#01\") # => Color.new(1, 1, 1, 255)\nColor.of(\"#123\") # same as \"#112233\" => Color.new(17, 34, 51, 255)\nColor.of(\"#1234\") # same as \"#11223344\" => Color.new(34, 51, 68, 17)\nColor.of(\"#010203\") # => Color.new(1, 2, 3, 255)\nColor.of(\"#01020304\") # => Color.new(2, 3, 4, 1)\n```","summary":"

        Parse color from a hex string:

        ","abstract":false,"args":[{"name":"color","external_name":"color","restriction":"String"}],"args_string":"(color : String) : Color","args_html":"(color : String) : Color","location":{"filename":"src/cr-image/color.cr","line_number":45,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/color.cr#L45"},"def":{"name":"of","args":[{"name":"color","external_name":"color","restriction":"String"}],"return_type":"Color","visibility":"Public","body":"if ((!(color.starts_with?(\"#\"))) || (!({2, 3, 4, 5, 7, 9}.includes?(color.size)))) || (color.match(/^#[^0-9a-f]/i))\n raise(\"Invalid hex color '#{color}': must start with '#' followed by 1, 2, 3, 4, 6, or 9 alphanumeric characters (0-9 or a-f)\")\nend\ncase color.size\nwhen 2\n gray = (color[1].to_i(16)).to_u8\n gray = (gray << 4) + gray\n self.new(gray, gray, gray)\nwhen 3\n gray = (color[1, 2].to_i(16)).to_u8\n self.new(gray, gray, gray)\nwhen 4\n red = (color[1].to_i(16)).to_u8\n green = (color[2].to_i(16)).to_u8\n blue = (color[3].to_i(16)).to_u8\n self.new((red << 4) + red, (green << 4) + green, (blue << 4) + blue)\nwhen 5\n alpha = (color[1].to_i(16)).to_u8\n red = (color[2].to_i(16)).to_u8\n green = (color[3].to_i(16)).to_u8\n blue = (color[4].to_i(16)).to_u8\n self.new((red << 4) + red, (green << 4) + green, (blue << 4) + blue, (alpha << 4) + alpha)\nwhen 7\n red = (color[1, 2].to_i(16)).to_u8\n green = (color[3, 2].to_i(16)).to_u8\n blue = (color[5, 2].to_i(16)).to_u8\n self.new(red, green, blue)\nelse\n alpha = (color[1, 2].to_i(16)).to_u8\n red = (color[3, 2].to_i(16)).to_u8\n green = (color[5, 2].to_i(16)).to_u8\n blue = (color[7, 2].to_i(16)).to_u8\n self.new(red, green, blue, alpha)\nend\n"}},{"html_id":"random:Color-class-method","name":"random","doc":"Generate a random color with full (255) opacity","summary":"

        Generate a random color with full (255) opacity

        ","abstract":false,"location":{"filename":"src/cr-image/color.cr","line_number":12,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/color.cr#L12"},"def":{"name":"random","return_type":"Color","visibility":"Public","body":"r = Random.new\nnew(r.rand(UInt8), r.rand(UInt8), r.rand(UInt8), 255_u8)\n"}}],"instance_methods":[{"html_id":"==(other:Color):Bool-instance-method","name":"==","abstract":false,"args":[{"name":"other","external_name":"other","restriction":"Color"}],"args_string":"(other : Color) : Bool","args_html":"(other : Color) : Bool","location":{"filename":"src/cr-image/color.cr","line_number":89,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/color.cr#L89"},"def":{"name":"==","args":[{"name":"other","external_name":"other","restriction":"Color"}],"return_type":"Bool","visibility":"Public","body":"(((red == other.red) && (green == other.green)) && (blue == other.blue)) && (alpha == other.alpha)"}},{"html_id":"[](channel_type:ChannelType):UInt8-instance-method","name":"[]","doc":"Receive the UInt8 portion of this color corresponding to `channel_type`","summary":"

        Receive the UInt8 portion of this color corresponding to channel_type

        ","abstract":false,"args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"}],"args_string":"(channel_type : ChannelType) : UInt8","args_html":"(channel_type : ChannelType) : UInt8","location":{"filename":"src/cr-image/color.cr","line_number":25,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/color.cr#L25"},"def":{"name":"[]","args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"}],"return_type":"UInt8","visibility":"Public","body":"case channel_type\nin ChannelType::Red\n red\nin ChannelType::Green\n green\nin ChannelType::Blue\n blue\nin ChannelType::Alpha\n alpha\nin ChannelType::Gray\n gray\nend"}},{"html_id":"alpha:UInt8-instance-method","name":"alpha","abstract":false,"location":{"filename":"src/cr-image/color.cr","line_number":6,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/color.cr#L6"},"def":{"name":"alpha","visibility":"Public","body":"@alpha"}},{"html_id":"blue:UInt8-instance-method","name":"blue","abstract":false,"location":{"filename":"src/cr-image/color.cr","line_number":6,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/color.cr#L6"},"def":{"name":"blue","visibility":"Public","body":"@blue"}},{"html_id":"gray(red_multiplier:Float=0.299,green_multiplier:Float=0.587,blue_multiplier:Float=0.114):UInt8-instance-method","name":"gray","doc":"Convert this Color to a single UInt8 gray value","summary":"

        Convert this Color to a single UInt8 gray value

        ","abstract":false,"args":[{"name":"red_multiplier","default_value":"0.299","external_name":"red_multiplier","restriction":"Float"},{"name":"green_multiplier","default_value":"0.587","external_name":"green_multiplier","restriction":"Float"},{"name":"blue_multiplier","default_value":"0.114","external_name":"blue_multiplier","restriction":"Float"}],"args_string":"(red_multiplier : Float = 0.299, green_multiplier : Float = 0.587, blue_multiplier : Float = 0.114) : UInt8","args_html":"(red_multiplier : Float = 0.299, green_multiplier : Float = 0.587, blue_multiplier : Float = 0.114) : UInt8","location":{"filename":"src/cr-image/color.cr","line_number":18,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/color.cr#L18"},"def":{"name":"gray","args":[{"name":"red_multiplier","default_value":"0.299","external_name":"red_multiplier","restriction":"Float"},{"name":"green_multiplier","default_value":"0.587","external_name":"green_multiplier","restriction":"Float"},{"name":"blue_multiplier","default_value":"0.114","external_name":"blue_multiplier","restriction":"Float"}],"return_type":"UInt8","visibility":"Public","body":"Math.min(255_u8, (((red * red_multiplier) + (blue * blue_multiplier)) + (green * green_multiplier)).to_u8)"}},{"html_id":"green:UInt8-instance-method","name":"green","abstract":false,"location":{"filename":"src/cr-image/color.cr","line_number":6,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/color.cr#L6"},"def":{"name":"green","visibility":"Public","body":"@green"}},{"html_id":"red:UInt8-instance-method","name":"red","abstract":false,"location":{"filename":"src/cr-image/color.cr","line_number":6,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/color.cr#L6"},"def":{"name":"red","visibility":"Public","body":"@red"}}]},{"html_id":"cr-image/CrImage/Exception","path":"CrImage/Exception.html","kind":"class","full_name":"CrImage::Exception","name":"Exception","abstract":false,"superclass":{"html_id":"cr-image/Exception","kind":"class","full_name":"Exception","name":"Exception"},"ancestors":[{"html_id":"cr-image/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"cr-image/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"cr-image/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cr-image/exception.cr","line_number":2,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/exception.cr#L2"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"cr-image/CrImage","kind":"module","full_name":"CrImage","name":"CrImage"},"doc":"Exception class for any errors thrown by CrImage","summary":"

        Exception class for any errors thrown by CrImage

        ","constructors":[{"html_id":"new(message:String)-class-method","name":"new","abstract":false,"args":[{"name":"message","external_name":"message","restriction":"String"}],"args_string":"(message : String)","args_html":"(message : String)","location":{"filename":"src/cr-image/exception.cr","line_number":5,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/exception.cr#L5"},"def":{"name":"new","args":[{"name":"message","external_name":"message","restriction":"String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(message)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(error_code:Int32)-class-method","name":"new","abstract":false,"args":[{"name":"error_code","external_name":"error_code","restriction":"Int32"}],"args_string":"(error_code : Int32)","args_html":"(error_code : Int32)","location":{"filename":"src/cr-image/exception.cr","line_number":9,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/exception.cr#L9"},"def":{"name":"new","args":[{"name":"error_code","external_name":"error_code","restriction":"Int32"}],"visibility":"Public","body":"_ = allocate\n_.initialize(error_code)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(handle:LibJPEGTurbo::Handle)-class-method","name":"new","abstract":false,"args":[{"name":"handle","external_name":"handle","restriction":"LibJPEGTurbo::Handle"}],"args_string":"(handle : LibJPEGTurbo::Handle)","args_html":"(handle : LibJPEGTurbo::Handle)","location":{"filename":"src/cr-image/exception.cr","line_number":13,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/exception.cr#L13"},"def":{"name":"new","args":[{"name":"handle","external_name":"handle","restriction":"LibJPEGTurbo::Handle"}],"visibility":"Public","body":"_ = allocate\n_.initialize(handle)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"error_code:Int32|Nil-instance-method","name":"error_code","abstract":false,"location":{"filename":"src/cr-image/exception.cr","line_number":3,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/exception.cr#L3"},"def":{"name":"error_code","return_type":"Int32 | ::Nil","visibility":"Public","body":"@error_code"}}]},{"html_id":"cr-image/CrImage/Format","path":"CrImage/Format.html","kind":"module","full_name":"CrImage::Format","name":"Format","abstract":false,"locations":[{"filename":"src/cr-image/format/save.cr","line_number":12,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/format/save.cr#L12"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"SUPPORTED_FORMATS","name":"SUPPORTED_FORMATS","value":"[{extension: \".ppm\", method: \"ppm\"}] of Nil"}],"namespace":{"html_id":"cr-image/CrImage","kind":"module","full_name":"CrImage","name":"CrImage"},"doc":"Provides a convenience method for saving image files to the filesystem.\nCurrently supports:\n* PPM (`.ppm`)\n* WebP (`.webp`)\n* JPEG (`.jpeg`, `.jpg`)\n* PNG (`.png`)\n\n```\nimage.save(\"image.jpg\")\n```\nSee `Open` for a convenience method to read images from the filesystem","summary":"

        Provides a convenience method for saving image files to the filesystem.

        ","types":[{"html_id":"cr-image/CrImage/Format/Open","path":"CrImage/Format/Open.html","kind":"module","full_name":"CrImage::Format::Open","name":"Open","abstract":false,"locations":[{"filename":"src/cr-image/format/open.cr","line_number":12,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/format/open.cr#L12"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"cr-image/CrImage/Format","kind":"module","full_name":"CrImage::Format","name":"Format"},"doc":"Provides a convenience method for opening up image files from the filesystem.\nCurrently supports:\n* PPM (`.ppm`)\n* WebP (`.webp`)\n* JPEG (`.jpeg`, `.jpg`)\n* PNG (`.png`)\n\n```\nimage = CrImage::RGBAImage.open(\"image.jpg\")\n```\nSee `Save` for a convenience method to write to the filesystem.","summary":"

        Provides a convenience method for opening up image files from the filesystem.

        ","instance_methods":[{"html_id":"open(filename:String):self-instance-method","name":"open","doc":"Reads this image from file using the provided filename.","summary":"

        Reads this image from file using the provided filename.

        ","abstract":false,"args":[{"name":"filename","external_name":"filename","restriction":"String"}],"args_string":"(filename : String) : self","args_html":"(filename : String) : self","location":{"filename":"src/cr-image/format/open.cr","line_number":14,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/format/open.cr#L14"},"def":{"name":"open","args":[{"name":"filename","external_name":"filename","restriction":"String"}],"return_type":"self","visibility":"Public","body":"{% if true %}\n case filename\n {% for format in SUPPORTED_FORMATS %}\n when .ends_with?({{ format[:extension] }}) then File.open(filename) { |file| self.from_{{ format[:method].id }}(file) }\n {% end %}\n else raise Exception.new \"Unknown file extension for filename #{filename}, cr-image only supports {{ (CrImage::Format::SUPPORTED_FORMATS.map do |__arg0|\n __arg0[:extension].id\nend.join(\", \")).id }}\"\n end\n {% end %}"}}]},{"html_id":"cr-image/CrImage/Format/PPM","path":"CrImage/Format/PPM.html","kind":"module","full_name":"CrImage::Format::PPM","name":"PPM","abstract":false,"locations":[{"filename":"src/cr-image/format/ppm.cr","line_number":13,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/format/ppm.cr#L13"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"cr-image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"cr-image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"cr-image/CrImage/Format","kind":"module","full_name":"CrImage::Format","name":"Format"},"doc":"Provides methods to read from and write to PPM.\n\n```\nimage = File.open(\"image.ppm\") { |file| CrImage::RGBAImage.from_ppm(file) }\nFile.open(\"other_image.ppm\") { |file| image.to_ppm(file) }\n```\nAlternatively, you can use the convenience methods in the `Open` and `Save` modules\nto acheive the same thing:\n```\nimage = CrImage::RGBAImage.open(\"image.ppm\")\nimage.save(\"other_image.ppm\")\n```","summary":"

        Provides methods to read from and write to PPM.

        ","instance_methods":[{"html_id":"to_ppm(io:IO):Nil-instance-method","name":"to_ppm","doc":"Output this image to `io` using PPM image encoding","summary":"

        Output this image to io using PPM image encoding

        ","abstract":false,"args":[{"name":"io","external_name":"io","restriction":"IO"}],"args_string":"(io : IO) : Nil","args_html":"(io : IO) : Nil","location":{"filename":"src/cr-image/format/ppm.cr","line_number":56,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/format/ppm.cr#L56"},"def":{"name":"to_ppm","args":[{"name":"io","external_name":"io","restriction":"IO"}],"return_type":"Nil","visibility":"Public","body":"io << \"P6\\n\"\n(((io << @width) << \" \") << @height) << \"\\n\"\nio << \"255\\n\"\nsize.times do |index|\n io.write_byte(red.unsafe_fetch(index))\n io.write_byte(green.unsafe_fetch(index))\n io.write_byte(blue.unsafe_fetch(index))\nend\n"}}]},{"html_id":"cr-image/CrImage/Format/Save","path":"CrImage/Format/Save.html","kind":"module","full_name":"CrImage::Format::Save","name":"Save","abstract":false,"locations":[{"filename":"src/cr-image/format/save.cr","line_number":15,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/format/save.cr#L15"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"cr-image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"cr-image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"cr-image/CrImage/Format","kind":"module","full_name":"CrImage::Format","name":"Format"},"instance_methods":[{"html_id":"save(filename:String):self-instance-method","name":"save","doc":"Write this image to file using the provided filename.\n\nThis method _will not_ create intermediate directory paths. This method will throw an\nerror if they don't exist.","summary":"

        Write this image to file using the provided filename.

        ","abstract":false,"args":[{"name":"filename","external_name":"filename","restriction":"String"}],"args_string":"(filename : String) : self","args_html":"(filename : String) : self","location":{"filename":"src/cr-image/format/save.cr","line_number":20,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/format/save.cr#L20"},"def":{"name":"save","args":[{"name":"filename","external_name":"filename","restriction":"String"}],"return_type":"self","visibility":"Public","body":"File.open(filename, \"w\") do |file|\n {% if true %}\n case filename\n {% for format in SUPPORTED_FORMATS %}\n when .ends_with?({{ format[:extension] }}) then to_{{ format[:method].id }}(file)\n {% end %}\n else raise Exception.new \"Unknown file extension for filename #{filename}, cr-image only supports {{ (CrImage::Format::SUPPORTED_FORMATS.map do |__arg0|\n __arg0[:extension].id\n end.join(\", \")).id }}\"\n end\n {% end %}\nend"}}]}]},{"html_id":"cr-image/CrImage/GrayscaleImage","path":"CrImage/GrayscaleImage.html","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage","abstract":false,"superclass":{"html_id":"cr-image/CrImage/Image","kind":"class","full_name":"CrImage::Image","name":"Image"},"ancestors":[{"html_id":"cr-image/CrImage/Operation/MaskApply","kind":"module","full_name":"CrImage::Operation::MaskApply","name":"MaskApply"},{"html_id":"cr-image/CrImage/Format/Save","kind":"module","full_name":"CrImage::Format::Save","name":"Save"},{"html_id":"cr-image/CrImage/Operation/HistogramEqualize","kind":"module","full_name":"CrImage::Operation::HistogramEqualize","name":"HistogramEqualize"},{"html_id":"cr-image/CrImage/Operation/Draw","kind":"module","full_name":"CrImage::Operation::Draw","name":"Draw"},{"html_id":"cr-image/CrImage/Operation/Crop","kind":"module","full_name":"CrImage::Operation::Crop","name":"Crop"},{"html_id":"cr-image/CrImage/Operation/VerticalBlur","kind":"module","full_name":"CrImage::Operation::VerticalBlur","name":"VerticalBlur"},{"html_id":"cr-image/CrImage/Operation/HorizontalBlur","kind":"module","full_name":"CrImage::Operation::HorizontalBlur","name":"HorizontalBlur"},{"html_id":"cr-image/CrImage/Operation/GaussianBlur","kind":"module","full_name":"CrImage::Operation::GaussianBlur","name":"GaussianBlur"},{"html_id":"cr-image/CrImage/Operation/Contrast","kind":"module","full_name":"CrImage::Operation::Contrast","name":"Contrast"},{"html_id":"cr-image/CrImage/Operation/ChannelSwap","kind":"module","full_name":"CrImage::Operation::ChannelSwap","name":"ChannelSwap"},{"html_id":"cr-image/CrImage/Operation/Brightness","kind":"module","full_name":"CrImage::Operation::Brightness","name":"Brightness"},{"html_id":"cr-image/CrImage/Operation/BoxBlur","kind":"module","full_name":"CrImage::Operation::BoxBlur","name":"BoxBlur"},{"html_id":"cr-image/CrImage/Operation/BilinearResize","kind":"module","full_name":"CrImage::Operation::BilinearResize","name":"BilinearResize"},{"html_id":"cr-image/CrImage/Format/PPM","kind":"module","full_name":"CrImage::Format::PPM","name":"PPM"},{"html_id":"cr-image/CrImage/Image","kind":"class","full_name":"CrImage::Image","name":"Image"},{"html_id":"cr-image/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"cr-image/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cr-image/grayscale_image.cr","line_number":13,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L13"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"cr-image/CrImage/Format/PPM","kind":"module","full_name":"CrImage::Format::PPM","name":"PPM"},{"html_id":"cr-image/CrImage/Format/Save","kind":"module","full_name":"CrImage::Format::Save","name":"Save"},{"html_id":"cr-image/CrImage/Operation/BilinearResize","kind":"module","full_name":"CrImage::Operation::BilinearResize","name":"BilinearResize"},{"html_id":"cr-image/CrImage/Operation/BoxBlur","kind":"module","full_name":"CrImage::Operation::BoxBlur","name":"BoxBlur"},{"html_id":"cr-image/CrImage/Operation/Brightness","kind":"module","full_name":"CrImage::Operation::Brightness","name":"Brightness"},{"html_id":"cr-image/CrImage/Operation/ChannelSwap","kind":"module","full_name":"CrImage::Operation::ChannelSwap","name":"ChannelSwap"},{"html_id":"cr-image/CrImage/Operation/Contrast","kind":"module","full_name":"CrImage::Operation::Contrast","name":"Contrast"},{"html_id":"cr-image/CrImage/Operation/Crop","kind":"module","full_name":"CrImage::Operation::Crop","name":"Crop"},{"html_id":"cr-image/CrImage/Operation/Draw","kind":"module","full_name":"CrImage::Operation::Draw","name":"Draw"},{"html_id":"cr-image/CrImage/Operation/GaussianBlur","kind":"module","full_name":"CrImage::Operation::GaussianBlur","name":"GaussianBlur"},{"html_id":"cr-image/CrImage/Operation/HistogramEqualize","kind":"module","full_name":"CrImage::Operation::HistogramEqualize","name":"HistogramEqualize"},{"html_id":"cr-image/CrImage/Operation/HorizontalBlur","kind":"module","full_name":"CrImage::Operation::HorizontalBlur","name":"HorizontalBlur"},{"html_id":"cr-image/CrImage/Operation/MaskApply","kind":"module","full_name":"CrImage::Operation::MaskApply","name":"MaskApply"},{"html_id":"cr-image/CrImage/Operation/VerticalBlur","kind":"module","full_name":"CrImage::Operation::VerticalBlur","name":"VerticalBlur"}],"extended_modules":[{"html_id":"cr-image/CrImage/Format/Open","kind":"module","full_name":"CrImage::Format::Open","name":"Open"}],"namespace":{"html_id":"cr-image/CrImage","kind":"module","full_name":"CrImage","name":"CrImage"},"doc":"An image in Grayscale. These image types are the easiest to perform feature and information extraction from, where\nthere is only one channel to examine, and so has methods for constructing `Mask`s from (see `#threshold` below).\n\nAn `RGBAImage` would become a `GrayscaleImage` this way:\n```\nimage.to_gray\n```\n\n\"Woman\n\"Woman","summary":"

        An image in Grayscale.

        ","constructors":[{"html_id":"from_ppm(image_data:Bytes):self-class-method","name":"from_ppm","doc":"Read `image_data` as PPM encoded bytes","summary":"

        Read image_data as PPM encoded bytes

        ","abstract":false,"args":[{"name":"image_data","external_name":"image_data","restriction":"Bytes"}],"args_string":"(image_data : Bytes) : self","args_html":"(image_data : Bytes) : self","def":{"name":"from_ppm","args":[{"name":"image_data","external_name":"image_data","restriction":"Bytes"}],"return_type":"self","visibility":"Public","body":"from_ppm(IO::Memory.new(image_data))"}},{"html_id":"from_ppm(io:IO):self-class-method","name":"from_ppm","doc":"Read bytes from `io` as PPM encoded","summary":"

        Read bytes from io as PPM encoded

        ","abstract":false,"args":[{"name":"io","external_name":"io","restriction":"IO"}],"args_string":"(io : IO) : self","args_html":"(io : IO) : self","def":{"name":"from_ppm","args":[{"name":"io","external_name":"io","restriction":"IO"}],"return_type":"self","visibility":"Public","body":"_magic_number = io.gets(\"\\n\", chomp: true)\nwidth = (io.gets(\" \", chomp: true)).try(&.to_i)\nheight = (io.gets(\"\\n\", chomp: true)).try(&.to_i)\n_maximum_color_value = io.gets(\"\\n\", chomp: true)\nif width && height\n red = Array.new(width * height) do\n 0_u8\n end\n green = Array.new(width * height) do\n 0_u8\n end\n blue = Array.new(width * height) do\n 0_u8\n end\n alpha = Array.new(width * height) do\n 255_u8\n end\n (width * height).times do |index|\n red_byte = io.read_byte\n green_byte = io.read_byte\n blue_byte = io.read_byte\n if (red_byte && green_byte) && blue_byte\n red.unsafe_put(index, red_byte)\n green.unsafe_put(index, green_byte)\n blue.unsafe_put(index, blue_byte)\n else\n raise(\"The image ends prematurely\")\n end\n end\n new(red, green, blue, alpha, width, height)\nelse\n raise(\"The image doesn't have width or height\")\nend\n"}},{"html_id":"new(red:Array(UInt8),green:Array(UInt8),blue:Array(UInt8),alpha:Array(UInt8),width:Int32,height:Int32)-class-method","name":"new","doc":"Create a GrayscaleImage from a set of color channels (delegates to `RGBAImage#to_gray`)","summary":"

        Create a GrayscaleImage from a set of color channels (delegates to RGBAImage#to_gray)

        ","abstract":false,"args":[{"name":"red","external_name":"red","restriction":"Array(UInt8)"},{"name":"green","external_name":"green","restriction":"Array(UInt8)"},{"name":"blue","external_name":"blue","restriction":"Array(UInt8)"},{"name":"alpha","external_name":"alpha","restriction":"Array(UInt8)"},{"name":"width","external_name":"width","restriction":"Int32"},{"name":"height","external_name":"height","restriction":"Int32"}],"args_string":"(red : Array(UInt8), green : Array(UInt8), blue : Array(UInt8), alpha : Array(UInt8), width : Int32, height : Int32)","args_html":"(red : Array(UInt8), green : Array(UInt8), blue : Array(UInt8), alpha : Array(UInt8), width : Int32, height : Int32)","location":{"filename":"src/cr-image/grayscale_image.cr","line_number":20,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L20"},"def":{"name":"new","args":[{"name":"red","external_name":"red","restriction":"Array(UInt8)"},{"name":"green","external_name":"green","restriction":"Array(UInt8)"},{"name":"blue","external_name":"blue","restriction":"Array(UInt8)"},{"name":"alpha","external_name":"alpha","restriction":"Array(UInt8)"},{"name":"width","external_name":"width","restriction":"Int32"},{"name":"height","external_name":"height","restriction":"Int32"}],"visibility":"Public","body":"(RGBAImage.new(red, green, blue, alpha, width, height)).to_gray"}},{"html_id":"new(gray:Array(UInt8),alpha:Array(UInt8),width:Int32,height:Int32)-class-method","name":"new","abstract":false,"args":[{"name":"gray","external_name":"gray","restriction":"::Array(::UInt8)"},{"name":"alpha","external_name":"alpha","restriction":"::Array(::UInt8)"},{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"height","external_name":"height","restriction":"::Int32"}],"args_string":"(gray : Array(UInt8), alpha : Array(UInt8), width : Int32, height : Int32)","args_html":"(gray : Array(UInt8), alpha : Array(UInt8), width : Int32, height : Int32)","location":{"filename":"src/cr-image/grayscale_image.cr","line_number":24,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L24"},"def":{"name":"new","args":[{"name":"gray","external_name":"gray","restriction":"::Array(::UInt8)"},{"name":"alpha","external_name":"alpha","restriction":"::Array(::UInt8)"},{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"height","external_name":"height","restriction":"::Int32"}],"visibility":"Public","body":"_ = allocate\n_.initialize(gray, alpha, width, height)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(gray:Array(UInt8),width:Int32,height:Int32)-class-method","name":"new","doc":"Create a GrayscaleImage with only an `Array(UInt8)` (alpha channel initialized as `255` throughout)","summary":"

        Create a GrayscaleImage with only an Array(UInt8) (alpha channel initialized as 255 throughout)

        ","abstract":false,"args":[{"name":"gray","external_name":"gray","restriction":"::Array(::UInt8)"},{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"height","external_name":"height","restriction":"::Int32"}],"args_string":"(gray : Array(UInt8), width : Int32, height : Int32)","args_html":"(gray : Array(UInt8), width : Int32, height : Int32)","location":{"filename":"src/cr-image/grayscale_image.cr","line_number":28,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L28"},"def":{"name":"new","args":[{"name":"gray","external_name":"gray","restriction":"::Array(::UInt8)"},{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"height","external_name":"height","restriction":"::Int32"}],"visibility":"Public","body":"_ = allocate\n_.initialize(gray, width, height)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"[](channel_type:ChannelType):Array(UInt8)-instance-method","name":"[]","doc":"Return the `Array(UInt8)` corresponding to `channel_type`","summary":"

        Return the Array(UInt8) corresponding to channel_type

        ","abstract":false,"args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"}],"args_string":"(channel_type : ChannelType) : Array(UInt8)","args_html":"(channel_type : ChannelType) : Array(UInt8)","location":{"filename":"src/cr-image/grayscale_image.cr","line_number":70,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L70"},"def":{"name":"[]","args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"}],"return_type":"Array(UInt8)","visibility":"Public","body":"if channel_type == ChannelType::Alpha\n return @alpha\nend\n@gray\n"}},{"html_id":"[]=(channel_type:ChannelType,channel:Array(UInt8)):Array(UInt8)-instance-method","name":"[]=","doc":"Set the underlying `Array(UInt8)` of `channel_type` to the new `channel`.\n\nWarning: this method does not check the size of the incoming array, and if it's a different\nsize from what the current image represents, this could break it. We recommend against using\nthis method except for from other methods that will be updating the `width` and `height` immediately after.","summary":"

        Set the underlying Array(UInt8) of channel_type to the new channel.

        ","abstract":false,"args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"},{"name":"channel","external_name":"channel","restriction":"Array(UInt8)"}],"args_string":"(channel_type : ChannelType, channel : Array(UInt8)) : Array(UInt8)","args_html":"(channel_type : ChannelType, channel : Array(UInt8)) : Array(UInt8)","location":{"filename":"src/cr-image/grayscale_image.cr","line_number":80,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L80"},"def":{"name":"[]=","args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"},{"name":"channel","external_name":"channel","restriction":"Array(UInt8)"}],"return_type":"Array(UInt8)","visibility":"Public","body":"case channel_type\nwhen ChannelType::Gray\n self.gray = channel\nwhen ChannelType::Alpha\n self.alpha = channel\nelse\n raise(\"Unknown channel type #{channel_type} for GrayscaleImage\")\nend"}},{"html_id":"alpha:Array(UInt8)-instance-method","name":"alpha","doc":"Return `alpha` channel","summary":"

        Return #alpha channel

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":58,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L58"},"def":{"name":"alpha","return_type":"Array(UInt8)","visibility":"Public","body":"@alpha"}},{"html_id":"alpha=(alpha:Array(UInt8))-instance-method","name":"alpha=","abstract":false,"args":[{"name":"alpha","external_name":"alpha","restriction":"Array(UInt8)"}],"args_string":"(alpha : Array(UInt8))","args_html":"(alpha : Array(UInt8))","location":{"filename":"src/cr-image/grayscale_image.cr","line_number":15,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L15"},"def":{"name":"alpha=","args":[{"name":"alpha","external_name":"alpha","restriction":"Array(UInt8)"}],"visibility":"Public","body":"@alpha = alpha"}},{"html_id":"blue:Array(UInt8)-instance-method","name":"blue","doc":"Return the \"`blue`\" channel (returns `gray`)","summary":"

        Return the "#blue" channel (returns #gray)

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":53,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L53"},"def":{"name":"blue","return_type":"Array(UInt8)","visibility":"Public","body":"@gray"}},{"html_id":"clone:GrayscaleImage-instance-method","name":"clone","doc":"Create a new GrayscaleImage as a copy of this one","summary":"

        Create a new GrayscaleImage as a copy of this one

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":33,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L33"},"def":{"name":"clone","return_type":"GrayscaleImage","visibility":"Public","body":"self.class.new(@gray.clone, @alpha.clone, @width, @height)"}},{"html_id":"each_channel(&:Array(UInt8),ChannelType->Nil):Nil-instance-method","name":"each_channel","doc":"Run provided block with the `ChannelType::Gray` and `ChannelType::Alpha` channels and channel types.","summary":"

        Run provided block with the ChannelType::Gray and ChannelType::Alpha channels and channel types.

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":63,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L63"},"def":{"name":"each_channel","yields":2,"block_arity":2,"block_arg":{"name":"","external_name":"","restriction":"(Array(UInt8), ChannelType -> Nil)"},"return_type":"Nil","visibility":"Public","body":"yield @gray, ChannelType::Gray\nyield @alpha, ChannelType::Alpha\nnil\n"}},{"html_id":"gray:Array(UInt8)-instance-method","name":"gray","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":14,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L14"},"def":{"name":"gray","return_type":"Array(UInt8)","visibility":"Public","body":"@gray"}},{"html_id":"gray=(gray:Array(UInt8))-instance-method","name":"gray=","abstract":false,"args":[{"name":"gray","external_name":"gray","restriction":"Array(UInt8)"}],"args_string":"(gray : Array(UInt8))","args_html":"(gray : Array(UInt8))","location":{"filename":"src/cr-image/grayscale_image.cr","line_number":14,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L14"},"def":{"name":"gray=","args":[{"name":"gray","external_name":"gray","restriction":"Array(UInt8)"}],"visibility":"Public","body":"@gray = gray"}},{"html_id":"green:Array(UInt8)-instance-method","name":"green","doc":"Return the \"`green`\" channel (returns `gray`)","summary":"

        Return the "#green" channel (returns #gray)

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":48,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L48"},"def":{"name":"green","return_type":"Array(UInt8)","visibility":"Public","body":"@gray"}},{"html_id":"height:Int32-instance-method","name":"height","doc":"Height of image","summary":"

        Height of image

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":17,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L17"},"def":{"name":"height","return_type":"Int32","visibility":"Public","body":"@height"}},{"html_id":"height=(height:Int32)-instance-method","name":"height=","abstract":false,"args":[{"name":"height","external_name":"height","restriction":"Int32"}],"args_string":"(height : Int32)","args_html":"(height : Int32)","location":{"filename":"src/cr-image/grayscale_image.cr","line_number":17,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L17"},"def":{"name":"height=","args":[{"name":"height","external_name":"height","restriction":"Int32"}],"visibility":"Public","body":"@height = height"}},{"html_id":"invert-instance-method","name":"invert","doc":"Invert grayscale pixels (replace each pixel will `255 - p` for all `p` in `@gray`).\n\n\"Woman\n\nBecomes\n\n\"Woman","summary":"

        Invert grayscale pixels (replace each pixel will 255 - p for all p in @gray).

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":112,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L112"},"def":{"name":"invert","visibility":"Public","body":"clone.invert!"}},{"html_id":"invert!-instance-method","name":"invert!","doc":"Invert grayscale pixels (replace each pixel will `255 - p` for all `p` in `@gray`). Modifies self.\n\n\"Woman\n\nBecomes\n\n\"Woman","summary":"

        Invert grayscale pixels (replace each pixel will 255 - p for all p in @gray).

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":123,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L123"},"def":{"name":"invert!","visibility":"Public","body":"@gray.map! do |pix|\n 255_u8 - pix\nend\nself\n"}},{"html_id":"mask_from(&block:Int32,Int32,UInt8->Bool):Mask-instance-method","name":"mask_from","doc":"Construct a `Mask` from this `GrayscaleImage` using the passed in block to determine if a given pixel should be true or not\n\n```\n# Construct a mask identifying the bright pixels in the bottom left corner of image\nimage.to_gray.mask_from do |x, y, pixel|\n x < image.width // 2 && # left half of image\n y > (image.height // 2) && # bottom half of image\n pixel > 128 # only \"bright\" pixels\nend\n```\n\"Woman\n->\n\"Mask","summary":"

        Construct a Mask from this GrayscaleImage using the passed in block to determine if a given pixel should be true or not

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":141,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L141"},"def":{"name":"mask_from","yields":3,"block_arity":3,"block_arg":{"name":"block","external_name":"block","restriction":"(Int32, Int32, UInt8 -> Bool)"},"return_type":"Mask","visibility":"Public","body":"Mask.new(width, BitArray.new(size) do |i|\n block.call(i % width, i // width, @gray[i])\nend)"}},{"html_id":"red:Array(UInt8)-instance-method","name":"red","doc":"Return the \"`red`\" channel (returns `gray`)","summary":"

        Return the "#red" channel (returns #gray)

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":43,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L43"},"def":{"name":"red","return_type":"Array(UInt8)","visibility":"Public","body":"@gray"}},{"html_id":"size:Int32-instance-method","name":"size","doc":"Return the number of pixels this image contains","summary":"

        Return the number of pixels this image contains

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":101,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L101"},"def":{"name":"size","return_type":"Int32","visibility":"Public","body":"@width * @height"}},{"html_id":"threshold(threshold:Int):Mask-instance-method","name":"threshold","doc":"Construct a simple threshold `Mask` containing all pixels with a `UInt8` value greater than `threshold`\nGiven sample image:\n\n\"Woman\n\n```\nimage\n .to_gray # convert color image to grayscale one\n .threshold(128) # generate a mask using threshold operator\n .to_gray # convert mask to grayscale image\n .save(\"threshold_example.jpg\") # save mask as grayscale\n```\n\"Black","summary":"

        Construct a simple threshold Mask containing all pixels with a UInt8 value greater than #threshold Given sample image:

        ","abstract":false,"args":[{"name":"threshold","external_name":"threshold","restriction":"Int"}],"args_string":"(threshold : Int) : Mask","args_html":"(threshold : Int) : Mask","location":{"filename":"src/cr-image/grayscale_image.cr","line_number":160,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L160"},"def":{"name":"threshold","args":[{"name":"threshold","external_name":"threshold","restriction":"Int"}],"return_type":"Mask","visibility":"Public","body":"mask_from do |_, _, pixel|\n pixel >= threshold\nend"}},{"html_id":"to_gray:GrayscaleImage-instance-method","name":"to_gray","doc":"Returns self","summary":"

        Returns self

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":96,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L96"},"def":{"name":"to_gray","return_type":"GrayscaleImage","visibility":"Public","body":"self"}},{"html_id":"to_rgba:RGBAImage-instance-method","name":"to_rgba","doc":"Convert this `GrayscaleImage` to an `RGBAImage`.\n\nNo color will be provided, all pixels will remain gray.","summary":"

        Convert this GrayscaleImage to an RGBAImage.

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":91,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L91"},"def":{"name":"to_rgba","return_type":"RGBAImage","visibility":"Public","body":"RGBAImage.new(@gray.clone, @gray.clone, @gray.clone, @alpha.clone, width, height)"}},{"html_id":"width:Int32-instance-method","name":"width","doc":"Width of image","summary":"

        Width of image

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":16,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L16"},"def":{"name":"width","return_type":"Int32","visibility":"Public","body":"@width"}},{"html_id":"width=(width:Int32)-instance-method","name":"width=","abstract":false,"args":[{"name":"width","external_name":"width","restriction":"Int32"}],"args_string":"(width : Int32)","args_html":"(width : Int32)","location":{"filename":"src/cr-image/grayscale_image.cr","line_number":16,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L16"},"def":{"name":"width=","args":[{"name":"width","external_name":"width","restriction":"Int32"}],"visibility":"Public","body":"@width = width"}}]},{"html_id":"cr-image/CrImage/Image","path":"CrImage/Image.html","kind":"class","full_name":"CrImage::Image","name":"Image","abstract":true,"superclass":{"html_id":"cr-image/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"cr-image/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"cr-image/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cr-image/image.cr","line_number":3,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/image.cr#L3"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"subclasses":[{"html_id":"cr-image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"cr-image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"cr-image/CrImage","kind":"module","full_name":"CrImage","name":"CrImage"},"doc":"Common base class for `GrayscaleImage` and `RGBAImage`. All `Image`s are readable and saveable\nto the filesystem or `IO` stream.","summary":"

        Common base class for GrayscaleImage and RGBAImage.

        ","instance_methods":[{"html_id":"[](channel_type:ChannelType):Array(UInt8)-instance-method","name":"[]","doc":"Get the `Array(UInt8)` corresponding to `channel_type`)","summary":"

        Get the Array(UInt8) corresponding to channel_type)

        ","abstract":true,"args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"}],"args_string":"(channel_type : ChannelType) : Array(UInt8)","args_html":"(channel_type : ChannelType) : Array(UInt8)","location":{"filename":"src/cr-image/image.cr","line_number":51,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/image.cr#L51"},"def":{"name":"[]","args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"}],"return_type":"Array(UInt8)","visibility":"Public","body":""}},{"html_id":"[]=(channel_type:ChannelType,channel:Array(UInt8)):Array(UInt8)-instance-method","name":"[]=","doc":"Set the `Array(UInt8)` corresponding to `channel_type`) to `channel`","summary":"

        Set the Array(UInt8) corresponding to channel_type) to channel

        ","abstract":true,"args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"},{"name":"channel","external_name":"channel","restriction":"Array(UInt8)"}],"args_string":"(channel_type : ChannelType, channel : Array(UInt8)) : Array(UInt8)","args_html":"(channel_type : ChannelType, channel : Array(UInt8)) : Array(UInt8)","location":{"filename":"src/cr-image/image.cr","line_number":53,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/image.cr#L53"},"def":{"name":"[]=","args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"},{"name":"channel","external_name":"channel","restriction":"Array(UInt8)"}],"return_type":"Array(UInt8)","visibility":"Public","body":""}},{"html_id":"alpha:Array(UInt8)-instance-method","name":"alpha","doc":"Return the alpha channel","summary":"

        Return the alpha channel

        ","abstract":true,"location":{"filename":"src/cr-image/image.cr","line_number":39,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/image.cr#L39"},"def":{"name":"alpha","return_type":"Array(UInt8)","visibility":"Public","body":""}},{"html_id":"blue:Array(UInt8)-instance-method","name":"blue","doc":"Return the blue channel","summary":"

        Return the blue channel

        ","abstract":true,"location":{"filename":"src/cr-image/image.cr","line_number":37,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/image.cr#L37"},"def":{"name":"blue","return_type":"Array(UInt8)","visibility":"Public","body":""}},{"html_id":"each_channel(&:Array(UInt8),ChannelType->Nil):Nil-instance-method","name":"each_channel","doc":"Run provided block on each channel supported by this image.","summary":"

        Run provided block on each channel supported by this image.

        ","abstract":true,"location":{"filename":"src/cr-image/image.cr","line_number":48,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/image.cr#L48"},"def":{"name":"each_channel","yields":2,"block_arity":2,"block_arg":{"name":"","external_name":"","restriction":"(Array(UInt8), ChannelType -> Nil)"},"return_type":"Nil","visibility":"Public","body":""}},{"html_id":"green:Array(UInt8)-instance-method","name":"green","doc":"Return the green channel","summary":"

        Return the green channel

        ","abstract":true,"location":{"filename":"src/cr-image/image.cr","line_number":35,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/image.cr#L35"},"def":{"name":"green","return_type":"Array(UInt8)","visibility":"Public","body":""}},{"html_id":"height:Int32-instance-method","name":"height","doc":"Height of image","summary":"

        Height of image

        ","abstract":true,"location":{"filename":"src/cr-image/image.cr","line_number":43,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/image.cr#L43"},"def":{"name":"height","return_type":"Int32","visibility":"Public","body":""}},{"html_id":"red:Array(UInt8)-instance-method","name":"red","doc":"Return the red channel","summary":"

        Return the red channel

        ","abstract":true,"location":{"filename":"src/cr-image/image.cr","line_number":33,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/image.cr#L33"},"def":{"name":"red","return_type":"Array(UInt8)","visibility":"Public","body":""}},{"html_id":"size:Int32-instance-method","name":"size","doc":"Size (total pixels) in image (`width` * `height`)","summary":"

        Size (total pixels) in image (#width * #height)

        ","abstract":true,"location":{"filename":"src/cr-image/image.cr","line_number":45,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/image.cr#L45"},"def":{"name":"size","return_type":"Int32","visibility":"Public","body":""}},{"html_id":"width:Int32-instance-method","name":"width","doc":"Width of image","summary":"

        Width of image

        ","abstract":true,"location":{"filename":"src/cr-image/image.cr","line_number":41,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/image.cr#L41"},"def":{"name":"width","return_type":"Int32","visibility":"Public","body":""}}],"macros":[{"html_id":"subsclasses_include(mod)-macro","name":"subsclasses_include","abstract":false,"args":[{"name":"mod","external_name":"mod","restriction":""}],"args_string":"(mod)","args_html":"(mod)","location":{"filename":"src/cr-image/image.cr","line_number":4,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/image.cr#L4"},"def":{"name":"subsclasses_include","args":[{"name":"mod","external_name":"mod","restriction":""}],"visibility":"Public","body":" \n{% for sub in @type.subclasses %}\n class ::{{ sub }}\n include {{ mod }}\n end\n {% end %}\n\n \n"}}]},{"html_id":"cr-image/CrImage/Mask","path":"CrImage/Mask.html","kind":"class","full_name":"CrImage::Mask","name":"Mask","abstract":false,"superclass":{"html_id":"cr-image/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"cr-image/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"cr-image/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cr-image/mask.cr","line_number":39,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L39"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"cr-image/CrImage","kind":"module","full_name":"CrImage","name":"CrImage"},"doc":"Mask is a wrapper around BitArray, where each flag represents a boolean bit of information about a pixel\nfrom an image. This can include whether a particular pixel has a value within certain conditions, OR\nif that pixel should be zeroed out or not.\n\nSee `[]=` methods below for examples of how to manually construct masks.\n\n(x,y) - coordinates. Represent these positions in a Mask of size 10x10:\n\n```\n[\n (0,0), (0,1), (0,2), (0,3), (0,4), (0,5), (0,6), (0,7), (0,8), (0,9),\n (1,0), (1,1), (1,2), (1,3), (1,4), (1,5), (1,6), (1,7), (1,8), (1,9),\n (2,0), (2,1), (2,2), (2,3), (2,4), (2,5), (2,6), (2,7), (2,8), (2,9),\n (3,0), (3,1), (3,2), (3,3), (3,4), (3,5), (3,6), (3,7), (3,8), (3,9),\n (4,0), (4,1), (4,2), (4,3), (4,4), (4,5), (4,6), (4,7), (4,8), (4,9),\n (5,0), (5,1), (5,2), (5,3), (5,4), (5,5), (5,6), (5,7), (5,8), (5,9),\n (6,0), (6,1), (6,2), (6,3), (6,4), (6,5), (6,6), (6,7), (6,8), (6,9),\n (7,0), (7,1), (7,2), (7,3), (7,4), (7,5), (7,6), (7,7), (7,8), (7,9),\n (8,0), (8,1), (8,2), (8,3), (8,4), (8,5), (8,6), (8,7), (8,8), (8,9),\n (9,0), (9,1), (9,2), (9,3), (9,4), (9,5), (9,6), (9,7), (9,8), (9,9),\n]\n```\n\nAnd every position is a Bool value.\n\nDifferent ways to refer to coordinates:\n```\nmask.at(0, 0) # => (0,0)\nmask[0, 0] # => (0,0), same as .at(0, 0)\nmask[0..1, 4] # => (4,0), (4,1)\nmask[3, 3..5] # => (3,3), (3,4), (3,5)\nmask[2..3, 4..5] # => (2,4), (2,5), (3,4), (3,5)\n```\n\nSee `Operation::Crop` and `Operation::MaskApply` for how this can be useful","summary":"

        Mask is a wrapper around BitArray, where each flag represents a boolean bit of information about a pixel from an image.

        ","constructors":[{"html_id":"new(width:Int32,height:Int32,initial:Bool=true)-class-method","name":"new","doc":"Construct a new `Mask` of width x height, preset to `initial`","summary":"

        Construct a new Mask of width x height, preset to initial

        ","abstract":false,"args":[{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"height","external_name":"height","restriction":"Int32"},{"name":"initial","default_value":"true","external_name":"initial","restriction":"Bool"}],"args_string":"(width : Int32, height : Int32, initial : Bool = true)","args_html":"(width : Int32, height : Int32, initial : Bool = true)","location":{"filename":"src/cr-image/mask.cr","line_number":49,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L49"},"def":{"name":"new","args":[{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"height","external_name":"height","restriction":"Int32"},{"name":"initial","default_value":"true","external_name":"initial","restriction":"Bool"}],"visibility":"Public","body":"_ = allocate\n_.initialize(width, height, initial)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(width:Int32,height:Int32,int:Int)-class-method","name":"new","doc":"Construct a new `Mask` from an integer (useful for testing or small mask construction)","summary":"

        Construct a new Mask from an integer (useful for testing or small mask construction)

        ","abstract":false,"args":[{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"height","external_name":"height","restriction":"Int32"},{"name":"int","external_name":"int","restriction":"Int"}],"args_string":"(width : Int32, height : Int32, int : Int)","args_html":"(width : Int32, height : Int32, int : Int)","location":{"filename":"src/cr-image/mask.cr","line_number":61,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L61"},"def":{"name":"new","args":[{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"height","external_name":"height","restriction":"Int32"},{"name":"int","external_name":"int","restriction":"Int"}],"visibility":"Public","body":"_ = allocate\n_.initialize(width, height, int)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(other_bits:Array(BitArray))-class-method","name":"new","doc":"Construct a new `Mask` from an array of `BitArray`. See `#[](xs : Range, ys : Range) : Array(BitArray)`\n\nThis assumes `other_bits[0]` corresponds to `x == 0` in the mask, and the corresponding\n`BitArray` represents all bits for that row. All `BitArray`s must be of the same size in\n`other_bits`.","summary":"

        Construct a new Mask from an array of BitArray.

        ","abstract":false,"args":[{"name":"other_bits","external_name":"other_bits","restriction":"Array(BitArray)"}],"args_string":"(other_bits : Array(BitArray))","args_html":"(other_bits : Array(BitArray))","location":{"filename":"src/cr-image/mask.cr","line_number":77,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L77"},"def":{"name":"new","args":[{"name":"other_bits","external_name":"other_bits","restriction":"Array(BitArray)"}],"visibility":"Public","body":"_ = allocate\n_.initialize(other_bits)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(image:Image,initial:Bool=true)-class-method","name":"new","doc":"Construct a new `Mask` from the dimensions of passed in `image` with an initial bit","summary":"

        Construct a new Mask from the dimensions of passed in image with an initial bit

        ","abstract":false,"args":[{"name":"image","external_name":"image","restriction":"Image"},{"name":"initial","default_value":"true","external_name":"initial","restriction":"Bool"}],"args_string":"(image : Image, initial : Bool = true)","args_html":"(image : Image, initial : Bool = true)","location":{"filename":"src/cr-image/mask.cr","line_number":67,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L67"},"def":{"name":"new","args":[{"name":"image","external_name":"image","restriction":"Image"},{"name":"initial","default_value":"true","external_name":"initial","restriction":"Bool"}],"visibility":"Public","body":"_ = allocate\n_.initialize(image, initial)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(width:Int32,bits:BitArray)-class-method","name":"new","doc":"Construct a new `Mask` with a set width and bits from `bits`","summary":"

        Construct a new Mask with a set width and bits from #bits

        ","abstract":false,"args":[{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"bits","external_name":"bits","restriction":"::BitArray"}],"args_string":"(width : Int32, bits : BitArray)","args_html":"(width : Int32, bits : BitArray)","location":{"filename":"src/cr-image/mask.cr","line_number":44,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L44"},"def":{"name":"new","args":[{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"bits","external_name":"bits","restriction":"::BitArray"}],"visibility":"Public","body":"_ = allocate\n_.initialize(width, bits)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(width:Int32,height:Int32,&block:Int32,Int32->Bool)-class-method","name":"new","doc":"Construct a new `Mask` of width x height using `&block` to determine if a bit should be true or not (passed in `x` and `y` coordinates)","summary":"

        Construct a new Mask of width x height using &block to determine if a bit should be true or not (passed in x and y coordinates)

        ","abstract":false,"args":[{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"height","external_name":"height","restriction":"Int32"}],"args_string":"(width : Int32, height : Int32, &block : Int32, Int32 -> Bool)","args_html":"(width : Int32, height : Int32, &block : Int32, Int32 -> Bool)","location":{"filename":"src/cr-image/mask.cr","line_number":54,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L54"},"def":{"name":"new","args":[{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"height","external_name":"height","restriction":"Int32"}],"yields":2,"block_arity":2,"block_arg":{"name":"block","external_name":"block","restriction":"(Int32, Int32 -> Bool)"},"visibility":"Public","body":"_ = allocate\n_.initialize(width, height, &block) do |_arg0, _arg1|\n yield _arg0, _arg1\nend\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"==(other:Mask)-instance-method","name":"==","abstract":false,"args":[{"name":"other","external_name":"other","restriction":"Mask"}],"args_string":"(other : Mask)","args_html":"(other : Mask)","location":{"filename":"src/cr-image/mask.cr","line_number":166,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L166"},"def":{"name":"==","args":[{"name":"other","external_name":"other","restriction":"Mask"}],"visibility":"Public","body":"(width == other.width) && (bits == other.bits)"}},{"html_id":"[](x:Int32,y:Int32):Bool-instance-method","name":"[]","doc":"Return the bit at `x` and `y`","summary":"

        Return the bit at x and y

        ","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"y","external_name":"y","restriction":"Int32"}],"args_string":"(x : Int32, y : Int32) : Bool","args_html":"(x : Int32, y : Int32) : Bool","location":{"filename":"src/cr-image/mask.cr","line_number":136,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L136"},"def":{"name":"[]","args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"y","external_name":"y","restriction":"Int32"}],"return_type":"Bool","visibility":"Public","body":"if x >= width || y >= height\n raise(IndexError.new(\"Out of bounds: this mask is #{width}x#{height}, and (#{x},#{y}) is outside of that\"))\nend\n@bits[(y * width) + x]\n"}},{"html_id":"[](xs:Range,y:Int32):BitArray-instance-method","name":"[]","doc":"Return a new `BitArray` corresponding to the partial row specified","summary":"

        Return a new BitArray corresponding to the partial row specified

        ","abstract":false,"args":[{"name":"xs","external_name":"xs","restriction":"Range"},{"name":"y","external_name":"y","restriction":"Int32"}],"args_string":"(xs : Range, y : Int32) : BitArray","args_html":"(xs : Range, y : Int32) : BitArray","location":{"filename":"src/cr-image/mask.cr","line_number":142,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L142"},"def":{"name":"[]","args":[{"name":"xs","external_name":"xs","restriction":"Range"},{"name":"y","external_name":"y","restriction":"Int32"}],"return_type":"BitArray","visibility":"Public","body":"start, count = resolve_to_start_and_count(xs, width)\nBitArray.new(count) do |x|\n self[x + start, y]\nend\n"}},{"html_id":"[](x:Int32,ys:Range):BitArray-instance-method","name":"[]","doc":"Return a new `BitArray` corresponding to the partial column specified","summary":"

        Return a new BitArray corresponding to the partial column specified

        ","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"ys","external_name":"ys","restriction":"Range"}],"args_string":"(x : Int32, ys : Range) : BitArray","args_html":"(x : Int32, ys : Range) : BitArray","location":{"filename":"src/cr-image/mask.cr","line_number":148,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L148"},"def":{"name":"[]","args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"ys","external_name":"ys","restriction":"Range"}],"return_type":"BitArray","visibility":"Public","body":"start, count = resolve_to_start_and_count(ys, height)\nBitArray.new(count) do |y|\n self[x, y + start]\nend\n"}},{"html_id":"[](xs:Range,ys:Range):Array(BitArray)-instance-method","name":"[]","doc":"Return an `Array(BitArray)` for the partial box (of partial rows and partial columns) of this mask.\n\nCan be used to construct another mask from.","summary":"

        Return an Array(BitArray) for the partial box (of partial rows and partial columns) of this mask.

        ","abstract":false,"args":[{"name":"xs","external_name":"xs","restriction":"Range"},{"name":"ys","external_name":"ys","restriction":"Range"}],"args_string":"(xs : Range, ys : Range) : Array(BitArray)","args_html":"(xs : Range, ys : Range) : Array(BitArray)","location":{"filename":"src/cr-image/mask.cr","line_number":156,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L156"},"def":{"name":"[]","args":[{"name":"xs","external_name":"xs","restriction":"Range"},{"name":"ys","external_name":"ys","restriction":"Range"}],"return_type":"Array(BitArray)","visibility":"Public","body":"start_x, count_x = resolve_to_start_and_count(xs, width)\nstart_y, count_y = resolve_to_start_and_count(ys, height)\ncount_y.times.to_a.map do |y|\n BitArray.new(count_x) do |x|\n self[x + start_x, y + start_y]\n end\nend\n"}},{"html_id":"[]=(x:Int32,y:Int32,value:Bool):Bool-instance-method","name":"[]=","doc":"Set the bit for coordinate `x` and `y`\n\n```\nmask = CrImage::Mask.new(50, 50, false)\nmask[20, 20] = true\nmask.to_gray.save(\"mask_point.jpg\")\n```\n\"Black","summary":"

        Set the bit for coordinate x and y

        ","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"y","external_name":"y","restriction":"Int32"},{"name":"value","external_name":"value","restriction":"Bool"}],"args_string":"(x : Int32, y : Int32, value : Bool) : Bool","args_html":"(x : Int32, y : Int32, value : Bool) : Bool","location":{"filename":"src/cr-image/mask.cr","line_number":186,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L186"},"def":{"name":"[]=","args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"y","external_name":"y","restriction":"Int32"},{"name":"value","external_name":"value","restriction":"Bool"}],"return_type":"Bool","visibility":"Public","body":"self.set(x, y, value)"}},{"html_id":"[]=(xs:Range,y:Int32,value:Bool):Bool-instance-method","name":"[]=","doc":"Set the bits for partial row `xs` at column `y`\n\n```\nmask = CrImage::Mask.new(50, 50, false)\nmask[20..40, 20] = true\nmask.to_gray.save(\"mask_partial_row.jpg\")\n```\n\"Black","summary":"

        Set the bits for partial row xs at column y

        ","abstract":false,"args":[{"name":"xs","external_name":"xs","restriction":"Range"},{"name":"y","external_name":"y","restriction":"Int32"},{"name":"value","external_name":"value","restriction":"Bool"}],"args_string":"(xs : Range, y : Int32, value : Bool) : Bool","args_html":"(xs : Range, y : Int32, value : Bool) : Bool","location":{"filename":"src/cr-image/mask.cr","line_number":198,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L198"},"def":{"name":"[]=","args":[{"name":"xs","external_name":"xs","restriction":"Range"},{"name":"y","external_name":"y","restriction":"Int32"},{"name":"value","external_name":"value","restriction":"Bool"}],"return_type":"Bool","visibility":"Public","body":"if y >= height\n raise(IndexError.new(\"Out of bounds: #{y} is beyond the bounds of this mask's height of #{height}\"))\nend\nstart_x, count_x = resolve_to_start_and_count(xs, width)\n@bits.fill(value, (y * width) + start_x, count_x)\nclear_caches\nvalue\n"}},{"html_id":"[]=(x:Int32,ys:Range,value:Bool):Bool-instance-method","name":"[]=","doc":"Set the bits for row `x` and partial columns `ys`\n\n```\nmask = CrImage::Mask.new(50, 50, false)\nmask[20..40, 20] = true\nmask.to_gray.save(\"mask_partial_column.jpg\")\n```\n\"Black","summary":"

        Set the bits for row x and partial columns ys

        ","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"ys","external_name":"ys","restriction":"Range"},{"name":"value","external_name":"value","restriction":"Bool"}],"args_string":"(x : Int32, ys : Range, value : Bool) : Bool","args_html":"(x : Int32, ys : Range, value : Bool) : Bool","location":{"filename":"src/cr-image/mask.cr","line_number":214,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L214"},"def":{"name":"[]=","args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"ys","external_name":"ys","restriction":"Range"},{"name":"value","external_name":"value","restriction":"Bool"}],"return_type":"Bool","visibility":"Public","body":"if x >= width\n raise(IndexError.new(\"Out of bounds: #{x} is beyond the bounds of this mask's width of #{width}\"))\nend\nstart_y, count_y = resolve_to_start_and_count(ys, height)\ncount_y.times.to_a.each do |y|\n set(x, y + start_y, value)\nend\nvalue\n"}},{"html_id":"[]=(xs:Range,ys:Range,value:Bool):Bool-instance-method","name":"[]=","doc":"Set the bits for partial rows `xs` and partial columns `ys`\n\n```\nmask = CrImage::Mask.new(50, 50, false)\nmask[20..40, 20..40] = true\nmask.to_gray.save(\"mask_partial_column.jpg\")\n```\n\"Black","summary":"

        Set the bits for partial rows xs and partial columns ys

        ","abstract":false,"args":[{"name":"xs","external_name":"xs","restriction":"Range"},{"name":"ys","external_name":"ys","restriction":"Range"},{"name":"value","external_name":"value","restriction":"Bool"}],"args_string":"(xs : Range, ys : Range, value : Bool) : Bool","args_html":"(xs : Range, ys : Range, value : Bool) : Bool","location":{"filename":"src/cr-image/mask.cr","line_number":231,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L231"},"def":{"name":"[]=","args":[{"name":"xs","external_name":"xs","restriction":"Range"},{"name":"ys","external_name":"ys","restriction":"Range"},{"name":"value","external_name":"value","restriction":"Bool"}],"return_type":"Bool","visibility":"Public","body":"start_x, count_x = resolve_to_start_and_count(xs, width)\nstart_y, count_y = resolve_to_start_and_count(ys, height)\ncount_y.times.to_a.each do |y|\n @bits.fill(value, ((y + start_y) * width) + start_x, count_x)\nend\nclear_caches\nvalue\n"}},{"html_id":"apply(image:Image):Image-instance-method","name":"apply","doc":"Apply this mask to the provided image with `Operation::MaskApply#apply`","summary":"

        Apply this mask to the provided image with Operation::MaskApply#apply

        ","abstract":false,"args":[{"name":"image","external_name":"image","restriction":"Image"}],"args_string":"(image : Image) : Image","args_html":"(image : Image) : Image","location":{"filename":"src/cr-image/mask.cr","line_number":247,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L247"},"def":{"name":"apply","args":[{"name":"image","external_name":"image","restriction":"Image"}],"return_type":"Image","visibility":"Public","body":"image.apply(self)"}},{"html_id":"apply(image:Image,&block:Int32,Int32,UInt8,ChannelType->UInt8):Image-instance-method","name":"apply","doc":"Apply this mask to the provided image with `Operation::MaskApply#apply`","summary":"

        Apply this mask to the provided image with Operation::MaskApply#apply

        ","abstract":false,"args":[{"name":"image","external_name":"image","restriction":"Image"}],"args_string":"(image : Image, &block : Int32, Int32, UInt8, ChannelType -> UInt8) : Image","args_html":"(image : Image, &block : Int32, Int32, UInt8, ChannelType -> UInt8) : Image","location":{"filename":"src/cr-image/mask.cr","line_number":252,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L252"},"def":{"name":"apply","args":[{"name":"image","external_name":"image","restriction":"Image"}],"yields":4,"block_arity":4,"block_arg":{"name":"block","external_name":"block","restriction":"(Int32, Int32, UInt8, ChannelType -> UInt8)"},"return_type":"Image","visibility":"Public","body":"image.apply(self, &block)"}},{"html_id":"at(index:Int32):Bool-instance-method","name":"at","doc":"Return the bit at `index`","summary":"

        Return the bit at index

        ","abstract":false,"args":[{"name":"index","external_name":"index","restriction":"Int32"}],"args_string":"(index : Int32) : Bool","args_html":"(index : Int32) : Bool","location":{"filename":"src/cr-image/mask.cr","line_number":124,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L124"},"def":{"name":"at","args":[{"name":"index","external_name":"index","restriction":"Int32"}],"return_type":"Bool","visibility":"Public","body":"if index >= size\n raise(\"Index #{index} exceeds mask size #{@bits.size}\")\nend\n@bits[index]\n"}},{"html_id":"bits:BitArray-instance-method","name":"bits","abstract":false,"location":{"filename":"src/cr-image/mask.cr","line_number":41,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L41"},"def":{"name":"bits","return_type":"BitArray","visibility":"Public","body":"@bits"}},{"html_id":"clone-instance-method","name":"clone","doc":"Create a new `Mask` from this one without modifying it","summary":"

        Create a new Mask from this one without modifying it

        ","abstract":false,"location":{"filename":"src/cr-image/mask.cr","line_number":95,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L95"},"def":{"name":"clone","visibility":"Public","body":"Mask.new(width, bits.dup)"}},{"html_id":"height:Int32-instance-method","name":"height","abstract":false,"location":{"filename":"src/cr-image/mask.cr","line_number":99,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L99"},"def":{"name":"height","return_type":"Int32","visibility":"Public","body":"@bits.size // width"}},{"html_id":"invert-instance-method","name":"invert","doc":"Return a new `Mask` that's a copy of this one with all bits inverted.","summary":"

        Return a new Mask that's a copy of this one with all bits inverted.

        ","abstract":false,"location":{"filename":"src/cr-image/mask.cr","line_number":117,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L117"},"def":{"name":"invert","visibility":"Public","body":"new_bits = @bits.dup\nnew_bits.invert\nMask.new(width, new_bits)\n"}},{"html_id":"invert!-instance-method","name":"invert!","doc":"Invert all bits in this instance of `Mask`. Modifies self.\n\n\"Black\n\nBecomes\n\n\"White","summary":"

        Invert all bits in this instance of Mask.

        ","abstract":false,"location":{"filename":"src/cr-image/mask.cr","line_number":110,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L110"},"def":{"name":"invert!","visibility":"Public","body":"@bits.invert\nclear_caches\nself\n"}},{"html_id":"region:Region-instance-method","name":"region","doc":"Returns the bounding box of the mask where all true bits are contained. Any pixels outside of the region are false\n\n```\nmask = CrImage::Mask.new(50, 50, false)\nmask[20..40, 20] = true\nmask[20, 20..40] = true\nmask.region # => Region(x: 20, y: 20, width: 20, height: 20)\n```\n\n\"Black","summary":"

        Returns the bounding box of the mask where all true bits are contained.

        ","abstract":false,"location":{"filename":"src/cr-image/mask.cr","line_number":274,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L274"},"def":{"name":"region","return_type":"Region","visibility":"Public","body":"@region || (@region = calculate_region)"}},{"html_id":"segments(*,diagonal:Bool=true):Array(Mask)-instance-method","name":"segments","doc":"Return an array of `Mask`s, each one corresponding to an area of contiguous true bits (identified from flood fills).\n\nMay specify `diagonal: false` for only 4-way (up, down, left, right) flood fill instead of default 8-way.\nStarting with sample mask:\n```\nmask = CrImage::Mask.new(50, 50, false)\n\nmask[5..45, 5..45] = true\nmask[15..35, 15..35] = false\nmask[21..25, 21..25] = true\nmask[26..30, 26..30] = true\n```\n\n\"Black\n\nIts segments look like:\n```\nmask.segments.each_with_index do |segment, i|\n segment.to_gray.save(\"mask_8-way_segments_example_#{i}.jpg\")\nend\n```\nYields the images:\n\n\"Black\n\"Black\n\nUsing `diagonal: false` yields:\n```\nmask.segments(diagonal: false).each_with_index do |segment, i|\n segment.to_gray.save(\"mask_4-way_segments_example_#{i}.jpg\")\nend\n```\nYields the images:\n\n\"Black\n\"Black\n\"Black","summary":"

        Return an array of Masks, each one corresponding to an area of contiguous true bits (identified from flood fills).

        ","abstract":false,"args":[{"name":"","external_name":"","restriction":""},{"name":"diagonal","default_value":"true","external_name":"diagonal","restriction":"Bool"}],"args_string":"(*, diagonal : Bool = true) : Array(Mask)","args_html":"(*, diagonal : Bool = true) : Array(Mask)","location":{"filename":"src/cr-image/mask.cr","line_number":342,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L342"},"def":{"name":"segments","args":[{"name":"","external_name":"","restriction":""},{"name":"diagonal","default_value":"true","external_name":"diagonal","restriction":"Bool"}],"splat_index":0,"return_type":"Array(Mask)","visibility":"Public","body":"diagonal ? (@segments_8_way || (@segments_8_way = calculate_segments(diagonal))) : (@segments_4_way || (@segments_4_way = calculate_segments(diagonal)))"}},{"html_id":"set(x:Int32,y:Int32,value:Bool):Bool-instance-method","name":"set","doc":"Set the bit for coordinate `x` and `y`","summary":"

        Set the bit for coordinate x and y

        ","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"y","external_name":"y","restriction":"Int32"},{"name":"value","external_name":"value","restriction":"Bool"}],"args_string":"(x : Int32, y : Int32, value : Bool) : Bool","args_html":"(x : Int32, y : Int32, value : Bool) : Bool","location":{"filename":"src/cr-image/mask.cr","line_number":172,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L172"},"def":{"name":"set","args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"y","external_name":"y","restriction":"Int32"},{"name":"value","external_name":"value","restriction":"Bool"}],"return_type":"Bool","visibility":"Public","body":"if x >= width || y >= height\n raise(IndexError.new(\"Out of bounds: this mask is #{width}x#{height}, and (#{x},#{y}) is outside of that\"))\nend\nclear_caches\n@bits[(y * width) + x] = value\n"}},{"html_id":"size(*args,**options)-instance-method","name":"size","doc":"How many bits are stored in this `Mask`","summary":"

        How many bits are stored in this Mask

        ","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/cr-image/mask.cr","line_number":92,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L92"},"def":{"name":"size","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"bits.size(*args, **options)"}},{"html_id":"size(*args,**options,&)-instance-method","name":"size","doc":"How many bits are stored in this `Mask`","summary":"

        How many bits are stored in this Mask

        ","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/cr-image/mask.cr","line_number":92,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L92"},"def":{"name":"size","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"bits.size(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"to_gray:GrayscaleImage-instance-method","name":"to_gray","doc":"Convert this `Mask` to a `GrayscaleImage`, with false bits becoming 0, and true bits becoming 255","summary":"

        Convert this Mask to a GrayscaleImage, with false bits becoming 0, and true bits becoming 255

        ","abstract":false,"location":{"filename":"src/cr-image/mask.cr","line_number":242,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L242"},"def":{"name":"to_gray","return_type":"GrayscaleImage","visibility":"Public","body":"GrayscaleImage.new(bits.map do |b|\n b ? 255_u8 : 0_u8\nend, width, height)"}},{"html_id":"width:Int32-instance-method","name":"width","abstract":false,"location":{"filename":"src/cr-image/mask.cr","line_number":40,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L40"},"def":{"name":"width","return_type":"Int32","visibility":"Public","body":"@width"}}]},{"html_id":"cr-image/CrImage/Operation","path":"CrImage/Operation.html","kind":"module","full_name":"CrImage::Operation","name":"Operation","abstract":false,"locations":[{"filename":"src/cr-image/operation/bilinear_resize.cr","line_number":14,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/bilinear_resize.cr#L14"},{"filename":"src/cr-image/operation/operation.cr","line_number":2,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/operation.cr#L2"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"cr-image/CrImage","kind":"module","full_name":"CrImage","name":"CrImage"},"doc":"Module for containing individual operations for `Image` classes.","summary":"

        Module for containing individual operations for Image classes.

        ","types":[{"html_id":"cr-image/CrImage/Operation/BilinearResize","path":"CrImage/Operation/BilinearResize.html","kind":"module","full_name":"CrImage::Operation::BilinearResize","name":"BilinearResize","abstract":false,"locations":[{"filename":"src/cr-image/operation/bilinear_resize.cr","line_number":14,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/bilinear_resize.cr#L14"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"cr-image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"cr-image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"cr-image/CrImage/Operation","kind":"module","full_name":"CrImage::Operation","name":"Operation"},"doc":"Resize an image using a bilinear resizing algorithm.\n\nTaking sample `image`:\n\n\"Woman\n\n```\nputs image.width, image.height # => 159x199\nimage.bilinear_resize(40, 50).save(\"small_sample.jpg\")\nimage.bilinear_resize(200, 250).save(\"larger_sample.jpg\")\n```\n\"Sample\n\"Sample","summary":"

        Resize an image using a bilinear resizing algorithm.

        ","instance_methods":[{"html_id":"bilinear_resize(width:Int32,height:Int32):self-instance-method","name":"bilinear_resize","doc":"Resizes image to new dimensions","summary":"

        Resizes image to new dimensions

        ","abstract":false,"args":[{"name":"width","external_name":"width","restriction":"Int32"},{"name":"height","external_name":"height","restriction":"Int32"}],"args_string":"(width : Int32, height : Int32) : self","args_html":"(width : Int32, height : Int32) : self","location":{"filename":"src/cr-image/operation/bilinear_resize.cr","line_number":16,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/bilinear_resize.cr#L16"},"def":{"name":"bilinear_resize","args":[{"name":"width","external_name":"width","restriction":"Int32"},{"name":"height","external_name":"height","restriction":"Int32"}],"return_type":"self","visibility":"Public","body":"clone.bilinear_resize!(width, height)"}},{"html_id":"bilinear_resize!(width:Int32,height:Int32):self-instance-method","name":"bilinear_resize!","doc":"Resizes image to new dimensions. Modifies self.","summary":"

        Resizes image to new dimensions.

        ","abstract":false,"args":[{"name":"width","external_name":"width","restriction":"Int32"},{"name":"height","external_name":"height","restriction":"Int32"}],"args_string":"(width : Int32, height : Int32) : self","args_html":"(width : Int32, height : Int32) : self","location":{"filename":"src/cr-image/operation/bilinear_resize.cr","line_number":21,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/bilinear_resize.cr#L21"},"def":{"name":"bilinear_resize!","args":[{"name":"width","external_name":"width","restriction":"Int32"},{"name":"height","external_name":"height","restriction":"Int32"}],"return_type":"self","visibility":"Public","body":"x_ratio = width > 1 ? (@width - 1) / (width - 1) : 0\ny_ratio = height > 1 ? (@height - 1) / (height - 1) : 0\neach_channel do |channel, channel_type|\n resized_channel = Array.new(width * height) do\n 0_u8\n end\n height.times do |h|\n width.times do |w|\n x = w * x_ratio\n y = h * y_ratio\n x_ceil = Math.min(@width - 1, x.ceil.to_i)\n x_floor = x.floor.to_i\n y_ceil = Math.min(@height - 1, y.ceil.to_i)\n y_floor = y.floor.to_i\n value = case\n when (x_ceil == x_floor) && (y_ceil == y_floor)\n x_index = x.to_i\n y_index = y.to_i\n channel.unsafe_fetch((@width * y_index) + x_index)\n when x_ceil == x_floor\n x_index = x.to_i\n q_1 = channel.unsafe_fetch((@width * y_ceil) + x_index)\n q_2 = channel.unsafe_fetch((@width * y_floor) + x_index)\n ((q_2 * (y_ceil - y)) + (q_1 * (y - y_floor))).to_u8\n when y_ceil == y_floor\n y_index = y.to_i\n q_1 = channel.unsafe_fetch((@width * y_index) + x_ceil)\n q_2 = channel.unsafe_fetch((@width * y_index) + x_floor)\n ((q_2 * (x_ceil - x)) + (q_1 * (x - x_floor))).to_u8\n else\n v_1 = channel.unsafe_fetch((@width * y_floor) + x_floor)\n v_2 = channel.unsafe_fetch((@width * y_floor) + x_ceil)\n v_3 = channel.unsafe_fetch((@width * y_ceil) + x_floor)\n v_4 = channel.unsafe_fetch((@width * y_ceil) + x_ceil)\n q_1 = (v_1 * (x_ceil - x)) + (v_2 * (x - x_floor))\n q_2 = (v_3 * (x_ceil - x)) + (v_4 * (x - x_floor))\n ((q_1 * (y_ceil - y)) + (q_2 * (y - y_floor))).to_u8\n end\n resized_channel.unsafe_put((width * h) + w, value)\n end\n end\n self[channel_type] = resized_channel\nend\n@width = width\n@height = height\nself\n"}}]},{"html_id":"cr-image/CrImage/Operation/BoxBlur","path":"CrImage/Operation/BoxBlur.html","kind":"module","full_name":"CrImage::Operation::BoxBlur","name":"BoxBlur","abstract":false,"locations":[{"filename":"src/cr-image/operation/box_blur.cr","line_number":13,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/box_blur.cr#L13"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"cr-image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"cr-image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"cr-image/CrImage/Operation","kind":"module","full_name":"CrImage::Operation","name":"Operation"},"doc":"Blurs the image\n\nTaking sample `image`:\n\n\"Woman\n\n```\nimage.box_blur(1).save(\"blurred_1_sample.jpg\")\nimage.box_blur(5).save(\"blurred_5_sample.jpg\")\n```\n\"Blurred\n\"Blurred","summary":"

        Blurs the image

        ","instance_methods":[{"html_id":"box_blur(value:Int32):self-instance-method","name":"box_blur","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Int32"}],"args_string":"(value : Int32) : self","args_html":"(value : Int32) : self","location":{"filename":"src/cr-image/operation/box_blur.cr","line_number":14,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/box_blur.cr#L14"},"def":{"name":"box_blur","args":[{"name":"value","external_name":"value","restriction":"Int32"}],"return_type":"self","visibility":"Public","body":"clone.box_blur!(value)"}},{"html_id":"box_blur!(value:Int32):self-instance-method","name":"box_blur!","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Int32"}],"args_string":"(value : Int32) : self","args_html":"(value : Int32) : self","location":{"filename":"src/cr-image/operation/box_blur.cr","line_number":18,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/box_blur.cr#L18"},"def":{"name":"box_blur!","args":[{"name":"value","external_name":"value","restriction":"Int32"}],"return_type":"self","visibility":"Public","body":"horizontal_blur!(value)\nvertical_blur!(value)\n"}}]},{"html_id":"cr-image/CrImage/Operation/Brightness","path":"CrImage/Operation/Brightness.html","kind":"module","full_name":"CrImage::Operation::Brightness","name":"Brightness","abstract":false,"locations":[{"filename":"src/cr-image/operation/brightness.cr","line_number":11,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/brightness.cr#L11"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"cr-image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"cr-image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"cr-image/CrImage/Operation","kind":"module","full_name":"CrImage::Operation","name":"Operation"},"doc":"Brightens an image (increases white value)\n\nTaking sample `image`:\n\n\"Woman\n\n```\nimage.brightness(2.0)\n```\n\"Brightened","summary":"

        Brightens an image (increases white value)

        ","instance_methods":[{"html_id":"brightness(value:Float64):self-instance-method","name":"brightness","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Float64"}],"args_string":"(value : Float64) : self","args_html":"(value : Float64) : self","location":{"filename":"src/cr-image/operation/brightness.cr","line_number":12,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/brightness.cr#L12"},"def":{"name":"brightness","args":[{"name":"value","external_name":"value","restriction":"Float64"}],"return_type":"self","visibility":"Public","body":"clone.brightness!(value)"}},{"html_id":"brightness!(value:Float64):self-instance-method","name":"brightness!","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Float64"}],"args_string":"(value : Float64) : self","args_html":"(value : Float64) : self","location":{"filename":"src/cr-image/operation/brightness.cr","line_number":16,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/brightness.cr#L16"},"def":{"name":"brightness!","args":[{"name":"value","external_name":"value","restriction":"Float64"}],"return_type":"self","visibility":"Public","body":"each_channel do |channel|\n size.times do |index|\n channel.unsafe_put(index, (Math.min(255, ( (channel.unsafe_fetch(index)) * value))).to_u8)\n end\nend\nself\n"}}]},{"html_id":"cr-image/CrImage/Operation/ChannelSwap","path":"CrImage/Operation/ChannelSwap.html","kind":"module","full_name":"CrImage::Operation::ChannelSwap","name":"ChannelSwap","abstract":false,"locations":[{"filename":"src/cr-image/operation/channel_swap.cr","line_number":11,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/channel_swap.cr#L11"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"cr-image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"cr-image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"cr-image/CrImage/Operation","kind":"module","full_name":"CrImage::Operation","name":"Operation"},"doc":"Swaps channels of `ChannelType` supported by an image\n\nTaking sample `image`:\n\n\"Woman\n\n```\nimage.channel_swap(:green, :red) # Crystal autocasting of symbols to Pluto::ChannelType enum is magic\n```\n\"Channel","summary":"

        Swaps channels of ChannelType supported by an image

        ","instance_methods":[{"html_id":"channel_swap(a:ChannelType,b:ChannelType):self-instance-method","name":"channel_swap","abstract":false,"args":[{"name":"a","external_name":"a","restriction":"ChannelType"},{"name":"b","external_name":"b","restriction":"ChannelType"}],"args_string":"(a : ChannelType, b : ChannelType) : self","args_html":"(a : ChannelType, b : ChannelType) : self","location":{"filename":"src/cr-image/operation/channel_swap.cr","line_number":12,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/channel_swap.cr#L12"},"def":{"name":"channel_swap","args":[{"name":"a","external_name":"a","restriction":"ChannelType"},{"name":"b","external_name":"b","restriction":"ChannelType"}],"return_type":"self","visibility":"Public","body":"clone.channel_swap!(a, b)"}},{"html_id":"channel_swap!(a:ChannelType,b:ChannelType):self-instance-method","name":"channel_swap!","abstract":false,"args":[{"name":"a","external_name":"a","restriction":"ChannelType"},{"name":"b","external_name":"b","restriction":"ChannelType"}],"args_string":"(a : ChannelType, b : ChannelType) : self","args_html":"(a : ChannelType, b : ChannelType) : self","location":{"filename":"src/cr-image/operation/channel_swap.cr","line_number":16,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/channel_swap.cr#L16"},"def":{"name":"channel_swap!","args":[{"name":"a","external_name":"a","restriction":"ChannelType"},{"name":"b","external_name":"b","restriction":"ChannelType"}],"return_type":"self","visibility":"Public","body":"ch_a, ch_b = self[a], self[b]\nself[a] = ch_b\nself[b] = ch_a\nself\n"}}]},{"html_id":"cr-image/CrImage/Operation/Contrast","path":"CrImage/Operation/Contrast.html","kind":"module","full_name":"CrImage::Operation::Contrast","name":"Contrast","abstract":false,"locations":[{"filename":"src/cr-image/operation/contrast.cr","line_number":11,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/contrast.cr#L11"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"cr-image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"cr-image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"cr-image/CrImage/Operation","kind":"module","full_name":"CrImage::Operation","name":"Operation"},"doc":"Increases contrast of an image\n\nTaking sample `image`:\n\n\"Woman\n\n```\nimage.contrast(20)\n```\n\"Contrasted","summary":"

        Increases contrast of an image

        ","instance_methods":[{"html_id":"contrast(value:Float64):self-instance-method","name":"contrast","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Float64"}],"args_string":"(value : Float64) : self","args_html":"(value : Float64) : self","location":{"filename":"src/cr-image/operation/contrast.cr","line_number":12,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/contrast.cr#L12"},"def":{"name":"contrast","args":[{"name":"value","external_name":"value","restriction":"Float64"}],"return_type":"self","visibility":"Public","body":"clone.contrast!(value)"}},{"html_id":"contrast!(value:Float64):self-instance-method","name":"contrast!","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Float64"}],"args_string":"(value : Float64) : self","args_html":"(value : Float64) : self","location":{"filename":"src/cr-image/operation/contrast.cr","line_number":16,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/contrast.cr#L16"},"def":{"name":"contrast!","args":[{"name":"value","external_name":"value","restriction":"Float64"}],"return_type":"self","visibility":"Public","body":"factor = (259 * (value + 255)) / (255 * (259 - value))\neach_channel do |channel|\n size.times do |index|\n channel.unsafe_put(index, (Math.min(255, Math.max(0, (factor * ((channel.unsafe_fetch(index)).to_i - 128)) + 128))).to_u8)\n end\nend\nself\n"}}]},{"html_id":"cr-image/CrImage/Operation/Crop","path":"CrImage/Operation/Crop.html","kind":"module","full_name":"CrImage::Operation::Crop","name":"Crop","abstract":false,"locations":[{"filename":"src/cr-image/operation/crop.cr","line_number":13,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/crop.cr#L13"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"cr-image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"cr-image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"cr-image/CrImage/Operation","kind":"module","full_name":"CrImage::Operation","name":"Operation"},"doc":"Crops an image\n\nTaking sample `image`:\n\n\"Woman\n\n```\n# These calls are equivalent\nimage.crop(40, 30, 80, 80)\nimage[40...120, 30...110]\n```\n\"Cropped","summary":"

        Crops an image

        ","instance_methods":[{"html_id":"[](xrange:Range(Int32,Int32)|Range(Int32,Nil)|Range(Nil,Int32),yrange:Range(Int32,Int32)|Range(Int32,Nil)|Range(Nil,Int32)):self-instance-method","name":"[]","abstract":false,"args":[{"name":"xrange","external_name":"xrange","restriction":"Range(Int32, Int32) | Range(Int32, Nil) | Range(Nil, Int32)"},{"name":"yrange","external_name":"yrange","restriction":"Range(Int32, Int32) | Range(Int32, Nil) | Range(Nil, Int32)"}],"args_string":"(xrange : Range(Int32, Int32) | Range(Int32, Nil) | Range(Nil, Int32), yrange : Range(Int32, Int32) | Range(Int32, Nil) | Range(Nil, Int32)) : self","args_html":"(xrange : Range(Int32, Int32) | Range(Int32, Nil) | Range(Nil, Int32), yrange : Range(Int32, Int32) | Range(Int32, Nil) | Range(Nil, Int32)) : self","location":{"filename":"src/cr-image/operation/crop.cr","line_number":22,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/crop.cr#L22"},"def":{"name":"[]","args":[{"name":"xrange","external_name":"xrange","restriction":"Range(Int32, Int32) | Range(Int32, Nil) | Range(Nil, Int32)"},{"name":"yrange","external_name":"yrange","restriction":"Range(Int32, Int32) | Range(Int32, Nil) | Range(Nil, Int32)"}],"return_type":"self","visibility":"Public","body":"xstart, xcount = resolve_to_start_and_count(xrange, width)\nystart, ycount = resolve_to_start_and_count(yrange, height)\ncrop(xstart, ystart, xcount, ycount)\n"}},{"html_id":"crop(x:Int32,y:Int32,new_width:Int32,new_height:Int32):self-instance-method","name":"crop","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"y","external_name":"y","restriction":"Int32"},{"name":"new_width","external_name":"new_width","restriction":"Int32"},{"name":"new_height","external_name":"new_height","restriction":"Int32"}],"args_string":"(x : Int32, y : Int32, new_width : Int32, new_height : Int32) : self","args_html":"(x : Int32, y : Int32, new_width : Int32, new_height : Int32) : self","location":{"filename":"src/cr-image/operation/crop.cr","line_number":18,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/crop.cr#L18"},"def":{"name":"crop","args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"y","external_name":"y","restriction":"Int32"},{"name":"new_width","external_name":"new_width","restriction":"Int32"},{"name":"new_height","external_name":"new_height","restriction":"Int32"}],"return_type":"self","visibility":"Public","body":"clone.crop!(x, y, new_width, new_height)"}},{"html_id":"crop(region:Region):self-instance-method","name":"crop","abstract":false,"args":[{"name":"region","external_name":"region","restriction":"Region"}],"args_string":"(region : Region) : self","args_html":"(region : Region) : self","location":{"filename":"src/cr-image/operation/crop.cr","line_number":14,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/crop.cr#L14"},"def":{"name":"crop","args":[{"name":"region","external_name":"region","restriction":"Region"}],"return_type":"self","visibility":"Public","body":"crop(*region.to_tuple)"}},{"html_id":"crop!(x:Int32,y:Int32,new_width:Int32,new_height:Int32):self-instance-method","name":"crop!","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"y","external_name":"y","restriction":"Int32"},{"name":"new_width","external_name":"new_width","restriction":"Int32"},{"name":"new_height","external_name":"new_height","restriction":"Int32"}],"args_string":"(x : Int32, y : Int32, new_width : Int32, new_height : Int32) : self","args_html":"(x : Int32, y : Int32, new_width : Int32, new_height : Int32) : self","location":{"filename":"src/cr-image/operation/crop.cr","line_number":32,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/crop.cr#L32"},"def":{"name":"crop!","args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"y","external_name":"y","restriction":"Int32"},{"name":"new_width","external_name":"new_width","restriction":"Int32"},{"name":"new_height","external_name":"new_height","restriction":"Int32"}],"return_type":"self","visibility":"Public","body":"if (x + new_width) > width\n raise(\"Crop dimensions extend #{(x + new_width) - width} pixels beyond width of the image (#{width})\")\nend\nif (y + new_height) > height\n raise(\"Crop dimensions extend #{(y + new_height) - height} pixels beyond height of the image (#{height})\")\nend\nnew_size = new_width * new_height\nheight_offset = y * width\neach_channel do |channel, channel_type|\n resized_channel = Array.new(new_size) do\n 0_u8\n end\n new_height.times do |new_y|\n orig_index = (height_offset + (new_y * width)) + x\n resized_channel[new_y * new_width, new_width] = channel[orig_index, new_width]\n end\n self[channel_type] = resized_channel\nend\n@width = new_width\n@height = new_height\nself\n"}},{"html_id":"crop!(region:Region):self-instance-method","name":"crop!","abstract":false,"args":[{"name":"region","external_name":"region","restriction":"Region"}],"args_string":"(region : Region) : self","args_html":"(region : Region) : self","location":{"filename":"src/cr-image/operation/crop.cr","line_number":28,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/crop.cr#L28"},"def":{"name":"crop!","args":[{"name":"region","external_name":"region","restriction":"Region"}],"return_type":"self","visibility":"Public","body":"crop!(*region.to_tuple)"}}]},{"html_id":"cr-image/CrImage/Operation/Draw","path":"CrImage/Operation/Draw.html","kind":"module","full_name":"CrImage::Operation::Draw","name":"Draw","abstract":false,"locations":[{"filename":"src/cr-image/operation/draw.cr","line_number":15,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/draw.cr#L15"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"cr-image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"cr-image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"cr-image/CrImage/Operation","kind":"module","full_name":"CrImage::Operation","name":"Operation"},"doc":"Draws shapes in the image\n\nTaking sample `image`:\n\n\"Woman\n\n```\nimage.draw_square(40, 30, 80, 80, CrImage::Color.of(\"#00f\"))\nimage.draw_circle(80, 70, 40, CrImage::Color.of(\"#00f\"))\n```\n\"Woman\n\"Woman\n\nCan also use the `fill: true` parameter to fill in the drawn shapes","summary":"

        Draws shapes in the image

        ","instance_methods":[{"html_id":"draw_circle(x:Int,y:Int,radius:Int,color:Color,*,fill:Bool=false):self-instance-method","name":"draw_circle","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int"},{"name":"y","external_name":"y","restriction":"Int"},{"name":"radius","external_name":"radius","restriction":"Int"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"}],"args_string":"(x : Int, y : Int, radius : Int, color : Color, *, fill : Bool = false) : self","args_html":"(x : Int, y : Int, radius : Int, color : Color, *, fill : Bool = false) : self","location":{"filename":"src/cr-image/operation/draw.cr","line_number":56,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/draw.cr#L56"},"def":{"name":"draw_circle","args":[{"name":"x","external_name":"x","restriction":"Int"},{"name":"y","external_name":"y","restriction":"Int"},{"name":"radius","external_name":"radius","restriction":"Int"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"}],"splat_index":4,"return_type":"self","visibility":"Public","body":"clone.draw_circle!(x, y, radius, color, fill: fill)"}},{"html_id":"draw_circle(region:Region,radius:Int,color:Color,*,fill:Bool=false):self-instance-method","name":"draw_circle","doc":"Draw a circle around the region's center (see `Region#center`)","summary":"

        Draw a circle around the region's center (see Region#center)

        ","abstract":false,"args":[{"name":"region","external_name":"region","restriction":"Region"},{"name":"radius","external_name":"radius","restriction":"Int"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"}],"args_string":"(region : Region, radius : Int, color : Color, *, fill : Bool = false) : self","args_html":"(region : Region, radius : Int, color : Color, *, fill : Bool = false) : self","location":{"filename":"src/cr-image/operation/draw.cr","line_number":52,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/draw.cr#L52"},"def":{"name":"draw_circle","args":[{"name":"region","external_name":"region","restriction":"Region"},{"name":"radius","external_name":"radius","restriction":"Int"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"}],"splat_index":3,"return_type":"self","visibility":"Public","body":"clone.draw_circle!(*region.center, radius, color, fill: fill)"}},{"html_id":"draw_circle!(region:Region,color:Color,*,fill:Bool=false,radius:Int32|Nil=nil):self-instance-method","name":"draw_circle!","doc":"Draw a circle around the region's center (see `Region#center`)","summary":"

        Draw a circle around the region's center (see Region#center)

        ","abstract":false,"args":[{"name":"region","external_name":"region","restriction":"Region"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"},{"name":"radius","default_value":"nil","external_name":"radius","restriction":"Int32 | ::Nil"}],"args_string":"(region : Region, color : Color, *, fill : Bool = false, radius : Int32 | Nil = nil) : self","args_html":"(region : Region, color : Color, *, fill : Bool = false, radius : Int32 | Nil = nil) : self","location":{"filename":"src/cr-image/operation/draw.cr","line_number":61,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/draw.cr#L61"},"def":{"name":"draw_circle!","args":[{"name":"region","external_name":"region","restriction":"Region"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"},{"name":"radius","default_value":"nil","external_name":"radius","restriction":"Int32 | ::Nil"}],"splat_index":2,"return_type":"self","visibility":"Public","body":"draw_circle!(*region.center, radius, color, fill: fill)"}},{"html_id":"draw_square(x:Int,y:Int,box_width:Int,box_height:Int,color:Color,*,fill:Bool=false):self-instance-method","name":"draw_square","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int"},{"name":"y","external_name":"y","restriction":"Int"},{"name":"box_width","external_name":"box_width","restriction":"Int"},{"name":"box_height","external_name":"box_height","restriction":"Int"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"}],"args_string":"(x : Int, y : Int, box_width : Int, box_height : Int, color : Color, *, fill : Bool = false) : self","args_html":"(x : Int, y : Int, box_width : Int, box_height : Int, color : Color, *, fill : Bool = false) : self","location":{"filename":"src/cr-image/operation/draw.cr","line_number":20,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/draw.cr#L20"},"def":{"name":"draw_square","args":[{"name":"x","external_name":"x","restriction":"Int"},{"name":"y","external_name":"y","restriction":"Int"},{"name":"box_width","external_name":"box_width","restriction":"Int"},{"name":"box_height","external_name":"box_height","restriction":"Int"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"}],"splat_index":5,"return_type":"self","visibility":"Public","body":"clone.draw_square!(x, y, box_width, box_height, color, fill: fill)"}},{"html_id":"draw_square(region:Region,color:Color,*,fill:Bool=false):self-instance-method","name":"draw_square","abstract":false,"args":[{"name":"region","external_name":"region","restriction":"Region"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"}],"args_string":"(region : Region, color : Color, *, fill : Bool = false) : self","args_html":"(region : Region, color : Color, *, fill : Bool = false) : self","location":{"filename":"src/cr-image/operation/draw.cr","line_number":16,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/draw.cr#L16"},"def":{"name":"draw_square","args":[{"name":"region","external_name":"region","restriction":"Region"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"}],"splat_index":2,"return_type":"self","visibility":"Public","body":"clone.draw_square!(region, color, fill: fill)"}},{"html_id":"draw_square!(x:Int,y:Int,box_width:Int,box_height:Int,color:Color,*,fill:Bool=false):self-instance-method","name":"draw_square!","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int"},{"name":"y","external_name":"y","restriction":"Int"},{"name":"box_width","external_name":"box_width","restriction":"Int"},{"name":"box_height","external_name":"box_height","restriction":"Int"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"}],"args_string":"(x : Int, y : Int, box_width : Int, box_height : Int, color : Color, *, fill : Bool = false) : self","args_html":"(x : Int, y : Int, box_width : Int, box_height : Int, color : Color, *, fill : Bool = false) : self","location":{"filename":"src/cr-image/operation/draw.cr","line_number":28,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/draw.cr#L28"},"def":{"name":"draw_square!","args":[{"name":"x","external_name":"x","restriction":"Int"},{"name":"y","external_name":"y","restriction":"Int"},{"name":"box_width","external_name":"box_width","restriction":"Int"},{"name":"box_height","external_name":"box_height","restriction":"Int"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"}],"splat_index":5,"return_type":"self","visibility":"Public","body":"if (x + box_width) > width\n raise(\"Box dimensions extend #{(x + box_width) - width} pixels beyond width of the image (#{width})\")\nend\nif (y + box_height) > height\n raise(\"Box dimensions extend #{(y + box_height) - height} pixels beyond height of the image (#{height})\")\nend\nx_i = x.to_i\ny_i = y.to_i\neach_channel do |channel, channel_type|\n channel[( (y_i * width) + x_i), box_width] = Array(UInt8).new(box_width) do\n color[channel_type]\n end\n channel[((y_i + box_height) * width) + x_i, box_width] = Array(UInt8).new(box_width) do\n color[channel_type]\n end\n box_height.times do |i|\n if i == 0\n next\n end\n if fill\n channel[( ((y_i + i) * width) + x_i), box_width] = Array(UInt8).new(box_width) do\n color[channel_type]\n end\n else\n channel.unsafe_put(((y_i + i) * width) + x_i, color[channel_type])\n channel.unsafe_put((((y_i + i) * width) + x_i) + box_width, color[channel_type])\n end\n end\nend\nself\n"}},{"html_id":"draw_square!(region:Region,color:Color,*,fill:Bool=false):self-instance-method","name":"draw_square!","abstract":false,"args":[{"name":"region","external_name":"region","restriction":"Region"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"}],"args_string":"(region : Region, color : Color, *, fill : Bool = false) : self","args_html":"(region : Region, color : Color, *, fill : Bool = false) : self","location":{"filename":"src/cr-image/operation/draw.cr","line_number":24,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/draw.cr#L24"},"def":{"name":"draw_square!","args":[{"name":"region","external_name":"region","restriction":"Region"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"}],"splat_index":2,"return_type":"self","visibility":"Public","body":"draw_square!(*region.to_tuple, color, fill: fill)"}}]},{"html_id":"cr-image/CrImage/Operation/GaussianBlur","path":"CrImage/Operation/GaussianBlur.html","kind":"module","full_name":"CrImage::Operation::GaussianBlur","name":"GaussianBlur","abstract":false,"locations":[{"filename":"src/cr-image/operation/gaussian_blur.cr","line_number":13,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/gaussian_blur.cr#L13"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"cr-image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"cr-image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"cr-image/CrImage/Operation","kind":"module","full_name":"CrImage::Operation","name":"Operation"},"doc":"Applies a 3x3 Gaussian blur. Implementation derived from [here](https://blog.ivank.net/fastest-gaussian-blur.html)\n\nTaking sample `image`:\n\n\"Woman\n\n```\nimage.gaussian_blur(1).save(\"gaussian_1_sample.jpg\")\nimage.gaussian_blur(5).save(\"gaussian_5_sample.jpg\")\n```\n\"Blurred\n\"Blurred","summary":"

        Applies a 3x3 Gaussian blur.

        ","instance_methods":[{"html_id":"gaussian_blur(sigma:Int32):self-instance-method","name":"gaussian_blur","abstract":false,"args":[{"name":"sigma","external_name":"sigma","restriction":"Int32"}],"args_string":"(sigma : Int32) : self","args_html":"(sigma : Int32) : self","location":{"filename":"src/cr-image/operation/gaussian_blur.cr","line_number":14,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/gaussian_blur.cr#L14"},"def":{"name":"gaussian_blur","args":[{"name":"sigma","external_name":"sigma","restriction":"Int32"}],"return_type":"self","visibility":"Public","body":"clone.gaussian_blur!(sigma)"}},{"html_id":"gaussian_blur!(sigma:Int32):self-instance-method","name":"gaussian_blur!","abstract":false,"args":[{"name":"sigma","external_name":"sigma","restriction":"Int32"}],"args_string":"(sigma : Int32) : self","args_html":"(sigma : Int32) : self","location":{"filename":"src/cr-image/operation/gaussian_blur.cr","line_number":18,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/gaussian_blur.cr#L18"},"def":{"name":"gaussian_blur!","args":[{"name":"sigma","external_name":"sigma","restriction":"Int32"}],"return_type":"self","visibility":"Public","body":"n = 3\nw_ideal = Math.sqrt((((12 * sigma) * sigma) / n) + 1)\nw_l = w_ideal.floor.to_i\nif (w_l % 2) == 0\n w_l = w_l - 1\nend\nm_ideal = (((((12 * sigma) * sigma) - ((n * w_l) * w_l)) - ((4 * n) * w_l)) - (3 * n)) / ((-4 * w_l) - 4)\nm = m_ideal.round\nsizes = [] of Int32\nn.times do |i|\n sizes << (if i < m\n w_l\n else\n w_l + 2\n end)\nend\nbox_blur!(((sizes.unsafe_fetch(0)) - 1) // 2)\nbox_blur!(((sizes.unsafe_fetch(1)) - 1) // 2)\nbox_blur!(((sizes.unsafe_fetch(2)) - 1) // 2)\nself\n"}}]},{"html_id":"cr-image/CrImage/Operation/HistogramEqualize","path":"CrImage/Operation/HistogramEqualize.html","kind":"module","full_name":"CrImage::Operation::HistogramEqualize","name":"HistogramEqualize","abstract":false,"locations":[{"filename":"src/cr-image/operation/histogram.cr","line_number":19,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/histogram.cr#L19"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"cr-image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"cr-image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"cr-image/CrImage/Operation","kind":"module","full_name":"CrImage::Operation","name":"Operation"},"doc":"Provides methods for histogram and histogram equalization. Follows method outlined [here](https://www.sci.utah.edu/~acoste/uou/Image/project1/Arthur_COSTE_Project_1_report.html)\n\nIf an image is particularly dark or particularly bright with low contrast, the `Operation::Contrast#contrast` method will only\nmake the image darker or lighter. For images like these, equalizing the image along its histogram will produce better results.\n\n\"A\n\n```\nimage.contrast(10).save(\"contrast.jpg\")\nimage.histogram_equalize.save(\"equalized.jpg\")\n```\n\"Darker\n\"A\n\nThis method does not work well when a given method has a bimodal distribution of color pixels. For example:\n\n\"Woman\n\"Highly","summary":"

        Provides methods for histogram and histogram equalization.

        ","instance_methods":[{"html_id":"histogram(channel_type:ChannelType):Histogram-instance-method","name":"histogram","abstract":false,"args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"}],"args_string":"(channel_type : ChannelType) : Histogram","args_html":"(channel_type : ChannelType) : Histogram","location":{"filename":"src/cr-image/operation/histogram.cr","line_number":93,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/histogram.cr#L93"},"def":{"name":"histogram","args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"}],"return_type":"Histogram","visibility":"Public","body":"Histogram.new(self, channel_type)"}},{"html_id":"histogram_equalize:self-instance-method","name":"histogram_equalize","abstract":false,"location":{"filename":"src/cr-image/operation/histogram.cr","line_number":97,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/histogram.cr#L97"},"def":{"name":"histogram_equalize","return_type":"self","visibility":"Public","body":"clone.histogram_equalize!"}},{"html_id":"histogram_equalize!:self-instance-method","name":"histogram_equalize!","abstract":false,"location":{"filename":"src/cr-image/operation/histogram.cr","line_number":101,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/histogram.cr#L101"},"def":{"name":"histogram_equalize!","return_type":"self","visibility":"Public","body":"each_channel do |channel, channel_type|\n if channel_type.alpha?\n next\n end\n remap = (histogram(channel_type)).equalize\n size.times do |i|\n channel.unsafe_put(i, remap[channel.unsafe_fetch(i)])\n end\nend\nself\n"}}],"types":[{"html_id":"cr-image/CrImage/Operation/HistogramEqualize/Histogram","path":"CrImage/Operation/HistogramEqualize/Histogram.html","kind":"class","full_name":"CrImage::Operation::HistogramEqualize::Histogram","name":"Histogram","abstract":false,"superclass":{"html_id":"cr-image/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"cr-image/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"cr-image/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cr-image/operation/histogram.cr","line_number":21,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/histogram.cr#L21"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"cr-image/CrImage/Operation/HistogramEqualize","kind":"module","full_name":"CrImage::Operation::HistogramEqualize","name":"HistogramEqualize"},"doc":"A histogram of an `Image` for a specific `ChannelType`","summary":"

        A histogram of an Image for a specific ChannelType

        ","constructors":[{"html_id":"new(image:Image,channel_type:ChannelType)-class-method","name":"new","abstract":false,"args":[{"name":"image","external_name":"image","restriction":"Image"},{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"}],"args_string":"(image : Image, channel_type : ChannelType)","args_html":"(image : Image, channel_type : ChannelType)","location":{"filename":"src/cr-image/operation/histogram.cr","line_number":22,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/histogram.cr#L22"},"def":{"name":"new","args":[{"name":"image","external_name":"image","restriction":"Image"},{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"}],"visibility":"Public","body":"_ = allocate\n_.initialize(image, channel_type)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"cdf:Hash(UInt8,Float64)-instance-method","name":"cdf","doc":"Get the cumulative distribution for the image's histogram","summary":"

        Get the cumulative distribution for the image's histogram

        ","abstract":false,"location":{"filename":"src/cr-image/operation/histogram.cr","line_number":54,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/histogram.cr#L54"},"def":{"name":"cdf","return_type":"Hash(UInt8, Float64)","visibility":"Public","body":"total = 0_f64\n@cumulative_distribution_histogram || (@cumulative_distribution_histogram = normalize.map do |pixel, probability|\n original = total\n total = total + probability\n {pixel, original}\nend.to_h)\n"}},{"html_id":"counts:Hash(UInt8,Int32)-instance-method","name":"counts","doc":"Get the raw counts for a given pixel value (0-255) in the image","summary":"

        Get the raw counts for a given pixel value (0-255) in the image

        ","abstract":false,"location":{"filename":"src/cr-image/operation/histogram.cr","line_number":28,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/histogram.cr#L28"},"def":{"name":"counts","return_type":"Hash(UInt8, Int32)","visibility":"Public","body":"@internal_hist || (@internal_hist = calculate_counts)"}},{"html_id":"equalize:Hash(UInt8,UInt8)-instance-method","name":"equalize","doc":"Remap the cumalitive distribution of pixels to get a new, more spread out pixel value","summary":"

        Remap the cumalitive distribution of pixels to get a new, more spread out pixel value

        ","abstract":false,"location":{"filename":"src/cr-image/operation/histogram.cr","line_number":64,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/histogram.cr#L64"},"def":{"name":"equalize","return_type":"Hash(UInt8, UInt8)","visibility":"Public","body":"cdf.map do |pixel, cumalative|\n {pixel, ((cumalative * 255).clamp(0, 255)).to_u8}\nend.to_h"}},{"html_id":"normalize:Hash(UInt8,Float64)-instance-method","name":"normalize","doc":"Get pixel counts normalized - all values between 0.0 and 1.0","summary":"

        Get pixel counts normalized - all values between 0.0 and 1.0

        ","abstract":false,"location":{"filename":"src/cr-image/operation/histogram.cr","line_number":45,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/histogram.cr#L45"},"def":{"name":"normalize","return_type":"Hash(UInt8, Float64)","visibility":"Public","body":"counts.map do |pixel, count|\n {pixel, count.to_f / @image.size}\nend.to_h"}}]}]},{"html_id":"cr-image/CrImage/Operation/HorizontalBlur","path":"CrImage/Operation/HorizontalBlur.html","kind":"module","full_name":"CrImage::Operation::HorizontalBlur","name":"HorizontalBlur","abstract":false,"locations":[{"filename":"src/cr-image/operation/horizontal_blur.cr","line_number":13,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/horizontal_blur.cr#L13"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"cr-image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"cr-image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"cr-image/CrImage/Operation","kind":"module","full_name":"CrImage::Operation","name":"Operation"},"doc":"Blur an image along the horizontal axis\n\nTaking sample `image`:\n\n\"Woman\n\n```\nimage.horizontal_blur(1).save(\"horizontal_1_sample.jpg\")\nimage.horizontal_blur(5).save(\"horizontal_5_sample.jpg\")\n```\n\"Blurred\n\"Blurred","summary":"

        Blur an image along the horizontal axis

        ","instance_methods":[{"html_id":"horizontal_blur(value:Int32):self-instance-method","name":"horizontal_blur","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Int32"}],"args_string":"(value : Int32) : self","args_html":"(value : Int32) : self","location":{"filename":"src/cr-image/operation/horizontal_blur.cr","line_number":14,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/horizontal_blur.cr#L14"},"def":{"name":"horizontal_blur","args":[{"name":"value","external_name":"value","restriction":"Int32"}],"return_type":"self","visibility":"Public","body":"clone.horizontal_blur!(value)"}},{"html_id":"horizontal_blur!(value:Int32):self-instance-method","name":"horizontal_blur!","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Int32"}],"args_string":"(value : Int32) : self","args_html":"(value : Int32) : self","location":{"filename":"src/cr-image/operation/horizontal_blur.cr","line_number":18,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/horizontal_blur.cr#L18"},"def":{"name":"horizontal_blur!","args":[{"name":"value","external_name":"value","restriction":"Int32"}],"return_type":"self","visibility":"Public","body":"buffer = Bytes.new(size, 0)\nmultiplier = 1 / ((value + value) + 1)\neach_channel do |channel|\n @height.times do |y|\n c_index : Int32 = y * @width\n l_index : Int32 = c_index\n r_index : Int32 = c_index + value\n f_value : Int32 = (channel.unsafe_fetch(c_index)).to_i\n l_value : Int32 = (channel.unsafe_fetch((c_index + @width) - 1)).to_i\n c_value : Int32 = (value + 1) * f_value\n (0..(value - 1)).each do\n c_value = c_value + (channel.unsafe_fetch(c_index))\n end\n (0..value).each do\n c_value = c_value + ((channel.unsafe_fetch(r_index)).to_i - f_value)\n buffer.unsafe_put(c_index, ((c_value * multiplier).clamp(0, 255)).to_u8)\n r_index = r_index + 1\n c_index = c_index + 1\n end\n ((value + 1)..((@width - value) - 1)).each do\n c_value = c_value + ((channel.unsafe_fetch(r_index)).to_i - (channel.unsafe_fetch(l_index)).to_i)\n buffer.unsafe_put(c_index, ((c_value * multiplier).clamp(0, 255)).to_u8)\n r_index = r_index + 1\n l_index = l_index + 1\n c_index = c_index + 1\n end\n ((@width - value)..(@width - 1)).each do\n c_value = c_value + (l_value - (channel.unsafe_fetch(l_index)).to_i)\n buffer.unsafe_put(c_index, ((c_value * multiplier).clamp(0, 255)).to_u8)\n l_index = l_index + 1\n c_index = c_index + 1\n end\n end\n (channel.@buffer).copy_from(buffer.to_unsafe, buffer.size)\nend\nself\n"}}]},{"html_id":"cr-image/CrImage/Operation/MaskApply","path":"CrImage/Operation/MaskApply.html","kind":"module","full_name":"CrImage::Operation::MaskApply","name":"MaskApply","abstract":false,"locations":[{"filename":"src/cr-image/operation/mask_apply.cr","line_number":27,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/mask_apply.cr#L27"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"cr-image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"cr-image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"cr-image/CrImage/Operation","kind":"module","full_name":"CrImage::Operation","name":"Operation"},"doc":"Apply a mask to an image\n\nTaking sample `image`:\n\n\"Woman\n\nAnd mask\n\n\"Black\n\n```\nmask = CrImage::Mask.new(image, false)\nmask[50..90, 65..75] = true\nmask.to_gray.save(\"apply_mask_mask.jpg\")\n\nimage.apply(mask).save(\"apply_mask.jpg\")\n\nimage.apply_color(mask, CrImage::Color.of(\"#00f\")).save(\"apply_mask_color.jpg\")\n\nimage.apply(mask) do |x, y, pixel, channel_type|\n Math.min(255, pixel + 50).to_u8 if channel_type.blue?\nend.save(\"apply_mask_block.jpg\")\n```\n\"Image\n\"Thin\n\"Thin","summary":"

        Apply a mask to an image

        ","instance_methods":[{"html_id":"apply(mask:Mask):self-instance-method","name":"apply","doc":"Black out all pixels but those found in the mask","summary":"

        Black out all pixels but those found in the mask

        ","abstract":false,"args":[{"name":"mask","external_name":"mask","restriction":"Mask"}],"args_string":"(mask : Mask) : self","args_html":"(mask : Mask) : self","location":{"filename":"src/cr-image/operation/mask_apply.cr","line_number":29,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/mask_apply.cr#L29"},"def":{"name":"apply","args":[{"name":"mask","external_name":"mask","restriction":"Mask"}],"return_type":"self","visibility":"Public","body":"clone.apply!(mask)"}},{"html_id":"apply(mask:Mask,&block:Int32,Int32,UInt8,ChannelType->UInt8|Nil):self-instance-method","name":"apply","doc":"Apply block to all pixels that match mask, replacing pixel value if block returns non-nil value.\n\nDoes not change values not matched by the mask","summary":"

        Apply block to all pixels that match mask, replacing pixel value if block returns non-nil value.

        ","abstract":false,"args":[{"name":"mask","external_name":"mask","restriction":"Mask"}],"args_string":"(mask : Mask, &block : Int32, Int32, UInt8, ChannelType -> UInt8 | Nil) : self","args_html":"(mask : Mask, &block : Int32, Int32, UInt8, ChannelType -> UInt8 | Nil) : self","location":{"filename":"src/cr-image/operation/mask_apply.cr","line_number":36,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/mask_apply.cr#L36"},"def":{"name":"apply","args":[{"name":"mask","external_name":"mask","restriction":"Mask"}],"yields":4,"block_arity":4,"block_arg":{"name":"block","external_name":"block","restriction":"(Int32, Int32, UInt8, ChannelType -> UInt8 | ::Nil)"},"return_type":"self","visibility":"Public","body":"clone.apply!(mask, &block)"}},{"html_id":"apply!(mask:Mask):self-instance-method","name":"apply!","doc":"TODO: add apply version that accepts 1+ ChannelType that the mask should apply to (i.e. make a background completely transparent, not just transparent black)","summary":"

        TODO add apply version that accepts 1+ ChannelType that the mask should apply to (i.e.

        ","abstract":false,"args":[{"name":"mask","external_name":"mask","restriction":"Mask"}],"args_string":"(mask : Mask) : self","args_html":"(mask : Mask) : self","location":{"filename":"src/cr-image/operation/mask_apply.cr","line_number":46,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/mask_apply.cr#L46"},"def":{"name":"apply!","args":[{"name":"mask","external_name":"mask","restriction":"Mask"}],"return_type":"self","visibility":"Public","body":"if (mask.width == width) && (mask.height == height)\nelse\n raise(\"Mask of #{mask.width}x#{mask.height} doesn't match image dimensions #{width}x#{height}\")\nend\neach_channel do |channel|\n channel.map_with_index! do |pixel, i|\n mask.at(i) ? pixel : 0_u8\n end\nend\nself\n"}},{"html_id":"apply!(mask:Mask,&block:Int32,Int32,UInt8,ChannelType->UInt8|Nil):self-instance-method","name":"apply!","abstract":false,"args":[{"name":"mask","external_name":"mask","restriction":"Mask"}],"args_string":"(mask : Mask, &block : Int32, Int32, UInt8, ChannelType -> UInt8 | Nil) : self","args_html":"(mask : Mask, &block : Int32, Int32, UInt8, ChannelType -> UInt8 | Nil) : self","location":{"filename":"src/cr-image/operation/mask_apply.cr","line_number":55,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/mask_apply.cr#L55"},"def":{"name":"apply!","args":[{"name":"mask","external_name":"mask","restriction":"Mask"}],"yields":4,"block_arity":4,"block_arg":{"name":"block","external_name":"block","restriction":"(Int32, Int32, UInt8, ChannelType -> UInt8 | ::Nil)"},"return_type":"self","visibility":"Public","body":"if (mask.width == width) && (mask.height == height)\nelse\n raise(\"Mask of #{mask.width}x#{mask.height} doesn't match image dimensions #{width}x#{height}\")\nend\neach_channel do |channel, channel_type|\n channel.map_with_index! do |pixel, i|\n mask.at(i) ? (block.call(i % width, i // width, pixel, channel_type)) || pixel : pixel\n end\nend\nself\n"}},{"html_id":"apply_color(mask:Mask,color:Color):self-instance-method","name":"apply_color","doc":"Change the color of all pixels that match the mask","summary":"

        Change the color of all pixels that match the mask

        ","abstract":false,"args":[{"name":"mask","external_name":"mask","restriction":"Mask"},{"name":"color","external_name":"color","restriction":"Color"}],"args_string":"(mask : Mask, color : Color) : self","args_html":"(mask : Mask, color : Color) : self","location":{"filename":"src/cr-image/operation/mask_apply.cr","line_number":41,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/mask_apply.cr#L41"},"def":{"name":"apply_color","args":[{"name":"mask","external_name":"mask","restriction":"Mask"},{"name":"color","external_name":"color","restriction":"Color"}],"return_type":"self","visibility":"Public","body":"clone.apply_color!(mask, color)"}},{"html_id":"apply_color!(mask:Mask,color:Color):self-instance-method","name":"apply_color!","abstract":false,"args":[{"name":"mask","external_name":"mask","restriction":"Mask"},{"name":"color","external_name":"color","restriction":"Color"}],"args_string":"(mask : Mask, color : Color) : self","args_html":"(mask : Mask, color : Color) : self","location":{"filename":"src/cr-image/operation/mask_apply.cr","line_number":66,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/mask_apply.cr#L66"},"def":{"name":"apply_color!","args":[{"name":"mask","external_name":"mask","restriction":"Mask"},{"name":"color","external_name":"color","restriction":"Color"}],"return_type":"self","visibility":"Public","body":"apply!(mask) do |_, _, _, channel_type|\n color[channel_type]\nend"}}]},{"html_id":"cr-image/CrImage/Operation/VerticalBlur","path":"CrImage/Operation/VerticalBlur.html","kind":"module","full_name":"CrImage::Operation::VerticalBlur","name":"VerticalBlur","abstract":false,"locations":[{"filename":"src/cr-image/operation/vertical_blur.cr","line_number":13,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/vertical_blur.cr#L13"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"cr-image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"cr-image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"cr-image/CrImage/Operation","kind":"module","full_name":"CrImage::Operation","name":"Operation"},"doc":"Blur an image along the vertical axis\n\nTaking sample `image`:\n\n\"Woman\n\n```\nimage.vertical_blur(1).save(\"vertical_1_sample.jpg\")\nimage.vertical_blur(5).save(\"vertical_5_sample.jpg\")\n```\n\"Blurred\n\"Blurred","summary":"

        Blur an image along the vertical axis

        ","instance_methods":[{"html_id":"vertical_blur(value:Int32):self-instance-method","name":"vertical_blur","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Int32"}],"args_string":"(value : Int32) : self","args_html":"(value : Int32) : self","location":{"filename":"src/cr-image/operation/vertical_blur.cr","line_number":14,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/vertical_blur.cr#L14"},"def":{"name":"vertical_blur","args":[{"name":"value","external_name":"value","restriction":"Int32"}],"return_type":"self","visibility":"Public","body":"clone.vertical_blur!(value)"}},{"html_id":"vertical_blur!(value:Int32):self-instance-method","name":"vertical_blur!","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Int32"}],"args_string":"(value : Int32) : self","args_html":"(value : Int32) : self","location":{"filename":"src/cr-image/operation/vertical_blur.cr","line_number":18,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/vertical_blur.cr#L18"},"def":{"name":"vertical_blur!","args":[{"name":"value","external_name":"value","restriction":"Int32"}],"return_type":"self","visibility":"Public","body":"buffer = Bytes.new(size, 0)\nmultiplier = 1 / ((value + value) + 1)\neach_channel do |channel|\n @width.times do |x|\n c_index : Int32 = x\n l_index : Int32 = c_index\n r_index : Int32 = c_index + (value * @width)\n f_value : Int32 = (channel.unsafe_fetch(c_index)).to_i\n l_value : Int32 = (channel.unsafe_fetch(c_index + (@width * (@height - 1)))).to_i\n c_value : Int32 = (value + 1) * f_value\n (0..(value - 1)).each do\n c_value = c_value + (channel.unsafe_fetch(c_index))\n end\n (0..value).each do\n c_value = c_value + ((channel.unsafe_fetch(r_index)).to_i - f_value)\n buffer.unsafe_put(c_index, ((c_value * multiplier).clamp(0, 255)).to_u8)\n r_index = r_index + @width\n c_index = c_index + @width\n end\n ((value + 1)..((@height - value) - 1)).each do\n c_value = c_value + ((channel.unsafe_fetch(r_index)).to_i - (channel.unsafe_fetch(l_index)).to_i)\n buffer.unsafe_put(c_index, ((c_value * multiplier).clamp(0, 255)).to_u8)\n l_index = l_index + @width\n r_index = r_index + @width\n c_index = c_index + @width\n end\n ((@height - value)..(@height - 1)).each do\n c_value = c_value + (l_value - (channel.unsafe_fetch(l_index)).to_i)\n buffer.unsafe_put(c_index, ((c_value * multiplier).clamp(0, 255)).to_u8)\n l_index = l_index + @width\n c_index = c_index + @width\n end\n end\n (channel.@buffer).copy_from(buffer.to_unsafe, buffer.size)\nend\nself\n"}}]}]},{"html_id":"cr-image/CrImage/Region","path":"CrImage/Region.html","kind":"struct","full_name":"CrImage::Region","name":"Region","abstract":false,"superclass":{"html_id":"cr-image/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"cr-image/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"cr-image/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"cr-image/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cr-image/region.cr","line_number":5,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/region.cr#L5"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"cr-image/CrImage","kind":"module","full_name":"CrImage","name":"CrImage"},"doc":"Represents a rectangular area on an `Image` from its upper left corner `x` and `y` coordinates, and a `width` and `height`.\n\nSee `Operation::Crop#crop` and `Operation::Draw#draw_square` for examples using it.","summary":"

        Represents a rectangular area on an Image from its upper left corner #x and #y coordinates, and a #width and #height.

        ","constructors":[{"html_id":"center(x:UInt16,y:UInt16,width:UInt16,height:UInt16):Region-class-method","name":"center","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"UInt16"},{"name":"y","external_name":"y","restriction":"UInt16"},{"name":"width","external_name":"width","restriction":"UInt16"},{"name":"height","external_name":"height","restriction":"UInt16"}],"args_string":"(x : UInt16, y : UInt16, width : UInt16, height : UInt16) : Region","args_html":"(x : UInt16, y : UInt16, width : UInt16, height : UInt16) : Region","location":{"filename":"src/cr-image/region.cr","line_number":11,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/region.cr#L11"},"def":{"name":"center","args":[{"name":"x","external_name":"x","restriction":"UInt16"},{"name":"y","external_name":"y","restriction":"UInt16"},{"name":"width","external_name":"width","restriction":"UInt16"},{"name":"height","external_name":"height","restriction":"UInt16"}],"return_type":"Region","visibility":"Public","body":"new(x - (width // 2), y - (height // 2), width, height)"}},{"html_id":"new(x:UInt16,y:UInt16,width:UInt16,height:UInt16)-class-method","name":"new","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"UInt16"},{"name":"y","external_name":"y","restriction":"UInt16"},{"name":"width","external_name":"width","restriction":"UInt16"},{"name":"height","external_name":"height","restriction":"UInt16"}],"args_string":"(x : UInt16, y : UInt16, width : UInt16, height : UInt16)","args_html":"(x : UInt16, y : UInt16, width : UInt16, height : UInt16)","location":{"filename":"src/cr-image/region.cr","line_number":5,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/region.cr#L5"},"def":{"name":"new","args":[{"name":"x","external_name":"x","restriction":"UInt16"},{"name":"y","external_name":"y","restriction":"UInt16"},{"name":"width","external_name":"width","restriction":"UInt16"},{"name":"height","external_name":"height","restriction":"UInt16"}],"visibility":"Public","body":"_ = allocate\n_.initialize(x, y, width, height)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"center:Tuple(Int32,Int32)-instance-method","name":"center","doc":"Return the `{x, y}` tuple of the center coordinates of this `Region`","summary":"

        Return the {x, y} tuple of the center coordinates of this Region

        ","abstract":false,"location":{"filename":"src/cr-image/region.cr","line_number":21,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/region.cr#L21"},"def":{"name":"center","return_type":"Tuple(Int32, Int32)","visibility":"Public","body":"{(width.to_i // 2) + x.to_i, (height.to_i // 2) + y.to_i}"}},{"html_id":"clone-instance-method","name":"clone","abstract":false,"location":{"filename":"src/cr-image/region.cr","line_number":5,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/region.cr#L5"},"def":{"name":"clone","visibility":"Public","body":"self.class.new(@x.clone, @y.clone, @width.clone, @height.clone)"}},{"html_id":"copy_with(x_x=@x,y_y=@y,width_width=@width,height_height=@height)-instance-method","name":"copy_with","abstract":false,"args":[{"name":"_x","default_value":"@x","external_name":"x","restriction":""},{"name":"_y","default_value":"@y","external_name":"y","restriction":""},{"name":"_width","default_value":"@width","external_name":"width","restriction":""},{"name":"_height","default_value":"@height","external_name":"height","restriction":""}],"args_string":"(x _x = @x, y _y = @y, width _width = @width, height _height = @height)","args_html":"(x _x = @x, y _y = @y, width _width = @width, height _height = @height)","location":{"filename":"src/cr-image/region.cr","line_number":5,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/region.cr#L5"},"def":{"name":"copy_with","args":[{"name":"_x","default_value":"@x","external_name":"x","restriction":""},{"name":"_y","default_value":"@y","external_name":"y","restriction":""},{"name":"_width","default_value":"@width","external_name":"width","restriction":""},{"name":"_height","default_value":"@height","external_name":"height","restriction":""}],"visibility":"Public","body":"self.class.new(_x, _y, _width, _height)"}},{"html_id":"crop(image:Image):Image-instance-method","name":"crop","doc":"Crop a provided `Image` with this region, using `Operation::Crop#crop`","summary":"

        Crop a provided Image with this region, using Operation::Crop#crop

        ","abstract":false,"args":[{"name":"image","external_name":"image","restriction":"Image"}],"args_string":"(image : Image) : Image","args_html":"(image : Image) : Image","location":{"filename":"src/cr-image/region.cr","line_number":16,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/region.cr#L16"},"def":{"name":"crop","args":[{"name":"image","external_name":"image","restriction":"Image"}],"return_type":"Image","visibility":"Public","body":"image.crop(self)"}},{"html_id":"height:UInt16-instance-method","name":"height","abstract":false,"def":{"name":"height","return_type":"UInt16","visibility":"Public","body":"@height"}},{"html_id":"to_tuple:Tuple(Int32,Int32,Int32,Int32)-instance-method","name":"to_tuple","doc":"Return this `Region` as a `x`, `y`, `width`, and `height` tuple","summary":"

        Return this Region as a #x, #y, #width, and #height tuple

        ","abstract":false,"location":{"filename":"src/cr-image/region.cr","line_number":26,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/region.cr#L26"},"def":{"name":"to_tuple","return_type":"Tuple(Int32, Int32, Int32, Int32)","visibility":"Public","body":"{x.to_i, y.to_i, width.to_i, height.to_i}"}},{"html_id":"width:UInt16-instance-method","name":"width","abstract":false,"def":{"name":"width","return_type":"UInt16","visibility":"Public","body":"@width"}},{"html_id":"x:UInt16-instance-method","name":"x","abstract":false,"def":{"name":"x","return_type":"UInt16","visibility":"Public","body":"@x"}},{"html_id":"y:UInt16-instance-method","name":"y","abstract":false,"def":{"name":"y","return_type":"UInt16","visibility":"Public","body":"@y"}}]},{"html_id":"cr-image/CrImage/RGBAImage","path":"CrImage/RGBAImage.html","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage","abstract":false,"superclass":{"html_id":"cr-image/CrImage/Image","kind":"class","full_name":"CrImage::Image","name":"Image"},"ancestors":[{"html_id":"cr-image/CrImage/Operation/MaskApply","kind":"module","full_name":"CrImage::Operation::MaskApply","name":"MaskApply"},{"html_id":"cr-image/CrImage/Format/Save","kind":"module","full_name":"CrImage::Format::Save","name":"Save"},{"html_id":"cr-image/CrImage/Operation/HistogramEqualize","kind":"module","full_name":"CrImage::Operation::HistogramEqualize","name":"HistogramEqualize"},{"html_id":"cr-image/CrImage/Operation/Draw","kind":"module","full_name":"CrImage::Operation::Draw","name":"Draw"},{"html_id":"cr-image/CrImage/Operation/Crop","kind":"module","full_name":"CrImage::Operation::Crop","name":"Crop"},{"html_id":"cr-image/CrImage/Operation/VerticalBlur","kind":"module","full_name":"CrImage::Operation::VerticalBlur","name":"VerticalBlur"},{"html_id":"cr-image/CrImage/Operation/HorizontalBlur","kind":"module","full_name":"CrImage::Operation::HorizontalBlur","name":"HorizontalBlur"},{"html_id":"cr-image/CrImage/Operation/GaussianBlur","kind":"module","full_name":"CrImage::Operation::GaussianBlur","name":"GaussianBlur"},{"html_id":"cr-image/CrImage/Operation/Contrast","kind":"module","full_name":"CrImage::Operation::Contrast","name":"Contrast"},{"html_id":"cr-image/CrImage/Operation/ChannelSwap","kind":"module","full_name":"CrImage::Operation::ChannelSwap","name":"ChannelSwap"},{"html_id":"cr-image/CrImage/Operation/Brightness","kind":"module","full_name":"CrImage::Operation::Brightness","name":"Brightness"},{"html_id":"cr-image/CrImage/Operation/BoxBlur","kind":"module","full_name":"CrImage::Operation::BoxBlur","name":"BoxBlur"},{"html_id":"cr-image/CrImage/Operation/BilinearResize","kind":"module","full_name":"CrImage::Operation::BilinearResize","name":"BilinearResize"},{"html_id":"cr-image/CrImage/Format/PPM","kind":"module","full_name":"CrImage::Format::PPM","name":"PPM"},{"html_id":"cr-image/CrImage/Image","kind":"class","full_name":"CrImage::Image","name":"Image"},{"html_id":"cr-image/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"cr-image/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cr-image/rgba_image.cr","line_number":2,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/rgba_image.cr#L2"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"cr-image/CrImage/Format/PPM","kind":"module","full_name":"CrImage::Format::PPM","name":"PPM"},{"html_id":"cr-image/CrImage/Format/Save","kind":"module","full_name":"CrImage::Format::Save","name":"Save"},{"html_id":"cr-image/CrImage/Operation/BilinearResize","kind":"module","full_name":"CrImage::Operation::BilinearResize","name":"BilinearResize"},{"html_id":"cr-image/CrImage/Operation/BoxBlur","kind":"module","full_name":"CrImage::Operation::BoxBlur","name":"BoxBlur"},{"html_id":"cr-image/CrImage/Operation/Brightness","kind":"module","full_name":"CrImage::Operation::Brightness","name":"Brightness"},{"html_id":"cr-image/CrImage/Operation/ChannelSwap","kind":"module","full_name":"CrImage::Operation::ChannelSwap","name":"ChannelSwap"},{"html_id":"cr-image/CrImage/Operation/Contrast","kind":"module","full_name":"CrImage::Operation::Contrast","name":"Contrast"},{"html_id":"cr-image/CrImage/Operation/Crop","kind":"module","full_name":"CrImage::Operation::Crop","name":"Crop"},{"html_id":"cr-image/CrImage/Operation/Draw","kind":"module","full_name":"CrImage::Operation::Draw","name":"Draw"},{"html_id":"cr-image/CrImage/Operation/GaussianBlur","kind":"module","full_name":"CrImage::Operation::GaussianBlur","name":"GaussianBlur"},{"html_id":"cr-image/CrImage/Operation/HistogramEqualize","kind":"module","full_name":"CrImage::Operation::HistogramEqualize","name":"HistogramEqualize"},{"html_id":"cr-image/CrImage/Operation/HorizontalBlur","kind":"module","full_name":"CrImage::Operation::HorizontalBlur","name":"HorizontalBlur"},{"html_id":"cr-image/CrImage/Operation/MaskApply","kind":"module","full_name":"CrImage::Operation::MaskApply","name":"MaskApply"},{"html_id":"cr-image/CrImage/Operation/VerticalBlur","kind":"module","full_name":"CrImage::Operation::VerticalBlur","name":"VerticalBlur"}],"extended_modules":[{"html_id":"cr-image/CrImage/Format/Open","kind":"module","full_name":"CrImage::Format::Open","name":"Open"}],"namespace":{"html_id":"cr-image/CrImage","kind":"module","full_name":"CrImage","name":"CrImage"},"doc":"An image with red, green, blue, and alpha color channels (i.e. a color image). This image type is likely the one read from and written to file (or `IO`).","summary":"

        An image with red, green, blue, and alpha color channels (i.e.

        ","constructors":[{"html_id":"from_ppm(image_data:Bytes):self-class-method","name":"from_ppm","doc":"Read `image_data` as PPM encoded bytes","summary":"

        Read image_data as PPM encoded bytes

        ","abstract":false,"args":[{"name":"image_data","external_name":"image_data","restriction":"Bytes"}],"args_string":"(image_data : Bytes) : self","args_html":"(image_data : Bytes) : self","def":{"name":"from_ppm","args":[{"name":"image_data","external_name":"image_data","restriction":"Bytes"}],"return_type":"self","visibility":"Public","body":"from_ppm(IO::Memory.new(image_data))"}},{"html_id":"from_ppm(io:IO):self-class-method","name":"from_ppm","doc":"Read bytes from `io` as PPM encoded","summary":"

        Read bytes from io as PPM encoded

        ","abstract":false,"args":[{"name":"io","external_name":"io","restriction":"IO"}],"args_string":"(io : IO) : self","args_html":"(io : IO) : self","def":{"name":"from_ppm","args":[{"name":"io","external_name":"io","restriction":"IO"}],"return_type":"self","visibility":"Public","body":"_magic_number = io.gets(\"\\n\", chomp: true)\nwidth = (io.gets(\" \", chomp: true)).try(&.to_i)\nheight = (io.gets(\"\\n\", chomp: true)).try(&.to_i)\n_maximum_color_value = io.gets(\"\\n\", chomp: true)\nif width && height\n red = Array.new(width * height) do\n 0_u8\n end\n green = Array.new(width * height) do\n 0_u8\n end\n blue = Array.new(width * height) do\n 0_u8\n end\n alpha = Array.new(width * height) do\n 255_u8\n end\n (width * height).times do |index|\n red_byte = io.read_byte\n green_byte = io.read_byte\n blue_byte = io.read_byte\n if (red_byte && green_byte) && blue_byte\n red.unsafe_put(index, red_byte)\n green.unsafe_put(index, green_byte)\n blue.unsafe_put(index, blue_byte)\n else\n raise(\"The image ends prematurely\")\n end\n end\n new(red, green, blue, alpha, width, height)\nelse\n raise(\"The image doesn't have width or height\")\nend\n"}},{"html_id":"new(red:Array(UInt8),green:Array(UInt8),blue:Array(UInt8),alpha:Array(UInt8),width:Int32,height:Int32)-class-method","name":"new","abstract":false,"args":[{"name":"red","external_name":"red","restriction":"::Array(::UInt8)"},{"name":"green","external_name":"green","restriction":"::Array(::UInt8)"},{"name":"blue","external_name":"blue","restriction":"::Array(::UInt8)"},{"name":"alpha","external_name":"alpha","restriction":"::Array(::UInt8)"},{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"height","external_name":"height","restriction":"::Int32"}],"args_string":"(red : Array(UInt8), green : Array(UInt8), blue : Array(UInt8), alpha : Array(UInt8), width : Int32, height : Int32)","args_html":"(red : Array(UInt8), green : Array(UInt8), blue : Array(UInt8), alpha : Array(UInt8), width : Int32, height : Int32)","location":{"filename":"src/cr-image/rgba_image.cr","line_number":10,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/rgba_image.cr#L10"},"def":{"name":"new","args":[{"name":"red","external_name":"red","restriction":"::Array(::UInt8)"},{"name":"green","external_name":"green","restriction":"::Array(::UInt8)"},{"name":"blue","external_name":"blue","restriction":"::Array(::UInt8)"},{"name":"alpha","external_name":"alpha","restriction":"::Array(::UInt8)"},{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"height","external_name":"height","restriction":"::Int32"}],"visibility":"Public","body":"_ = allocate\n_.initialize(red, green, blue, alpha, width, height)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"[](channel_type:ChannelType):Array(UInt8)-instance-method","name":"[]","doc":"Return the channel corresponding to `channel_type`","summary":"

        Return the channel corresponding to channel_type

        ","abstract":false,"args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"}],"args_string":"(channel_type : ChannelType) : Array(UInt8)","args_html":"(channel_type : ChannelType) : Array(UInt8)","location":{"filename":"src/cr-image/rgba_image.cr","line_number":35,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/rgba_image.cr#L35"},"def":{"name":"[]","args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"}],"return_type":"Array(UInt8)","visibility":"Public","body":"case channel_type\nwhen ChannelType::Red\n @red\nwhen ChannelType::Green\n @green\nwhen ChannelType::Blue\n @blue\nwhen ChannelType::Alpha\n @alpha\nelse\n raise(\"Unknown channel type #{channel_type} for RGBAImage\")\nend"}},{"html_id":"[]=(channel_type:ChannelType,channel:Array(UInt8)):Array(UInt8)-instance-method","name":"[]=","doc":"Set the corresponding `channel_type` with `channel`","summary":"

        Set the corresponding channel_type with channel

        ","abstract":false,"args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"},{"name":"channel","external_name":"channel","restriction":"Array(UInt8)"}],"args_string":"(channel_type : ChannelType, channel : Array(UInt8)) : Array(UInt8)","args_html":"(channel_type : ChannelType, channel : Array(UInt8)) : Array(UInt8)","location":{"filename":"src/cr-image/rgba_image.cr","line_number":46,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/rgba_image.cr#L46"},"def":{"name":"[]=","args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"},{"name":"channel","external_name":"channel","restriction":"Array(UInt8)"}],"return_type":"Array(UInt8)","visibility":"Public","body":"case channel_type\nwhen ChannelType::Red\n @red = channel\nwhen ChannelType::Green\n @green = channel\nwhen ChannelType::Blue\n @blue = channel\nwhen ChannelType::Alpha\n @alpha = channel\nelse\n raise(\"Unknown channel type #{channel_type} for RGBAImage\")\nend"}},{"html_id":"alpha:Array(UInt8)-instance-method","name":"alpha","doc":"Return the alpha channel","summary":"

        Return the alpha channel

        ","abstract":false,"location":{"filename":"src/cr-image/rgba_image.cr","line_number":6,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/rgba_image.cr#L6"},"def":{"name":"alpha","return_type":"Array(UInt8)","visibility":"Public","body":"@alpha"}},{"html_id":"alpha=(alpha:Array(UInt8))-instance-method","name":"alpha=","abstract":false,"args":[{"name":"alpha","external_name":"alpha","restriction":"Array(UInt8)"}],"args_string":"(alpha : Array(UInt8))","args_html":"(alpha : Array(UInt8))","location":{"filename":"src/cr-image/rgba_image.cr","line_number":6,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/rgba_image.cr#L6"},"def":{"name":"alpha=","args":[{"name":"alpha","external_name":"alpha","restriction":"Array(UInt8)"}],"visibility":"Public","body":"@alpha = alpha"}},{"html_id":"blue:Array(UInt8)-instance-method","name":"blue","doc":"Return the blue channel","summary":"

        Return the blue channel

        ","abstract":false,"location":{"filename":"src/cr-image/rgba_image.cr","line_number":5,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/rgba_image.cr#L5"},"def":{"name":"blue","return_type":"Array(UInt8)","visibility":"Public","body":"@blue"}},{"html_id":"blue=(blue:Array(UInt8))-instance-method","name":"blue=","abstract":false,"args":[{"name":"blue","external_name":"blue","restriction":"Array(UInt8)"}],"args_string":"(blue : Array(UInt8))","args_html":"(blue : Array(UInt8))","location":{"filename":"src/cr-image/rgba_image.cr","line_number":5,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/rgba_image.cr#L5"},"def":{"name":"blue=","args":[{"name":"blue","external_name":"blue","restriction":"Array(UInt8)"}],"visibility":"Public","body":"@blue = blue"}},{"html_id":"clone:RGBAImage-instance-method","name":"clone","doc":"Create a copy of this image","summary":"

        Create a copy of this image

        ","abstract":false,"location":{"filename":"src/cr-image/rgba_image.cr","line_number":14,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/rgba_image.cr#L14"},"def":{"name":"clone","return_type":"RGBAImage","visibility":"Public","body":"self.class.new(@red.clone, @green.clone, @blue.clone, @alpha.clone, @width, @height)"}},{"html_id":"each_channel(&:Array(UInt8),ChannelType->Nil):Nil-instance-method","name":"each_channel","doc":"Run provided block with the `ChannelType::Red`, `ChannelType::Green`, `ChannelType::Blue`, and `ChannelType::Alpha` channels.","summary":"

        Run provided block with the ChannelType::Red, ChannelType::Green, ChannelType::Blue, and ChannelType::Alpha channels.

        ","abstract":false,"location":{"filename":"src/cr-image/rgba_image.cr","line_number":26,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/rgba_image.cr#L26"},"def":{"name":"each_channel","yields":2,"block_arity":2,"block_arg":{"name":"","external_name":"","restriction":"(Array(UInt8), ChannelType -> Nil)"},"return_type":"Nil","visibility":"Public","body":"yield @red, ChannelType::Red\nyield @green, ChannelType::Green\nyield @blue, ChannelType::Blue\nyield @alpha, ChannelType::Alpha\nnil\n"}},{"html_id":"green:Array(UInt8)-instance-method","name":"green","doc":"Return the green channel","summary":"

        Return the green channel

        ","abstract":false,"location":{"filename":"src/cr-image/rgba_image.cr","line_number":4,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/rgba_image.cr#L4"},"def":{"name":"green","return_type":"Array(UInt8)","visibility":"Public","body":"@green"}},{"html_id":"green=(green:Array(UInt8))-instance-method","name":"green=","abstract":false,"args":[{"name":"green","external_name":"green","restriction":"Array(UInt8)"}],"args_string":"(green : Array(UInt8))","args_html":"(green : Array(UInt8))","location":{"filename":"src/cr-image/rgba_image.cr","line_number":4,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/rgba_image.cr#L4"},"def":{"name":"green=","args":[{"name":"green","external_name":"green","restriction":"Array(UInt8)"}],"visibility":"Public","body":"@green = green"}},{"html_id":"height:Int32-instance-method","name":"height","doc":"Height of image","summary":"

        Height of image

        ","abstract":false,"location":{"filename":"src/cr-image/rgba_image.cr","line_number":8,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/rgba_image.cr#L8"},"def":{"name":"height","return_type":"Int32","visibility":"Public","body":"@height"}},{"html_id":"height=(height:Int32)-instance-method","name":"height=","abstract":false,"args":[{"name":"height","external_name":"height","restriction":"Int32"}],"args_string":"(height : Int32)","args_html":"(height : Int32)","location":{"filename":"src/cr-image/rgba_image.cr","line_number":8,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/rgba_image.cr#L8"},"def":{"name":"height=","args":[{"name":"height","external_name":"height","restriction":"Int32"}],"visibility":"Public","body":"@height = height"}},{"html_id":"red:Array(UInt8)-instance-method","name":"red","doc":"Return the red channel","summary":"

        Return the red channel

        ","abstract":false,"location":{"filename":"src/cr-image/rgba_image.cr","line_number":3,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/rgba_image.cr#L3"},"def":{"name":"red","return_type":"Array(UInt8)","visibility":"Public","body":"@red"}},{"html_id":"red=(red:Array(UInt8))-instance-method","name":"red=","abstract":false,"args":[{"name":"red","external_name":"red","restriction":"Array(UInt8)"}],"args_string":"(red : Array(UInt8))","args_html":"(red : Array(UInt8))","location":{"filename":"src/cr-image/rgba_image.cr","line_number":3,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/rgba_image.cr#L3"},"def":{"name":"red=","args":[{"name":"red","external_name":"red","restriction":"Array(UInt8)"}],"visibility":"Public","body":"@red = red"}},{"html_id":"size:Int32-instance-method","name":"size","doc":"Return the number of pixels in this image","summary":"

        Return the number of pixels in this image

        ","abstract":false,"location":{"filename":"src/cr-image/rgba_image.cr","line_number":74,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/rgba_image.cr#L74"},"def":{"name":"size","return_type":"Int32","visibility":"Public","body":"@width * @height"}},{"html_id":"to_gray(red_multiplier:Float=0.299,green_multiplier:Float=0.587,blue_multiplier:Float=0.114):GrayscaleImage-instance-method","name":"to_gray","doc":"Convert color image to `GrayscaleImage`, using the NTSC formula as default values.\n\n\"Woman\n\nBecomes\n\n\"Woman","summary":"

        Convert color image to GrayscaleImage, using the NTSC formula as default values.

        ","abstract":false,"args":[{"name":"red_multiplier","default_value":"0.299","external_name":"red_multiplier","restriction":"Float"},{"name":"green_multiplier","default_value":"0.587","external_name":"green_multiplier","restriction":"Float"},{"name":"blue_multiplier","default_value":"0.114","external_name":"blue_multiplier","restriction":"Float"}],"args_string":"(red_multiplier : Float = 0.299, green_multiplier : Float = 0.587, blue_multiplier : Float = 0.114) : GrayscaleImage","args_html":"(red_multiplier : Float = 0.299, green_multiplier : Float = 0.587, blue_multiplier : Float = 0.114) : GrayscaleImage","location":{"filename":"src/cr-image/rgba_image.cr","line_number":63,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/rgba_image.cr#L63"},"def":{"name":"to_gray","args":[{"name":"red_multiplier","default_value":"0.299","external_name":"red_multiplier","restriction":"Float"},{"name":"green_multiplier","default_value":"0.587","external_name":"green_multiplier","restriction":"Float"},{"name":"blue_multiplier","default_value":"0.114","external_name":"blue_multiplier","restriction":"Float"}],"return_type":"GrayscaleImage","visibility":"Public","body":"GrayscaleImage.new(red.map_with_index do |red_pix, i|\n (Math.min(255, ((red_pix * red_multiplier) + (@green[i] * green_multiplier)) + (@blue[i] * blue_multiplier))).to_u8\nend, width, height)"}},{"html_id":"width:Int32-instance-method","name":"width","doc":"Width of image","summary":"

        Width of image

        ","abstract":false,"location":{"filename":"src/cr-image/rgba_image.cr","line_number":7,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/rgba_image.cr#L7"},"def":{"name":"width","return_type":"Int32","visibility":"Public","body":"@width"}},{"html_id":"width=(width:Int32)-instance-method","name":"width=","abstract":false,"args":[{"name":"width","external_name":"width","restriction":"Int32"}],"args_string":"(width : Int32)","args_html":"(width : Int32)","location":{"filename":"src/cr-image/rgba_image.cr","line_number":7,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/rgba_image.cr#L7"},"def":{"name":"width=","args":[{"name":"width","external_name":"width","restriction":"Int32"}],"visibility":"Public","body":"@width = width"}}]}]}]}} \ No newline at end of file +{"repository_name":"Crystal Image","body":"

        Crystal Image (Processing)

        \n\nThis shard aims to provide feature rich image processing abilities, both for the purpose of\nimage manipulation as well as feature / information extraction from those images.\n\nThe code here takes imense inspiration from [Pluto](https://github.com/phenopolis/pluto) and [Stumpy](https://github.com/stumpycr/stumpy_core), with\nan eventual goal to be able to convert between images of this and those libraries.\n\nAll sample images used are from [Unsplash](https://unsplash.com/).\n\n## Installation\n\n1. Add the dependency to your `shard.yml`:\n\n ```yaml\n dependencies:\n cr-image:\n github: vici37/cr-image\n ```\n\n2. Run `shards install`\n\n## Usage\n\nCrImage supports the formats:\n* PPM\n* JPEG (requires `libturbojpeg`)\n* PNG (requirens `libspng`)\n* WebP (requires `libwebp`)\n\nFor the formats that require a linked library, they must be `require`d explicitly:\n\n```crystal\nrequire \"cr-image\"\nrequire \"cr-image/jpeg\"\nrequire \"cr-image/png\"\nrequire \"cr-image/webp\"\n\n# Or, alternatively\nrequire \"cr-image/all_formats\"\n```\n\n### Example\n\nAssuming an image `moon.jpg` already exists\n\n\"Picture\n\n```crystal\nrequire \"cr-image\"\n\nimage = CrImage::RGBAImage.open(\"moon.jpg\")\n\n# create a mask identifying all pixels with light (i.e. the moon)\nmoon_mask = image\n .to_gray\n .threshold(8) # pixels are UInt8, with 0 as black and 255 as white\n\n# Crop out the moon from the image, and save it to a new file\nimage.crop(\n moon_mask.region # smallest area that encompasses all true bits in mask\n).save(\"moon_cropped.jpg\")\n\n```\n\nYields this image:\n\n\"Cropped\n\n[See documentation](http://troy.sornson.io/cr-image/) for more examples.\n\n### (Pluto)[https://github.com/phenopolis/pluto] and (Stumpy)[https://github.com/stumpycr/stumpy_core] Conversion\n\nIf your library or application already uses Pluto or Stumpy and you want to use\nsome of the functionality of this library, CrImage also provides some optional\nconversion methods:\n\n```crystal\nrequire \"cr-image/pluto\"\npluto_image # => Pluto::ImageRGBA\npluto_image_rgba.to_crimage # => CrImage::RGBAImage\n\ncr_image # => CrImage::RGBAImage\ncr_image.to_pluto # => Pluto::ImageRGBA\n```\n\n```crystal\nrequire \"cr-image/stumpy\"\nstumpy_canvas # => StumpyCore::Canvas\nstumpy_canvas.to_crimage # => CrImage::RGBAImage\n\ncr_image # => CrImage::RGBAImage\ncr_image.to_stumpy # => StumpyCore::Canvas\n```\n\n*NOTE:* Stumpy uses `UInt16` for its underlying raw image storage per channel per pixel, while Pluto and\nCrImage uses `UInt8`. Converting from a Stumpy `Canvas` object to `RGBAImage` may lose quality if the original\nimage used 16 bit color channels (i.e. 16-bit PNG). Most image formats tend to use 8-bit color channels.\n\n## Development\n\nThis requires `libwebp`, `libspng`, and `libturbojpeg` to run. Then:\n\n```\n> make test\n```\n\nTo ensure all tests run and pass.\n\n## Contributing\n\n1. [Fork it](https://github.com/Vici37/cr-image/fork)\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n- [Troy Sornson](https://github.com/Vici37) - creator and maintainer\n","program":{"html_id":"Crystal Image/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"locations":[],"repository_name":"Crystal Image","program":true,"enum":false,"alias":false,"const":false,"types":[{"html_id":"Crystal Image/CrImage","path":"CrImage.html","kind":"module","full_name":"CrImage","name":"CrImage","abstract":false,"locations":[{"filename":"src/cr-image/operation/bilinear_resize.cr","line_number":14,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/bilinear_resize.cr#L14"},{"filename":"src/cr-image/region.cr","line_number":1,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/region.cr#L1"},{"filename":"src/lib-formats/bindings/lib_jpeg_turbo.cr","line_number":1,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/lib-formats/bindings/lib_jpeg_turbo.cr#L1"},{"filename":"src/lib-formats/bindings/lib_spng.cr","line_number":1,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/lib-formats/bindings/lib_spng.cr#L1"},{"filename":"src/lib-formats/bindings/lib_webp.cr","line_number":1,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/lib-formats/bindings/lib_webp.cr#L1"},{"filename":"src/stumpy.cr","line_number":28,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/stumpy.cr#L28"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"types":[{"html_id":"Crystal Image/CrImage/ChannelType","path":"CrImage/ChannelType.html","kind":"enum","full_name":"CrImage::ChannelType","name":"ChannelType","abstract":false,"ancestors":[{"html_id":"Crystal Image/Enum","kind":"struct","full_name":"Enum","name":"Enum"},{"html_id":"Crystal Image/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"Crystal Image/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"Crystal Image/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cr-image/channel_type.cr","line_number":4,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/channel_type.cr#L4"}],"repository_name":"Crystal Image","program":false,"enum":true,"alias":false,"const":false,"constants":[{"id":"Red","name":"Red","value":"0"},{"id":"Green","name":"Green","value":"1"},{"id":"Blue","name":"Blue","value":"2"},{"id":"Gray","name":"Gray","value":"3"},{"id":"Alpha","name":"Alpha","value":"4"}],"namespace":{"html_id":"Crystal Image/CrImage","kind":"module","full_name":"CrImage","name":"CrImage"},"doc":"Enum representing different image channels supported by CrImage\n\nSee `RGBAImage#each_channel` and `GrayscaleImage#each_channel`","summary":"

        Enum representing different image channels supported by CrImage

        ","instance_methods":[{"html_id":"alpha?-instance-method","name":"alpha?","abstract":false,"location":{"filename":"src/cr-image/channel_type.cr","line_number":9,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/channel_type.cr#L9"},"def":{"name":"alpha?","visibility":"Public","body":"self == Alpha"}},{"html_id":"blue?-instance-method","name":"blue?","abstract":false,"location":{"filename":"src/cr-image/channel_type.cr","line_number":7,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/channel_type.cr#L7"},"def":{"name":"blue?","visibility":"Public","body":"self == Blue"}},{"html_id":"gray?-instance-method","name":"gray?","abstract":false,"location":{"filename":"src/cr-image/channel_type.cr","line_number":8,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/channel_type.cr#L8"},"def":{"name":"gray?","visibility":"Public","body":"self == Gray"}},{"html_id":"green?-instance-method","name":"green?","abstract":false,"location":{"filename":"src/cr-image/channel_type.cr","line_number":6,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/channel_type.cr#L6"},"def":{"name":"green?","visibility":"Public","body":"self == Green"}},{"html_id":"red?-instance-method","name":"red?","abstract":false,"location":{"filename":"src/cr-image/channel_type.cr","line_number":5,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/channel_type.cr#L5"},"def":{"name":"red?","visibility":"Public","body":"self == Red"}}]},{"html_id":"Crystal Image/CrImage/Color","path":"CrImage/Color.html","kind":"class","full_name":"CrImage::Color","name":"Color","abstract":false,"superclass":{"html_id":"Crystal Image/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"Crystal Image/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"Crystal Image/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cr-image/color.cr","line_number":5,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/color.cr#L5"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"Crystal Image/CrImage","kind":"module","full_name":"CrImage","name":"CrImage"},"doc":"Utility class for parsing and representing colors that can be used for certain\nmethods in CrImage.\n\nSee `Operation::MaskApply#apply_color`, `Operation::Draw#draw_square`, or `Operation::Draw#draw_circle`","summary":"

        Utility class for parsing and representing colors that can be used for certain methods in CrImage.

        ","constructors":[{"html_id":"new(red:UInt8,green:UInt8,blue:UInt8,alpha:UInt8=255)-class-method","name":"new","abstract":false,"args":[{"name":"red","external_name":"red","restriction":"UInt8"},{"name":"green","external_name":"green","restriction":"UInt8"},{"name":"blue","external_name":"blue","restriction":"UInt8"},{"name":"alpha","default_value":"255","external_name":"alpha","restriction":"UInt8"}],"args_string":"(red : UInt8, green : UInt8, blue : UInt8, alpha : UInt8 = 255)","args_html":"(red : UInt8, green : UInt8, blue : UInt8, alpha : UInt8 = 255)","location":{"filename":"src/cr-image/color.cr","line_number":8,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/color.cr#L8"},"def":{"name":"new","args":[{"name":"red","external_name":"red","restriction":"UInt8"},{"name":"green","external_name":"green","restriction":"UInt8"},{"name":"blue","external_name":"blue","restriction":"UInt8"},{"name":"alpha","default_value":"255","external_name":"alpha","restriction":"UInt8"}],"visibility":"Public","body":"_ = allocate\n_.initialize(red, green, blue, alpha)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"of(color:String):Color-class-method","name":"of","doc":"Parse color from a hex string:\n\n```\nColor.of(\"#1\") # same as \"#11\" => Color.new(17, 17, 17, 255)\nColor.of(\"#01\") # => Color.new(1, 1, 1, 255)\nColor.of(\"#123\") # same as \"#112233\" => Color.new(17, 34, 51, 255)\nColor.of(\"#1234\") # same as \"#11223344\" => Color.new(34, 51, 68, 17)\nColor.of(\"#010203\") # => Color.new(1, 2, 3, 255)\nColor.of(\"#01020304\") # => Color.new(2, 3, 4, 1)\n```","summary":"

        Parse color from a hex string:

        ","abstract":false,"args":[{"name":"color","external_name":"color","restriction":"String"}],"args_string":"(color : String) : Color","args_html":"(color : String) : Color","location":{"filename":"src/cr-image/color.cr","line_number":45,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/color.cr#L45"},"def":{"name":"of","args":[{"name":"color","external_name":"color","restriction":"String"}],"return_type":"Color","visibility":"Public","body":"if ((!(color.starts_with?(\"#\"))) || (!({2, 3, 4, 5, 7, 9}.includes?(color.size)))) || (color.match(/^#[^0-9a-f]/i))\n raise(\"Invalid hex color '#{color}': must start with '#' followed by 1, 2, 3, 4, 6, or 9 alphanumeric characters (0-9 or a-f)\")\nend\ncase color.size\nwhen 2\n gray = (color[1].to_i(16)).to_u8\n gray = (gray << 4) + gray\n self.new(gray, gray, gray)\nwhen 3\n gray = (color[1, 2].to_i(16)).to_u8\n self.new(gray, gray, gray)\nwhen 4\n red = (color[1].to_i(16)).to_u8\n green = (color[2].to_i(16)).to_u8\n blue = (color[3].to_i(16)).to_u8\n self.new((red << 4) + red, (green << 4) + green, (blue << 4) + blue)\nwhen 5\n alpha = (color[1].to_i(16)).to_u8\n red = (color[2].to_i(16)).to_u8\n green = (color[3].to_i(16)).to_u8\n blue = (color[4].to_i(16)).to_u8\n self.new((red << 4) + red, (green << 4) + green, (blue << 4) + blue, (alpha << 4) + alpha)\nwhen 7\n red = (color[1, 2].to_i(16)).to_u8\n green = (color[3, 2].to_i(16)).to_u8\n blue = (color[5, 2].to_i(16)).to_u8\n self.new(red, green, blue)\nelse\n alpha = (color[1, 2].to_i(16)).to_u8\n red = (color[3, 2].to_i(16)).to_u8\n green = (color[5, 2].to_i(16)).to_u8\n blue = (color[7, 2].to_i(16)).to_u8\n self.new(red, green, blue, alpha)\nend\n"}},{"html_id":"random:Color-class-method","name":"random","doc":"Generate a random color with full (255) opacity","summary":"

        Generate a random color with full (255) opacity

        ","abstract":false,"location":{"filename":"src/cr-image/color.cr","line_number":12,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/color.cr#L12"},"def":{"name":"random","return_type":"Color","visibility":"Public","body":"r = Random.new\nnew(r.rand(UInt8), r.rand(UInt8), r.rand(UInt8), 255_u8)\n"}}],"instance_methods":[{"html_id":"==(other:Color):Bool-instance-method","name":"==","abstract":false,"args":[{"name":"other","external_name":"other","restriction":"Color"}],"args_string":"(other : Color) : Bool","args_html":"(other : Color) : Bool","location":{"filename":"src/cr-image/color.cr","line_number":89,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/color.cr#L89"},"def":{"name":"==","args":[{"name":"other","external_name":"other","restriction":"Color"}],"return_type":"Bool","visibility":"Public","body":"(((red == other.red) && (green == other.green)) && (blue == other.blue)) && (alpha == other.alpha)"}},{"html_id":"[](channel_type:ChannelType):UInt8-instance-method","name":"[]","doc":"Receive the UInt8 portion of this color corresponding to `channel_type`","summary":"

        Receive the UInt8 portion of this color corresponding to channel_type

        ","abstract":false,"args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"}],"args_string":"(channel_type : ChannelType) : UInt8","args_html":"(channel_type : ChannelType) : UInt8","location":{"filename":"src/cr-image/color.cr","line_number":25,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/color.cr#L25"},"def":{"name":"[]","args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"}],"return_type":"UInt8","visibility":"Public","body":"case channel_type\nin ChannelType::Red\n red\nin ChannelType::Green\n green\nin ChannelType::Blue\n blue\nin ChannelType::Alpha\n alpha\nin ChannelType::Gray\n gray\nend"}},{"html_id":"alpha:UInt8-instance-method","name":"alpha","abstract":false,"location":{"filename":"src/cr-image/color.cr","line_number":6,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/color.cr#L6"},"def":{"name":"alpha","visibility":"Public","body":"@alpha"}},{"html_id":"blue:UInt8-instance-method","name":"blue","abstract":false,"location":{"filename":"src/cr-image/color.cr","line_number":6,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/color.cr#L6"},"def":{"name":"blue","visibility":"Public","body":"@blue"}},{"html_id":"gray(red_multiplier:Float=0.299,green_multiplier:Float=0.587,blue_multiplier:Float=0.114):UInt8-instance-method","name":"gray","doc":"Convert this Color to a single UInt8 gray value","summary":"

        Convert this Color to a single UInt8 gray value

        ","abstract":false,"args":[{"name":"red_multiplier","default_value":"0.299","external_name":"red_multiplier","restriction":"Float"},{"name":"green_multiplier","default_value":"0.587","external_name":"green_multiplier","restriction":"Float"},{"name":"blue_multiplier","default_value":"0.114","external_name":"blue_multiplier","restriction":"Float"}],"args_string":"(red_multiplier : Float = 0.299, green_multiplier : Float = 0.587, blue_multiplier : Float = 0.114) : UInt8","args_html":"(red_multiplier : Float = 0.299, green_multiplier : Float = 0.587, blue_multiplier : Float = 0.114) : UInt8","location":{"filename":"src/cr-image/color.cr","line_number":18,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/color.cr#L18"},"def":{"name":"gray","args":[{"name":"red_multiplier","default_value":"0.299","external_name":"red_multiplier","restriction":"Float"},{"name":"green_multiplier","default_value":"0.587","external_name":"green_multiplier","restriction":"Float"},{"name":"blue_multiplier","default_value":"0.114","external_name":"blue_multiplier","restriction":"Float"}],"return_type":"UInt8","visibility":"Public","body":"Math.min(255_u8, (((red * red_multiplier) + (blue * blue_multiplier)) + (green * green_multiplier)).to_u8)"}},{"html_id":"green:UInt8-instance-method","name":"green","abstract":false,"location":{"filename":"src/cr-image/color.cr","line_number":6,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/color.cr#L6"},"def":{"name":"green","visibility":"Public","body":"@green"}},{"html_id":"red:UInt8-instance-method","name":"red","abstract":false,"location":{"filename":"src/cr-image/color.cr","line_number":6,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/color.cr#L6"},"def":{"name":"red","visibility":"Public","body":"@red"}}]},{"html_id":"Crystal Image/CrImage/Exception","path":"CrImage/Exception.html","kind":"class","full_name":"CrImage::Exception","name":"Exception","abstract":false,"superclass":{"html_id":"Crystal Image/Exception","kind":"class","full_name":"Exception","name":"Exception"},"ancestors":[{"html_id":"Crystal Image/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"Crystal Image/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"Crystal Image/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cr-image/exception.cr","line_number":2,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/exception.cr#L2"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"Crystal Image/CrImage","kind":"module","full_name":"CrImage","name":"CrImage"},"doc":"Exception class for any errors thrown by CrImage","summary":"

        Exception class for any errors thrown by CrImage

        ","constructors":[{"html_id":"new(message:String)-class-method","name":"new","abstract":false,"args":[{"name":"message","external_name":"message","restriction":"String"}],"args_string":"(message : String)","args_html":"(message : String)","location":{"filename":"src/cr-image/exception.cr","line_number":5,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/exception.cr#L5"},"def":{"name":"new","args":[{"name":"message","external_name":"message","restriction":"String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(message)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(error_code:Int32)-class-method","name":"new","abstract":false,"args":[{"name":"error_code","external_name":"error_code","restriction":"Int32"}],"args_string":"(error_code : Int32)","args_html":"(error_code : Int32)","location":{"filename":"src/cr-image/exception.cr","line_number":9,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/exception.cr#L9"},"def":{"name":"new","args":[{"name":"error_code","external_name":"error_code","restriction":"Int32"}],"visibility":"Public","body":"_ = allocate\n_.initialize(error_code)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(handle:LibJPEGTurbo::Handle)-class-method","name":"new","abstract":false,"args":[{"name":"handle","external_name":"handle","restriction":"LibJPEGTurbo::Handle"}],"args_string":"(handle : LibJPEGTurbo::Handle)","args_html":"(handle : LibJPEGTurbo::Handle)","location":{"filename":"src/cr-image/exception.cr","line_number":13,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/exception.cr#L13"},"def":{"name":"new","args":[{"name":"handle","external_name":"handle","restriction":"LibJPEGTurbo::Handle"}],"visibility":"Public","body":"_ = allocate\n_.initialize(handle)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"error_code:Int32|Nil-instance-method","name":"error_code","abstract":false,"location":{"filename":"src/cr-image/exception.cr","line_number":3,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/exception.cr#L3"},"def":{"name":"error_code","return_type":"Int32 | ::Nil","visibility":"Public","body":"@error_code"}}]},{"html_id":"Crystal Image/CrImage/Format","path":"CrImage/Format.html","kind":"module","full_name":"CrImage::Format","name":"Format","abstract":false,"locations":[{"filename":"src/cr-image/format/save.cr","line_number":12,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/format/save.cr#L12"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"SUPPORTED_FORMATS","name":"SUPPORTED_FORMATS","value":"[{extension: \".ppm\", method: \"ppm\"}, {extension: \".jpeg\", method: \"jpeg\"}, {extension: \".jpg\", method: \"jpeg\"}, {extension: \".png\", method: \"png\"}, {extension: \".webp\", method: \"webp\"}] of Nil"}],"namespace":{"html_id":"Crystal Image/CrImage","kind":"module","full_name":"CrImage","name":"CrImage"},"doc":"Provides a convenience method for saving image files to the filesystem.\nCurrently supports:\n* PPM (`.ppm`)\n* WebP (`.webp`)\n* JPEG (`.jpeg`, `.jpg`)\n* PNG (`.png`)\n\n```\nimage.save(\"image.jpg\")\n```\nSee `Open` for a convenience method to read images from the filesystem","summary":"

        Provides a convenience method for saving image files to the filesystem.

        ","types":[{"html_id":"Crystal Image/CrImage/Format/JPEG","path":"CrImage/Format/JPEG.html","kind":"module","full_name":"CrImage::Format::JPEG","name":"JPEG","abstract":false,"locations":[{"filename":"src/lib-formats/jpeg.cr","line_number":15,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/lib-formats/jpeg.cr#L15"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"Crystal Image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"Crystal Image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"Crystal Image/CrImage/Format","kind":"module","full_name":"CrImage::Format","name":"Format"},"doc":"Provides methods to read from and write to jpeg. Requires `libturbojpeg` to function.\n\n```\nimage = File.open(\"image.jpg\") { |file| CrImage::RGBAImage.from_jpeg(file) }\nFile.open(\"other_image.jpg\") { |file| image.to_jpeg(file) }\n```\nAlternatively, you can use the convenience methods in the `Open` and `Save` modules\nto acheive the same thing:\n```\nimage = CrImage::RGBAImage.open(\"image.jpg\")\nimage.save(\"other_image.jpg\")\n```","summary":"

        Provides methods to read from and write to jpeg.

        ","instance_methods":[{"html_id":"to_jpeg(io:IO,quality:Int32=100):Nil-instance-method","name":"to_jpeg","doc":"Output the image as JPEG to `io`","summary":"

        Output the image as JPEG to io

        ","abstract":false,"args":[{"name":"io","external_name":"io","restriction":"IO"},{"name":"quality","default_value":"100","external_name":"quality","restriction":"Int32"}],"args_string":"(io : IO, quality : Int32 = 100) : Nil","args_html":"(io : IO, quality : Int32 = 100) : Nil","location":{"filename":"src/lib-formats/jpeg.cr","line_number":74,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/lib-formats/jpeg.cr#L74"},"def":{"name":"to_jpeg","args":[{"name":"io","external_name":"io","restriction":"IO"},{"name":"quality","default_value":"100","external_name":"quality","restriction":"Int32"}],"return_type":"Nil","visibility":"Public","body":"handle = LibJPEGTurbo.init_compress\nimage_data = IO::Memory.new(size * 3)\nsize.times do |index|\n image_data.write_byte(red.unsafe_fetch(index))\n image_data.write_byte(green.unsafe_fetch(index))\n image_data.write_byte(blue.unsafe_fetch(index))\nend\nbuffer = Pointer(UInt8).null\ncheck_jpeg(handle, LibJPEGTurbo.compress2(handle, image_data.buffer, @width, 0, @height, LibJPEGTurbo::PixelFormat::RGB, pointerof(buffer), out size, LibJPEGTurbo::Subsampling::S444, quality, 0))\ncheck_jpeg(handle, LibJPEGTurbo.destroy(handle))\nbytes = Bytes.new(buffer, size)\nio.write(bytes)\nLibJPEGTurbo.free(buffer)\n"}}]},{"html_id":"Crystal Image/CrImage/Format/Open","path":"CrImage/Format/Open.html","kind":"module","full_name":"CrImage::Format::Open","name":"Open","abstract":false,"locations":[{"filename":"src/cr-image/format/open.cr","line_number":12,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/format/open.cr#L12"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"Crystal Image/CrImage/Format","kind":"module","full_name":"CrImage::Format","name":"Format"},"doc":"Provides a convenience method for opening up image files from the filesystem.\nCurrently supports:\n* PPM (`.ppm`)\n* WebP (`.webp`)\n* JPEG (`.jpeg`, `.jpg`)\n* PNG (`.png`)\n\n```\nimage = CrImage::RGBAImage.open(\"image.jpg\")\n```\nSee `Save` for a convenience method to write to the filesystem.","summary":"

        Provides a convenience method for opening up image files from the filesystem.

        ","instance_methods":[{"html_id":"open(filename:String):self-instance-method","name":"open","doc":"Reads this image from file using the provided filename.","summary":"

        Reads this image from file using the provided filename.

        ","abstract":false,"args":[{"name":"filename","external_name":"filename","restriction":"String"}],"args_string":"(filename : String) : self","args_html":"(filename : String) : self","location":{"filename":"src/cr-image/format/open.cr","line_number":14,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/format/open.cr#L14"},"def":{"name":"open","args":[{"name":"filename","external_name":"filename","restriction":"String"}],"return_type":"self","visibility":"Public","body":"{% if true %}\n case filename\n {% for format in SUPPORTED_FORMATS %}\n when .ends_with?({{ format[:extension] }}) then File.open(filename) { |file| self.from_{{ format[:method].id }}(file) }\n {% end %}\n else raise Exception.new \"Unknown file extension for filename #{filename}, cr-image only supports {{ (CrImage::Format::SUPPORTED_FORMATS.map do |__arg0|\n __arg0[:extension].id\nend.join(\", \")).id }}\"\n end\n {% end %}"}}]},{"html_id":"Crystal Image/CrImage/Format/PNG","path":"CrImage/Format/PNG.html","kind":"module","full_name":"CrImage::Format::PNG","name":"PNG","abstract":false,"locations":[{"filename":"src/lib-formats/png.cr","line_number":15,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/lib-formats/png.cr#L15"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"Crystal Image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"Crystal Image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"Crystal Image/CrImage/Format","kind":"module","full_name":"CrImage::Format","name":"Format"},"doc":"Provides methods to read from and write to PNG. Requires `libspng` to function.\n\n```\nimage = File.open(\"image.png\") { |file| CrImage::RGBAImage.from_png(file) }\nFile.open(\"other_image.png\") { |file| image.to_png(file) }\n```\nAlternatively, you can use the convenience methods in the `Open` and `Save` modules\nto acheive the same thing:\n```\nimage = CrImage::RGBAImage.open(\"image.png\")\nimage.save(\"other_image.png\")\n```","summary":"

        Provides methods to read from and write to PNG.

        ","instance_methods":[{"html_id":"to_png(io:IO):Nil-instance-method","name":"to_png","doc":"Output the image as PNG to `io`","summary":"

        Output the image as PNG to io

        ","abstract":false,"args":[{"name":"io","external_name":"io","restriction":"IO"}],"args_string":"(io : IO) : Nil","args_html":"(io : IO) : Nil","location":{"filename":"src/lib-formats/png.cr","line_number":72,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/lib-formats/png.cr#L72"},"def":{"name":"to_png","args":[{"name":"io","external_name":"io","restriction":"IO"}],"return_type":"Nil","visibility":"Public","body":"image_data = IO::Memory.new(size * 4)\nsize.times do |index|\n image_data.write_byte(red.unsafe_fetch(index))\n image_data.write_byte(green.unsafe_fetch(index))\n image_data.write_byte(blue.unsafe_fetch(index))\n image_data.write_byte(alpha.unsafe_fetch(index))\nend\nctx = LibSPNG.ctx_new(LibSPNG::CtxFlags::Encoder)\nif ctx\nelse\n raise(::CrImage::Exception.new(\"Failed to create a context\"))\nend\nLibSPNG.set_option(ctx, LibSPNG::Option::EncodeToBuffer, true)\nLibSPNG.set_png_buffer(ctx, image_data.buffer, image_data.size)\nihdr = LibSPNG::IHDR.new\nihdr.width = @width\nihdr.height = @height\nihdr.color_type = LibSPNG::ColorType::TrueColorAlpha\nihdr.bit_depth = 8\nLibSPNG.set_ihdr(ctx, pointerof(ihdr))\nerror = LibSPNG.encode_image(ctx, image_data.buffer, image_data.size, LibSPNG::Format::PNG, LibSPNG::EncodeFlags::Finalize)\ncheck_png(error)\nbuffer = LibSPNG.get_png_buffer(ctx, out size, pointerof(error))\nif ctx\nelse\n raise(::CrImage::Exception.new(\"Failed to get a buffer\"))\nend\nbytes = Bytes.new(buffer, size)\nio.write(bytes)\nLibC.free(buffer)\n"}}]},{"html_id":"Crystal Image/CrImage/Format/PPM","path":"CrImage/Format/PPM.html","kind":"module","full_name":"CrImage::Format::PPM","name":"PPM","abstract":false,"locations":[{"filename":"src/cr-image/format/ppm.cr","line_number":13,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/format/ppm.cr#L13"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"Crystal Image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"Crystal Image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"Crystal Image/CrImage/Format","kind":"module","full_name":"CrImage::Format","name":"Format"},"doc":"Provides methods to read from and write to PPM.\n\n```\nimage = File.open(\"image.ppm\") { |file| CrImage::RGBAImage.from_ppm(file) }\nFile.open(\"other_image.ppm\") { |file| image.to_ppm(file) }\n```\nAlternatively, you can use the convenience methods in the `Open` and `Save` modules\nto acheive the same thing:\n```\nimage = CrImage::RGBAImage.open(\"image.ppm\")\nimage.save(\"other_image.ppm\")\n```","summary":"

        Provides methods to read from and write to PPM.

        ","instance_methods":[{"html_id":"to_ppm(io:IO):Nil-instance-method","name":"to_ppm","doc":"Output this image to `io` using PPM image encoding","summary":"

        Output this image to io using PPM image encoding

        ","abstract":false,"args":[{"name":"io","external_name":"io","restriction":"IO"}],"args_string":"(io : IO) : Nil","args_html":"(io : IO) : Nil","location":{"filename":"src/cr-image/format/ppm.cr","line_number":56,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/format/ppm.cr#L56"},"def":{"name":"to_ppm","args":[{"name":"io","external_name":"io","restriction":"IO"}],"return_type":"Nil","visibility":"Public","body":"io << \"P6\\n\"\n(((io << @width) << \" \") << @height) << \"\\n\"\nio << \"255\\n\"\nsize.times do |index|\n io.write_byte(red.unsafe_fetch(index))\n io.write_byte(green.unsafe_fetch(index))\n io.write_byte(blue.unsafe_fetch(index))\nend\n"}}]},{"html_id":"Crystal Image/CrImage/Format/Save","path":"CrImage/Format/Save.html","kind":"module","full_name":"CrImage::Format::Save","name":"Save","abstract":false,"locations":[{"filename":"src/cr-image/format/save.cr","line_number":15,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/format/save.cr#L15"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"Crystal Image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"Crystal Image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"Crystal Image/CrImage/Format","kind":"module","full_name":"CrImage::Format","name":"Format"},"instance_methods":[{"html_id":"save(filename:String):self-instance-method","name":"save","doc":"Write this image to file using the provided filename.\n\nThis method _will not_ create intermediate directory paths. This method will throw an\nerror if they don't exist.","summary":"

        Write this image to file using the provided filename.

        ","abstract":false,"args":[{"name":"filename","external_name":"filename","restriction":"String"}],"args_string":"(filename : String) : self","args_html":"(filename : String) : self","location":{"filename":"src/cr-image/format/save.cr","line_number":20,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/format/save.cr#L20"},"def":{"name":"save","args":[{"name":"filename","external_name":"filename","restriction":"String"}],"return_type":"self","visibility":"Public","body":"File.open(filename, \"w\") do |file|\n {% if true %}\n case filename\n {% for format in SUPPORTED_FORMATS %}\n when .ends_with?({{ format[:extension] }}) then to_{{ format[:method].id }}(file)\n {% end %}\n else raise Exception.new \"Unknown file extension for filename #{filename}, cr-image only supports {{ (CrImage::Format::SUPPORTED_FORMATS.map do |__arg0|\n __arg0[:extension].id\n end.join(\", \")).id }}\"\n end\n {% end %}\nend\nself\n"}}]},{"html_id":"Crystal Image/CrImage/Format/WebP","path":"CrImage/Format/WebP.html","kind":"module","full_name":"CrImage::Format::WebP","name":"WebP","abstract":false,"locations":[{"filename":"src/lib-formats/webp.cr","line_number":15,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/lib-formats/webp.cr#L15"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"Crystal Image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"Crystal Image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"Crystal Image/CrImage/Format","kind":"module","full_name":"CrImage::Format","name":"Format"},"doc":"Provides methods to read from and write to WebP. Requires `libwebp` to function.\n\n```\nimage = File.open(\"image.webp\") { |file| CrImage::RGBAImage.from_webp(file) }\nFile.open(\"other_image.webp\") { |file| image.to_webp(file) }\n```\nAlternatively, you can use the convenience methods in the `Open` and `Save` modules\nto acheive the same thing:\n```\nimage = CrImage::RGBAImage.open(\"image.webp\")\nimage.save(\"other_image.webp\")\n```","summary":"

        Provides methods to read from and write to WebP.

        ","instance_methods":[{"html_id":"to_webp(io:IO):Nil-instance-method","name":"to_webp","doc":"Write image to `io` using WebP encoding","summary":"

        Write image to io using WebP encoding

        ","abstract":false,"args":[{"name":"io","external_name":"io","restriction":"IO"}],"args_string":"(io : IO) : Nil","args_html":"(io : IO) : Nil","location":{"filename":"src/lib-formats/webp.cr","line_number":58,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/lib-formats/webp.cr#L58"},"def":{"name":"to_webp","args":[{"name":"io","external_name":"io","restriction":"IO"}],"return_type":"Nil","visibility":"Public","body":"image_data = String.build do |string|\n size.times do |index|\n string.write_byte(red.unsafe_fetch(index))\n string.write_byte(green.unsafe_fetch(index))\n string.write_byte(blue.unsafe_fetch(index))\n string.write_byte(alpha.unsafe_fetch(index))\n end\nend\nsize = LibWebP.encode_lossless_rgba(image_data, @width, @height, @width * 4, out buffer)\ncheck_webp(size)\nbytes = Bytes.new(buffer, size)\nio.write(bytes)\nLibWebP.free(buffer)\n"}}]}]},{"html_id":"Crystal Image/CrImage/GrayscaleImage","path":"CrImage/GrayscaleImage.html","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage","abstract":false,"superclass":{"html_id":"Crystal Image/CrImage/Image","kind":"class","full_name":"CrImage::Image","name":"Image"},"ancestors":[{"html_id":"Crystal Image/CrImage/Format/WebP","kind":"module","full_name":"CrImage::Format::WebP","name":"WebP"},{"html_id":"Crystal Image/CrImage/Format/PNG","kind":"module","full_name":"CrImage::Format::PNG","name":"PNG"},{"html_id":"Crystal Image/CrImage/Format/JPEG","kind":"module","full_name":"CrImage::Format::JPEG","name":"JPEG"},{"html_id":"Crystal Image/CrImage/Operation/MaskApply","kind":"module","full_name":"CrImage::Operation::MaskApply","name":"MaskApply"},{"html_id":"Crystal Image/CrImage/Format/Save","kind":"module","full_name":"CrImage::Format::Save","name":"Save"},{"html_id":"Crystal Image/CrImage/Operation/HistogramEqualize","kind":"module","full_name":"CrImage::Operation::HistogramEqualize","name":"HistogramEqualize"},{"html_id":"Crystal Image/CrImage/Operation/Draw","kind":"module","full_name":"CrImage::Operation::Draw","name":"Draw"},{"html_id":"Crystal Image/CrImage/Operation/Crop","kind":"module","full_name":"CrImage::Operation::Crop","name":"Crop"},{"html_id":"Crystal Image/CrImage/Operation/VerticalBlur","kind":"module","full_name":"CrImage::Operation::VerticalBlur","name":"VerticalBlur"},{"html_id":"Crystal Image/CrImage/Operation/HorizontalBlur","kind":"module","full_name":"CrImage::Operation::HorizontalBlur","name":"HorizontalBlur"},{"html_id":"Crystal Image/CrImage/Operation/GaussianBlur","kind":"module","full_name":"CrImage::Operation::GaussianBlur","name":"GaussianBlur"},{"html_id":"Crystal Image/CrImage/Operation/Contrast","kind":"module","full_name":"CrImage::Operation::Contrast","name":"Contrast"},{"html_id":"Crystal Image/CrImage/Operation/ChannelSwap","kind":"module","full_name":"CrImage::Operation::ChannelSwap","name":"ChannelSwap"},{"html_id":"Crystal Image/CrImage/Operation/Brightness","kind":"module","full_name":"CrImage::Operation::Brightness","name":"Brightness"},{"html_id":"Crystal Image/CrImage/Operation/BoxBlur","kind":"module","full_name":"CrImage::Operation::BoxBlur","name":"BoxBlur"},{"html_id":"Crystal Image/CrImage/Operation/BilinearResize","kind":"module","full_name":"CrImage::Operation::BilinearResize","name":"BilinearResize"},{"html_id":"Crystal Image/CrImage/Format/PPM","kind":"module","full_name":"CrImage::Format::PPM","name":"PPM"},{"html_id":"Crystal Image/CrImage/Image","kind":"class","full_name":"CrImage::Image","name":"Image"},{"html_id":"Crystal Image/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"Crystal Image/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cr-image/grayscale_image.cr","line_number":13,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L13"},{"filename":"src/jpeg.cr","line_number":4,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/jpeg.cr#L4"},{"filename":"src/png.cr","line_number":4,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/png.cr#L4"},{"filename":"src/stumpy.cr","line_number":38,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/stumpy.cr#L38"},{"filename":"src/webp.cr","line_number":4,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/webp.cr#L4"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"Crystal Image/CrImage/Format/JPEG","kind":"module","full_name":"CrImage::Format::JPEG","name":"JPEG"},{"html_id":"Crystal Image/CrImage/Format/PNG","kind":"module","full_name":"CrImage::Format::PNG","name":"PNG"},{"html_id":"Crystal Image/CrImage/Format/PPM","kind":"module","full_name":"CrImage::Format::PPM","name":"PPM"},{"html_id":"Crystal Image/CrImage/Format/Save","kind":"module","full_name":"CrImage::Format::Save","name":"Save"},{"html_id":"Crystal Image/CrImage/Format/WebP","kind":"module","full_name":"CrImage::Format::WebP","name":"WebP"},{"html_id":"Crystal Image/CrImage/Operation/BilinearResize","kind":"module","full_name":"CrImage::Operation::BilinearResize","name":"BilinearResize"},{"html_id":"Crystal Image/CrImage/Operation/BoxBlur","kind":"module","full_name":"CrImage::Operation::BoxBlur","name":"BoxBlur"},{"html_id":"Crystal Image/CrImage/Operation/Brightness","kind":"module","full_name":"CrImage::Operation::Brightness","name":"Brightness"},{"html_id":"Crystal Image/CrImage/Operation/ChannelSwap","kind":"module","full_name":"CrImage::Operation::ChannelSwap","name":"ChannelSwap"},{"html_id":"Crystal Image/CrImage/Operation/Contrast","kind":"module","full_name":"CrImage::Operation::Contrast","name":"Contrast"},{"html_id":"Crystal Image/CrImage/Operation/Crop","kind":"module","full_name":"CrImage::Operation::Crop","name":"Crop"},{"html_id":"Crystal Image/CrImage/Operation/Draw","kind":"module","full_name":"CrImage::Operation::Draw","name":"Draw"},{"html_id":"Crystal Image/CrImage/Operation/GaussianBlur","kind":"module","full_name":"CrImage::Operation::GaussianBlur","name":"GaussianBlur"},{"html_id":"Crystal Image/CrImage/Operation/HistogramEqualize","kind":"module","full_name":"CrImage::Operation::HistogramEqualize","name":"HistogramEqualize"},{"html_id":"Crystal Image/CrImage/Operation/HorizontalBlur","kind":"module","full_name":"CrImage::Operation::HorizontalBlur","name":"HorizontalBlur"},{"html_id":"Crystal Image/CrImage/Operation/MaskApply","kind":"module","full_name":"CrImage::Operation::MaskApply","name":"MaskApply"},{"html_id":"Crystal Image/CrImage/Operation/VerticalBlur","kind":"module","full_name":"CrImage::Operation::VerticalBlur","name":"VerticalBlur"}],"extended_modules":[{"html_id":"Crystal Image/CrImage/Format/Open","kind":"module","full_name":"CrImage::Format::Open","name":"Open"}],"namespace":{"html_id":"Crystal Image/CrImage","kind":"module","full_name":"CrImage","name":"CrImage"},"doc":"An image in Grayscale. These image types are the easiest to perform feature and information extraction from, where\nthere is only one channel to examine, and so has methods for constructing `Mask`s from (see `#threshold` below).\n\nAn `RGBAImage` would become a `GrayscaleImage` this way:\n```\nimage.to_gray\n```\n\n\"Woman\n\"Woman","summary":"

        An image in Grayscale.

        ","constructors":[{"html_id":"from_jpeg(image_data:Bytes):self-class-method","name":"from_jpeg","doc":"Read `image_data` as JPEG encoded bytes","summary":"

        Read image_data as JPEG encoded bytes

        ","abstract":false,"args":[{"name":"image_data","external_name":"image_data","restriction":"Bytes"}],"args_string":"(image_data : Bytes) : self","args_html":"(image_data : Bytes) : self","def":{"name":"from_jpeg","args":[{"name":"image_data","external_name":"image_data","restriction":"Bytes"}],"return_type":"self","visibility":"Public","body":"handle = LibJPEGTurbo.init_decompress\ncheck_jpeg(handle, LibJPEGTurbo.decompress_header3(handle, image_data, image_data.size, out width, out height, out _subsampling, out _colorspace))\nbuffer = Bytes.new((width * height) * 3, 0)\ncheck_jpeg(handle, LibJPEGTurbo.decompress2(handle, image_data, LibC::ULong.new(image_data.size), buffer, width, 0, height, LibJPEGTurbo::PixelFormat::RGB, 0))\ncheck_jpeg(handle, LibJPEGTurbo.destroy(handle))\nred = Array.new(width * height) do\n 0_u8\nend\ngreen = Array.new(width * height) do\n 0_u8\nend\nblue = Array.new(width * height) do\n 0_u8\nend\nalpha = Array.new(width * height) do\n 255_u8\nend\n(width * height).times do |index|\n red.unsafe_put(index, buffer[index * 3])\n green.unsafe_put(index, buffer[(index * 3) + 1])\n blue.unsafe_put(index, buffer[(index * 3) + 2])\nend\nnew(red, green, blue, alpha, width, height)\n"}},{"html_id":"from_jpeg(io:IO):self-class-method","name":"from_jpeg","doc":"Construct an Image from reading in bytes from `io`","summary":"

        Construct an Image from reading in bytes from io

        ","abstract":false,"args":[{"name":"io","external_name":"io","restriction":"IO"}],"args_string":"(io : IO) : self","args_html":"(io : IO) : self","def":{"name":"from_jpeg","args":[{"name":"io","external_name":"io","restriction":"IO"}],"return_type":"self","visibility":"Public","body":"from_jpeg(io.getb_to_end)"}},{"html_id":"from_png(image_data:Bytes):self-class-method","name":"from_png","doc":"Read `image_data` and PNG encoded bytes","summary":"

        Read image_data and PNG encoded bytes

        ","abstract":false,"args":[{"name":"image_data","external_name":"image_data","restriction":"Bytes"}],"args_string":"(image_data : Bytes) : self","args_html":"(image_data : Bytes) : self","def":{"name":"from_png","args":[{"name":"image_data","external_name":"image_data","restriction":"Bytes"}],"return_type":"self","visibility":"Public","body":"ctx = LibSPNG.ctx_new(LibSPNG::CtxFlags::None)\nif ctx\nelse\n raise(::CrImage::Exception.new(\"Failed to create a context\"))\nend\nLibSPNG.set_png_buffer(ctx, image_data, image_data.size)\ncheck_png(LibSPNG.get_ihdr(ctx, out ihdr))\ncheck_png(LibSPNG.decoded_image_size(ctx, LibSPNG::Format::RGBA8, out image_size))\nimage = Bytes.new(image_size.to_i, 0_u8)\ncheck_png(LibSPNG.decode_image(ctx, image, image_size, LibSPNG::Format::RGBA8, LibSPNG::DecodeFlags::None))\nLibSPNG.ctx_free(ctx)\nsize = image_size // 4\nwidth = size // ihdr.height\nheight = ihdr.height\nred = Array.new(size) do\n 0_u8\nend\ngreen = Array.new(size) do\n 0_u8\nend\nblue = Array.new(size) do\n 0_u8\nend\nalpha = Array.new(size) do\n 0_u8\nend\nsize.times do |index|\n position = index * 4\n red.unsafe_put(index, image[position + 0])\n green.unsafe_put(index, image[position + 1])\n blue.unsafe_put(index, image[position + 2])\n alpha.unsafe_put(index, image[position + 3])\nend\nnew(red, green, blue, alpha, width.to_i, height.to_i)\n"}},{"html_id":"from_png(io:IO):self-class-method","name":"from_png","doc":"Construct an Image by reading bytes from `io`","summary":"

        Construct an Image by reading bytes from io

        ","abstract":false,"args":[{"name":"io","external_name":"io","restriction":"IO"}],"args_string":"(io : IO) : self","args_html":"(io : IO) : self","def":{"name":"from_png","args":[{"name":"io","external_name":"io","restriction":"IO"}],"return_type":"self","visibility":"Public","body":"from_png(io.getb_to_end)"}},{"html_id":"from_ppm(image_data:Bytes):self-class-method","name":"from_ppm","doc":"Read `image_data` as PPM encoded bytes","summary":"

        Read image_data as PPM encoded bytes

        ","abstract":false,"args":[{"name":"image_data","external_name":"image_data","restriction":"Bytes"}],"args_string":"(image_data : Bytes) : self","args_html":"(image_data : Bytes) : self","def":{"name":"from_ppm","args":[{"name":"image_data","external_name":"image_data","restriction":"Bytes"}],"return_type":"self","visibility":"Public","body":"from_ppm(IO::Memory.new(image_data))"}},{"html_id":"from_ppm(io:IO):self-class-method","name":"from_ppm","doc":"Read bytes from `io` as PPM encoded","summary":"

        Read bytes from io as PPM encoded

        ","abstract":false,"args":[{"name":"io","external_name":"io","restriction":"IO"}],"args_string":"(io : IO) : self","args_html":"(io : IO) : self","def":{"name":"from_ppm","args":[{"name":"io","external_name":"io","restriction":"IO"}],"return_type":"self","visibility":"Public","body":"_magic_number = io.gets(\"\\n\", chomp: true)\nwidth = (io.gets(\" \", chomp: true)).try(&.to_i)\nheight = (io.gets(\"\\n\", chomp: true)).try(&.to_i)\n_maximum_color_value = io.gets(\"\\n\", chomp: true)\nif width && height\n red = Array.new(width * height) do\n 0_u8\n end\n green = Array.new(width * height) do\n 0_u8\n end\n blue = Array.new(width * height) do\n 0_u8\n end\n alpha = Array.new(width * height) do\n 255_u8\n end\n (width * height).times do |index|\n red_byte = io.read_byte\n green_byte = io.read_byte\n blue_byte = io.read_byte\n if (red_byte && green_byte) && blue_byte\n red.unsafe_put(index, red_byte)\n green.unsafe_put(index, green_byte)\n blue.unsafe_put(index, blue_byte)\n else\n raise(\"The image ends prematurely\")\n end\n end\n new(red, green, blue, alpha, width, height)\nelse\n raise(\"The image doesn't have width or height\")\nend\n"}},{"html_id":"from_webp(image_data:Bytes):self-class-method","name":"from_webp","doc":"Read `image_data` as WebP encoded bytes","summary":"

        Read image_data as WebP encoded bytes

        ","abstract":false,"args":[{"name":"image_data","external_name":"image_data","restriction":"Bytes"}],"args_string":"(image_data : Bytes) : self","args_html":"(image_data : Bytes) : self","def":{"name":"from_webp","args":[{"name":"image_data","external_name":"image_data","restriction":"Bytes"}],"return_type":"self","visibility":"Public","body":"check_webp(LibWebP.get_info(image_data, image_data.size, out width, out height))\nbuffer = LibWebP.decode_rgba(image_data, image_data.size, pointerof(width), pointerof(height))\nred = Array.new(width * height) do\n 0_u8\nend\ngreen = Array.new(width * height) do\n 0_u8\nend\nblue = Array.new(width * height) do\n 0_u8\nend\nalpha = Array.new(width * height) do\n 0_u8\nend\n(width * height).times do |index|\n red.unsafe_put(index, buffer[index * 4])\n green.unsafe_put(index, buffer[(index * 4) + 1])\n blue.unsafe_put(index, buffer[(index * 4) + 2])\n alpha.unsafe_put(index, buffer[(index * 4) + 3])\nend\nLibWebP.free(buffer)\nnew(red, green, blue, alpha, width, height)\n"}},{"html_id":"from_webp(io:IO):self-class-method","name":"from_webp","doc":"Read bytes from `io` as WebP encoded","summary":"

        Read bytes from io as WebP encoded

        ","abstract":false,"args":[{"name":"io","external_name":"io","restriction":"IO"}],"args_string":"(io : IO) : self","args_html":"(io : IO) : self","def":{"name":"from_webp","args":[{"name":"io","external_name":"io","restriction":"IO"}],"return_type":"self","visibility":"Public","body":"from_webp(io.getb_to_end)"}},{"html_id":"new(red:Array(UInt8),green:Array(UInt8),blue:Array(UInt8),alpha:Array(UInt8),width:Int32,height:Int32)-class-method","name":"new","doc":"Create a GrayscaleImage from a set of color channels (delegates to `RGBAImage#to_gray`)","summary":"

        Create a GrayscaleImage from a set of color channels (delegates to RGBAImage#to_gray)

        ","abstract":false,"args":[{"name":"red","external_name":"red","restriction":"Array(UInt8)"},{"name":"green","external_name":"green","restriction":"Array(UInt8)"},{"name":"blue","external_name":"blue","restriction":"Array(UInt8)"},{"name":"alpha","external_name":"alpha","restriction":"Array(UInt8)"},{"name":"width","external_name":"width","restriction":"Int32"},{"name":"height","external_name":"height","restriction":"Int32"}],"args_string":"(red : Array(UInt8), green : Array(UInt8), blue : Array(UInt8), alpha : Array(UInt8), width : Int32, height : Int32)","args_html":"(red : Array(UInt8), green : Array(UInt8), blue : Array(UInt8), alpha : Array(UInt8), width : Int32, height : Int32)","location":{"filename":"src/cr-image/grayscale_image.cr","line_number":20,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L20"},"def":{"name":"new","args":[{"name":"red","external_name":"red","restriction":"Array(UInt8)"},{"name":"green","external_name":"green","restriction":"Array(UInt8)"},{"name":"blue","external_name":"blue","restriction":"Array(UInt8)"},{"name":"alpha","external_name":"alpha","restriction":"Array(UInt8)"},{"name":"width","external_name":"width","restriction":"Int32"},{"name":"height","external_name":"height","restriction":"Int32"}],"visibility":"Public","body":"(RGBAImage.new(red, green, blue, alpha, width, height)).to_gray"}},{"html_id":"new(gray:Array(UInt8),alpha:Array(UInt8),width:Int32,height:Int32)-class-method","name":"new","abstract":false,"args":[{"name":"gray","external_name":"gray","restriction":"::Array(::UInt8)"},{"name":"alpha","external_name":"alpha","restriction":"::Array(::UInt8)"},{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"height","external_name":"height","restriction":"::Int32"}],"args_string":"(gray : Array(UInt8), alpha : Array(UInt8), width : Int32, height : Int32)","args_html":"(gray : Array(UInt8), alpha : Array(UInt8), width : Int32, height : Int32)","location":{"filename":"src/cr-image/grayscale_image.cr","line_number":24,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L24"},"def":{"name":"new","args":[{"name":"gray","external_name":"gray","restriction":"::Array(::UInt8)"},{"name":"alpha","external_name":"alpha","restriction":"::Array(::UInt8)"},{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"height","external_name":"height","restriction":"::Int32"}],"visibility":"Public","body":"_ = allocate\n_.initialize(gray, alpha, width, height)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(gray:Array(UInt8),width:Int32,height:Int32)-class-method","name":"new","doc":"Create a GrayscaleImage with only an `Array(UInt8)` (alpha channel initialized as `255` throughout)","summary":"

        Create a GrayscaleImage with only an Array(UInt8) (alpha channel initialized as 255 throughout)

        ","abstract":false,"args":[{"name":"gray","external_name":"gray","restriction":"::Array(::UInt8)"},{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"height","external_name":"height","restriction":"::Int32"}],"args_string":"(gray : Array(UInt8), width : Int32, height : Int32)","args_html":"(gray : Array(UInt8), width : Int32, height : Int32)","location":{"filename":"src/cr-image/grayscale_image.cr","line_number":28,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L28"},"def":{"name":"new","args":[{"name":"gray","external_name":"gray","restriction":"::Array(::UInt8)"},{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"height","external_name":"height","restriction":"::Int32"}],"visibility":"Public","body":"_ = allocate\n_.initialize(gray, width, height)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"[](x:Int32,y:Int32):Pixel-instance-method","name":"[]","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"y","external_name":"y","restriction":"Int32"}],"args_string":"(x : Int32, y : Int32) : Pixel","args_html":"(x : Int32, y : Int32) : Pixel","location":{"filename":"src/cr-image/grayscale_image.cr","line_number":73,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L73"},"def":{"name":"[]","args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"y","external_name":"y","restriction":"Int32"}],"return_type":"Pixel","visibility":"Public","body":"index = (y * width) + x\nPixel.new(gray[index], alpha[index])\n"}},{"html_id":"[](channel_type:ChannelType):Array(UInt8)-instance-method","name":"[]","doc":"Return the `Array(UInt8)` corresponding to `channel_type`","summary":"

        Return the Array(UInt8) corresponding to channel_type

        ","abstract":false,"args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"}],"args_string":"(channel_type : ChannelType) : Array(UInt8)","args_html":"(channel_type : ChannelType) : Array(UInt8)","location":{"filename":"src/cr-image/grayscale_image.cr","line_number":79,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L79"},"def":{"name":"[]","args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"}],"return_type":"Array(UInt8)","visibility":"Public","body":"if channel_type == ChannelType::Alpha\n return @alpha\nend\n@gray\n"}},{"html_id":"[]=(channel_type:ChannelType,channel:Array(UInt8)):Array(UInt8)-instance-method","name":"[]=","doc":"Set the underlying `Array(UInt8)` of `channel_type` to the new `channel`.\n\nWarning: this method does not check the size of the incoming array, and if it's a different\nsize from what the current image represents, this could break it. We recommend against using\nthis method except for from other methods that will be updating the `width` and `height` immediately after.","summary":"

        Set the underlying Array(UInt8) of channel_type to the new channel.

        ","abstract":false,"args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"},{"name":"channel","external_name":"channel","restriction":"Array(UInt8)"}],"args_string":"(channel_type : ChannelType, channel : Array(UInt8)) : Array(UInt8)","args_html":"(channel_type : ChannelType, channel : Array(UInt8)) : Array(UInt8)","location":{"filename":"src/cr-image/grayscale_image.cr","line_number":89,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L89"},"def":{"name":"[]=","args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"},{"name":"channel","external_name":"channel","restriction":"Array(UInt8)"}],"return_type":"Array(UInt8)","visibility":"Public","body":"case channel_type\nwhen ChannelType::Gray\n self.gray = channel\nwhen ChannelType::Alpha\n self.alpha = channel\nelse\n raise(\"Unknown channel type #{channel_type} for GrayscaleImage\")\nend"}},{"html_id":"alpha:Array(UInt8)-instance-method","name":"alpha","doc":"Return `alpha` channel","summary":"

        Return #alpha channel

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":58,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L58"},"def":{"name":"alpha","return_type":"Array(UInt8)","visibility":"Public","body":"@alpha"}},{"html_id":"alpha=(alpha:Array(UInt8))-instance-method","name":"alpha=","abstract":false,"args":[{"name":"alpha","external_name":"alpha","restriction":"Array(UInt8)"}],"args_string":"(alpha : Array(UInt8))","args_html":"(alpha : Array(UInt8))","location":{"filename":"src/cr-image/grayscale_image.cr","line_number":15,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L15"},"def":{"name":"alpha=","args":[{"name":"alpha","external_name":"alpha","restriction":"Array(UInt8)"}],"visibility":"Public","body":"@alpha = alpha"}},{"html_id":"blue:Array(UInt8)-instance-method","name":"blue","doc":"Return the \"`blue`\" channel (returns `gray`)","summary":"

        Return the "#blue" channel (returns #gray)

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":53,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L53"},"def":{"name":"blue","return_type":"Array(UInt8)","visibility":"Public","body":"@gray"}},{"html_id":"clone:GrayscaleImage-instance-method","name":"clone","doc":"Create a new GrayscaleImage as a copy of this one","summary":"

        Create a new GrayscaleImage as a copy of this one

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":33,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L33"},"def":{"name":"clone","return_type":"GrayscaleImage","visibility":"Public","body":"self.class.new(@gray.clone, @alpha.clone, @width, @height)"}},{"html_id":"each_channel(&:Array(UInt8),ChannelType->Nil):Nil-instance-method","name":"each_channel","doc":"Run provided block with the `ChannelType::Gray` and `ChannelType::Alpha` channels and channel types.","summary":"

        Run provided block with the ChannelType::Gray and ChannelType::Alpha channels and channel types.

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":63,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L63"},"def":{"name":"each_channel","yields":2,"block_arity":2,"block_arg":{"name":"","external_name":"","restriction":"(Array(UInt8), ChannelType -> Nil)"},"return_type":"Nil","visibility":"Public","body":"yield @gray, ChannelType::Gray\nyield @alpha, ChannelType::Alpha\nnil\n"}},{"html_id":"gray:Array(UInt8)-instance-method","name":"gray","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":14,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L14"},"def":{"name":"gray","return_type":"Array(UInt8)","visibility":"Public","body":"@gray"}},{"html_id":"gray=(gray:Array(UInt8))-instance-method","name":"gray=","abstract":false,"args":[{"name":"gray","external_name":"gray","restriction":"Array(UInt8)"}],"args_string":"(gray : Array(UInt8))","args_html":"(gray : Array(UInt8))","location":{"filename":"src/cr-image/grayscale_image.cr","line_number":14,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L14"},"def":{"name":"gray=","args":[{"name":"gray","external_name":"gray","restriction":"Array(UInt8)"}],"visibility":"Public","body":"@gray = gray"}},{"html_id":"green:Array(UInt8)-instance-method","name":"green","doc":"Return the \"`green`\" channel (returns `gray`)","summary":"

        Return the "#green" channel (returns #gray)

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":48,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L48"},"def":{"name":"green","return_type":"Array(UInt8)","visibility":"Public","body":"@gray"}},{"html_id":"height:Int32-instance-method","name":"height","doc":"Height of image","summary":"

        Height of image

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":17,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L17"},"def":{"name":"height","return_type":"Int32","visibility":"Public","body":"@height"}},{"html_id":"height=(height:Int32)-instance-method","name":"height=","abstract":false,"args":[{"name":"height","external_name":"height","restriction":"Int32"}],"args_string":"(height : Int32)","args_html":"(height : Int32)","location":{"filename":"src/cr-image/grayscale_image.cr","line_number":17,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L17"},"def":{"name":"height=","args":[{"name":"height","external_name":"height","restriction":"Int32"}],"visibility":"Public","body":"@height = height"}},{"html_id":"invert-instance-method","name":"invert","doc":"Invert grayscale pixels (replace each pixel will `255 - p` for all `p` in `@gray`).\n\n\"Woman\n\nBecomes\n\n\"Woman","summary":"

        Invert grayscale pixels (replace each pixel will 255 - p for all p in @gray).

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":121,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L121"},"def":{"name":"invert","visibility":"Public","body":"clone.invert!"}},{"html_id":"invert!-instance-method","name":"invert!","doc":"Invert grayscale pixels (replace each pixel will `255 - p` for all `p` in `@gray`). Modifies self.\n\n\"Woman\n\nBecomes\n\n\"Woman","summary":"

        Invert grayscale pixels (replace each pixel will 255 - p for all p in @gray).

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":132,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L132"},"def":{"name":"invert!","visibility":"Public","body":"@gray.map! do |pix|\n 255_u8 - pix\nend\nself\n"}},{"html_id":"mask_from(&block:Int32,Int32,UInt8->Bool):Mask-instance-method","name":"mask_from","doc":"Construct a `Mask` from this `GrayscaleImage` using the passed in block to determine if a given pixel should be true or not\n\n```\n# Construct a mask identifying the bright pixels in the bottom left corner of image\nimage.to_gray.mask_from do |x, y, pixel|\n x < image.width // 2 && # left half of image\n y > (image.height // 2) && # bottom half of image\n pixel > 128 # only \"bright\" pixels\nend\n```\n\"Woman\n->\n\"Mask","summary":"

        Construct a Mask from this GrayscaleImage using the passed in block to determine if a given pixel should be true or not

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":150,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L150"},"def":{"name":"mask_from","yields":3,"block_arity":3,"block_arg":{"name":"block","external_name":"block","restriction":"(Int32, Int32, UInt8 -> Bool)"},"return_type":"Mask","visibility":"Public","body":"Mask.new(width, BitArray.new(size) do |i|\n block.call(i % width, i // width, @gray[i])\nend)"}},{"html_id":"red:Array(UInt8)-instance-method","name":"red","doc":"Return the \"`red`\" channel (returns `gray`)","summary":"

        Return the "#red" channel (returns #gray)

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":43,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L43"},"def":{"name":"red","return_type":"Array(UInt8)","visibility":"Public","body":"@gray"}},{"html_id":"size:Int32-instance-method","name":"size","doc":"Return the number of pixels this image contains","summary":"

        Return the number of pixels this image contains

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":110,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L110"},"def":{"name":"size","return_type":"Int32","visibility":"Public","body":"@width * @height"}},{"html_id":"threshold(threshold:Int):Mask-instance-method","name":"threshold","doc":"Construct a simple threshold `Mask` containing all pixels with a `UInt8` value greater than `threshold`\nGiven sample image:\n\n\"Woman\n\n```\nimage\n .to_gray # convert color image to grayscale one\n .threshold(128) # generate a mask using threshold operator\n .to_gray # convert mask to grayscale image\n .save(\"threshold_example.jpg\") # save mask as grayscale\n```\n\"Black","summary":"

        Construct a simple threshold Mask containing all pixels with a UInt8 value greater than #threshold Given sample image:

        ","abstract":false,"args":[{"name":"threshold","external_name":"threshold","restriction":"Int"}],"args_string":"(threshold : Int) : Mask","args_html":"(threshold : Int) : Mask","location":{"filename":"src/cr-image/grayscale_image.cr","line_number":169,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L169"},"def":{"name":"threshold","args":[{"name":"threshold","external_name":"threshold","restriction":"Int"}],"return_type":"Mask","visibility":"Public","body":"mask_from do |_, _, pixel|\n pixel >= threshold\nend"}},{"html_id":"to_gray:GrayscaleImage-instance-method","name":"to_gray","doc":"Returns self","summary":"

        Returns self

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":105,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L105"},"def":{"name":"to_gray","return_type":"GrayscaleImage","visibility":"Public","body":"self"}},{"html_id":"to_rgba:RGBAImage-instance-method","name":"to_rgba","doc":"Convert this `GrayscaleImage` to an `RGBAImage`.\n\nNo color will be provided, all pixels will remain gray.","summary":"

        Convert this GrayscaleImage to an RGBAImage.

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":100,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L100"},"def":{"name":"to_rgba","return_type":"RGBAImage","visibility":"Public","body":"RGBAImage.new(@gray.clone, @gray.clone, @gray.clone, @alpha.clone, width, height)"}},{"html_id":"to_stumpy:StumpyCore::Canvas-instance-method","name":"to_stumpy","abstract":false,"location":{"filename":"src/stumpy.cr","line_number":39,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/stumpy.cr#L39"},"def":{"name":"to_stumpy","return_type":"StumpyCore::Canvas","visibility":"Public","body":"StumpyCore::Canvas.new(width, height) do |x, y|\n color = self[x, y]\n StumpyCore::RGBA.new(color.gray.to_u16 << 8, color.gray.to_u16 << 8, color.gray.to_u16 << 8, color.alpha.to_u16 << 8)\nend"}},{"html_id":"width:Int32-instance-method","name":"width","doc":"Width of image","summary":"

        Width of image

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":16,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L16"},"def":{"name":"width","return_type":"Int32","visibility":"Public","body":"@width"}},{"html_id":"width=(width:Int32)-instance-method","name":"width=","abstract":false,"args":[{"name":"width","external_name":"width","restriction":"Int32"}],"args_string":"(width : Int32)","args_html":"(width : Int32)","location":{"filename":"src/cr-image/grayscale_image.cr","line_number":16,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L16"},"def":{"name":"width=","args":[{"name":"width","external_name":"width","restriction":"Int32"}],"visibility":"Public","body":"@width = width"}}],"types":[{"html_id":"Crystal Image/CrImage/GrayscaleImage/Pixel","path":"CrImage/GrayscaleImage/Pixel.html","kind":"struct","full_name":"CrImage::GrayscaleImage::Pixel","name":"Pixel","abstract":false,"superclass":{"html_id":"Crystal Image/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"Crystal Image/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"Crystal Image/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"Crystal Image/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cr-image/grayscale_image.cr","line_number":69,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L69"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"Crystal Image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},"constructors":[{"html_id":"new(gray:UInt8,alpha:UInt8)-class-method","name":"new","abstract":false,"args":[{"name":"gray","external_name":"gray","restriction":"UInt8"},{"name":"alpha","external_name":"alpha","restriction":"UInt8"}],"args_string":"(gray : UInt8, alpha : UInt8)","args_html":"(gray : UInt8, alpha : UInt8)","location":{"filename":"src/cr-image/grayscale_image.cr","line_number":69,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L69"},"def":{"name":"new","args":[{"name":"gray","external_name":"gray","restriction":"UInt8"},{"name":"alpha","external_name":"alpha","restriction":"UInt8"}],"visibility":"Public","body":"_ = allocate\n_.initialize(gray, alpha)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"alpha:UInt8-instance-method","name":"alpha","abstract":false,"def":{"name":"alpha","return_type":"UInt8","visibility":"Public","body":"@alpha"}},{"html_id":"clone-instance-method","name":"clone","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":69,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L69"},"def":{"name":"clone","visibility":"Public","body":"self.class.new(@gray.clone, @alpha.clone)"}},{"html_id":"copy_with(gray_gray=@gray,alpha_alpha=@alpha)-instance-method","name":"copy_with","abstract":false,"args":[{"name":"_gray","default_value":"@gray","external_name":"gray","restriction":""},{"name":"_alpha","default_value":"@alpha","external_name":"alpha","restriction":""}],"args_string":"(gray _gray = @gray, alpha _alpha = @alpha)","args_html":"(gray _gray = @gray, alpha _alpha = @alpha)","location":{"filename":"src/cr-image/grayscale_image.cr","line_number":69,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L69"},"def":{"name":"copy_with","args":[{"name":"_gray","default_value":"@gray","external_name":"gray","restriction":""},{"name":"_alpha","default_value":"@alpha","external_name":"alpha","restriction":""}],"visibility":"Public","body":"self.class.new(_gray, _alpha)"}},{"html_id":"gray:UInt8-instance-method","name":"gray","abstract":false,"def":{"name":"gray","return_type":"UInt8","visibility":"Public","body":"@gray"}}]}]},{"html_id":"Crystal Image/CrImage/Image","path":"CrImage/Image.html","kind":"class","full_name":"CrImage::Image","name":"Image","abstract":true,"superclass":{"html_id":"Crystal Image/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"Crystal Image/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"Crystal Image/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cr-image/image.cr","line_number":3,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/image.cr#L3"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"subclasses":[{"html_id":"Crystal Image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"Crystal Image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"Crystal Image/CrImage","kind":"module","full_name":"CrImage","name":"CrImage"},"doc":"Common base class for `GrayscaleImage` and `RGBAImage`. All `Image`s are readable and saveable\nto the filesystem or `IO` stream.","summary":"

        Common base class for GrayscaleImage and RGBAImage.

        ","instance_methods":[{"html_id":"[](channel_type:ChannelType):Array(UInt8)-instance-method","name":"[]","doc":"Get the `Array(UInt8)` corresponding to `channel_type`)","summary":"

        Get the Array(UInt8) corresponding to channel_type)

        ","abstract":true,"args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"}],"args_string":"(channel_type : ChannelType) : Array(UInt8)","args_html":"(channel_type : ChannelType) : Array(UInt8)","location":{"filename":"src/cr-image/image.cr","line_number":51,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/image.cr#L51"},"def":{"name":"[]","args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"}],"return_type":"Array(UInt8)","visibility":"Public","body":""}},{"html_id":"[]=(channel_type:ChannelType,channel:Array(UInt8)):Array(UInt8)-instance-method","name":"[]=","doc":"Set the `Array(UInt8)` corresponding to `channel_type`) to `channel`","summary":"

        Set the Array(UInt8) corresponding to channel_type) to channel

        ","abstract":true,"args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"},{"name":"channel","external_name":"channel","restriction":"Array(UInt8)"}],"args_string":"(channel_type : ChannelType, channel : Array(UInt8)) : Array(UInt8)","args_html":"(channel_type : ChannelType, channel : Array(UInt8)) : Array(UInt8)","location":{"filename":"src/cr-image/image.cr","line_number":53,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/image.cr#L53"},"def":{"name":"[]=","args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"},{"name":"channel","external_name":"channel","restriction":"Array(UInt8)"}],"return_type":"Array(UInt8)","visibility":"Public","body":""}},{"html_id":"alpha:Array(UInt8)-instance-method","name":"alpha","doc":"Return the alpha channel","summary":"

        Return the alpha channel

        ","abstract":true,"location":{"filename":"src/cr-image/image.cr","line_number":39,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/image.cr#L39"},"def":{"name":"alpha","return_type":"Array(UInt8)","visibility":"Public","body":""}},{"html_id":"blue:Array(UInt8)-instance-method","name":"blue","doc":"Return the blue channel","summary":"

        Return the blue channel

        ","abstract":true,"location":{"filename":"src/cr-image/image.cr","line_number":37,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/image.cr#L37"},"def":{"name":"blue","return_type":"Array(UInt8)","visibility":"Public","body":""}},{"html_id":"each_channel(&:Array(UInt8),ChannelType->Nil):Nil-instance-method","name":"each_channel","doc":"Run provided block on each channel supported by this image.","summary":"

        Run provided block on each channel supported by this image.

        ","abstract":true,"location":{"filename":"src/cr-image/image.cr","line_number":48,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/image.cr#L48"},"def":{"name":"each_channel","yields":2,"block_arity":2,"block_arg":{"name":"","external_name":"","restriction":"(Array(UInt8), ChannelType -> Nil)"},"return_type":"Nil","visibility":"Public","body":""}},{"html_id":"green:Array(UInt8)-instance-method","name":"green","doc":"Return the green channel","summary":"

        Return the green channel

        ","abstract":true,"location":{"filename":"src/cr-image/image.cr","line_number":35,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/image.cr#L35"},"def":{"name":"green","return_type":"Array(UInt8)","visibility":"Public","body":""}},{"html_id":"height:Int32-instance-method","name":"height","doc":"Height of image","summary":"

        Height of image

        ","abstract":true,"location":{"filename":"src/cr-image/image.cr","line_number":43,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/image.cr#L43"},"def":{"name":"height","return_type":"Int32","visibility":"Public","body":""}},{"html_id":"red:Array(UInt8)-instance-method","name":"red","doc":"Return the red channel","summary":"

        Return the red channel

        ","abstract":true,"location":{"filename":"src/cr-image/image.cr","line_number":33,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/image.cr#L33"},"def":{"name":"red","return_type":"Array(UInt8)","visibility":"Public","body":""}},{"html_id":"size:Int32-instance-method","name":"size","doc":"Size (total pixels) in image (`width` * `height`)","summary":"

        Size (total pixels) in image (#width * #height)

        ","abstract":true,"location":{"filename":"src/cr-image/image.cr","line_number":45,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/image.cr#L45"},"def":{"name":"size","return_type":"Int32","visibility":"Public","body":""}},{"html_id":"width:Int32-instance-method","name":"width","doc":"Width of image","summary":"

        Width of image

        ","abstract":true,"location":{"filename":"src/cr-image/image.cr","line_number":41,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/image.cr#L41"},"def":{"name":"width","return_type":"Int32","visibility":"Public","body":""}}],"macros":[{"html_id":"subsclasses_include(mod)-macro","name":"subsclasses_include","abstract":false,"args":[{"name":"mod","external_name":"mod","restriction":""}],"args_string":"(mod)","args_html":"(mod)","location":{"filename":"src/cr-image/image.cr","line_number":4,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/image.cr#L4"},"def":{"name":"subsclasses_include","args":[{"name":"mod","external_name":"mod","restriction":""}],"visibility":"Public","body":" \n{% for sub in @type.subclasses %}\n class ::{{ sub }}\n include {{ mod }}\n end\n {% end %}\n\n \n"}}]},{"html_id":"Crystal Image/CrImage/Mask","path":"CrImage/Mask.html","kind":"class","full_name":"CrImage::Mask","name":"Mask","abstract":false,"superclass":{"html_id":"Crystal Image/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"Crystal Image/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"Crystal Image/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cr-image/mask.cr","line_number":39,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L39"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"Crystal Image/CrImage","kind":"module","full_name":"CrImage","name":"CrImage"},"doc":"Mask is a wrapper around BitArray, where each flag represents a boolean bit of information about a pixel\nfrom an image. This can include whether a particular pixel has a value within certain conditions, OR\nif that pixel should be zeroed out or not.\n\nSee `[]=` methods below for examples of how to manually construct masks.\n\n(x,y) - coordinates. Represent these positions in a Mask of size 10x10:\n\n```\n[\n (0,0), (0,1), (0,2), (0,3), (0,4), (0,5), (0,6), (0,7), (0,8), (0,9),\n (1,0), (1,1), (1,2), (1,3), (1,4), (1,5), (1,6), (1,7), (1,8), (1,9),\n (2,0), (2,1), (2,2), (2,3), (2,4), (2,5), (2,6), (2,7), (2,8), (2,9),\n (3,0), (3,1), (3,2), (3,3), (3,4), (3,5), (3,6), (3,7), (3,8), (3,9),\n (4,0), (4,1), (4,2), (4,3), (4,4), (4,5), (4,6), (4,7), (4,8), (4,9),\n (5,0), (5,1), (5,2), (5,3), (5,4), (5,5), (5,6), (5,7), (5,8), (5,9),\n (6,0), (6,1), (6,2), (6,3), (6,4), (6,5), (6,6), (6,7), (6,8), (6,9),\n (7,0), (7,1), (7,2), (7,3), (7,4), (7,5), (7,6), (7,7), (7,8), (7,9),\n (8,0), (8,1), (8,2), (8,3), (8,4), (8,5), (8,6), (8,7), (8,8), (8,9),\n (9,0), (9,1), (9,2), (9,3), (9,4), (9,5), (9,6), (9,7), (9,8), (9,9),\n]\n```\n\nAnd every position is a Bool value.\n\nDifferent ways to refer to coordinates:\n```\nmask.at(0, 0) # => (0,0)\nmask[0, 0] # => (0,0), same as .at(0, 0)\nmask[0..1, 4] # => (4,0), (4,1)\nmask[3, 3..5] # => (3,3), (3,4), (3,5)\nmask[2..3, 4..5] # => (2,4), (2,5), (3,4), (3,5)\n```\n\nSee `Operation::Crop` and `Operation::MaskApply` for how this can be useful","summary":"

        Mask is a wrapper around BitArray, where each flag represents a boolean bit of information about a pixel from an image.

        ","constructors":[{"html_id":"new(width:Int32,height:Int32,initial:Bool=true)-class-method","name":"new","doc":"Construct a new `Mask` of width x height, preset to `initial`","summary":"

        Construct a new Mask of width x height, preset to initial

        ","abstract":false,"args":[{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"height","external_name":"height","restriction":"Int32"},{"name":"initial","default_value":"true","external_name":"initial","restriction":"Bool"}],"args_string":"(width : Int32, height : Int32, initial : Bool = true)","args_html":"(width : Int32, height : Int32, initial : Bool = true)","location":{"filename":"src/cr-image/mask.cr","line_number":49,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L49"},"def":{"name":"new","args":[{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"height","external_name":"height","restriction":"Int32"},{"name":"initial","default_value":"true","external_name":"initial","restriction":"Bool"}],"visibility":"Public","body":"_ = allocate\n_.initialize(width, height, initial)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(width:Int32,height:Int32,int:Int)-class-method","name":"new","doc":"Construct a new `Mask` from an integer (useful for testing or small mask construction)","summary":"

        Construct a new Mask from an integer (useful for testing or small mask construction)

        ","abstract":false,"args":[{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"height","external_name":"height","restriction":"Int32"},{"name":"int","external_name":"int","restriction":"Int"}],"args_string":"(width : Int32, height : Int32, int : Int)","args_html":"(width : Int32, height : Int32, int : Int)","location":{"filename":"src/cr-image/mask.cr","line_number":61,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L61"},"def":{"name":"new","args":[{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"height","external_name":"height","restriction":"Int32"},{"name":"int","external_name":"int","restriction":"Int"}],"visibility":"Public","body":"_ = allocate\n_.initialize(width, height, int)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(other_bits:Array(BitArray))-class-method","name":"new","doc":"Construct a new `Mask` from an array of `BitArray`. See `#[](xs : Range, ys : Range) : Array(BitArray)`\n\nThis assumes `other_bits[0]` corresponds to `x == 0` in the mask, and the corresponding\n`BitArray` represents all bits for that row. All `BitArray`s must be of the same size in\n`other_bits`.","summary":"

        Construct a new Mask from an array of BitArray.

        ","abstract":false,"args":[{"name":"other_bits","external_name":"other_bits","restriction":"Array(BitArray)"}],"args_string":"(other_bits : Array(BitArray))","args_html":"(other_bits : Array(BitArray))","location":{"filename":"src/cr-image/mask.cr","line_number":77,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L77"},"def":{"name":"new","args":[{"name":"other_bits","external_name":"other_bits","restriction":"Array(BitArray)"}],"visibility":"Public","body":"_ = allocate\n_.initialize(other_bits)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(image:Image,initial:Bool=true)-class-method","name":"new","doc":"Construct a new `Mask` from the dimensions of passed in `image` with an initial bit","summary":"

        Construct a new Mask from the dimensions of passed in image with an initial bit

        ","abstract":false,"args":[{"name":"image","external_name":"image","restriction":"Image"},{"name":"initial","default_value":"true","external_name":"initial","restriction":"Bool"}],"args_string":"(image : Image, initial : Bool = true)","args_html":"(image : Image, initial : Bool = true)","location":{"filename":"src/cr-image/mask.cr","line_number":67,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L67"},"def":{"name":"new","args":[{"name":"image","external_name":"image","restriction":"Image"},{"name":"initial","default_value":"true","external_name":"initial","restriction":"Bool"}],"visibility":"Public","body":"_ = allocate\n_.initialize(image, initial)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(width:Int32,bits:BitArray)-class-method","name":"new","doc":"Construct a new `Mask` with a set width and bits from `bits`","summary":"

        Construct a new Mask with a set width and bits from #bits

        ","abstract":false,"args":[{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"bits","external_name":"bits","restriction":"::BitArray"}],"args_string":"(width : Int32, bits : BitArray)","args_html":"(width : Int32, bits : BitArray)","location":{"filename":"src/cr-image/mask.cr","line_number":44,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L44"},"def":{"name":"new","args":[{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"bits","external_name":"bits","restriction":"::BitArray"}],"visibility":"Public","body":"_ = allocate\n_.initialize(width, bits)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(width:Int32,height:Int32,&block:Int32,Int32->Bool)-class-method","name":"new","doc":"Construct a new `Mask` of width x height using `&block` to determine if a bit should be true or not (passed in `x` and `y` coordinates)","summary":"

        Construct a new Mask of width x height using &block to determine if a bit should be true or not (passed in x and y coordinates)

        ","abstract":false,"args":[{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"height","external_name":"height","restriction":"Int32"}],"args_string":"(width : Int32, height : Int32, &block : Int32, Int32 -> Bool)","args_html":"(width : Int32, height : Int32, &block : Int32, Int32 -> Bool)","location":{"filename":"src/cr-image/mask.cr","line_number":54,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L54"},"def":{"name":"new","args":[{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"height","external_name":"height","restriction":"Int32"}],"yields":2,"block_arity":2,"block_arg":{"name":"block","external_name":"block","restriction":"(Int32, Int32 -> Bool)"},"visibility":"Public","body":"_ = allocate\n_.initialize(width, height, &block) do |_arg0, _arg1|\n yield _arg0, _arg1\nend\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"==(other:Mask)-instance-method","name":"==","abstract":false,"args":[{"name":"other","external_name":"other","restriction":"Mask"}],"args_string":"(other : Mask)","args_html":"(other : Mask)","location":{"filename":"src/cr-image/mask.cr","line_number":166,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L166"},"def":{"name":"==","args":[{"name":"other","external_name":"other","restriction":"Mask"}],"visibility":"Public","body":"(width == other.width) && (bits == other.bits)"}},{"html_id":"[](x:Int32,y:Int32):Bool-instance-method","name":"[]","doc":"Return the bit at `x` and `y`","summary":"

        Return the bit at x and y

        ","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"y","external_name":"y","restriction":"Int32"}],"args_string":"(x : Int32, y : Int32) : Bool","args_html":"(x : Int32, y : Int32) : Bool","location":{"filename":"src/cr-image/mask.cr","line_number":136,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L136"},"def":{"name":"[]","args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"y","external_name":"y","restriction":"Int32"}],"return_type":"Bool","visibility":"Public","body":"if x >= width || y >= height\n raise(IndexError.new(\"Out of bounds: this mask is #{width}x#{height}, and (#{x},#{y}) is outside of that\"))\nend\n@bits[(y * width) + x]\n"}},{"html_id":"[](xs:Range,y:Int32):BitArray-instance-method","name":"[]","doc":"Return a new `BitArray` corresponding to the partial row specified","summary":"

        Return a new BitArray corresponding to the partial row specified

        ","abstract":false,"args":[{"name":"xs","external_name":"xs","restriction":"Range"},{"name":"y","external_name":"y","restriction":"Int32"}],"args_string":"(xs : Range, y : Int32) : BitArray","args_html":"(xs : Range, y : Int32) : BitArray","location":{"filename":"src/cr-image/mask.cr","line_number":142,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L142"},"def":{"name":"[]","args":[{"name":"xs","external_name":"xs","restriction":"Range"},{"name":"y","external_name":"y","restriction":"Int32"}],"return_type":"BitArray","visibility":"Public","body":"start, count = resolve_to_start_and_count(xs, width)\nBitArray.new(count) do |x|\n self[x + start, y]\nend\n"}},{"html_id":"[](x:Int32,ys:Range):BitArray-instance-method","name":"[]","doc":"Return a new `BitArray` corresponding to the partial column specified","summary":"

        Return a new BitArray corresponding to the partial column specified

        ","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"ys","external_name":"ys","restriction":"Range"}],"args_string":"(x : Int32, ys : Range) : BitArray","args_html":"(x : Int32, ys : Range) : BitArray","location":{"filename":"src/cr-image/mask.cr","line_number":148,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L148"},"def":{"name":"[]","args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"ys","external_name":"ys","restriction":"Range"}],"return_type":"BitArray","visibility":"Public","body":"start, count = resolve_to_start_and_count(ys, height)\nBitArray.new(count) do |y|\n self[x, y + start]\nend\n"}},{"html_id":"[](xs:Range,ys:Range):Array(BitArray)-instance-method","name":"[]","doc":"Return an `Array(BitArray)` for the partial box (of partial rows and partial columns) of this mask.\n\nCan be used to construct another mask from.","summary":"

        Return an Array(BitArray) for the partial box (of partial rows and partial columns) of this mask.

        ","abstract":false,"args":[{"name":"xs","external_name":"xs","restriction":"Range"},{"name":"ys","external_name":"ys","restriction":"Range"}],"args_string":"(xs : Range, ys : Range) : Array(BitArray)","args_html":"(xs : Range, ys : Range) : Array(BitArray)","location":{"filename":"src/cr-image/mask.cr","line_number":156,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L156"},"def":{"name":"[]","args":[{"name":"xs","external_name":"xs","restriction":"Range"},{"name":"ys","external_name":"ys","restriction":"Range"}],"return_type":"Array(BitArray)","visibility":"Public","body":"start_x, count_x = resolve_to_start_and_count(xs, width)\nstart_y, count_y = resolve_to_start_and_count(ys, height)\ncount_y.times.to_a.map do |y|\n BitArray.new(count_x) do |x|\n self[x + start_x, y + start_y]\n end\nend\n"}},{"html_id":"[]=(x:Int32,y:Int32,value:Bool):Bool-instance-method","name":"[]=","doc":"Set the bit for coordinate `x` and `y`\n\n```\nmask = CrImage::Mask.new(50, 50, false)\nmask[20, 20] = true\nmask.to_gray.save(\"mask_point.jpg\")\n```\n\"Black","summary":"

        Set the bit for coordinate x and y

        ","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"y","external_name":"y","restriction":"Int32"},{"name":"value","external_name":"value","restriction":"Bool"}],"args_string":"(x : Int32, y : Int32, value : Bool) : Bool","args_html":"(x : Int32, y : Int32, value : Bool) : Bool","location":{"filename":"src/cr-image/mask.cr","line_number":186,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L186"},"def":{"name":"[]=","args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"y","external_name":"y","restriction":"Int32"},{"name":"value","external_name":"value","restriction":"Bool"}],"return_type":"Bool","visibility":"Public","body":"self.set(x, y, value)"}},{"html_id":"[]=(xs:Range,y:Int32,value:Bool):Bool-instance-method","name":"[]=","doc":"Set the bits for partial row `xs` at column `y`\n\n```\nmask = CrImage::Mask.new(50, 50, false)\nmask[20..40, 20] = true\nmask.to_gray.save(\"mask_partial_row.jpg\")\n```\n\"Black","summary":"

        Set the bits for partial row xs at column y

        ","abstract":false,"args":[{"name":"xs","external_name":"xs","restriction":"Range"},{"name":"y","external_name":"y","restriction":"Int32"},{"name":"value","external_name":"value","restriction":"Bool"}],"args_string":"(xs : Range, y : Int32, value : Bool) : Bool","args_html":"(xs : Range, y : Int32, value : Bool) : Bool","location":{"filename":"src/cr-image/mask.cr","line_number":198,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L198"},"def":{"name":"[]=","args":[{"name":"xs","external_name":"xs","restriction":"Range"},{"name":"y","external_name":"y","restriction":"Int32"},{"name":"value","external_name":"value","restriction":"Bool"}],"return_type":"Bool","visibility":"Public","body":"if y >= height\n raise(IndexError.new(\"Out of bounds: #{y} is beyond the bounds of this mask's height of #{height}\"))\nend\nstart_x, count_x = resolve_to_start_and_count(xs, width)\n@bits.fill(value, (y * width) + start_x, count_x)\nclear_caches\nvalue\n"}},{"html_id":"[]=(x:Int32,ys:Range,value:Bool):Bool-instance-method","name":"[]=","doc":"Set the bits for row `x` and partial columns `ys`\n\n```\nmask = CrImage::Mask.new(50, 50, false)\nmask[20..40, 20] = true\nmask.to_gray.save(\"mask_partial_column.jpg\")\n```\n\"Black","summary":"

        Set the bits for row x and partial columns ys

        ","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"ys","external_name":"ys","restriction":"Range"},{"name":"value","external_name":"value","restriction":"Bool"}],"args_string":"(x : Int32, ys : Range, value : Bool) : Bool","args_html":"(x : Int32, ys : Range, value : Bool) : Bool","location":{"filename":"src/cr-image/mask.cr","line_number":214,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L214"},"def":{"name":"[]=","args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"ys","external_name":"ys","restriction":"Range"},{"name":"value","external_name":"value","restriction":"Bool"}],"return_type":"Bool","visibility":"Public","body":"if x >= width\n raise(IndexError.new(\"Out of bounds: #{x} is beyond the bounds of this mask's width of #{width}\"))\nend\nstart_y, count_y = resolve_to_start_and_count(ys, height)\ncount_y.times.to_a.each do |y|\n set(x, y + start_y, value)\nend\nvalue\n"}},{"html_id":"[]=(xs:Range,ys:Range,value:Bool):Bool-instance-method","name":"[]=","doc":"Set the bits for partial rows `xs` and partial columns `ys`\n\n```\nmask = CrImage::Mask.new(50, 50, false)\nmask[20..40, 20..40] = true\nmask.to_gray.save(\"mask_partial_column.jpg\")\n```\n\"Black","summary":"

        Set the bits for partial rows xs and partial columns ys

        ","abstract":false,"args":[{"name":"xs","external_name":"xs","restriction":"Range"},{"name":"ys","external_name":"ys","restriction":"Range"},{"name":"value","external_name":"value","restriction":"Bool"}],"args_string":"(xs : Range, ys : Range, value : Bool) : Bool","args_html":"(xs : Range, ys : Range, value : Bool) : Bool","location":{"filename":"src/cr-image/mask.cr","line_number":231,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L231"},"def":{"name":"[]=","args":[{"name":"xs","external_name":"xs","restriction":"Range"},{"name":"ys","external_name":"ys","restriction":"Range"},{"name":"value","external_name":"value","restriction":"Bool"}],"return_type":"Bool","visibility":"Public","body":"start_x, count_x = resolve_to_start_and_count(xs, width)\nstart_y, count_y = resolve_to_start_and_count(ys, height)\ncount_y.times.to_a.each do |y|\n @bits.fill(value, ((y + start_y) * width) + start_x, count_x)\nend\nclear_caches\nvalue\n"}},{"html_id":"apply(image:Image):Image-instance-method","name":"apply","doc":"Apply this mask to the provided image with `Operation::MaskApply#apply`","summary":"

        Apply this mask to the provided image with Operation::MaskApply#apply

        ","abstract":false,"args":[{"name":"image","external_name":"image","restriction":"Image"}],"args_string":"(image : Image) : Image","args_html":"(image : Image) : Image","location":{"filename":"src/cr-image/mask.cr","line_number":247,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L247"},"def":{"name":"apply","args":[{"name":"image","external_name":"image","restriction":"Image"}],"return_type":"Image","visibility":"Public","body":"image.apply(self)"}},{"html_id":"apply(image:Image,&block:Int32,Int32,UInt8,ChannelType->UInt8):Image-instance-method","name":"apply","doc":"Apply this mask to the provided image with `Operation::MaskApply#apply`","summary":"

        Apply this mask to the provided image with Operation::MaskApply#apply

        ","abstract":false,"args":[{"name":"image","external_name":"image","restriction":"Image"}],"args_string":"(image : Image, &block : Int32, Int32, UInt8, ChannelType -> UInt8) : Image","args_html":"(image : Image, &block : Int32, Int32, UInt8, ChannelType -> UInt8) : Image","location":{"filename":"src/cr-image/mask.cr","line_number":252,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L252"},"def":{"name":"apply","args":[{"name":"image","external_name":"image","restriction":"Image"}],"yields":4,"block_arity":4,"block_arg":{"name":"block","external_name":"block","restriction":"(Int32, Int32, UInt8, ChannelType -> UInt8)"},"return_type":"Image","visibility":"Public","body":"image.apply(self, &block)"}},{"html_id":"at(index:Int32):Bool-instance-method","name":"at","doc":"Return the bit at `index`","summary":"

        Return the bit at index

        ","abstract":false,"args":[{"name":"index","external_name":"index","restriction":"Int32"}],"args_string":"(index : Int32) : Bool","args_html":"(index : Int32) : Bool","location":{"filename":"src/cr-image/mask.cr","line_number":124,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L124"},"def":{"name":"at","args":[{"name":"index","external_name":"index","restriction":"Int32"}],"return_type":"Bool","visibility":"Public","body":"if index >= size\n raise(\"Index #{index} exceeds mask size #{@bits.size}\")\nend\n@bits[index]\n"}},{"html_id":"bits:BitArray-instance-method","name":"bits","abstract":false,"location":{"filename":"src/cr-image/mask.cr","line_number":41,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L41"},"def":{"name":"bits","return_type":"BitArray","visibility":"Public","body":"@bits"}},{"html_id":"clone-instance-method","name":"clone","doc":"Create a new `Mask` from this one without modifying it","summary":"

        Create a new Mask from this one without modifying it

        ","abstract":false,"location":{"filename":"src/cr-image/mask.cr","line_number":95,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L95"},"def":{"name":"clone","visibility":"Public","body":"Mask.new(width, bits.dup)"}},{"html_id":"height:Int32-instance-method","name":"height","abstract":false,"location":{"filename":"src/cr-image/mask.cr","line_number":99,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L99"},"def":{"name":"height","return_type":"Int32","visibility":"Public","body":"@bits.size // width"}},{"html_id":"invert-instance-method","name":"invert","doc":"Return a new `Mask` that's a copy of this one with all bits inverted.","summary":"

        Return a new Mask that's a copy of this one with all bits inverted.

        ","abstract":false,"location":{"filename":"src/cr-image/mask.cr","line_number":117,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L117"},"def":{"name":"invert","visibility":"Public","body":"new_bits = @bits.dup\nnew_bits.invert\nMask.new(width, new_bits)\n"}},{"html_id":"invert!-instance-method","name":"invert!","doc":"Invert all bits in this instance of `Mask`. Modifies self.\n\n\"Black\n\nBecomes\n\n\"White","summary":"

        Invert all bits in this instance of Mask.

        ","abstract":false,"location":{"filename":"src/cr-image/mask.cr","line_number":110,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L110"},"def":{"name":"invert!","visibility":"Public","body":"@bits.invert\nclear_caches\nself\n"}},{"html_id":"region:Region-instance-method","name":"region","doc":"Returns the bounding box of the mask where all true bits are contained. Any pixels outside of the region are false\n\n```\nmask = CrImage::Mask.new(50, 50, false)\nmask[20..40, 20] = true\nmask[20, 20..40] = true\nmask.region # => Region(x: 20, y: 20, width: 20, height: 20)\n```\n\n\"Black","summary":"

        Returns the bounding box of the mask where all true bits are contained.

        ","abstract":false,"location":{"filename":"src/cr-image/mask.cr","line_number":274,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L274"},"def":{"name":"region","return_type":"Region","visibility":"Public","body":"@region || (@region = calculate_region)"}},{"html_id":"segments(*,diagonal:Bool=true):Array(Mask)-instance-method","name":"segments","doc":"Return an array of `Mask`s, each one corresponding to an area of contiguous true bits (identified from flood fills).\n\nMay specify `diagonal: false` for only 4-way (up, down, left, right) flood fill instead of default 8-way.\nStarting with sample mask:\n```\nmask = CrImage::Mask.new(50, 50, false)\n\nmask[5..45, 5..45] = true\nmask[15..35, 15..35] = false\nmask[21..25, 21..25] = true\nmask[26..30, 26..30] = true\n```\n\n\"Black\n\nIts segments look like:\n```\nmask.segments.each_with_index do |segment, i|\n segment.to_gray.save(\"mask_8-way_segments_example_#{i}.jpg\")\nend\n```\nYields the images:\n\n\"Black\n\"Black\n\nUsing `diagonal: false` yields:\n```\nmask.segments(diagonal: false).each_with_index do |segment, i|\n segment.to_gray.save(\"mask_4-way_segments_example_#{i}.jpg\")\nend\n```\nYields the images:\n\n\"Black\n\"Black\n\"Black","summary":"

        Return an array of Masks, each one corresponding to an area of contiguous true bits (identified from flood fills).

        ","abstract":false,"args":[{"name":"","external_name":"","restriction":""},{"name":"diagonal","default_value":"true","external_name":"diagonal","restriction":"Bool"}],"args_string":"(*, diagonal : Bool = true) : Array(Mask)","args_html":"(*, diagonal : Bool = true) : Array(Mask)","location":{"filename":"src/cr-image/mask.cr","line_number":342,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L342"},"def":{"name":"segments","args":[{"name":"","external_name":"","restriction":""},{"name":"diagonal","default_value":"true","external_name":"diagonal","restriction":"Bool"}],"splat_index":0,"return_type":"Array(Mask)","visibility":"Public","body":"diagonal ? (@segments_8_way || (@segments_8_way = calculate_segments(diagonal))) : (@segments_4_way || (@segments_4_way = calculate_segments(diagonal)))"}},{"html_id":"set(x:Int32,y:Int32,value:Bool):Bool-instance-method","name":"set","doc":"Set the bit for coordinate `x` and `y`","summary":"

        Set the bit for coordinate x and y

        ","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"y","external_name":"y","restriction":"Int32"},{"name":"value","external_name":"value","restriction":"Bool"}],"args_string":"(x : Int32, y : Int32, value : Bool) : Bool","args_html":"(x : Int32, y : Int32, value : Bool) : Bool","location":{"filename":"src/cr-image/mask.cr","line_number":172,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L172"},"def":{"name":"set","args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"y","external_name":"y","restriction":"Int32"},{"name":"value","external_name":"value","restriction":"Bool"}],"return_type":"Bool","visibility":"Public","body":"if x >= width || y >= height\n raise(IndexError.new(\"Out of bounds: this mask is #{width}x#{height}, and (#{x},#{y}) is outside of that\"))\nend\nclear_caches\n@bits[(y * width) + x] = value\n"}},{"html_id":"size(*args,**options)-instance-method","name":"size","doc":"How many bits are stored in this `Mask`","summary":"

        How many bits are stored in this Mask

        ","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/cr-image/mask.cr","line_number":92,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L92"},"def":{"name":"size","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"bits.size(*args, **options)"}},{"html_id":"size(*args,**options,&)-instance-method","name":"size","doc":"How many bits are stored in this `Mask`","summary":"

        How many bits are stored in this Mask

        ","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/cr-image/mask.cr","line_number":92,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L92"},"def":{"name":"size","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"bits.size(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"to_gray:GrayscaleImage-instance-method","name":"to_gray","doc":"Convert this `Mask` to a `GrayscaleImage`, with false bits becoming 0, and true bits becoming 255","summary":"

        Convert this Mask to a GrayscaleImage, with false bits becoming 0, and true bits becoming 255

        ","abstract":false,"location":{"filename":"src/cr-image/mask.cr","line_number":242,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L242"},"def":{"name":"to_gray","return_type":"GrayscaleImage","visibility":"Public","body":"GrayscaleImage.new(bits.map do |b|\n b ? 255_u8 : 0_u8\nend, width, height)"}},{"html_id":"width:Int32-instance-method","name":"width","abstract":false,"location":{"filename":"src/cr-image/mask.cr","line_number":40,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L40"},"def":{"name":"width","return_type":"Int32","visibility":"Public","body":"@width"}}]},{"html_id":"Crystal Image/CrImage/Operation","path":"CrImage/Operation.html","kind":"module","full_name":"CrImage::Operation","name":"Operation","abstract":false,"locations":[{"filename":"src/cr-image/operation/bilinear_resize.cr","line_number":14,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/bilinear_resize.cr#L14"},{"filename":"src/cr-image/operation/operation.cr","line_number":2,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/operation.cr#L2"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"Crystal Image/CrImage","kind":"module","full_name":"CrImage","name":"CrImage"},"doc":"Module for containing individual operations for `Image` classes.","summary":"

        Module for containing individual operations for Image classes.

        ","types":[{"html_id":"Crystal Image/CrImage/Operation/BilinearResize","path":"CrImage/Operation/BilinearResize.html","kind":"module","full_name":"CrImage::Operation::BilinearResize","name":"BilinearResize","abstract":false,"locations":[{"filename":"src/cr-image/operation/bilinear_resize.cr","line_number":14,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/bilinear_resize.cr#L14"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"Crystal Image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"Crystal Image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"Crystal Image/CrImage/Operation","kind":"module","full_name":"CrImage::Operation","name":"Operation"},"doc":"Resize an image using a bilinear resizing algorithm.\n\nTaking sample `image`:\n\n\"Woman\n\n```\nputs image.width, image.height # => 159x199\nimage.bilinear_resize(40, 50).save(\"small_sample.jpg\")\nimage.bilinear_resize(200, 250).save(\"larger_sample.jpg\")\n```\n\"Sample\n\"Sample","summary":"

        Resize an image using a bilinear resizing algorithm.

        ","instance_methods":[{"html_id":"bilinear_resize(width:Int32,height:Int32):self-instance-method","name":"bilinear_resize","doc":"Resizes image to new dimensions","summary":"

        Resizes image to new dimensions

        ","abstract":false,"args":[{"name":"width","external_name":"width","restriction":"Int32"},{"name":"height","external_name":"height","restriction":"Int32"}],"args_string":"(width : Int32, height : Int32) : self","args_html":"(width : Int32, height : Int32) : self","location":{"filename":"src/cr-image/operation/bilinear_resize.cr","line_number":16,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/bilinear_resize.cr#L16"},"def":{"name":"bilinear_resize","args":[{"name":"width","external_name":"width","restriction":"Int32"},{"name":"height","external_name":"height","restriction":"Int32"}],"return_type":"self","visibility":"Public","body":"clone.bilinear_resize!(width, height)"}},{"html_id":"bilinear_resize!(width:Int32,height:Int32):self-instance-method","name":"bilinear_resize!","doc":"Resizes image to new dimensions. Modifies self.","summary":"

        Resizes image to new dimensions.

        ","abstract":false,"args":[{"name":"width","external_name":"width","restriction":"Int32"},{"name":"height","external_name":"height","restriction":"Int32"}],"args_string":"(width : Int32, height : Int32) : self","args_html":"(width : Int32, height : Int32) : self","location":{"filename":"src/cr-image/operation/bilinear_resize.cr","line_number":21,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/bilinear_resize.cr#L21"},"def":{"name":"bilinear_resize!","args":[{"name":"width","external_name":"width","restriction":"Int32"},{"name":"height","external_name":"height","restriction":"Int32"}],"return_type":"self","visibility":"Public","body":"x_ratio = width > 1 ? (@width - 1) / (width - 1) : 0\ny_ratio = height > 1 ? (@height - 1) / (height - 1) : 0\neach_channel do |channel, channel_type|\n resized_channel = Array.new(width * height) do\n 0_u8\n end\n height.times do |h|\n width.times do |w|\n x = w * x_ratio\n y = h * y_ratio\n x_ceil = Math.min(@width - 1, x.ceil.to_i)\n x_floor = x.floor.to_i\n y_ceil = Math.min(@height - 1, y.ceil.to_i)\n y_floor = y.floor.to_i\n value = case\n when (x_ceil == x_floor) && (y_ceil == y_floor)\n x_index = x.to_i\n y_index = y.to_i\n channel.unsafe_fetch((@width * y_index) + x_index)\n when x_ceil == x_floor\n x_index = x.to_i\n q_1 = channel.unsafe_fetch((@width * y_ceil) + x_index)\n q_2 = channel.unsafe_fetch((@width * y_floor) + x_index)\n ((q_2 * (y_ceil - y)) + (q_1 * (y - y_floor))).to_u8\n when y_ceil == y_floor\n y_index = y.to_i\n q_1 = channel.unsafe_fetch((@width * y_index) + x_ceil)\n q_2 = channel.unsafe_fetch((@width * y_index) + x_floor)\n ((q_2 * (x_ceil - x)) + (q_1 * (x - x_floor))).to_u8\n else\n v_1 = channel.unsafe_fetch((@width * y_floor) + x_floor)\n v_2 = channel.unsafe_fetch((@width * y_floor) + x_ceil)\n v_3 = channel.unsafe_fetch((@width * y_ceil) + x_floor)\n v_4 = channel.unsafe_fetch((@width * y_ceil) + x_ceil)\n q_1 = (v_1 * (x_ceil - x)) + (v_2 * (x - x_floor))\n q_2 = (v_3 * (x_ceil - x)) + (v_4 * (x - x_floor))\n ((q_1 * (y_ceil - y)) + (q_2 * (y - y_floor))).to_u8\n end\n resized_channel.unsafe_put((width * h) + w, value)\n end\n end\n self[channel_type] = resized_channel\nend\n@width = width\n@height = height\nself\n"}}]},{"html_id":"Crystal Image/CrImage/Operation/BoxBlur","path":"CrImage/Operation/BoxBlur.html","kind":"module","full_name":"CrImage::Operation::BoxBlur","name":"BoxBlur","abstract":false,"locations":[{"filename":"src/cr-image/operation/box_blur.cr","line_number":13,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/box_blur.cr#L13"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"Crystal Image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"Crystal Image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"Crystal Image/CrImage/Operation","kind":"module","full_name":"CrImage::Operation","name":"Operation"},"doc":"Blurs the image\n\nTaking sample `image`:\n\n\"Woman\n\n```\nimage.box_blur(1).save(\"blurred_1_sample.jpg\")\nimage.box_blur(5).save(\"blurred_5_sample.jpg\")\n```\n\"Blurred\n\"Blurred","summary":"

        Blurs the image

        ","instance_methods":[{"html_id":"box_blur(value:Int32):self-instance-method","name":"box_blur","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Int32"}],"args_string":"(value : Int32) : self","args_html":"(value : Int32) : self","location":{"filename":"src/cr-image/operation/box_blur.cr","line_number":14,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/box_blur.cr#L14"},"def":{"name":"box_blur","args":[{"name":"value","external_name":"value","restriction":"Int32"}],"return_type":"self","visibility":"Public","body":"clone.box_blur!(value)"}},{"html_id":"box_blur!(value:Int32):self-instance-method","name":"box_blur!","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Int32"}],"args_string":"(value : Int32) : self","args_html":"(value : Int32) : self","location":{"filename":"src/cr-image/operation/box_blur.cr","line_number":18,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/box_blur.cr#L18"},"def":{"name":"box_blur!","args":[{"name":"value","external_name":"value","restriction":"Int32"}],"return_type":"self","visibility":"Public","body":"horizontal_blur!(value)\nvertical_blur!(value)\n"}}]},{"html_id":"Crystal Image/CrImage/Operation/Brightness","path":"CrImage/Operation/Brightness.html","kind":"module","full_name":"CrImage::Operation::Brightness","name":"Brightness","abstract":false,"locations":[{"filename":"src/cr-image/operation/brightness.cr","line_number":11,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/brightness.cr#L11"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"Crystal Image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"Crystal Image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"Crystal Image/CrImage/Operation","kind":"module","full_name":"CrImage::Operation","name":"Operation"},"doc":"Brightens an image (increases white value)\n\nTaking sample `image`:\n\n\"Woman\n\n```\nimage.brightness(2.0)\n```\n\"Brightened","summary":"

        Brightens an image (increases white value)

        ","instance_methods":[{"html_id":"brightness(value:Float64):self-instance-method","name":"brightness","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Float64"}],"args_string":"(value : Float64) : self","args_html":"(value : Float64) : self","location":{"filename":"src/cr-image/operation/brightness.cr","line_number":12,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/brightness.cr#L12"},"def":{"name":"brightness","args":[{"name":"value","external_name":"value","restriction":"Float64"}],"return_type":"self","visibility":"Public","body":"clone.brightness!(value)"}},{"html_id":"brightness!(value:Float64):self-instance-method","name":"brightness!","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Float64"}],"args_string":"(value : Float64) : self","args_html":"(value : Float64) : self","location":{"filename":"src/cr-image/operation/brightness.cr","line_number":16,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/brightness.cr#L16"},"def":{"name":"brightness!","args":[{"name":"value","external_name":"value","restriction":"Float64"}],"return_type":"self","visibility":"Public","body":"each_channel do |channel|\n size.times do |index|\n channel.unsafe_put(index, (Math.min(255, ( (channel.unsafe_fetch(index)) * value))).to_u8)\n end\nend\nself\n"}}]},{"html_id":"Crystal Image/CrImage/Operation/ChannelSwap","path":"CrImage/Operation/ChannelSwap.html","kind":"module","full_name":"CrImage::Operation::ChannelSwap","name":"ChannelSwap","abstract":false,"locations":[{"filename":"src/cr-image/operation/channel_swap.cr","line_number":11,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/channel_swap.cr#L11"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"Crystal Image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"Crystal Image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"Crystal Image/CrImage/Operation","kind":"module","full_name":"CrImage::Operation","name":"Operation"},"doc":"Swaps channels of `ChannelType` supported by an image\n\nTaking sample `image`:\n\n\"Woman\n\n```\nimage.channel_swap(:green, :red) # Crystal autocasting of symbols to Pluto::ChannelType enum is magic\n```\n\"Channel","summary":"

        Swaps channels of ChannelType supported by an image

        ","instance_methods":[{"html_id":"channel_swap(a:ChannelType,b:ChannelType):self-instance-method","name":"channel_swap","abstract":false,"args":[{"name":"a","external_name":"a","restriction":"ChannelType"},{"name":"b","external_name":"b","restriction":"ChannelType"}],"args_string":"(a : ChannelType, b : ChannelType) : self","args_html":"(a : ChannelType, b : ChannelType) : self","location":{"filename":"src/cr-image/operation/channel_swap.cr","line_number":12,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/channel_swap.cr#L12"},"def":{"name":"channel_swap","args":[{"name":"a","external_name":"a","restriction":"ChannelType"},{"name":"b","external_name":"b","restriction":"ChannelType"}],"return_type":"self","visibility":"Public","body":"clone.channel_swap!(a, b)"}},{"html_id":"channel_swap!(a:ChannelType,b:ChannelType):self-instance-method","name":"channel_swap!","abstract":false,"args":[{"name":"a","external_name":"a","restriction":"ChannelType"},{"name":"b","external_name":"b","restriction":"ChannelType"}],"args_string":"(a : ChannelType, b : ChannelType) : self","args_html":"(a : ChannelType, b : ChannelType) : self","location":{"filename":"src/cr-image/operation/channel_swap.cr","line_number":16,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/channel_swap.cr#L16"},"def":{"name":"channel_swap!","args":[{"name":"a","external_name":"a","restriction":"ChannelType"},{"name":"b","external_name":"b","restriction":"ChannelType"}],"return_type":"self","visibility":"Public","body":"ch_a, ch_b = self[a], self[b]\nself[a] = ch_b\nself[b] = ch_a\nself\n"}}]},{"html_id":"Crystal Image/CrImage/Operation/Contrast","path":"CrImage/Operation/Contrast.html","kind":"module","full_name":"CrImage::Operation::Contrast","name":"Contrast","abstract":false,"locations":[{"filename":"src/cr-image/operation/contrast.cr","line_number":11,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/contrast.cr#L11"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"Crystal Image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"Crystal Image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"Crystal Image/CrImage/Operation","kind":"module","full_name":"CrImage::Operation","name":"Operation"},"doc":"Increases contrast of an image\n\nTaking sample `image`:\n\n\"Woman\n\n```\nimage.contrast(20)\n```\n\"Contrasted","summary":"

        Increases contrast of an image

        ","instance_methods":[{"html_id":"contrast(value:Float64):self-instance-method","name":"contrast","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Float64"}],"args_string":"(value : Float64) : self","args_html":"(value : Float64) : self","location":{"filename":"src/cr-image/operation/contrast.cr","line_number":12,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/contrast.cr#L12"},"def":{"name":"contrast","args":[{"name":"value","external_name":"value","restriction":"Float64"}],"return_type":"self","visibility":"Public","body":"clone.contrast!(value)"}},{"html_id":"contrast!(value:Float64):self-instance-method","name":"contrast!","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Float64"}],"args_string":"(value : Float64) : self","args_html":"(value : Float64) : self","location":{"filename":"src/cr-image/operation/contrast.cr","line_number":16,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/contrast.cr#L16"},"def":{"name":"contrast!","args":[{"name":"value","external_name":"value","restriction":"Float64"}],"return_type":"self","visibility":"Public","body":"factor = (259 * (value + 255)) / (255 * (259 - value))\neach_channel do |channel|\n size.times do |index|\n channel.unsafe_put(index, (Math.min(255, Math.max(0, (factor * ((channel.unsafe_fetch(index)).to_i - 128)) + 128))).to_u8)\n end\nend\nself\n"}}]},{"html_id":"Crystal Image/CrImage/Operation/Crop","path":"CrImage/Operation/Crop.html","kind":"module","full_name":"CrImage::Operation::Crop","name":"Crop","abstract":false,"locations":[{"filename":"src/cr-image/operation/crop.cr","line_number":13,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/crop.cr#L13"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"Crystal Image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"Crystal Image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"Crystal Image/CrImage/Operation","kind":"module","full_name":"CrImage::Operation","name":"Operation"},"doc":"Crops an image\n\nTaking sample `image`:\n\n\"Woman\n\n```\n# These calls are equivalent\nimage.crop(40, 30, 80, 80)\nimage[40...120, 30...110]\n```\n\"Cropped","summary":"

        Crops an image

        ","instance_methods":[{"html_id":"[](xrange:Range(Int32,Int32)|Range(Int32,Nil)|Range(Nil,Int32),yrange:Range(Int32,Int32)|Range(Int32,Nil)|Range(Nil,Int32)):self-instance-method","name":"[]","abstract":false,"args":[{"name":"xrange","external_name":"xrange","restriction":"Range(Int32, Int32) | Range(Int32, Nil) | Range(Nil, Int32)"},{"name":"yrange","external_name":"yrange","restriction":"Range(Int32, Int32) | Range(Int32, Nil) | Range(Nil, Int32)"}],"args_string":"(xrange : Range(Int32, Int32) | Range(Int32, Nil) | Range(Nil, Int32), yrange : Range(Int32, Int32) | Range(Int32, Nil) | Range(Nil, Int32)) : self","args_html":"(xrange : Range(Int32, Int32) | Range(Int32, Nil) | Range(Nil, Int32), yrange : Range(Int32, Int32) | Range(Int32, Nil) | Range(Nil, Int32)) : self","location":{"filename":"src/cr-image/operation/crop.cr","line_number":22,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/crop.cr#L22"},"def":{"name":"[]","args":[{"name":"xrange","external_name":"xrange","restriction":"Range(Int32, Int32) | Range(Int32, Nil) | Range(Nil, Int32)"},{"name":"yrange","external_name":"yrange","restriction":"Range(Int32, Int32) | Range(Int32, Nil) | Range(Nil, Int32)"}],"return_type":"self","visibility":"Public","body":"xstart, xcount = resolve_to_start_and_count(xrange, width)\nystart, ycount = resolve_to_start_and_count(yrange, height)\ncrop(xstart, ystart, xcount, ycount)\n"}},{"html_id":"crop(x:Int32,y:Int32,new_width:Int32,new_height:Int32):self-instance-method","name":"crop","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"y","external_name":"y","restriction":"Int32"},{"name":"new_width","external_name":"new_width","restriction":"Int32"},{"name":"new_height","external_name":"new_height","restriction":"Int32"}],"args_string":"(x : Int32, y : Int32, new_width : Int32, new_height : Int32) : self","args_html":"(x : Int32, y : Int32, new_width : Int32, new_height : Int32) : self","location":{"filename":"src/cr-image/operation/crop.cr","line_number":18,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/crop.cr#L18"},"def":{"name":"crop","args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"y","external_name":"y","restriction":"Int32"},{"name":"new_width","external_name":"new_width","restriction":"Int32"},{"name":"new_height","external_name":"new_height","restriction":"Int32"}],"return_type":"self","visibility":"Public","body":"clone.crop!(x, y, new_width, new_height)"}},{"html_id":"crop(region:Region):self-instance-method","name":"crop","abstract":false,"args":[{"name":"region","external_name":"region","restriction":"Region"}],"args_string":"(region : Region) : self","args_html":"(region : Region) : self","location":{"filename":"src/cr-image/operation/crop.cr","line_number":14,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/crop.cr#L14"},"def":{"name":"crop","args":[{"name":"region","external_name":"region","restriction":"Region"}],"return_type":"self","visibility":"Public","body":"crop(*region.to_tuple)"}},{"html_id":"crop!(x:Int32,y:Int32,new_width:Int32,new_height:Int32):self-instance-method","name":"crop!","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"y","external_name":"y","restriction":"Int32"},{"name":"new_width","external_name":"new_width","restriction":"Int32"},{"name":"new_height","external_name":"new_height","restriction":"Int32"}],"args_string":"(x : Int32, y : Int32, new_width : Int32, new_height : Int32) : self","args_html":"(x : Int32, y : Int32, new_width : Int32, new_height : Int32) : self","location":{"filename":"src/cr-image/operation/crop.cr","line_number":32,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/crop.cr#L32"},"def":{"name":"crop!","args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"y","external_name":"y","restriction":"Int32"},{"name":"new_width","external_name":"new_width","restriction":"Int32"},{"name":"new_height","external_name":"new_height","restriction":"Int32"}],"return_type":"self","visibility":"Public","body":"if (x + new_width) > width\n raise(\"Crop dimensions extend #{(x + new_width) - width} pixels beyond width of the image (#{width})\")\nend\nif (y + new_height) > height\n raise(\"Crop dimensions extend #{(y + new_height) - height} pixels beyond height of the image (#{height})\")\nend\nnew_size = new_width * new_height\nheight_offset = y * width\neach_channel do |channel, channel_type|\n resized_channel = Array.new(new_size) do\n 0_u8\n end\n new_height.times do |new_y|\n orig_index = (height_offset + (new_y * width)) + x\n resized_channel[new_y * new_width, new_width] = channel[orig_index, new_width]\n end\n self[channel_type] = resized_channel\nend\n@width = new_width\n@height = new_height\nself\n"}},{"html_id":"crop!(region:Region):self-instance-method","name":"crop!","abstract":false,"args":[{"name":"region","external_name":"region","restriction":"Region"}],"args_string":"(region : Region) : self","args_html":"(region : Region) : self","location":{"filename":"src/cr-image/operation/crop.cr","line_number":28,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/crop.cr#L28"},"def":{"name":"crop!","args":[{"name":"region","external_name":"region","restriction":"Region"}],"return_type":"self","visibility":"Public","body":"crop!(*region.to_tuple)"}}]},{"html_id":"Crystal Image/CrImage/Operation/Draw","path":"CrImage/Operation/Draw.html","kind":"module","full_name":"CrImage::Operation::Draw","name":"Draw","abstract":false,"locations":[{"filename":"src/cr-image/operation/draw.cr","line_number":15,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/draw.cr#L15"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"Crystal Image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"Crystal Image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"Crystal Image/CrImage/Operation","kind":"module","full_name":"CrImage::Operation","name":"Operation"},"doc":"Draws shapes in the image\n\nTaking sample `image`:\n\n\"Woman\n\n```\nimage.draw_square(40, 30, 80, 80, CrImage::Color.of(\"#00f\"))\nimage.draw_circle(80, 70, 40, CrImage::Color.of(\"#00f\"))\n```\n\"Woman\n\"Woman\n\nCan also use the `fill: true` parameter to fill in the drawn shapes","summary":"

        Draws shapes in the image

        ","instance_methods":[{"html_id":"draw_circle(x:Int,y:Int,radius:Int,color:Color,*,fill:Bool=false):self-instance-method","name":"draw_circle","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int"},{"name":"y","external_name":"y","restriction":"Int"},{"name":"radius","external_name":"radius","restriction":"Int"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"}],"args_string":"(x : Int, y : Int, radius : Int, color : Color, *, fill : Bool = false) : self","args_html":"(x : Int, y : Int, radius : Int, color : Color, *, fill : Bool = false) : self","location":{"filename":"src/cr-image/operation/draw.cr","line_number":56,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/draw.cr#L56"},"def":{"name":"draw_circle","args":[{"name":"x","external_name":"x","restriction":"Int"},{"name":"y","external_name":"y","restriction":"Int"},{"name":"radius","external_name":"radius","restriction":"Int"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"}],"splat_index":4,"return_type":"self","visibility":"Public","body":"clone.draw_circle!(x, y, radius, color, fill: fill)"}},{"html_id":"draw_circle(region:Region,radius:Int,color:Color,*,fill:Bool=false):self-instance-method","name":"draw_circle","doc":"Draw a circle around the region's center (see `Region#center`)","summary":"

        Draw a circle around the region's center (see Region#center)

        ","abstract":false,"args":[{"name":"region","external_name":"region","restriction":"Region"},{"name":"radius","external_name":"radius","restriction":"Int"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"}],"args_string":"(region : Region, radius : Int, color : Color, *, fill : Bool = false) : self","args_html":"(region : Region, radius : Int, color : Color, *, fill : Bool = false) : self","location":{"filename":"src/cr-image/operation/draw.cr","line_number":52,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/draw.cr#L52"},"def":{"name":"draw_circle","args":[{"name":"region","external_name":"region","restriction":"Region"},{"name":"radius","external_name":"radius","restriction":"Int"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"}],"splat_index":3,"return_type":"self","visibility":"Public","body":"clone.draw_circle!(*region.center, radius, color, fill: fill)"}},{"html_id":"draw_circle!(region:Region,color:Color,*,fill:Bool=false,radius:Int32|Nil=nil):self-instance-method","name":"draw_circle!","doc":"Draw a circle around the region's center (see `Region#center`)","summary":"

        Draw a circle around the region's center (see Region#center)

        ","abstract":false,"args":[{"name":"region","external_name":"region","restriction":"Region"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"},{"name":"radius","default_value":"nil","external_name":"radius","restriction":"Int32 | ::Nil"}],"args_string":"(region : Region, color : Color, *, fill : Bool = false, radius : Int32 | Nil = nil) : self","args_html":"(region : Region, color : Color, *, fill : Bool = false, radius : Int32 | Nil = nil) : self","location":{"filename":"src/cr-image/operation/draw.cr","line_number":61,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/draw.cr#L61"},"def":{"name":"draw_circle!","args":[{"name":"region","external_name":"region","restriction":"Region"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"},{"name":"radius","default_value":"nil","external_name":"radius","restriction":"Int32 | ::Nil"}],"splat_index":2,"return_type":"self","visibility":"Public","body":"draw_circle!(*region.center, radius, color, fill: fill)"}},{"html_id":"draw_square(x:Int,y:Int,box_width:Int,box_height:Int,color:Color,*,fill:Bool=false):self-instance-method","name":"draw_square","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int"},{"name":"y","external_name":"y","restriction":"Int"},{"name":"box_width","external_name":"box_width","restriction":"Int"},{"name":"box_height","external_name":"box_height","restriction":"Int"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"}],"args_string":"(x : Int, y : Int, box_width : Int, box_height : Int, color : Color, *, fill : Bool = false) : self","args_html":"(x : Int, y : Int, box_width : Int, box_height : Int, color : Color, *, fill : Bool = false) : self","location":{"filename":"src/cr-image/operation/draw.cr","line_number":20,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/draw.cr#L20"},"def":{"name":"draw_square","args":[{"name":"x","external_name":"x","restriction":"Int"},{"name":"y","external_name":"y","restriction":"Int"},{"name":"box_width","external_name":"box_width","restriction":"Int"},{"name":"box_height","external_name":"box_height","restriction":"Int"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"}],"splat_index":5,"return_type":"self","visibility":"Public","body":"clone.draw_square!(x, y, box_width, box_height, color, fill: fill)"}},{"html_id":"draw_square(region:Region,color:Color,*,fill:Bool=false):self-instance-method","name":"draw_square","abstract":false,"args":[{"name":"region","external_name":"region","restriction":"Region"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"}],"args_string":"(region : Region, color : Color, *, fill : Bool = false) : self","args_html":"(region : Region, color : Color, *, fill : Bool = false) : self","location":{"filename":"src/cr-image/operation/draw.cr","line_number":16,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/draw.cr#L16"},"def":{"name":"draw_square","args":[{"name":"region","external_name":"region","restriction":"Region"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"}],"splat_index":2,"return_type":"self","visibility":"Public","body":"clone.draw_square!(region, color, fill: fill)"}},{"html_id":"draw_square!(x:Int,y:Int,box_width:Int,box_height:Int,color:Color,*,fill:Bool=false):self-instance-method","name":"draw_square!","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int"},{"name":"y","external_name":"y","restriction":"Int"},{"name":"box_width","external_name":"box_width","restriction":"Int"},{"name":"box_height","external_name":"box_height","restriction":"Int"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"}],"args_string":"(x : Int, y : Int, box_width : Int, box_height : Int, color : Color, *, fill : Bool = false) : self","args_html":"(x : Int, y : Int, box_width : Int, box_height : Int, color : Color, *, fill : Bool = false) : self","location":{"filename":"src/cr-image/operation/draw.cr","line_number":28,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/draw.cr#L28"},"def":{"name":"draw_square!","args":[{"name":"x","external_name":"x","restriction":"Int"},{"name":"y","external_name":"y","restriction":"Int"},{"name":"box_width","external_name":"box_width","restriction":"Int"},{"name":"box_height","external_name":"box_height","restriction":"Int"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"}],"splat_index":5,"return_type":"self","visibility":"Public","body":"if (x + box_width) > width\n raise(\"Box dimensions extend #{(x + box_width) - width} pixels beyond width of the image (#{width})\")\nend\nif (y + box_height) > height\n raise(\"Box dimensions extend #{(y + box_height) - height} pixels beyond height of the image (#{height})\")\nend\nx_i = x.to_i\ny_i = y.to_i\neach_channel do |channel, channel_type|\n channel[( (y_i * width) + x_i), box_width] = Array(UInt8).new(box_width) do\n color[channel_type]\n end\n channel[((y_i + box_height) * width) + x_i, box_width] = Array(UInt8).new(box_width) do\n color[channel_type]\n end\n box_height.times do |i|\n if i == 0\n next\n end\n if fill\n channel[( ((y_i + i) * width) + x_i), box_width] = Array(UInt8).new(box_width) do\n color[channel_type]\n end\n else\n channel.unsafe_put(((y_i + i) * width) + x_i, color[channel_type])\n channel.unsafe_put((((y_i + i) * width) + x_i) + box_width, color[channel_type])\n end\n end\nend\nself\n"}},{"html_id":"draw_square!(region:Region,color:Color,*,fill:Bool=false):self-instance-method","name":"draw_square!","abstract":false,"args":[{"name":"region","external_name":"region","restriction":"Region"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"}],"args_string":"(region : Region, color : Color, *, fill : Bool = false) : self","args_html":"(region : Region, color : Color, *, fill : Bool = false) : self","location":{"filename":"src/cr-image/operation/draw.cr","line_number":24,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/draw.cr#L24"},"def":{"name":"draw_square!","args":[{"name":"region","external_name":"region","restriction":"Region"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"}],"splat_index":2,"return_type":"self","visibility":"Public","body":"draw_square!(*region.to_tuple, color, fill: fill)"}}]},{"html_id":"Crystal Image/CrImage/Operation/GaussianBlur","path":"CrImage/Operation/GaussianBlur.html","kind":"module","full_name":"CrImage::Operation::GaussianBlur","name":"GaussianBlur","abstract":false,"locations":[{"filename":"src/cr-image/operation/gaussian_blur.cr","line_number":13,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/gaussian_blur.cr#L13"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"Crystal Image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"Crystal Image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"Crystal Image/CrImage/Operation","kind":"module","full_name":"CrImage::Operation","name":"Operation"},"doc":"Applies a 3x3 Gaussian blur. Implementation derived from [here](https://blog.ivank.net/fastest-gaussian-blur.html)\n\nTaking sample `image`:\n\n\"Woman\n\n```\nimage.gaussian_blur(1).save(\"gaussian_1_sample.jpg\")\nimage.gaussian_blur(5).save(\"gaussian_5_sample.jpg\")\n```\n\"Blurred\n\"Blurred","summary":"

        Applies a 3x3 Gaussian blur.

        ","instance_methods":[{"html_id":"gaussian_blur(sigma:Int32):self-instance-method","name":"gaussian_blur","abstract":false,"args":[{"name":"sigma","external_name":"sigma","restriction":"Int32"}],"args_string":"(sigma : Int32) : self","args_html":"(sigma : Int32) : self","location":{"filename":"src/cr-image/operation/gaussian_blur.cr","line_number":14,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/gaussian_blur.cr#L14"},"def":{"name":"gaussian_blur","args":[{"name":"sigma","external_name":"sigma","restriction":"Int32"}],"return_type":"self","visibility":"Public","body":"clone.gaussian_blur!(sigma)"}},{"html_id":"gaussian_blur!(sigma:Int32):self-instance-method","name":"gaussian_blur!","abstract":false,"args":[{"name":"sigma","external_name":"sigma","restriction":"Int32"}],"args_string":"(sigma : Int32) : self","args_html":"(sigma : Int32) : self","location":{"filename":"src/cr-image/operation/gaussian_blur.cr","line_number":18,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/gaussian_blur.cr#L18"},"def":{"name":"gaussian_blur!","args":[{"name":"sigma","external_name":"sigma","restriction":"Int32"}],"return_type":"self","visibility":"Public","body":"n = 3\nw_ideal = Math.sqrt((((12 * sigma) * sigma) / n) + 1)\nw_l = w_ideal.floor.to_i\nif (w_l % 2) == 0\n w_l = w_l - 1\nend\nm_ideal = (((((12 * sigma) * sigma) - ((n * w_l) * w_l)) - ((4 * n) * w_l)) - (3 * n)) / ((-4 * w_l) - 4)\nm = m_ideal.round\nsizes = [] of Int32\nn.times do |i|\n sizes << (if i < m\n w_l\n else\n w_l + 2\n end)\nend\nbox_blur!(((sizes.unsafe_fetch(0)) - 1) // 2)\nbox_blur!(((sizes.unsafe_fetch(1)) - 1) // 2)\nbox_blur!(((sizes.unsafe_fetch(2)) - 1) // 2)\nself\n"}}]},{"html_id":"Crystal Image/CrImage/Operation/HistogramEqualize","path":"CrImage/Operation/HistogramEqualize.html","kind":"module","full_name":"CrImage::Operation::HistogramEqualize","name":"HistogramEqualize","abstract":false,"locations":[{"filename":"src/cr-image/operation/histogram.cr","line_number":19,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/histogram.cr#L19"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"Crystal Image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"Crystal Image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"Crystal Image/CrImage/Operation","kind":"module","full_name":"CrImage::Operation","name":"Operation"},"doc":"Provides methods for histogram and histogram equalization. Follows method outlined [here](https://www.sci.utah.edu/~acoste/uou/Image/project1/Arthur_COSTE_Project_1_report.html)\n\nIf an image is particularly dark or particularly bright with low contrast, the `Operation::Contrast#contrast` method will only\nmake the image darker or lighter. For images like these, equalizing the image along its histogram will produce better results.\n\n\"A\n\n```\nimage.contrast(10).save(\"contrast.jpg\")\nimage.histogram_equalize.save(\"equalized.jpg\")\n```\n\"Darker\n\"A\n\nThis method does not work well when a given method has a bimodal distribution of color pixels. For example:\n\n\"Woman\n\"Highly","summary":"

        Provides methods for histogram and histogram equalization.

        ","instance_methods":[{"html_id":"histogram(channel_type:ChannelType):Histogram-instance-method","name":"histogram","abstract":false,"args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"}],"args_string":"(channel_type : ChannelType) : Histogram","args_html":"(channel_type : ChannelType) : Histogram","location":{"filename":"src/cr-image/operation/histogram.cr","line_number":93,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/histogram.cr#L93"},"def":{"name":"histogram","args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"}],"return_type":"Histogram","visibility":"Public","body":"Histogram.new(self, channel_type)"}},{"html_id":"histogram_equalize:self-instance-method","name":"histogram_equalize","abstract":false,"location":{"filename":"src/cr-image/operation/histogram.cr","line_number":97,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/histogram.cr#L97"},"def":{"name":"histogram_equalize","return_type":"self","visibility":"Public","body":"clone.histogram_equalize!"}},{"html_id":"histogram_equalize!:self-instance-method","name":"histogram_equalize!","abstract":false,"location":{"filename":"src/cr-image/operation/histogram.cr","line_number":101,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/histogram.cr#L101"},"def":{"name":"histogram_equalize!","return_type":"self","visibility":"Public","body":"each_channel do |channel, channel_type|\n if channel_type.alpha?\n next\n end\n remap = (histogram(channel_type)).equalize\n size.times do |i|\n channel.unsafe_put(i, remap[channel.unsafe_fetch(i)])\n end\nend\nself\n"}}],"types":[{"html_id":"Crystal Image/CrImage/Operation/HistogramEqualize/Histogram","path":"CrImage/Operation/HistogramEqualize/Histogram.html","kind":"class","full_name":"CrImage::Operation::HistogramEqualize::Histogram","name":"Histogram","abstract":false,"superclass":{"html_id":"Crystal Image/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"Crystal Image/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"Crystal Image/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cr-image/operation/histogram.cr","line_number":21,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/histogram.cr#L21"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"Crystal Image/CrImage/Operation/HistogramEqualize","kind":"module","full_name":"CrImage::Operation::HistogramEqualize","name":"HistogramEqualize"},"doc":"A histogram of an `Image` for a specific `ChannelType`","summary":"

        A histogram of an Image for a specific ChannelType

        ","constructors":[{"html_id":"new(image:Image,channel_type:ChannelType)-class-method","name":"new","abstract":false,"args":[{"name":"image","external_name":"image","restriction":"Image"},{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"}],"args_string":"(image : Image, channel_type : ChannelType)","args_html":"(image : Image, channel_type : ChannelType)","location":{"filename":"src/cr-image/operation/histogram.cr","line_number":22,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/histogram.cr#L22"},"def":{"name":"new","args":[{"name":"image","external_name":"image","restriction":"Image"},{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"}],"visibility":"Public","body":"_ = allocate\n_.initialize(image, channel_type)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"cdf:Hash(UInt8,Float64)-instance-method","name":"cdf","doc":"Get the cumulative distribution for the image's histogram","summary":"

        Get the cumulative distribution for the image's histogram

        ","abstract":false,"location":{"filename":"src/cr-image/operation/histogram.cr","line_number":54,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/histogram.cr#L54"},"def":{"name":"cdf","return_type":"Hash(UInt8, Float64)","visibility":"Public","body":"total = 0_f64\n@cumulative_distribution_histogram || (@cumulative_distribution_histogram = normalize.map do |pixel, probability|\n original = total\n total = total + probability\n {pixel, original}\nend.to_h)\n"}},{"html_id":"counts:Hash(UInt8,Int32)-instance-method","name":"counts","doc":"Get the raw counts for a given pixel value (0-255) in the image","summary":"

        Get the raw counts for a given pixel value (0-255) in the image

        ","abstract":false,"location":{"filename":"src/cr-image/operation/histogram.cr","line_number":28,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/histogram.cr#L28"},"def":{"name":"counts","return_type":"Hash(UInt8, Int32)","visibility":"Public","body":"@internal_hist || (@internal_hist = calculate_counts)"}},{"html_id":"equalize:Hash(UInt8,UInt8)-instance-method","name":"equalize","doc":"Remap the cumalitive distribution of pixels to get a new, more spread out pixel value","summary":"

        Remap the cumalitive distribution of pixels to get a new, more spread out pixel value

        ","abstract":false,"location":{"filename":"src/cr-image/operation/histogram.cr","line_number":64,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/histogram.cr#L64"},"def":{"name":"equalize","return_type":"Hash(UInt8, UInt8)","visibility":"Public","body":"cdf.map do |pixel, cumalative|\n {pixel, ((cumalative * 255).clamp(0, 255)).to_u8}\nend.to_h"}},{"html_id":"normalize:Hash(UInt8,Float64)-instance-method","name":"normalize","doc":"Get pixel counts normalized - all values between 0.0 and 1.0","summary":"

        Get pixel counts normalized - all values between 0.0 and 1.0

        ","abstract":false,"location":{"filename":"src/cr-image/operation/histogram.cr","line_number":45,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/histogram.cr#L45"},"def":{"name":"normalize","return_type":"Hash(UInt8, Float64)","visibility":"Public","body":"counts.map do |pixel, count|\n {pixel, count.to_f / @image.size}\nend.to_h"}}]}]},{"html_id":"Crystal Image/CrImage/Operation/HorizontalBlur","path":"CrImage/Operation/HorizontalBlur.html","kind":"module","full_name":"CrImage::Operation::HorizontalBlur","name":"HorizontalBlur","abstract":false,"locations":[{"filename":"src/cr-image/operation/horizontal_blur.cr","line_number":13,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/horizontal_blur.cr#L13"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"Crystal Image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"Crystal Image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"Crystal Image/CrImage/Operation","kind":"module","full_name":"CrImage::Operation","name":"Operation"},"doc":"Blur an image along the horizontal axis\n\nTaking sample `image`:\n\n\"Woman\n\n```\nimage.horizontal_blur(1).save(\"horizontal_1_sample.jpg\")\nimage.horizontal_blur(5).save(\"horizontal_5_sample.jpg\")\n```\n\"Blurred\n\"Blurred","summary":"

        Blur an image along the horizontal axis

        ","instance_methods":[{"html_id":"horizontal_blur(value:Int32):self-instance-method","name":"horizontal_blur","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Int32"}],"args_string":"(value : Int32) : self","args_html":"(value : Int32) : self","location":{"filename":"src/cr-image/operation/horizontal_blur.cr","line_number":14,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/horizontal_blur.cr#L14"},"def":{"name":"horizontal_blur","args":[{"name":"value","external_name":"value","restriction":"Int32"}],"return_type":"self","visibility":"Public","body":"clone.horizontal_blur!(value)"}},{"html_id":"horizontal_blur!(value:Int32):self-instance-method","name":"horizontal_blur!","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Int32"}],"args_string":"(value : Int32) : self","args_html":"(value : Int32) : self","location":{"filename":"src/cr-image/operation/horizontal_blur.cr","line_number":18,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/horizontal_blur.cr#L18"},"def":{"name":"horizontal_blur!","args":[{"name":"value","external_name":"value","restriction":"Int32"}],"return_type":"self","visibility":"Public","body":"buffer = Bytes.new(size, 0)\nmultiplier = 1 / ((value + value) + 1)\neach_channel do |channel|\n @height.times do |y|\n c_index : Int32 = y * @width\n l_index : Int32 = c_index\n r_index : Int32 = c_index + value\n f_value : Int32 = (channel.unsafe_fetch(c_index)).to_i\n l_value : Int32 = (channel.unsafe_fetch((c_index + @width) - 1)).to_i\n c_value : Int32 = (value + 1) * f_value\n (0..(value - 1)).each do\n c_value = c_value + (channel.unsafe_fetch(c_index))\n end\n (0..value).each do\n c_value = c_value + ((channel.unsafe_fetch(r_index)).to_i - f_value)\n buffer.unsafe_put(c_index, ((c_value * multiplier).clamp(0, 255)).to_u8)\n r_index = r_index + 1\n c_index = c_index + 1\n end\n ((value + 1)..((@width - value) - 1)).each do\n c_value = c_value + ((channel.unsafe_fetch(r_index)).to_i - (channel.unsafe_fetch(l_index)).to_i)\n buffer.unsafe_put(c_index, ((c_value * multiplier).clamp(0, 255)).to_u8)\n r_index = r_index + 1\n l_index = l_index + 1\n c_index = c_index + 1\n end\n ((@width - value)..(@width - 1)).each do\n c_value = c_value + (l_value - (channel.unsafe_fetch(l_index)).to_i)\n buffer.unsafe_put(c_index, ((c_value * multiplier).clamp(0, 255)).to_u8)\n l_index = l_index + 1\n c_index = c_index + 1\n end\n end\n (channel.@buffer).copy_from(buffer.to_unsafe, buffer.size)\nend\nself\n"}}]},{"html_id":"Crystal Image/CrImage/Operation/MaskApply","path":"CrImage/Operation/MaskApply.html","kind":"module","full_name":"CrImage::Operation::MaskApply","name":"MaskApply","abstract":false,"locations":[{"filename":"src/cr-image/operation/mask_apply.cr","line_number":27,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/mask_apply.cr#L27"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"Crystal Image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"Crystal Image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"Crystal Image/CrImage/Operation","kind":"module","full_name":"CrImage::Operation","name":"Operation"},"doc":"Apply a mask to an image\n\nTaking sample `image`:\n\n\"Woman\n\nAnd mask\n\n\"Black\n\n```\nmask = CrImage::Mask.new(image, false)\nmask[50..90, 65..75] = true\nmask.to_gray.save(\"apply_mask_mask.jpg\")\n\nimage.apply(mask).save(\"apply_mask.jpg\")\n\nimage.apply_color(mask, CrImage::Color.of(\"#00f\")).save(\"apply_mask_color.jpg\")\n\nimage.apply(mask) do |x, y, pixel, channel_type|\n Math.min(255, pixel + 50).to_u8 if channel_type.blue?\nend.save(\"apply_mask_block.jpg\")\n```\n\"Image\n\"Thin\n\"Thin","summary":"

        Apply a mask to an image

        ","instance_methods":[{"html_id":"apply(mask:Mask):self-instance-method","name":"apply","doc":"Black out all pixels but those found in the mask","summary":"

        Black out all pixels but those found in the mask

        ","abstract":false,"args":[{"name":"mask","external_name":"mask","restriction":"Mask"}],"args_string":"(mask : Mask) : self","args_html":"(mask : Mask) : self","location":{"filename":"src/cr-image/operation/mask_apply.cr","line_number":29,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/mask_apply.cr#L29"},"def":{"name":"apply","args":[{"name":"mask","external_name":"mask","restriction":"Mask"}],"return_type":"self","visibility":"Public","body":"clone.apply!(mask)"}},{"html_id":"apply(mask:Mask,&block:Int32,Int32,UInt8,ChannelType->UInt8|Nil):self-instance-method","name":"apply","doc":"Apply block to all pixels that match mask, replacing pixel value if block returns non-nil value.\n\nDoes not change values not matched by the mask","summary":"

        Apply block to all pixels that match mask, replacing pixel value if block returns non-nil value.

        ","abstract":false,"args":[{"name":"mask","external_name":"mask","restriction":"Mask"}],"args_string":"(mask : Mask, &block : Int32, Int32, UInt8, ChannelType -> UInt8 | Nil) : self","args_html":"(mask : Mask, &block : Int32, Int32, UInt8, ChannelType -> UInt8 | Nil) : self","location":{"filename":"src/cr-image/operation/mask_apply.cr","line_number":36,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/mask_apply.cr#L36"},"def":{"name":"apply","args":[{"name":"mask","external_name":"mask","restriction":"Mask"}],"yields":4,"block_arity":4,"block_arg":{"name":"block","external_name":"block","restriction":"(Int32, Int32, UInt8, ChannelType -> UInt8 | ::Nil)"},"return_type":"self","visibility":"Public","body":"clone.apply!(mask, &block)"}},{"html_id":"apply!(mask:Mask):self-instance-method","name":"apply!","doc":"TODO: add apply version that accepts 1+ ChannelType that the mask should apply to (i.e. make a background completely transparent, not just transparent black)","summary":"

        TODO add apply version that accepts 1+ ChannelType that the mask should apply to (i.e.

        ","abstract":false,"args":[{"name":"mask","external_name":"mask","restriction":"Mask"}],"args_string":"(mask : Mask) : self","args_html":"(mask : Mask) : self","location":{"filename":"src/cr-image/operation/mask_apply.cr","line_number":46,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/mask_apply.cr#L46"},"def":{"name":"apply!","args":[{"name":"mask","external_name":"mask","restriction":"Mask"}],"return_type":"self","visibility":"Public","body":"if (mask.width == width) && (mask.height == height)\nelse\n raise(\"Mask of #{mask.width}x#{mask.height} doesn't match image dimensions #{width}x#{height}\")\nend\neach_channel do |channel|\n channel.map_with_index! do |pixel, i|\n mask.at(i) ? pixel : 0_u8\n end\nend\nself\n"}},{"html_id":"apply!(mask:Mask,&block:Int32,Int32,UInt8,ChannelType->UInt8|Nil):self-instance-method","name":"apply!","abstract":false,"args":[{"name":"mask","external_name":"mask","restriction":"Mask"}],"args_string":"(mask : Mask, &block : Int32, Int32, UInt8, ChannelType -> UInt8 | Nil) : self","args_html":"(mask : Mask, &block : Int32, Int32, UInt8, ChannelType -> UInt8 | Nil) : self","location":{"filename":"src/cr-image/operation/mask_apply.cr","line_number":55,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/mask_apply.cr#L55"},"def":{"name":"apply!","args":[{"name":"mask","external_name":"mask","restriction":"Mask"}],"yields":4,"block_arity":4,"block_arg":{"name":"block","external_name":"block","restriction":"(Int32, Int32, UInt8, ChannelType -> UInt8 | ::Nil)"},"return_type":"self","visibility":"Public","body":"if (mask.width == width) && (mask.height == height)\nelse\n raise(\"Mask of #{mask.width}x#{mask.height} doesn't match image dimensions #{width}x#{height}\")\nend\neach_channel do |channel, channel_type|\n channel.map_with_index! do |pixel, i|\n mask.at(i) ? (block.call(i % width, i // width, pixel, channel_type)) || pixel : pixel\n end\nend\nself\n"}},{"html_id":"apply_color(mask:Mask,color:Color):self-instance-method","name":"apply_color","doc":"Change the color of all pixels that match the mask","summary":"

        Change the color of all pixels that match the mask

        ","abstract":false,"args":[{"name":"mask","external_name":"mask","restriction":"Mask"},{"name":"color","external_name":"color","restriction":"Color"}],"args_string":"(mask : Mask, color : Color) : self","args_html":"(mask : Mask, color : Color) : self","location":{"filename":"src/cr-image/operation/mask_apply.cr","line_number":41,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/mask_apply.cr#L41"},"def":{"name":"apply_color","args":[{"name":"mask","external_name":"mask","restriction":"Mask"},{"name":"color","external_name":"color","restriction":"Color"}],"return_type":"self","visibility":"Public","body":"clone.apply_color!(mask, color)"}},{"html_id":"apply_color!(mask:Mask,color:Color):self-instance-method","name":"apply_color!","abstract":false,"args":[{"name":"mask","external_name":"mask","restriction":"Mask"},{"name":"color","external_name":"color","restriction":"Color"}],"args_string":"(mask : Mask, color : Color) : self","args_html":"(mask : Mask, color : Color) : self","location":{"filename":"src/cr-image/operation/mask_apply.cr","line_number":66,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/mask_apply.cr#L66"},"def":{"name":"apply_color!","args":[{"name":"mask","external_name":"mask","restriction":"Mask"},{"name":"color","external_name":"color","restriction":"Color"}],"return_type":"self","visibility":"Public","body":"apply!(mask) do |_, _, _, channel_type|\n color[channel_type]\nend"}}]},{"html_id":"Crystal Image/CrImage/Operation/VerticalBlur","path":"CrImage/Operation/VerticalBlur.html","kind":"module","full_name":"CrImage::Operation::VerticalBlur","name":"VerticalBlur","abstract":false,"locations":[{"filename":"src/cr-image/operation/vertical_blur.cr","line_number":13,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/vertical_blur.cr#L13"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"Crystal Image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"Crystal Image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"Crystal Image/CrImage/Operation","kind":"module","full_name":"CrImage::Operation","name":"Operation"},"doc":"Blur an image along the vertical axis\n\nTaking sample `image`:\n\n\"Woman\n\n```\nimage.vertical_blur(1).save(\"vertical_1_sample.jpg\")\nimage.vertical_blur(5).save(\"vertical_5_sample.jpg\")\n```\n\"Blurred\n\"Blurred","summary":"

        Blur an image along the vertical axis

        ","instance_methods":[{"html_id":"vertical_blur(value:Int32):self-instance-method","name":"vertical_blur","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Int32"}],"args_string":"(value : Int32) : self","args_html":"(value : Int32) : self","location":{"filename":"src/cr-image/operation/vertical_blur.cr","line_number":14,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/vertical_blur.cr#L14"},"def":{"name":"vertical_blur","args":[{"name":"value","external_name":"value","restriction":"Int32"}],"return_type":"self","visibility":"Public","body":"clone.vertical_blur!(value)"}},{"html_id":"vertical_blur!(value:Int32):self-instance-method","name":"vertical_blur!","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Int32"}],"args_string":"(value : Int32) : self","args_html":"(value : Int32) : self","location":{"filename":"src/cr-image/operation/vertical_blur.cr","line_number":18,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/vertical_blur.cr#L18"},"def":{"name":"vertical_blur!","args":[{"name":"value","external_name":"value","restriction":"Int32"}],"return_type":"self","visibility":"Public","body":"buffer = Bytes.new(size, 0)\nmultiplier = 1 / ((value + value) + 1)\neach_channel do |channel|\n @width.times do |x|\n c_index : Int32 = x\n l_index : Int32 = c_index\n r_index : Int32 = c_index + (value * @width)\n f_value : Int32 = (channel.unsafe_fetch(c_index)).to_i\n l_value : Int32 = (channel.unsafe_fetch(c_index + (@width * (@height - 1)))).to_i\n c_value : Int32 = (value + 1) * f_value\n (0..(value - 1)).each do\n c_value = c_value + (channel.unsafe_fetch(c_index))\n end\n (0..value).each do\n c_value = c_value + ((channel.unsafe_fetch(r_index)).to_i - f_value)\n buffer.unsafe_put(c_index, ((c_value * multiplier).clamp(0, 255)).to_u8)\n r_index = r_index + @width\n c_index = c_index + @width\n end\n ((value + 1)..((@height - value) - 1)).each do\n c_value = c_value + ((channel.unsafe_fetch(r_index)).to_i - (channel.unsafe_fetch(l_index)).to_i)\n buffer.unsafe_put(c_index, ((c_value * multiplier).clamp(0, 255)).to_u8)\n l_index = l_index + @width\n r_index = r_index + @width\n c_index = c_index + @width\n end\n ((@height - value)..(@height - 1)).each do\n c_value = c_value + (l_value - (channel.unsafe_fetch(l_index)).to_i)\n buffer.unsafe_put(c_index, ((c_value * multiplier).clamp(0, 255)).to_u8)\n l_index = l_index + @width\n c_index = c_index + @width\n end\n end\n (channel.@buffer).copy_from(buffer.to_unsafe, buffer.size)\nend\nself\n"}}]}]},{"html_id":"Crystal Image/CrImage/Region","path":"CrImage/Region.html","kind":"struct","full_name":"CrImage::Region","name":"Region","abstract":false,"superclass":{"html_id":"Crystal Image/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"Crystal Image/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"Crystal Image/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"Crystal Image/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cr-image/region.cr","line_number":5,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/region.cr#L5"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"Crystal Image/CrImage","kind":"module","full_name":"CrImage","name":"CrImage"},"doc":"Represents a rectangular area on an `Image` from its upper left corner `x` and `y` coordinates, and a `width` and `height`.\n\nSee `Operation::Crop#crop` and `Operation::Draw#draw_square` for examples using it.","summary":"

        Represents a rectangular area on an Image from its upper left corner #x and #y coordinates, and a #width and #height.

        ","constructors":[{"html_id":"center(x:UInt16,y:UInt16,width:UInt16,height:UInt16):Region-class-method","name":"center","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"UInt16"},{"name":"y","external_name":"y","restriction":"UInt16"},{"name":"width","external_name":"width","restriction":"UInt16"},{"name":"height","external_name":"height","restriction":"UInt16"}],"args_string":"(x : UInt16, y : UInt16, width : UInt16, height : UInt16) : Region","args_html":"(x : UInt16, y : UInt16, width : UInt16, height : UInt16) : Region","location":{"filename":"src/cr-image/region.cr","line_number":11,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/region.cr#L11"},"def":{"name":"center","args":[{"name":"x","external_name":"x","restriction":"UInt16"},{"name":"y","external_name":"y","restriction":"UInt16"},{"name":"width","external_name":"width","restriction":"UInt16"},{"name":"height","external_name":"height","restriction":"UInt16"}],"return_type":"Region","visibility":"Public","body":"new(x - (width // 2), y - (height // 2), width, height)"}},{"html_id":"new(x:UInt16,y:UInt16,width:UInt16,height:UInt16)-class-method","name":"new","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"UInt16"},{"name":"y","external_name":"y","restriction":"UInt16"},{"name":"width","external_name":"width","restriction":"UInt16"},{"name":"height","external_name":"height","restriction":"UInt16"}],"args_string":"(x : UInt16, y : UInt16, width : UInt16, height : UInt16)","args_html":"(x : UInt16, y : UInt16, width : UInt16, height : UInt16)","location":{"filename":"src/cr-image/region.cr","line_number":5,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/region.cr#L5"},"def":{"name":"new","args":[{"name":"x","external_name":"x","restriction":"UInt16"},{"name":"y","external_name":"y","restriction":"UInt16"},{"name":"width","external_name":"width","restriction":"UInt16"},{"name":"height","external_name":"height","restriction":"UInt16"}],"visibility":"Public","body":"_ = allocate\n_.initialize(x, y, width, height)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"center:Tuple(Int32,Int32)-instance-method","name":"center","doc":"Return the `{x, y}` tuple of the center coordinates of this `Region`","summary":"

        Return the {x, y} tuple of the center coordinates of this Region

        ","abstract":false,"location":{"filename":"src/cr-image/region.cr","line_number":21,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/region.cr#L21"},"def":{"name":"center","return_type":"Tuple(Int32, Int32)","visibility":"Public","body":"{(width.to_i // 2) + x.to_i, (height.to_i // 2) + y.to_i}"}},{"html_id":"clone-instance-method","name":"clone","abstract":false,"location":{"filename":"src/cr-image/region.cr","line_number":5,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/region.cr#L5"},"def":{"name":"clone","visibility":"Public","body":"self.class.new(@x.clone, @y.clone, @width.clone, @height.clone)"}},{"html_id":"copy_with(x_x=@x,y_y=@y,width_width=@width,height_height=@height)-instance-method","name":"copy_with","abstract":false,"args":[{"name":"_x","default_value":"@x","external_name":"x","restriction":""},{"name":"_y","default_value":"@y","external_name":"y","restriction":""},{"name":"_width","default_value":"@width","external_name":"width","restriction":""},{"name":"_height","default_value":"@height","external_name":"height","restriction":""}],"args_string":"(x _x = @x, y _y = @y, width _width = @width, height _height = @height)","args_html":"(x _x = @x, y _y = @y, width _width = @width, height _height = @height)","location":{"filename":"src/cr-image/region.cr","line_number":5,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/region.cr#L5"},"def":{"name":"copy_with","args":[{"name":"_x","default_value":"@x","external_name":"x","restriction":""},{"name":"_y","default_value":"@y","external_name":"y","restriction":""},{"name":"_width","default_value":"@width","external_name":"width","restriction":""},{"name":"_height","default_value":"@height","external_name":"height","restriction":""}],"visibility":"Public","body":"self.class.new(_x, _y, _width, _height)"}},{"html_id":"crop(image:Image):Image-instance-method","name":"crop","doc":"Crop a provided `Image` with this region, using `Operation::Crop#crop`","summary":"

        Crop a provided Image with this region, using Operation::Crop#crop

        ","abstract":false,"args":[{"name":"image","external_name":"image","restriction":"Image"}],"args_string":"(image : Image) : Image","args_html":"(image : Image) : Image","location":{"filename":"src/cr-image/region.cr","line_number":16,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/region.cr#L16"},"def":{"name":"crop","args":[{"name":"image","external_name":"image","restriction":"Image"}],"return_type":"Image","visibility":"Public","body":"image.crop(self)"}},{"html_id":"height:UInt16-instance-method","name":"height","abstract":false,"def":{"name":"height","return_type":"UInt16","visibility":"Public","body":"@height"}},{"html_id":"to_tuple:Tuple(Int32,Int32,Int32,Int32)-instance-method","name":"to_tuple","doc":"Return this `Region` as a `x`, `y`, `width`, and `height` tuple","summary":"

        Return this Region as a #x, #y, #width, and #height tuple

        ","abstract":false,"location":{"filename":"src/cr-image/region.cr","line_number":26,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/region.cr#L26"},"def":{"name":"to_tuple","return_type":"Tuple(Int32, Int32, Int32, Int32)","visibility":"Public","body":"{x.to_i, y.to_i, width.to_i, height.to_i}"}},{"html_id":"width:UInt16-instance-method","name":"width","abstract":false,"def":{"name":"width","return_type":"UInt16","visibility":"Public","body":"@width"}},{"html_id":"x:UInt16-instance-method","name":"x","abstract":false,"def":{"name":"x","return_type":"UInt16","visibility":"Public","body":"@x"}},{"html_id":"y:UInt16-instance-method","name":"y","abstract":false,"def":{"name":"y","return_type":"UInt16","visibility":"Public","body":"@y"}}]},{"html_id":"Crystal Image/CrImage/RGBAImage","path":"CrImage/RGBAImage.html","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage","abstract":false,"superclass":{"html_id":"Crystal Image/CrImage/Image","kind":"class","full_name":"CrImage::Image","name":"Image"},"ancestors":[{"html_id":"Crystal Image/CrImage/Format/WebP","kind":"module","full_name":"CrImage::Format::WebP","name":"WebP"},{"html_id":"Crystal Image/CrImage/Format/PNG","kind":"module","full_name":"CrImage::Format::PNG","name":"PNG"},{"html_id":"Crystal Image/CrImage/Format/JPEG","kind":"module","full_name":"CrImage::Format::JPEG","name":"JPEG"},{"html_id":"Crystal Image/CrImage/Operation/MaskApply","kind":"module","full_name":"CrImage::Operation::MaskApply","name":"MaskApply"},{"html_id":"Crystal Image/CrImage/Format/Save","kind":"module","full_name":"CrImage::Format::Save","name":"Save"},{"html_id":"Crystal Image/CrImage/Operation/HistogramEqualize","kind":"module","full_name":"CrImage::Operation::HistogramEqualize","name":"HistogramEqualize"},{"html_id":"Crystal Image/CrImage/Operation/Draw","kind":"module","full_name":"CrImage::Operation::Draw","name":"Draw"},{"html_id":"Crystal Image/CrImage/Operation/Crop","kind":"module","full_name":"CrImage::Operation::Crop","name":"Crop"},{"html_id":"Crystal Image/CrImage/Operation/VerticalBlur","kind":"module","full_name":"CrImage::Operation::VerticalBlur","name":"VerticalBlur"},{"html_id":"Crystal Image/CrImage/Operation/HorizontalBlur","kind":"module","full_name":"CrImage::Operation::HorizontalBlur","name":"HorizontalBlur"},{"html_id":"Crystal Image/CrImage/Operation/GaussianBlur","kind":"module","full_name":"CrImage::Operation::GaussianBlur","name":"GaussianBlur"},{"html_id":"Crystal Image/CrImage/Operation/Contrast","kind":"module","full_name":"CrImage::Operation::Contrast","name":"Contrast"},{"html_id":"Crystal Image/CrImage/Operation/ChannelSwap","kind":"module","full_name":"CrImage::Operation::ChannelSwap","name":"ChannelSwap"},{"html_id":"Crystal Image/CrImage/Operation/Brightness","kind":"module","full_name":"CrImage::Operation::Brightness","name":"Brightness"},{"html_id":"Crystal Image/CrImage/Operation/BoxBlur","kind":"module","full_name":"CrImage::Operation::BoxBlur","name":"BoxBlur"},{"html_id":"Crystal Image/CrImage/Operation/BilinearResize","kind":"module","full_name":"CrImage::Operation::BilinearResize","name":"BilinearResize"},{"html_id":"Crystal Image/CrImage/Format/PPM","kind":"module","full_name":"CrImage::Format::PPM","name":"PPM"},{"html_id":"Crystal Image/CrImage/Image","kind":"class","full_name":"CrImage::Image","name":"Image"},{"html_id":"Crystal Image/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"Crystal Image/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cr-image/rgba_image.cr","line_number":2,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L2"},{"filename":"src/jpeg.cr","line_number":4,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/jpeg.cr#L4"},{"filename":"src/png.cr","line_number":4,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/png.cr#L4"},{"filename":"src/stumpy.cr","line_number":29,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/stumpy.cr#L29"},{"filename":"src/webp.cr","line_number":4,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/webp.cr#L4"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"Crystal Image/CrImage/Format/JPEG","kind":"module","full_name":"CrImage::Format::JPEG","name":"JPEG"},{"html_id":"Crystal Image/CrImage/Format/PNG","kind":"module","full_name":"CrImage::Format::PNG","name":"PNG"},{"html_id":"Crystal Image/CrImage/Format/PPM","kind":"module","full_name":"CrImage::Format::PPM","name":"PPM"},{"html_id":"Crystal Image/CrImage/Format/Save","kind":"module","full_name":"CrImage::Format::Save","name":"Save"},{"html_id":"Crystal Image/CrImage/Format/WebP","kind":"module","full_name":"CrImage::Format::WebP","name":"WebP"},{"html_id":"Crystal Image/CrImage/Operation/BilinearResize","kind":"module","full_name":"CrImage::Operation::BilinearResize","name":"BilinearResize"},{"html_id":"Crystal Image/CrImage/Operation/BoxBlur","kind":"module","full_name":"CrImage::Operation::BoxBlur","name":"BoxBlur"},{"html_id":"Crystal Image/CrImage/Operation/Brightness","kind":"module","full_name":"CrImage::Operation::Brightness","name":"Brightness"},{"html_id":"Crystal Image/CrImage/Operation/ChannelSwap","kind":"module","full_name":"CrImage::Operation::ChannelSwap","name":"ChannelSwap"},{"html_id":"Crystal Image/CrImage/Operation/Contrast","kind":"module","full_name":"CrImage::Operation::Contrast","name":"Contrast"},{"html_id":"Crystal Image/CrImage/Operation/Crop","kind":"module","full_name":"CrImage::Operation::Crop","name":"Crop"},{"html_id":"Crystal Image/CrImage/Operation/Draw","kind":"module","full_name":"CrImage::Operation::Draw","name":"Draw"},{"html_id":"Crystal Image/CrImage/Operation/GaussianBlur","kind":"module","full_name":"CrImage::Operation::GaussianBlur","name":"GaussianBlur"},{"html_id":"Crystal Image/CrImage/Operation/HistogramEqualize","kind":"module","full_name":"CrImage::Operation::HistogramEqualize","name":"HistogramEqualize"},{"html_id":"Crystal Image/CrImage/Operation/HorizontalBlur","kind":"module","full_name":"CrImage::Operation::HorizontalBlur","name":"HorizontalBlur"},{"html_id":"Crystal Image/CrImage/Operation/MaskApply","kind":"module","full_name":"CrImage::Operation::MaskApply","name":"MaskApply"},{"html_id":"Crystal Image/CrImage/Operation/VerticalBlur","kind":"module","full_name":"CrImage::Operation::VerticalBlur","name":"VerticalBlur"}],"extended_modules":[{"html_id":"Crystal Image/CrImage/Format/Open","kind":"module","full_name":"CrImage::Format::Open","name":"Open"}],"namespace":{"html_id":"Crystal Image/CrImage","kind":"module","full_name":"CrImage","name":"CrImage"},"doc":"An image with red, green, blue, and alpha color channels (i.e. a color image). This image type is likely the one read from and written to file (or `IO`).","summary":"

        An image with red, green, blue, and alpha color channels (i.e.

        ","constructors":[{"html_id":"from_jpeg(image_data:Bytes):self-class-method","name":"from_jpeg","doc":"Read `image_data` as JPEG encoded bytes","summary":"

        Read image_data as JPEG encoded bytes

        ","abstract":false,"args":[{"name":"image_data","external_name":"image_data","restriction":"Bytes"}],"args_string":"(image_data : Bytes) : self","args_html":"(image_data : Bytes) : self","def":{"name":"from_jpeg","args":[{"name":"image_data","external_name":"image_data","restriction":"Bytes"}],"return_type":"self","visibility":"Public","body":"handle = LibJPEGTurbo.init_decompress\ncheck_jpeg(handle, LibJPEGTurbo.decompress_header3(handle, image_data, image_data.size, out width, out height, out _subsampling, out _colorspace))\nbuffer = Bytes.new((width * height) * 3, 0)\ncheck_jpeg(handle, LibJPEGTurbo.decompress2(handle, image_data, LibC::ULong.new(image_data.size), buffer, width, 0, height, LibJPEGTurbo::PixelFormat::RGB, 0))\ncheck_jpeg(handle, LibJPEGTurbo.destroy(handle))\nred = Array.new(width * height) do\n 0_u8\nend\ngreen = Array.new(width * height) do\n 0_u8\nend\nblue = Array.new(width * height) do\n 0_u8\nend\nalpha = Array.new(width * height) do\n 255_u8\nend\n(width * height).times do |index|\n red.unsafe_put(index, buffer[index * 3])\n green.unsafe_put(index, buffer[(index * 3) + 1])\n blue.unsafe_put(index, buffer[(index * 3) + 2])\nend\nnew(red, green, blue, alpha, width, height)\n"}},{"html_id":"from_jpeg(io:IO):self-class-method","name":"from_jpeg","doc":"Construct an Image from reading in bytes from `io`","summary":"

        Construct an Image from reading in bytes from io

        ","abstract":false,"args":[{"name":"io","external_name":"io","restriction":"IO"}],"args_string":"(io : IO) : self","args_html":"(io : IO) : self","def":{"name":"from_jpeg","args":[{"name":"io","external_name":"io","restriction":"IO"}],"return_type":"self","visibility":"Public","body":"from_jpeg(io.getb_to_end)"}},{"html_id":"from_png(image_data:Bytes):self-class-method","name":"from_png","doc":"Read `image_data` and PNG encoded bytes","summary":"

        Read image_data and PNG encoded bytes

        ","abstract":false,"args":[{"name":"image_data","external_name":"image_data","restriction":"Bytes"}],"args_string":"(image_data : Bytes) : self","args_html":"(image_data : Bytes) : self","def":{"name":"from_png","args":[{"name":"image_data","external_name":"image_data","restriction":"Bytes"}],"return_type":"self","visibility":"Public","body":"ctx = LibSPNG.ctx_new(LibSPNG::CtxFlags::None)\nif ctx\nelse\n raise(::CrImage::Exception.new(\"Failed to create a context\"))\nend\nLibSPNG.set_png_buffer(ctx, image_data, image_data.size)\ncheck_png(LibSPNG.get_ihdr(ctx, out ihdr))\ncheck_png(LibSPNG.decoded_image_size(ctx, LibSPNG::Format::RGBA8, out image_size))\nimage = Bytes.new(image_size.to_i, 0_u8)\ncheck_png(LibSPNG.decode_image(ctx, image, image_size, LibSPNG::Format::RGBA8, LibSPNG::DecodeFlags::None))\nLibSPNG.ctx_free(ctx)\nsize = image_size // 4\nwidth = size // ihdr.height\nheight = ihdr.height\nred = Array.new(size) do\n 0_u8\nend\ngreen = Array.new(size) do\n 0_u8\nend\nblue = Array.new(size) do\n 0_u8\nend\nalpha = Array.new(size) do\n 0_u8\nend\nsize.times do |index|\n position = index * 4\n red.unsafe_put(index, image[position + 0])\n green.unsafe_put(index, image[position + 1])\n blue.unsafe_put(index, image[position + 2])\n alpha.unsafe_put(index, image[position + 3])\nend\nnew(red, green, blue, alpha, width.to_i, height.to_i)\n"}},{"html_id":"from_png(io:IO):self-class-method","name":"from_png","doc":"Construct an Image by reading bytes from `io`","summary":"

        Construct an Image by reading bytes from io

        ","abstract":false,"args":[{"name":"io","external_name":"io","restriction":"IO"}],"args_string":"(io : IO) : self","args_html":"(io : IO) : self","def":{"name":"from_png","args":[{"name":"io","external_name":"io","restriction":"IO"}],"return_type":"self","visibility":"Public","body":"from_png(io.getb_to_end)"}},{"html_id":"from_ppm(image_data:Bytes):self-class-method","name":"from_ppm","doc":"Read `image_data` as PPM encoded bytes","summary":"

        Read image_data as PPM encoded bytes

        ","abstract":false,"args":[{"name":"image_data","external_name":"image_data","restriction":"Bytes"}],"args_string":"(image_data : Bytes) : self","args_html":"(image_data : Bytes) : self","def":{"name":"from_ppm","args":[{"name":"image_data","external_name":"image_data","restriction":"Bytes"}],"return_type":"self","visibility":"Public","body":"from_ppm(IO::Memory.new(image_data))"}},{"html_id":"from_ppm(io:IO):self-class-method","name":"from_ppm","doc":"Read bytes from `io` as PPM encoded","summary":"

        Read bytes from io as PPM encoded

        ","abstract":false,"args":[{"name":"io","external_name":"io","restriction":"IO"}],"args_string":"(io : IO) : self","args_html":"(io : IO) : self","def":{"name":"from_ppm","args":[{"name":"io","external_name":"io","restriction":"IO"}],"return_type":"self","visibility":"Public","body":"_magic_number = io.gets(\"\\n\", chomp: true)\nwidth = (io.gets(\" \", chomp: true)).try(&.to_i)\nheight = (io.gets(\"\\n\", chomp: true)).try(&.to_i)\n_maximum_color_value = io.gets(\"\\n\", chomp: true)\nif width && height\n red = Array.new(width * height) do\n 0_u8\n end\n green = Array.new(width * height) do\n 0_u8\n end\n blue = Array.new(width * height) do\n 0_u8\n end\n alpha = Array.new(width * height) do\n 255_u8\n end\n (width * height).times do |index|\n red_byte = io.read_byte\n green_byte = io.read_byte\n blue_byte = io.read_byte\n if (red_byte && green_byte) && blue_byte\n red.unsafe_put(index, red_byte)\n green.unsafe_put(index, green_byte)\n blue.unsafe_put(index, blue_byte)\n else\n raise(\"The image ends prematurely\")\n end\n end\n new(red, green, blue, alpha, width, height)\nelse\n raise(\"The image doesn't have width or height\")\nend\n"}},{"html_id":"from_webp(image_data:Bytes):self-class-method","name":"from_webp","doc":"Read `image_data` as WebP encoded bytes","summary":"

        Read image_data as WebP encoded bytes

        ","abstract":false,"args":[{"name":"image_data","external_name":"image_data","restriction":"Bytes"}],"args_string":"(image_data : Bytes) : self","args_html":"(image_data : Bytes) : self","def":{"name":"from_webp","args":[{"name":"image_data","external_name":"image_data","restriction":"Bytes"}],"return_type":"self","visibility":"Public","body":"check_webp(LibWebP.get_info(image_data, image_data.size, out width, out height))\nbuffer = LibWebP.decode_rgba(image_data, image_data.size, pointerof(width), pointerof(height))\nred = Array.new(width * height) do\n 0_u8\nend\ngreen = Array.new(width * height) do\n 0_u8\nend\nblue = Array.new(width * height) do\n 0_u8\nend\nalpha = Array.new(width * height) do\n 0_u8\nend\n(width * height).times do |index|\n red.unsafe_put(index, buffer[index * 4])\n green.unsafe_put(index, buffer[(index * 4) + 1])\n blue.unsafe_put(index, buffer[(index * 4) + 2])\n alpha.unsafe_put(index, buffer[(index * 4) + 3])\nend\nLibWebP.free(buffer)\nnew(red, green, blue, alpha, width, height)\n"}},{"html_id":"from_webp(io:IO):self-class-method","name":"from_webp","doc":"Read bytes from `io` as WebP encoded","summary":"

        Read bytes from io as WebP encoded

        ","abstract":false,"args":[{"name":"io","external_name":"io","restriction":"IO"}],"args_string":"(io : IO) : self","args_html":"(io : IO) : self","def":{"name":"from_webp","args":[{"name":"io","external_name":"io","restriction":"IO"}],"return_type":"self","visibility":"Public","body":"from_webp(io.getb_to_end)"}},{"html_id":"new(red:Array(UInt8),green:Array(UInt8),blue:Array(UInt8),alpha:Array(UInt8),width:Int32,height:Int32)-class-method","name":"new","abstract":false,"args":[{"name":"red","external_name":"red","restriction":"::Array(::UInt8)"},{"name":"green","external_name":"green","restriction":"::Array(::UInt8)"},{"name":"blue","external_name":"blue","restriction":"::Array(::UInt8)"},{"name":"alpha","external_name":"alpha","restriction":"::Array(::UInt8)"},{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"height","external_name":"height","restriction":"::Int32"}],"args_string":"(red : Array(UInt8), green : Array(UInt8), blue : Array(UInt8), alpha : Array(UInt8), width : Int32, height : Int32)","args_html":"(red : Array(UInt8), green : Array(UInt8), blue : Array(UInt8), alpha : Array(UInt8), width : Int32, height : Int32)","location":{"filename":"src/cr-image/rgba_image.cr","line_number":10,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L10"},"def":{"name":"new","args":[{"name":"red","external_name":"red","restriction":"::Array(::UInt8)"},{"name":"green","external_name":"green","restriction":"::Array(::UInt8)"},{"name":"blue","external_name":"blue","restriction":"::Array(::UInt8)"},{"name":"alpha","external_name":"alpha","restriction":"::Array(::UInt8)"},{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"height","external_name":"height","restriction":"::Int32"}],"visibility":"Public","body":"_ = allocate\n_.initialize(red, green, blue, alpha, width, height)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"[](x:Int32,y:Int32):Pixel-instance-method","name":"[]","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"y","external_name":"y","restriction":"Int32"}],"args_string":"(x : Int32, y : Int32) : Pixel","args_html":"(x : Int32, y : Int32) : Pixel","location":{"filename":"src/cr-image/rgba_image.cr","line_number":40,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L40"},"def":{"name":"[]","args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"y","external_name":"y","restriction":"Int32"}],"return_type":"Pixel","visibility":"Public","body":"index = (y * width) + x\nPixel.new(red[index], green[index], blue[index], alpha[index])\n"}},{"html_id":"[](channel_type:ChannelType):Array(UInt8)-instance-method","name":"[]","doc":"Return the channel corresponding to `channel_type`","summary":"

        Return the channel corresponding to channel_type

        ","abstract":false,"args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"}],"args_string":"(channel_type : ChannelType) : Array(UInt8)","args_html":"(channel_type : ChannelType) : Array(UInt8)","location":{"filename":"src/cr-image/rgba_image.cr","line_number":46,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L46"},"def":{"name":"[]","args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"}],"return_type":"Array(UInt8)","visibility":"Public","body":"case channel_type\nwhen ChannelType::Red\n @red\nwhen ChannelType::Green\n @green\nwhen ChannelType::Blue\n @blue\nwhen ChannelType::Alpha\n @alpha\nelse\n raise(\"Unknown channel type #{channel_type} for RGBAImage\")\nend"}},{"html_id":"[]=(channel_type:ChannelType,channel:Array(UInt8)):Array(UInt8)-instance-method","name":"[]=","doc":"Set the corresponding `channel_type` with `channel`","summary":"

        Set the corresponding channel_type with channel

        ","abstract":false,"args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"},{"name":"channel","external_name":"channel","restriction":"Array(UInt8)"}],"args_string":"(channel_type : ChannelType, channel : Array(UInt8)) : Array(UInt8)","args_html":"(channel_type : ChannelType, channel : Array(UInt8)) : Array(UInt8)","location":{"filename":"src/cr-image/rgba_image.cr","line_number":57,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L57"},"def":{"name":"[]=","args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"},{"name":"channel","external_name":"channel","restriction":"Array(UInt8)"}],"return_type":"Array(UInt8)","visibility":"Public","body":"case channel_type\nwhen ChannelType::Red\n @red = channel\nwhen ChannelType::Green\n @green = channel\nwhen ChannelType::Blue\n @blue = channel\nwhen ChannelType::Alpha\n @alpha = channel\nelse\n raise(\"Unknown channel type #{channel_type} for RGBAImage\")\nend"}},{"html_id":"alpha:Array(UInt8)-instance-method","name":"alpha","doc":"Return the alpha channel","summary":"

        Return the alpha channel

        ","abstract":false,"location":{"filename":"src/cr-image/rgba_image.cr","line_number":6,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L6"},"def":{"name":"alpha","return_type":"Array(UInt8)","visibility":"Public","body":"@alpha"}},{"html_id":"alpha=(alpha:Array(UInt8))-instance-method","name":"alpha=","abstract":false,"args":[{"name":"alpha","external_name":"alpha","restriction":"Array(UInt8)"}],"args_string":"(alpha : Array(UInt8))","args_html":"(alpha : Array(UInt8))","location":{"filename":"src/cr-image/rgba_image.cr","line_number":6,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L6"},"def":{"name":"alpha=","args":[{"name":"alpha","external_name":"alpha","restriction":"Array(UInt8)"}],"visibility":"Public","body":"@alpha = alpha"}},{"html_id":"blue:Array(UInt8)-instance-method","name":"blue","doc":"Return the blue channel","summary":"

        Return the blue channel

        ","abstract":false,"location":{"filename":"src/cr-image/rgba_image.cr","line_number":5,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L5"},"def":{"name":"blue","return_type":"Array(UInt8)","visibility":"Public","body":"@blue"}},{"html_id":"blue=(blue:Array(UInt8))-instance-method","name":"blue=","abstract":false,"args":[{"name":"blue","external_name":"blue","restriction":"Array(UInt8)"}],"args_string":"(blue : Array(UInt8))","args_html":"(blue : Array(UInt8))","location":{"filename":"src/cr-image/rgba_image.cr","line_number":5,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L5"},"def":{"name":"blue=","args":[{"name":"blue","external_name":"blue","restriction":"Array(UInt8)"}],"visibility":"Public","body":"@blue = blue"}},{"html_id":"clone:RGBAImage-instance-method","name":"clone","doc":"Create a copy of this image","summary":"

        Create a copy of this image

        ","abstract":false,"location":{"filename":"src/cr-image/rgba_image.cr","line_number":14,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L14"},"def":{"name":"clone","return_type":"RGBAImage","visibility":"Public","body":"self.class.new(@red.clone, @green.clone, @blue.clone, @alpha.clone, @width, @height)"}},{"html_id":"each_channel(&:Array(UInt8),ChannelType->Nil):Nil-instance-method","name":"each_channel","doc":"Run provided block with the `ChannelType::Red`, `ChannelType::Green`, `ChannelType::Blue`, and `ChannelType::Alpha` channels.","summary":"

        Run provided block with the ChannelType::Red, ChannelType::Green, ChannelType::Blue, and ChannelType::Alpha channels.

        ","abstract":false,"location":{"filename":"src/cr-image/rgba_image.cr","line_number":26,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L26"},"def":{"name":"each_channel","yields":2,"block_arity":2,"block_arg":{"name":"","external_name":"","restriction":"(Array(UInt8), ChannelType -> Nil)"},"return_type":"Nil","visibility":"Public","body":"yield @red, ChannelType::Red\nyield @green, ChannelType::Green\nyield @blue, ChannelType::Blue\nyield @alpha, ChannelType::Alpha\nnil\n"}},{"html_id":"green:Array(UInt8)-instance-method","name":"green","doc":"Return the green channel","summary":"

        Return the green channel

        ","abstract":false,"location":{"filename":"src/cr-image/rgba_image.cr","line_number":4,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L4"},"def":{"name":"green","return_type":"Array(UInt8)","visibility":"Public","body":"@green"}},{"html_id":"green=(green:Array(UInt8))-instance-method","name":"green=","abstract":false,"args":[{"name":"green","external_name":"green","restriction":"Array(UInt8)"}],"args_string":"(green : Array(UInt8))","args_html":"(green : Array(UInt8))","location":{"filename":"src/cr-image/rgba_image.cr","line_number":4,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L4"},"def":{"name":"green=","args":[{"name":"green","external_name":"green","restriction":"Array(UInt8)"}],"visibility":"Public","body":"@green = green"}},{"html_id":"height:Int32-instance-method","name":"height","doc":"Height of image","summary":"

        Height of image

        ","abstract":false,"location":{"filename":"src/cr-image/rgba_image.cr","line_number":8,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L8"},"def":{"name":"height","return_type":"Int32","visibility":"Public","body":"@height"}},{"html_id":"height=(height:Int32)-instance-method","name":"height=","abstract":false,"args":[{"name":"height","external_name":"height","restriction":"Int32"}],"args_string":"(height : Int32)","args_html":"(height : Int32)","location":{"filename":"src/cr-image/rgba_image.cr","line_number":8,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L8"},"def":{"name":"height=","args":[{"name":"height","external_name":"height","restriction":"Int32"}],"visibility":"Public","body":"@height = height"}},{"html_id":"red:Array(UInt8)-instance-method","name":"red","doc":"Return the red channel","summary":"

        Return the red channel

        ","abstract":false,"location":{"filename":"src/cr-image/rgba_image.cr","line_number":3,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L3"},"def":{"name":"red","return_type":"Array(UInt8)","visibility":"Public","body":"@red"}},{"html_id":"red=(red:Array(UInt8))-instance-method","name":"red=","abstract":false,"args":[{"name":"red","external_name":"red","restriction":"Array(UInt8)"}],"args_string":"(red : Array(UInt8))","args_html":"(red : Array(UInt8))","location":{"filename":"src/cr-image/rgba_image.cr","line_number":3,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L3"},"def":{"name":"red=","args":[{"name":"red","external_name":"red","restriction":"Array(UInt8)"}],"visibility":"Public","body":"@red = red"}},{"html_id":"size:Int32-instance-method","name":"size","doc":"Return the number of pixels in this image","summary":"

        Return the number of pixels in this image

        ","abstract":false,"location":{"filename":"src/cr-image/rgba_image.cr","line_number":85,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L85"},"def":{"name":"size","return_type":"Int32","visibility":"Public","body":"@width * @height"}},{"html_id":"to_gray(red_multiplier:Float=0.299,green_multiplier:Float=0.587,blue_multiplier:Float=0.114):GrayscaleImage-instance-method","name":"to_gray","doc":"Convert color image to `GrayscaleImage`, using the NTSC formula as default values.\n\n\"Woman\n\nBecomes\n\n\"Woman","summary":"

        Convert color image to GrayscaleImage, using the NTSC formula as default values.

        ","abstract":false,"args":[{"name":"red_multiplier","default_value":"0.299","external_name":"red_multiplier","restriction":"Float"},{"name":"green_multiplier","default_value":"0.587","external_name":"green_multiplier","restriction":"Float"},{"name":"blue_multiplier","default_value":"0.114","external_name":"blue_multiplier","restriction":"Float"}],"args_string":"(red_multiplier : Float = 0.299, green_multiplier : Float = 0.587, blue_multiplier : Float = 0.114) : GrayscaleImage","args_html":"(red_multiplier : Float = 0.299, green_multiplier : Float = 0.587, blue_multiplier : Float = 0.114) : GrayscaleImage","location":{"filename":"src/cr-image/rgba_image.cr","line_number":74,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L74"},"def":{"name":"to_gray","args":[{"name":"red_multiplier","default_value":"0.299","external_name":"red_multiplier","restriction":"Float"},{"name":"green_multiplier","default_value":"0.587","external_name":"green_multiplier","restriction":"Float"},{"name":"blue_multiplier","default_value":"0.114","external_name":"blue_multiplier","restriction":"Float"}],"return_type":"GrayscaleImage","visibility":"Public","body":"GrayscaleImage.new(red.map_with_index do |red_pix, i|\n (Math.min(255, ((red_pix * red_multiplier) + (@green[i] * green_multiplier)) + (@blue[i] * blue_multiplier))).to_u8\nend, width, height)"}},{"html_id":"to_stumpy:StumpyCore::Canvas-instance-method","name":"to_stumpy","abstract":false,"location":{"filename":"src/stumpy.cr","line_number":30,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/stumpy.cr#L30"},"def":{"name":"to_stumpy","return_type":"StumpyCore::Canvas","visibility":"Public","body":"StumpyCore::Canvas.new(width, height) do |x, y|\n color = self[x, y]\n StumpyCore::RGBA.new(color.red.to_u16 << 8, color.green.to_u16 << 8, color.blue.to_u16 << 8, color.alpha.to_u16 << 8)\nend"}},{"html_id":"width:Int32-instance-method","name":"width","doc":"Width of image","summary":"

        Width of image

        ","abstract":false,"location":{"filename":"src/cr-image/rgba_image.cr","line_number":7,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L7"},"def":{"name":"width","return_type":"Int32","visibility":"Public","body":"@width"}},{"html_id":"width=(width:Int32)-instance-method","name":"width=","abstract":false,"args":[{"name":"width","external_name":"width","restriction":"Int32"}],"args_string":"(width : Int32)","args_html":"(width : Int32)","location":{"filename":"src/cr-image/rgba_image.cr","line_number":7,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L7"},"def":{"name":"width=","args":[{"name":"width","external_name":"width","restriction":"Int32"}],"visibility":"Public","body":"@width = width"}}],"types":[{"html_id":"Crystal Image/CrImage/RGBAImage/Pixel","path":"CrImage/RGBAImage/Pixel.html","kind":"struct","full_name":"CrImage::RGBAImage::Pixel","name":"Pixel","abstract":false,"superclass":{"html_id":"Crystal Image/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"Crystal Image/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"Crystal Image/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"Crystal Image/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cr-image/rgba_image.cr","line_number":34,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L34"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"Crystal Image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"},"constructors":[{"html_id":"new(red:UInt8,green:UInt8,blue:UInt8,alpha:UInt8)-class-method","name":"new","abstract":false,"args":[{"name":"red","external_name":"red","restriction":"UInt8"},{"name":"green","external_name":"green","restriction":"UInt8"},{"name":"blue","external_name":"blue","restriction":"UInt8"},{"name":"alpha","external_name":"alpha","restriction":"UInt8"}],"args_string":"(red : UInt8, green : UInt8, blue : UInt8, alpha : UInt8)","args_html":"(red : UInt8, green : UInt8, blue : UInt8, alpha : UInt8)","location":{"filename":"src/cr-image/rgba_image.cr","line_number":34,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L34"},"def":{"name":"new","args":[{"name":"red","external_name":"red","restriction":"UInt8"},{"name":"green","external_name":"green","restriction":"UInt8"},{"name":"blue","external_name":"blue","restriction":"UInt8"},{"name":"alpha","external_name":"alpha","restriction":"UInt8"}],"visibility":"Public","body":"_ = allocate\n_.initialize(red, green, blue, alpha)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"alpha:UInt8-instance-method","name":"alpha","abstract":false,"def":{"name":"alpha","return_type":"UInt8","visibility":"Public","body":"@alpha"}},{"html_id":"blue:UInt8-instance-method","name":"blue","abstract":false,"def":{"name":"blue","return_type":"UInt8","visibility":"Public","body":"@blue"}},{"html_id":"clone-instance-method","name":"clone","abstract":false,"location":{"filename":"src/cr-image/rgba_image.cr","line_number":34,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L34"},"def":{"name":"clone","visibility":"Public","body":"self.class.new(@red.clone, @green.clone, @blue.clone, @alpha.clone)"}},{"html_id":"copy_with(red_red=@red,green_green=@green,blue_blue=@blue,alpha_alpha=@alpha)-instance-method","name":"copy_with","abstract":false,"args":[{"name":"_red","default_value":"@red","external_name":"red","restriction":""},{"name":"_green","default_value":"@green","external_name":"green","restriction":""},{"name":"_blue","default_value":"@blue","external_name":"blue","restriction":""},{"name":"_alpha","default_value":"@alpha","external_name":"alpha","restriction":""}],"args_string":"(red _red = @red, green _green = @green, blue _blue = @blue, alpha _alpha = @alpha)","args_html":"(red _red = @red, green _green = @green, blue _blue = @blue, alpha _alpha = @alpha)","location":{"filename":"src/cr-image/rgba_image.cr","line_number":34,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L34"},"def":{"name":"copy_with","args":[{"name":"_red","default_value":"@red","external_name":"red","restriction":""},{"name":"_green","default_value":"@green","external_name":"green","restriction":""},{"name":"_blue","default_value":"@blue","external_name":"blue","restriction":""},{"name":"_alpha","default_value":"@alpha","external_name":"alpha","restriction":""}],"visibility":"Public","body":"self.class.new(_red, _green, _blue, _alpha)"}},{"html_id":"green:UInt8-instance-method","name":"green","abstract":false,"def":{"name":"green","return_type":"UInt8","visibility":"Public","body":"@green"}},{"html_id":"red:UInt8-instance-method","name":"red","abstract":false,"def":{"name":"red","return_type":"UInt8","visibility":"Public","body":"@red"}}]}]}]},{"html_id":"Crystal Image/StumpyCore","path":"StumpyCore.html","kind":"module","full_name":"StumpyCore","name":"StumpyCore","abstract":false,"locations":[{"filename":"lib/stumpy_core/src/stumpy_core/canvas.cr","line_number":3,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/lib/stumpy_core/src/stumpy_core/canvas.cr#L3"},{"filename":"lib/stumpy_core/src/stumpy_core/rgba.cr","line_number":4,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/lib/stumpy_core/src/stumpy_core/rgba.cr#L4"},{"filename":"lib/stumpy_core/src/stumpy_core/rgba/css_constants.cr","line_number":1,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/lib/stumpy_core/src/stumpy_core/rgba/css_constants.cr#L1"},{"filename":"lib/stumpy_core/src/stumpy_core/rgba/from_grayscale.cr","line_number":1,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/lib/stumpy_core/src/stumpy_core/rgba/from_grayscale.cr#L1"},{"filename":"lib/stumpy_core/src/stumpy_core/rgba/from_hex.cr","line_number":1,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/lib/stumpy_core/src/stumpy_core/rgba/from_hex.cr#L1"},{"filename":"lib/stumpy_core/src/stumpy_core/rgba/from_hsl_hsv.cr","line_number":1,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/lib/stumpy_core/src/stumpy_core/rgba/from_hsl_hsv.cr#L1"},{"filename":"lib/stumpy_core/src/stumpy_core/rgba/from_relative.cr","line_number":1,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/lib/stumpy_core/src/stumpy_core/rgba/from_relative.cr#L1"},{"filename":"lib/stumpy_core/src/stumpy_core/rgba/from_rgba.cr","line_number":1,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/lib/stumpy_core/src/stumpy_core/rgba/from_rgba.cr#L1"},{"filename":"lib/stumpy_core/src/stumpy_core/rgba/mixing.cr","line_number":1,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/lib/stumpy_core/src/stumpy_core/rgba/mixing.cr#L1"},{"filename":"lib/stumpy_core/src/stumpy_core/utils.cr","line_number":1,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/lib/stumpy_core/src/stumpy_core/utils.cr#L1"},{"filename":"src/stumpy.cr","line_number":5,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/stumpy.cr#L5"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"doc":"A module owned by [StumpyCr](https://github.com/stumpycr/stumpy_core)","summary":"

        A module owned by StumpyCr

        ","types":[{"html_id":"Crystal Image/StumpyCore/Canvas","path":"StumpyCore/Canvas.html","kind":"class","full_name":"StumpyCore::Canvas","name":"Canvas","abstract":false,"superclass":{"html_id":"Crystal Image/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"Crystal Image/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"Crystal Image/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"lib/stumpy_core/src/stumpy_core/canvas.cr","line_number":31,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/lib/stumpy_core/src/stumpy_core/canvas.cr#L31"},{"filename":"src/stumpy.cr","line_number":6,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/stumpy.cr#L6"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"Crystal Image/StumpyCore","kind":"module","full_name":"StumpyCore","name":"StumpyCore"},"doc":"A canvas is 2D array of `RGBA` pixels\n\nTo create a canvas of size `400` x `200`\n\n```\ncanvas = StumpyCore::Canvas.new(400, 200)\n```\n\nThe default background color is transparent,\nbut it can be passed in as a parameter or as a block\nthat returns the color value for each `{x, y}` pair.\n\n```\ncanvas2 = StumpyCore::Canvas.new(400, 200, RGBA::WHITE)\n```\n\n```\ncanvas3 = StumpyCore::Canvas.new(256, 256) do |x, y|\n RGBA.from_rgb_n(x, y, 255, 8)\nend\n```\n![image](https://github.com/stumpycr/stumpy_core/blob/feature/images/rainbow.png?raw=true)\n\nBecause of the way pixels are stored in a `Slice`,\n`Canvas`es are limited to `Int32::MAX = 2147483647` pixels in total,\ne.g. a maximal size of 46340x46340 for a square image.","summary":"

        A canvas is 2D array of RGBA pixels

        ","instance_methods":[{"html_id":"to_crimage:CrImage::RGBAImage-instance-method","name":"to_crimage","abstract":false,"location":{"filename":"src/stumpy.cr","line_number":7,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/stumpy.cr#L7"},"def":{"name":"to_crimage","return_type":"CrImage::RGBAImage","visibility":"Public","body":"size = width * height\nred = Array(UInt8).new(size)\ngreen = Array(UInt8).new(size)\nblue = Array(UInt8).new(size)\nalpha = Array(UInt8).new(size)\neach_row do |row|\n row.each do |rgba|\n red << (rgba.r >> 8).to_u8\n green << (rgba.g >> 8).to_u8\n blue << (rgba.b >> 8).to_u8\n alpha << (rgba.a >> 8).to_u8\n end\nend\nCrImage::RGBAImage.new(red, green, blue, alpha, width, height)\n"}}]}]}]}} \ No newline at end of file diff --git a/docs/search-index.js b/docs/search-index.js index f672978..d487271 100644 --- a/docs/search-index.js +++ b/docs/search-index.js @@ -1 +1 @@ -crystal_doc_search_index_callback({"repository_name":"cr-image","body":"

        Crystal Image (Processing)

        \n\nThis shard aims to provide feature rich image processing abilities, both for the purpose of\nimage manipulation as well as feature / information extraction from those images.\n\nThe code here takes imense inspiration from [Pluto](https://github.com/phenopolis/pluto) and [Stumpy](https://github.com/stumpycr/stumpy_core), with\nan eventual goal to be able to convert between images of this and those libraries.\n\nAll sample images used are from [Unsplash](https://unsplash.com/).\n\n## Installation\n\n1. Add the dependency to your `shard.yml`:\n\n ```yaml\n dependencies:\n cr-image:\n github: vici37/cr-image\n ```\n\n2. Run `shards install`\n\n## Usage\n\nCrImage supports the formats:\n* PPM\n* JPEG (requires `libturbojpeg`)\n* PNG (requirens `libspng`)\n* WebP (requires `libwebp`)\n\nFor the formats that require a linked library, they must be `require`d explicitly:\n\n```crystal\nrequire \"cr-image\"\nrequire \"cr-image/jpeg\"\nrequire \"cr-image/png\"\nrequire \"cr-image/webp\"\n```\n\n### Example\n\nAssuming an image `moon.jpg` already exists\n\n\"Picture\n\n```crystal\nrequire \"cr-image\"\n\nimage = CrImage::RGBAImage.open(\"moon.jpg\")\n\n# create a mask identifying all pixels with light (i.e. the moon)\nmoon_mask = image\n .to_gray\n .threshold(8) # pixels are UInt8, with 0 as black and 255 as white\n\n# Crop out the moon from the image, and save it to a new file\nimage.crop(\n moon_mask.region # smallest area that encompasses all true bits in mask\n).save(\"moon_cropped.jpg\")\n\n```\n\nYields this image:\n\n\"Cropped\n\n[See documentation](http://troy.sornson.io/cr-image/) for more examples.\n\n## Development\n\nThis requires `libwebp`, `libspng`, and `libturbojpeg` to run. Then:\n\n```\n> make test\n```\n\nTo ensure all tests run and pass.\n\n## Contributing\n\n1. [Fork it](https://github.com/Vici37/cr-image/fork)\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n- [Troy Sornson](https://github.com/Vici37) - creator and maintainer\n","program":{"html_id":"cr-image/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"locations":[],"repository_name":"cr-image","program":true,"enum":false,"alias":false,"const":false,"types":[{"html_id":"cr-image/CrImage","path":"CrImage.html","kind":"module","full_name":"CrImage","name":"CrImage","abstract":false,"locations":[{"filename":"src/cr-image/operation/bilinear_resize.cr","line_number":14,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/bilinear_resize.cr#L14"},{"filename":"src/cr-image/region.cr","line_number":1,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/region.cr#L1"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"types":[{"html_id":"cr-image/CrImage/ChannelType","path":"CrImage/ChannelType.html","kind":"enum","full_name":"CrImage::ChannelType","name":"ChannelType","abstract":false,"ancestors":[{"html_id":"cr-image/Enum","kind":"struct","full_name":"Enum","name":"Enum"},{"html_id":"cr-image/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"cr-image/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"cr-image/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cr-image/channel_type.cr","line_number":4,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/channel_type.cr#L4"}],"repository_name":"cr-image","program":false,"enum":true,"alias":false,"const":false,"constants":[{"id":"Red","name":"Red","value":"0"},{"id":"Green","name":"Green","value":"1"},{"id":"Blue","name":"Blue","value":"2"},{"id":"Gray","name":"Gray","value":"3"},{"id":"Alpha","name":"Alpha","value":"4"}],"namespace":{"html_id":"cr-image/CrImage","kind":"module","full_name":"CrImage","name":"CrImage"},"doc":"Enum representing different image channels supported by CrImage\n\nSee `RGBAImage#each_channel` and `GrayscaleImage#each_channel`","summary":"

        Enum representing different image channels supported by CrImage

        ","instance_methods":[{"html_id":"alpha?-instance-method","name":"alpha?","abstract":false,"location":{"filename":"src/cr-image/channel_type.cr","line_number":9,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/channel_type.cr#L9"},"def":{"name":"alpha?","visibility":"Public","body":"self == Alpha"}},{"html_id":"blue?-instance-method","name":"blue?","abstract":false,"location":{"filename":"src/cr-image/channel_type.cr","line_number":7,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/channel_type.cr#L7"},"def":{"name":"blue?","visibility":"Public","body":"self == Blue"}},{"html_id":"gray?-instance-method","name":"gray?","abstract":false,"location":{"filename":"src/cr-image/channel_type.cr","line_number":8,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/channel_type.cr#L8"},"def":{"name":"gray?","visibility":"Public","body":"self == Gray"}},{"html_id":"green?-instance-method","name":"green?","abstract":false,"location":{"filename":"src/cr-image/channel_type.cr","line_number":6,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/channel_type.cr#L6"},"def":{"name":"green?","visibility":"Public","body":"self == Green"}},{"html_id":"red?-instance-method","name":"red?","abstract":false,"location":{"filename":"src/cr-image/channel_type.cr","line_number":5,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/channel_type.cr#L5"},"def":{"name":"red?","visibility":"Public","body":"self == Red"}}]},{"html_id":"cr-image/CrImage/Color","path":"CrImage/Color.html","kind":"class","full_name":"CrImage::Color","name":"Color","abstract":false,"superclass":{"html_id":"cr-image/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"cr-image/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"cr-image/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cr-image/color.cr","line_number":5,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/color.cr#L5"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"cr-image/CrImage","kind":"module","full_name":"CrImage","name":"CrImage"},"doc":"Utility class for parsing and representing colors that can be used for certain\nmethods in CrImage.\n\nSee `Operation::MaskApply#apply_color`, `Operation::Draw#draw_square`, or `Operation::Draw#draw_circle`","summary":"

        Utility class for parsing and representing colors that can be used for certain methods in CrImage.

        ","constructors":[{"html_id":"new(red:UInt8,green:UInt8,blue:UInt8,alpha:UInt8=255)-class-method","name":"new","abstract":false,"args":[{"name":"red","external_name":"red","restriction":"UInt8"},{"name":"green","external_name":"green","restriction":"UInt8"},{"name":"blue","external_name":"blue","restriction":"UInt8"},{"name":"alpha","default_value":"255","external_name":"alpha","restriction":"UInt8"}],"args_string":"(red : UInt8, green : UInt8, blue : UInt8, alpha : UInt8 = 255)","args_html":"(red : UInt8, green : UInt8, blue : UInt8, alpha : UInt8 = 255)","location":{"filename":"src/cr-image/color.cr","line_number":8,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/color.cr#L8"},"def":{"name":"new","args":[{"name":"red","external_name":"red","restriction":"UInt8"},{"name":"green","external_name":"green","restriction":"UInt8"},{"name":"blue","external_name":"blue","restriction":"UInt8"},{"name":"alpha","default_value":"255","external_name":"alpha","restriction":"UInt8"}],"visibility":"Public","body":"_ = allocate\n_.initialize(red, green, blue, alpha)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"of(color:String):Color-class-method","name":"of","doc":"Parse color from a hex string:\n\n```\nColor.of(\"#1\") # same as \"#11\" => Color.new(17, 17, 17, 255)\nColor.of(\"#01\") # => Color.new(1, 1, 1, 255)\nColor.of(\"#123\") # same as \"#112233\" => Color.new(17, 34, 51, 255)\nColor.of(\"#1234\") # same as \"#11223344\" => Color.new(34, 51, 68, 17)\nColor.of(\"#010203\") # => Color.new(1, 2, 3, 255)\nColor.of(\"#01020304\") # => Color.new(2, 3, 4, 1)\n```","summary":"

        Parse color from a hex string:

        ","abstract":false,"args":[{"name":"color","external_name":"color","restriction":"String"}],"args_string":"(color : String) : Color","args_html":"(color : String) : Color","location":{"filename":"src/cr-image/color.cr","line_number":45,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/color.cr#L45"},"def":{"name":"of","args":[{"name":"color","external_name":"color","restriction":"String"}],"return_type":"Color","visibility":"Public","body":"if ((!(color.starts_with?(\"#\"))) || (!({2, 3, 4, 5, 7, 9}.includes?(color.size)))) || (color.match(/^#[^0-9a-f]/i))\n raise(\"Invalid hex color '#{color}': must start with '#' followed by 1, 2, 3, 4, 6, or 9 alphanumeric characters (0-9 or a-f)\")\nend\ncase color.size\nwhen 2\n gray = (color[1].to_i(16)).to_u8\n gray = (gray << 4) + gray\n self.new(gray, gray, gray)\nwhen 3\n gray = (color[1, 2].to_i(16)).to_u8\n self.new(gray, gray, gray)\nwhen 4\n red = (color[1].to_i(16)).to_u8\n green = (color[2].to_i(16)).to_u8\n blue = (color[3].to_i(16)).to_u8\n self.new((red << 4) + red, (green << 4) + green, (blue << 4) + blue)\nwhen 5\n alpha = (color[1].to_i(16)).to_u8\n red = (color[2].to_i(16)).to_u8\n green = (color[3].to_i(16)).to_u8\n blue = (color[4].to_i(16)).to_u8\n self.new((red << 4) + red, (green << 4) + green, (blue << 4) + blue, (alpha << 4) + alpha)\nwhen 7\n red = (color[1, 2].to_i(16)).to_u8\n green = (color[3, 2].to_i(16)).to_u8\n blue = (color[5, 2].to_i(16)).to_u8\n self.new(red, green, blue)\nelse\n alpha = (color[1, 2].to_i(16)).to_u8\n red = (color[3, 2].to_i(16)).to_u8\n green = (color[5, 2].to_i(16)).to_u8\n blue = (color[7, 2].to_i(16)).to_u8\n self.new(red, green, blue, alpha)\nend\n"}},{"html_id":"random:Color-class-method","name":"random","doc":"Generate a random color with full (255) opacity","summary":"

        Generate a random color with full (255) opacity

        ","abstract":false,"location":{"filename":"src/cr-image/color.cr","line_number":12,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/color.cr#L12"},"def":{"name":"random","return_type":"Color","visibility":"Public","body":"r = Random.new\nnew(r.rand(UInt8), r.rand(UInt8), r.rand(UInt8), 255_u8)\n"}}],"instance_methods":[{"html_id":"==(other:Color):Bool-instance-method","name":"==","abstract":false,"args":[{"name":"other","external_name":"other","restriction":"Color"}],"args_string":"(other : Color) : Bool","args_html":"(other : Color) : Bool","location":{"filename":"src/cr-image/color.cr","line_number":89,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/color.cr#L89"},"def":{"name":"==","args":[{"name":"other","external_name":"other","restriction":"Color"}],"return_type":"Bool","visibility":"Public","body":"(((red == other.red) && (green == other.green)) && (blue == other.blue)) && (alpha == other.alpha)"}},{"html_id":"[](channel_type:ChannelType):UInt8-instance-method","name":"[]","doc":"Receive the UInt8 portion of this color corresponding to `channel_type`","summary":"

        Receive the UInt8 portion of this color corresponding to channel_type

        ","abstract":false,"args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"}],"args_string":"(channel_type : ChannelType) : UInt8","args_html":"(channel_type : ChannelType) : UInt8","location":{"filename":"src/cr-image/color.cr","line_number":25,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/color.cr#L25"},"def":{"name":"[]","args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"}],"return_type":"UInt8","visibility":"Public","body":"case channel_type\nin ChannelType::Red\n red\nin ChannelType::Green\n green\nin ChannelType::Blue\n blue\nin ChannelType::Alpha\n alpha\nin ChannelType::Gray\n gray\nend"}},{"html_id":"alpha:UInt8-instance-method","name":"alpha","abstract":false,"location":{"filename":"src/cr-image/color.cr","line_number":6,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/color.cr#L6"},"def":{"name":"alpha","visibility":"Public","body":"@alpha"}},{"html_id":"blue:UInt8-instance-method","name":"blue","abstract":false,"location":{"filename":"src/cr-image/color.cr","line_number":6,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/color.cr#L6"},"def":{"name":"blue","visibility":"Public","body":"@blue"}},{"html_id":"gray(red_multiplier:Float=0.299,green_multiplier:Float=0.587,blue_multiplier:Float=0.114):UInt8-instance-method","name":"gray","doc":"Convert this Color to a single UInt8 gray value","summary":"

        Convert this Color to a single UInt8 gray value

        ","abstract":false,"args":[{"name":"red_multiplier","default_value":"0.299","external_name":"red_multiplier","restriction":"Float"},{"name":"green_multiplier","default_value":"0.587","external_name":"green_multiplier","restriction":"Float"},{"name":"blue_multiplier","default_value":"0.114","external_name":"blue_multiplier","restriction":"Float"}],"args_string":"(red_multiplier : Float = 0.299, green_multiplier : Float = 0.587, blue_multiplier : Float = 0.114) : UInt8","args_html":"(red_multiplier : Float = 0.299, green_multiplier : Float = 0.587, blue_multiplier : Float = 0.114) : UInt8","location":{"filename":"src/cr-image/color.cr","line_number":18,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/color.cr#L18"},"def":{"name":"gray","args":[{"name":"red_multiplier","default_value":"0.299","external_name":"red_multiplier","restriction":"Float"},{"name":"green_multiplier","default_value":"0.587","external_name":"green_multiplier","restriction":"Float"},{"name":"blue_multiplier","default_value":"0.114","external_name":"blue_multiplier","restriction":"Float"}],"return_type":"UInt8","visibility":"Public","body":"Math.min(255_u8, (((red * red_multiplier) + (blue * blue_multiplier)) + (green * green_multiplier)).to_u8)"}},{"html_id":"green:UInt8-instance-method","name":"green","abstract":false,"location":{"filename":"src/cr-image/color.cr","line_number":6,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/color.cr#L6"},"def":{"name":"green","visibility":"Public","body":"@green"}},{"html_id":"red:UInt8-instance-method","name":"red","abstract":false,"location":{"filename":"src/cr-image/color.cr","line_number":6,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/color.cr#L6"},"def":{"name":"red","visibility":"Public","body":"@red"}}]},{"html_id":"cr-image/CrImage/Exception","path":"CrImage/Exception.html","kind":"class","full_name":"CrImage::Exception","name":"Exception","abstract":false,"superclass":{"html_id":"cr-image/Exception","kind":"class","full_name":"Exception","name":"Exception"},"ancestors":[{"html_id":"cr-image/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"cr-image/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"cr-image/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cr-image/exception.cr","line_number":2,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/exception.cr#L2"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"cr-image/CrImage","kind":"module","full_name":"CrImage","name":"CrImage"},"doc":"Exception class for any errors thrown by CrImage","summary":"

        Exception class for any errors thrown by CrImage

        ","constructors":[{"html_id":"new(message:String)-class-method","name":"new","abstract":false,"args":[{"name":"message","external_name":"message","restriction":"String"}],"args_string":"(message : String)","args_html":"(message : String)","location":{"filename":"src/cr-image/exception.cr","line_number":5,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/exception.cr#L5"},"def":{"name":"new","args":[{"name":"message","external_name":"message","restriction":"String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(message)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(error_code:Int32)-class-method","name":"new","abstract":false,"args":[{"name":"error_code","external_name":"error_code","restriction":"Int32"}],"args_string":"(error_code : Int32)","args_html":"(error_code : Int32)","location":{"filename":"src/cr-image/exception.cr","line_number":9,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/exception.cr#L9"},"def":{"name":"new","args":[{"name":"error_code","external_name":"error_code","restriction":"Int32"}],"visibility":"Public","body":"_ = allocate\n_.initialize(error_code)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(handle:LibJPEGTurbo::Handle)-class-method","name":"new","abstract":false,"args":[{"name":"handle","external_name":"handle","restriction":"LibJPEGTurbo::Handle"}],"args_string":"(handle : LibJPEGTurbo::Handle)","args_html":"(handle : LibJPEGTurbo::Handle)","location":{"filename":"src/cr-image/exception.cr","line_number":13,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/exception.cr#L13"},"def":{"name":"new","args":[{"name":"handle","external_name":"handle","restriction":"LibJPEGTurbo::Handle"}],"visibility":"Public","body":"_ = allocate\n_.initialize(handle)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"error_code:Int32|Nil-instance-method","name":"error_code","abstract":false,"location":{"filename":"src/cr-image/exception.cr","line_number":3,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/exception.cr#L3"},"def":{"name":"error_code","return_type":"Int32 | ::Nil","visibility":"Public","body":"@error_code"}}]},{"html_id":"cr-image/CrImage/Format","path":"CrImage/Format.html","kind":"module","full_name":"CrImage::Format","name":"Format","abstract":false,"locations":[{"filename":"src/cr-image/format/save.cr","line_number":12,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/format/save.cr#L12"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"SUPPORTED_FORMATS","name":"SUPPORTED_FORMATS","value":"[{extension: \".ppm\", method: \"ppm\"}] of Nil"}],"namespace":{"html_id":"cr-image/CrImage","kind":"module","full_name":"CrImage","name":"CrImage"},"doc":"Provides a convenience method for saving image files to the filesystem.\nCurrently supports:\n* PPM (`.ppm`)\n* WebP (`.webp`)\n* JPEG (`.jpeg`, `.jpg`)\n* PNG (`.png`)\n\n```\nimage.save(\"image.jpg\")\n```\nSee `Open` for a convenience method to read images from the filesystem","summary":"

        Provides a convenience method for saving image files to the filesystem.

        ","types":[{"html_id":"cr-image/CrImage/Format/Open","path":"CrImage/Format/Open.html","kind":"module","full_name":"CrImage::Format::Open","name":"Open","abstract":false,"locations":[{"filename":"src/cr-image/format/open.cr","line_number":12,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/format/open.cr#L12"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"cr-image/CrImage/Format","kind":"module","full_name":"CrImage::Format","name":"Format"},"doc":"Provides a convenience method for opening up image files from the filesystem.\nCurrently supports:\n* PPM (`.ppm`)\n* WebP (`.webp`)\n* JPEG (`.jpeg`, `.jpg`)\n* PNG (`.png`)\n\n```\nimage = CrImage::RGBAImage.open(\"image.jpg\")\n```\nSee `Save` for a convenience method to write to the filesystem.","summary":"

        Provides a convenience method for opening up image files from the filesystem.

        ","instance_methods":[{"html_id":"open(filename:String):self-instance-method","name":"open","doc":"Reads this image from file using the provided filename.","summary":"

        Reads this image from file using the provided filename.

        ","abstract":false,"args":[{"name":"filename","external_name":"filename","restriction":"String"}],"args_string":"(filename : String) : self","args_html":"(filename : String) : self","location":{"filename":"src/cr-image/format/open.cr","line_number":14,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/format/open.cr#L14"},"def":{"name":"open","args":[{"name":"filename","external_name":"filename","restriction":"String"}],"return_type":"self","visibility":"Public","body":"{% if true %}\n case filename\n {% for format in SUPPORTED_FORMATS %}\n when .ends_with?({{ format[:extension] }}) then File.open(filename) { |file| self.from_{{ format[:method].id }}(file) }\n {% end %}\n else raise Exception.new \"Unknown file extension for filename #{filename}, cr-image only supports {{ (CrImage::Format::SUPPORTED_FORMATS.map do |__arg0|\n __arg0[:extension].id\nend.join(\", \")).id }}\"\n end\n {% end %}"}}]},{"html_id":"cr-image/CrImage/Format/PPM","path":"CrImage/Format/PPM.html","kind":"module","full_name":"CrImage::Format::PPM","name":"PPM","abstract":false,"locations":[{"filename":"src/cr-image/format/ppm.cr","line_number":13,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/format/ppm.cr#L13"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"cr-image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"cr-image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"cr-image/CrImage/Format","kind":"module","full_name":"CrImage::Format","name":"Format"},"doc":"Provides methods to read from and write to PPM.\n\n```\nimage = File.open(\"image.ppm\") { |file| CrImage::RGBAImage.from_ppm(file) }\nFile.open(\"other_image.ppm\") { |file| image.to_ppm(file) }\n```\nAlternatively, you can use the convenience methods in the `Open` and `Save` modules\nto acheive the same thing:\n```\nimage = CrImage::RGBAImage.open(\"image.ppm\")\nimage.save(\"other_image.ppm\")\n```","summary":"

        Provides methods to read from and write to PPM.

        ","instance_methods":[{"html_id":"to_ppm(io:IO):Nil-instance-method","name":"to_ppm","doc":"Output this image to `io` using PPM image encoding","summary":"

        Output this image to io using PPM image encoding

        ","abstract":false,"args":[{"name":"io","external_name":"io","restriction":"IO"}],"args_string":"(io : IO) : Nil","args_html":"(io : IO) : Nil","location":{"filename":"src/cr-image/format/ppm.cr","line_number":56,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/format/ppm.cr#L56"},"def":{"name":"to_ppm","args":[{"name":"io","external_name":"io","restriction":"IO"}],"return_type":"Nil","visibility":"Public","body":"io << \"P6\\n\"\n(((io << @width) << \" \") << @height) << \"\\n\"\nio << \"255\\n\"\nsize.times do |index|\n io.write_byte(red.unsafe_fetch(index))\n io.write_byte(green.unsafe_fetch(index))\n io.write_byte(blue.unsafe_fetch(index))\nend\n"}}]},{"html_id":"cr-image/CrImage/Format/Save","path":"CrImage/Format/Save.html","kind":"module","full_name":"CrImage::Format::Save","name":"Save","abstract":false,"locations":[{"filename":"src/cr-image/format/save.cr","line_number":15,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/format/save.cr#L15"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"cr-image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"cr-image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"cr-image/CrImage/Format","kind":"module","full_name":"CrImage::Format","name":"Format"},"instance_methods":[{"html_id":"save(filename:String):self-instance-method","name":"save","doc":"Write this image to file using the provided filename.\n\nThis method _will not_ create intermediate directory paths. This method will throw an\nerror if they don't exist.","summary":"

        Write this image to file using the provided filename.

        ","abstract":false,"args":[{"name":"filename","external_name":"filename","restriction":"String"}],"args_string":"(filename : String) : self","args_html":"(filename : String) : self","location":{"filename":"src/cr-image/format/save.cr","line_number":20,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/format/save.cr#L20"},"def":{"name":"save","args":[{"name":"filename","external_name":"filename","restriction":"String"}],"return_type":"self","visibility":"Public","body":"File.open(filename, \"w\") do |file|\n {% if true %}\n case filename\n {% for format in SUPPORTED_FORMATS %}\n when .ends_with?({{ format[:extension] }}) then to_{{ format[:method].id }}(file)\n {% end %}\n else raise Exception.new \"Unknown file extension for filename #{filename}, cr-image only supports {{ (CrImage::Format::SUPPORTED_FORMATS.map do |__arg0|\n __arg0[:extension].id\n end.join(\", \")).id }}\"\n end\n {% end %}\nend"}}]}]},{"html_id":"cr-image/CrImage/GrayscaleImage","path":"CrImage/GrayscaleImage.html","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage","abstract":false,"superclass":{"html_id":"cr-image/CrImage/Image","kind":"class","full_name":"CrImage::Image","name":"Image"},"ancestors":[{"html_id":"cr-image/CrImage/Operation/MaskApply","kind":"module","full_name":"CrImage::Operation::MaskApply","name":"MaskApply"},{"html_id":"cr-image/CrImage/Format/Save","kind":"module","full_name":"CrImage::Format::Save","name":"Save"},{"html_id":"cr-image/CrImage/Operation/HistogramEqualize","kind":"module","full_name":"CrImage::Operation::HistogramEqualize","name":"HistogramEqualize"},{"html_id":"cr-image/CrImage/Operation/Draw","kind":"module","full_name":"CrImage::Operation::Draw","name":"Draw"},{"html_id":"cr-image/CrImage/Operation/Crop","kind":"module","full_name":"CrImage::Operation::Crop","name":"Crop"},{"html_id":"cr-image/CrImage/Operation/VerticalBlur","kind":"module","full_name":"CrImage::Operation::VerticalBlur","name":"VerticalBlur"},{"html_id":"cr-image/CrImage/Operation/HorizontalBlur","kind":"module","full_name":"CrImage::Operation::HorizontalBlur","name":"HorizontalBlur"},{"html_id":"cr-image/CrImage/Operation/GaussianBlur","kind":"module","full_name":"CrImage::Operation::GaussianBlur","name":"GaussianBlur"},{"html_id":"cr-image/CrImage/Operation/Contrast","kind":"module","full_name":"CrImage::Operation::Contrast","name":"Contrast"},{"html_id":"cr-image/CrImage/Operation/ChannelSwap","kind":"module","full_name":"CrImage::Operation::ChannelSwap","name":"ChannelSwap"},{"html_id":"cr-image/CrImage/Operation/Brightness","kind":"module","full_name":"CrImage::Operation::Brightness","name":"Brightness"},{"html_id":"cr-image/CrImage/Operation/BoxBlur","kind":"module","full_name":"CrImage::Operation::BoxBlur","name":"BoxBlur"},{"html_id":"cr-image/CrImage/Operation/BilinearResize","kind":"module","full_name":"CrImage::Operation::BilinearResize","name":"BilinearResize"},{"html_id":"cr-image/CrImage/Format/PPM","kind":"module","full_name":"CrImage::Format::PPM","name":"PPM"},{"html_id":"cr-image/CrImage/Image","kind":"class","full_name":"CrImage::Image","name":"Image"},{"html_id":"cr-image/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"cr-image/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cr-image/grayscale_image.cr","line_number":13,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L13"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"cr-image/CrImage/Format/PPM","kind":"module","full_name":"CrImage::Format::PPM","name":"PPM"},{"html_id":"cr-image/CrImage/Format/Save","kind":"module","full_name":"CrImage::Format::Save","name":"Save"},{"html_id":"cr-image/CrImage/Operation/BilinearResize","kind":"module","full_name":"CrImage::Operation::BilinearResize","name":"BilinearResize"},{"html_id":"cr-image/CrImage/Operation/BoxBlur","kind":"module","full_name":"CrImage::Operation::BoxBlur","name":"BoxBlur"},{"html_id":"cr-image/CrImage/Operation/Brightness","kind":"module","full_name":"CrImage::Operation::Brightness","name":"Brightness"},{"html_id":"cr-image/CrImage/Operation/ChannelSwap","kind":"module","full_name":"CrImage::Operation::ChannelSwap","name":"ChannelSwap"},{"html_id":"cr-image/CrImage/Operation/Contrast","kind":"module","full_name":"CrImage::Operation::Contrast","name":"Contrast"},{"html_id":"cr-image/CrImage/Operation/Crop","kind":"module","full_name":"CrImage::Operation::Crop","name":"Crop"},{"html_id":"cr-image/CrImage/Operation/Draw","kind":"module","full_name":"CrImage::Operation::Draw","name":"Draw"},{"html_id":"cr-image/CrImage/Operation/GaussianBlur","kind":"module","full_name":"CrImage::Operation::GaussianBlur","name":"GaussianBlur"},{"html_id":"cr-image/CrImage/Operation/HistogramEqualize","kind":"module","full_name":"CrImage::Operation::HistogramEqualize","name":"HistogramEqualize"},{"html_id":"cr-image/CrImage/Operation/HorizontalBlur","kind":"module","full_name":"CrImage::Operation::HorizontalBlur","name":"HorizontalBlur"},{"html_id":"cr-image/CrImage/Operation/MaskApply","kind":"module","full_name":"CrImage::Operation::MaskApply","name":"MaskApply"},{"html_id":"cr-image/CrImage/Operation/VerticalBlur","kind":"module","full_name":"CrImage::Operation::VerticalBlur","name":"VerticalBlur"}],"extended_modules":[{"html_id":"cr-image/CrImage/Format/Open","kind":"module","full_name":"CrImage::Format::Open","name":"Open"}],"namespace":{"html_id":"cr-image/CrImage","kind":"module","full_name":"CrImage","name":"CrImage"},"doc":"An image in Grayscale. These image types are the easiest to perform feature and information extraction from, where\nthere is only one channel to examine, and so has methods for constructing `Mask`s from (see `#threshold` below).\n\nAn `RGBAImage` would become a `GrayscaleImage` this way:\n```\nimage.to_gray\n```\n\n\"Woman\n\"Woman","summary":"

        An image in Grayscale.

        ","constructors":[{"html_id":"from_ppm(image_data:Bytes):self-class-method","name":"from_ppm","doc":"Read `image_data` as PPM encoded bytes","summary":"

        Read image_data as PPM encoded bytes

        ","abstract":false,"args":[{"name":"image_data","external_name":"image_data","restriction":"Bytes"}],"args_string":"(image_data : Bytes) : self","args_html":"(image_data : Bytes) : self","def":{"name":"from_ppm","args":[{"name":"image_data","external_name":"image_data","restriction":"Bytes"}],"return_type":"self","visibility":"Public","body":"from_ppm(IO::Memory.new(image_data))"}},{"html_id":"from_ppm(io:IO):self-class-method","name":"from_ppm","doc":"Read bytes from `io` as PPM encoded","summary":"

        Read bytes from io as PPM encoded

        ","abstract":false,"args":[{"name":"io","external_name":"io","restriction":"IO"}],"args_string":"(io : IO) : self","args_html":"(io : IO) : self","def":{"name":"from_ppm","args":[{"name":"io","external_name":"io","restriction":"IO"}],"return_type":"self","visibility":"Public","body":"_magic_number = io.gets(\"\\n\", chomp: true)\nwidth = (io.gets(\" \", chomp: true)).try(&.to_i)\nheight = (io.gets(\"\\n\", chomp: true)).try(&.to_i)\n_maximum_color_value = io.gets(\"\\n\", chomp: true)\nif width && height\n red = Array.new(width * height) do\n 0_u8\n end\n green = Array.new(width * height) do\n 0_u8\n end\n blue = Array.new(width * height) do\n 0_u8\n end\n alpha = Array.new(width * height) do\n 255_u8\n end\n (width * height).times do |index|\n red_byte = io.read_byte\n green_byte = io.read_byte\n blue_byte = io.read_byte\n if (red_byte && green_byte) && blue_byte\n red.unsafe_put(index, red_byte)\n green.unsafe_put(index, green_byte)\n blue.unsafe_put(index, blue_byte)\n else\n raise(\"The image ends prematurely\")\n end\n end\n new(red, green, blue, alpha, width, height)\nelse\n raise(\"The image doesn't have width or height\")\nend\n"}},{"html_id":"new(red:Array(UInt8),green:Array(UInt8),blue:Array(UInt8),alpha:Array(UInt8),width:Int32,height:Int32)-class-method","name":"new","doc":"Create a GrayscaleImage from a set of color channels (delegates to `RGBAImage#to_gray`)","summary":"

        Create a GrayscaleImage from a set of color channels (delegates to RGBAImage#to_gray)

        ","abstract":false,"args":[{"name":"red","external_name":"red","restriction":"Array(UInt8)"},{"name":"green","external_name":"green","restriction":"Array(UInt8)"},{"name":"blue","external_name":"blue","restriction":"Array(UInt8)"},{"name":"alpha","external_name":"alpha","restriction":"Array(UInt8)"},{"name":"width","external_name":"width","restriction":"Int32"},{"name":"height","external_name":"height","restriction":"Int32"}],"args_string":"(red : Array(UInt8), green : Array(UInt8), blue : Array(UInt8), alpha : Array(UInt8), width : Int32, height : Int32)","args_html":"(red : Array(UInt8), green : Array(UInt8), blue : Array(UInt8), alpha : Array(UInt8), width : Int32, height : Int32)","location":{"filename":"src/cr-image/grayscale_image.cr","line_number":20,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L20"},"def":{"name":"new","args":[{"name":"red","external_name":"red","restriction":"Array(UInt8)"},{"name":"green","external_name":"green","restriction":"Array(UInt8)"},{"name":"blue","external_name":"blue","restriction":"Array(UInt8)"},{"name":"alpha","external_name":"alpha","restriction":"Array(UInt8)"},{"name":"width","external_name":"width","restriction":"Int32"},{"name":"height","external_name":"height","restriction":"Int32"}],"visibility":"Public","body":"(RGBAImage.new(red, green, blue, alpha, width, height)).to_gray"}},{"html_id":"new(gray:Array(UInt8),alpha:Array(UInt8),width:Int32,height:Int32)-class-method","name":"new","abstract":false,"args":[{"name":"gray","external_name":"gray","restriction":"::Array(::UInt8)"},{"name":"alpha","external_name":"alpha","restriction":"::Array(::UInt8)"},{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"height","external_name":"height","restriction":"::Int32"}],"args_string":"(gray : Array(UInt8), alpha : Array(UInt8), width : Int32, height : Int32)","args_html":"(gray : Array(UInt8), alpha : Array(UInt8), width : Int32, height : Int32)","location":{"filename":"src/cr-image/grayscale_image.cr","line_number":24,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L24"},"def":{"name":"new","args":[{"name":"gray","external_name":"gray","restriction":"::Array(::UInt8)"},{"name":"alpha","external_name":"alpha","restriction":"::Array(::UInt8)"},{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"height","external_name":"height","restriction":"::Int32"}],"visibility":"Public","body":"_ = allocate\n_.initialize(gray, alpha, width, height)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(gray:Array(UInt8),width:Int32,height:Int32)-class-method","name":"new","doc":"Create a GrayscaleImage with only an `Array(UInt8)` (alpha channel initialized as `255` throughout)","summary":"

        Create a GrayscaleImage with only an Array(UInt8) (alpha channel initialized as 255 throughout)

        ","abstract":false,"args":[{"name":"gray","external_name":"gray","restriction":"::Array(::UInt8)"},{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"height","external_name":"height","restriction":"::Int32"}],"args_string":"(gray : Array(UInt8), width : Int32, height : Int32)","args_html":"(gray : Array(UInt8), width : Int32, height : Int32)","location":{"filename":"src/cr-image/grayscale_image.cr","line_number":28,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L28"},"def":{"name":"new","args":[{"name":"gray","external_name":"gray","restriction":"::Array(::UInt8)"},{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"height","external_name":"height","restriction":"::Int32"}],"visibility":"Public","body":"_ = allocate\n_.initialize(gray, width, height)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"[](channel_type:ChannelType):Array(UInt8)-instance-method","name":"[]","doc":"Return the `Array(UInt8)` corresponding to `channel_type`","summary":"

        Return the Array(UInt8) corresponding to channel_type

        ","abstract":false,"args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"}],"args_string":"(channel_type : ChannelType) : Array(UInt8)","args_html":"(channel_type : ChannelType) : Array(UInt8)","location":{"filename":"src/cr-image/grayscale_image.cr","line_number":70,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L70"},"def":{"name":"[]","args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"}],"return_type":"Array(UInt8)","visibility":"Public","body":"if channel_type == ChannelType::Alpha\n return @alpha\nend\n@gray\n"}},{"html_id":"[]=(channel_type:ChannelType,channel:Array(UInt8)):Array(UInt8)-instance-method","name":"[]=","doc":"Set the underlying `Array(UInt8)` of `channel_type` to the new `channel`.\n\nWarning: this method does not check the size of the incoming array, and if it's a different\nsize from what the current image represents, this could break it. We recommend against using\nthis method except for from other methods that will be updating the `width` and `height` immediately after.","summary":"

        Set the underlying Array(UInt8) of channel_type to the new channel.

        ","abstract":false,"args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"},{"name":"channel","external_name":"channel","restriction":"Array(UInt8)"}],"args_string":"(channel_type : ChannelType, channel : Array(UInt8)) : Array(UInt8)","args_html":"(channel_type : ChannelType, channel : Array(UInt8)) : Array(UInt8)","location":{"filename":"src/cr-image/grayscale_image.cr","line_number":80,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L80"},"def":{"name":"[]=","args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"},{"name":"channel","external_name":"channel","restriction":"Array(UInt8)"}],"return_type":"Array(UInt8)","visibility":"Public","body":"case channel_type\nwhen ChannelType::Gray\n self.gray = channel\nwhen ChannelType::Alpha\n self.alpha = channel\nelse\n raise(\"Unknown channel type #{channel_type} for GrayscaleImage\")\nend"}},{"html_id":"alpha:Array(UInt8)-instance-method","name":"alpha","doc":"Return `alpha` channel","summary":"

        Return #alpha channel

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":58,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L58"},"def":{"name":"alpha","return_type":"Array(UInt8)","visibility":"Public","body":"@alpha"}},{"html_id":"alpha=(alpha:Array(UInt8))-instance-method","name":"alpha=","abstract":false,"args":[{"name":"alpha","external_name":"alpha","restriction":"Array(UInt8)"}],"args_string":"(alpha : Array(UInt8))","args_html":"(alpha : Array(UInt8))","location":{"filename":"src/cr-image/grayscale_image.cr","line_number":15,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L15"},"def":{"name":"alpha=","args":[{"name":"alpha","external_name":"alpha","restriction":"Array(UInt8)"}],"visibility":"Public","body":"@alpha = alpha"}},{"html_id":"blue:Array(UInt8)-instance-method","name":"blue","doc":"Return the \"`blue`\" channel (returns `gray`)","summary":"

        Return the "#blue" channel (returns #gray)

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":53,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L53"},"def":{"name":"blue","return_type":"Array(UInt8)","visibility":"Public","body":"@gray"}},{"html_id":"clone:GrayscaleImage-instance-method","name":"clone","doc":"Create a new GrayscaleImage as a copy of this one","summary":"

        Create a new GrayscaleImage as a copy of this one

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":33,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L33"},"def":{"name":"clone","return_type":"GrayscaleImage","visibility":"Public","body":"self.class.new(@gray.clone, @alpha.clone, @width, @height)"}},{"html_id":"each_channel(&:Array(UInt8),ChannelType->Nil):Nil-instance-method","name":"each_channel","doc":"Run provided block with the `ChannelType::Gray` and `ChannelType::Alpha` channels and channel types.","summary":"

        Run provided block with the ChannelType::Gray and ChannelType::Alpha channels and channel types.

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":63,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L63"},"def":{"name":"each_channel","yields":2,"block_arity":2,"block_arg":{"name":"","external_name":"","restriction":"(Array(UInt8), ChannelType -> Nil)"},"return_type":"Nil","visibility":"Public","body":"yield @gray, ChannelType::Gray\nyield @alpha, ChannelType::Alpha\nnil\n"}},{"html_id":"gray:Array(UInt8)-instance-method","name":"gray","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":14,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L14"},"def":{"name":"gray","return_type":"Array(UInt8)","visibility":"Public","body":"@gray"}},{"html_id":"gray=(gray:Array(UInt8))-instance-method","name":"gray=","abstract":false,"args":[{"name":"gray","external_name":"gray","restriction":"Array(UInt8)"}],"args_string":"(gray : Array(UInt8))","args_html":"(gray : Array(UInt8))","location":{"filename":"src/cr-image/grayscale_image.cr","line_number":14,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L14"},"def":{"name":"gray=","args":[{"name":"gray","external_name":"gray","restriction":"Array(UInt8)"}],"visibility":"Public","body":"@gray = gray"}},{"html_id":"green:Array(UInt8)-instance-method","name":"green","doc":"Return the \"`green`\" channel (returns `gray`)","summary":"

        Return the "#green" channel (returns #gray)

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":48,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L48"},"def":{"name":"green","return_type":"Array(UInt8)","visibility":"Public","body":"@gray"}},{"html_id":"height:Int32-instance-method","name":"height","doc":"Height of image","summary":"

        Height of image

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":17,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L17"},"def":{"name":"height","return_type":"Int32","visibility":"Public","body":"@height"}},{"html_id":"height=(height:Int32)-instance-method","name":"height=","abstract":false,"args":[{"name":"height","external_name":"height","restriction":"Int32"}],"args_string":"(height : Int32)","args_html":"(height : Int32)","location":{"filename":"src/cr-image/grayscale_image.cr","line_number":17,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L17"},"def":{"name":"height=","args":[{"name":"height","external_name":"height","restriction":"Int32"}],"visibility":"Public","body":"@height = height"}},{"html_id":"invert-instance-method","name":"invert","doc":"Invert grayscale pixels (replace each pixel will `255 - p` for all `p` in `@gray`).\n\n\"Woman\n\nBecomes\n\n\"Woman","summary":"

        Invert grayscale pixels (replace each pixel will 255 - p for all p in @gray).

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":112,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L112"},"def":{"name":"invert","visibility":"Public","body":"clone.invert!"}},{"html_id":"invert!-instance-method","name":"invert!","doc":"Invert grayscale pixels (replace each pixel will `255 - p` for all `p` in `@gray`). Modifies self.\n\n\"Woman\n\nBecomes\n\n\"Woman","summary":"

        Invert grayscale pixels (replace each pixel will 255 - p for all p in @gray).

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":123,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L123"},"def":{"name":"invert!","visibility":"Public","body":"@gray.map! do |pix|\n 255_u8 - pix\nend\nself\n"}},{"html_id":"mask_from(&block:Int32,Int32,UInt8->Bool):Mask-instance-method","name":"mask_from","doc":"Construct a `Mask` from this `GrayscaleImage` using the passed in block to determine if a given pixel should be true or not\n\n```\n# Construct a mask identifying the bright pixels in the bottom left corner of image\nimage.to_gray.mask_from do |x, y, pixel|\n x < image.width // 2 && # left half of image\n y > (image.height // 2) && # bottom half of image\n pixel > 128 # only \"bright\" pixels\nend\n```\n\"Woman\n->\n\"Mask","summary":"

        Construct a Mask from this GrayscaleImage using the passed in block to determine if a given pixel should be true or not

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":141,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L141"},"def":{"name":"mask_from","yields":3,"block_arity":3,"block_arg":{"name":"block","external_name":"block","restriction":"(Int32, Int32, UInt8 -> Bool)"},"return_type":"Mask","visibility":"Public","body":"Mask.new(width, BitArray.new(size) do |i|\n block.call(i % width, i // width, @gray[i])\nend)"}},{"html_id":"red:Array(UInt8)-instance-method","name":"red","doc":"Return the \"`red`\" channel (returns `gray`)","summary":"

        Return the "#red" channel (returns #gray)

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":43,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L43"},"def":{"name":"red","return_type":"Array(UInt8)","visibility":"Public","body":"@gray"}},{"html_id":"size:Int32-instance-method","name":"size","doc":"Return the number of pixels this image contains","summary":"

        Return the number of pixels this image contains

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":101,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L101"},"def":{"name":"size","return_type":"Int32","visibility":"Public","body":"@width * @height"}},{"html_id":"threshold(threshold:Int):Mask-instance-method","name":"threshold","doc":"Construct a simple threshold `Mask` containing all pixels with a `UInt8` value greater than `threshold`\nGiven sample image:\n\n\"Woman\n\n```\nimage\n .to_gray # convert color image to grayscale one\n .threshold(128) # generate a mask using threshold operator\n .to_gray # convert mask to grayscale image\n .save(\"threshold_example.jpg\") # save mask as grayscale\n```\n\"Black","summary":"

        Construct a simple threshold Mask containing all pixels with a UInt8 value greater than #threshold Given sample image:

        ","abstract":false,"args":[{"name":"threshold","external_name":"threshold","restriction":"Int"}],"args_string":"(threshold : Int) : Mask","args_html":"(threshold : Int) : Mask","location":{"filename":"src/cr-image/grayscale_image.cr","line_number":160,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L160"},"def":{"name":"threshold","args":[{"name":"threshold","external_name":"threshold","restriction":"Int"}],"return_type":"Mask","visibility":"Public","body":"mask_from do |_, _, pixel|\n pixel >= threshold\nend"}},{"html_id":"to_gray:GrayscaleImage-instance-method","name":"to_gray","doc":"Returns self","summary":"

        Returns self

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":96,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L96"},"def":{"name":"to_gray","return_type":"GrayscaleImage","visibility":"Public","body":"self"}},{"html_id":"to_rgba:RGBAImage-instance-method","name":"to_rgba","doc":"Convert this `GrayscaleImage` to an `RGBAImage`.\n\nNo color will be provided, all pixels will remain gray.","summary":"

        Convert this GrayscaleImage to an RGBAImage.

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":91,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L91"},"def":{"name":"to_rgba","return_type":"RGBAImage","visibility":"Public","body":"RGBAImage.new(@gray.clone, @gray.clone, @gray.clone, @alpha.clone, width, height)"}},{"html_id":"width:Int32-instance-method","name":"width","doc":"Width of image","summary":"

        Width of image

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":16,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L16"},"def":{"name":"width","return_type":"Int32","visibility":"Public","body":"@width"}},{"html_id":"width=(width:Int32)-instance-method","name":"width=","abstract":false,"args":[{"name":"width","external_name":"width","restriction":"Int32"}],"args_string":"(width : Int32)","args_html":"(width : Int32)","location":{"filename":"src/cr-image/grayscale_image.cr","line_number":16,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/grayscale_image.cr#L16"},"def":{"name":"width=","args":[{"name":"width","external_name":"width","restriction":"Int32"}],"visibility":"Public","body":"@width = width"}}]},{"html_id":"cr-image/CrImage/Image","path":"CrImage/Image.html","kind":"class","full_name":"CrImage::Image","name":"Image","abstract":true,"superclass":{"html_id":"cr-image/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"cr-image/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"cr-image/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cr-image/image.cr","line_number":3,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/image.cr#L3"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"subclasses":[{"html_id":"cr-image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"cr-image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"cr-image/CrImage","kind":"module","full_name":"CrImage","name":"CrImage"},"doc":"Common base class for `GrayscaleImage` and `RGBAImage`. All `Image`s are readable and saveable\nto the filesystem or `IO` stream.","summary":"

        Common base class for GrayscaleImage and RGBAImage.

        ","instance_methods":[{"html_id":"[](channel_type:ChannelType):Array(UInt8)-instance-method","name":"[]","doc":"Get the `Array(UInt8)` corresponding to `channel_type`)","summary":"

        Get the Array(UInt8) corresponding to channel_type)

        ","abstract":true,"args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"}],"args_string":"(channel_type : ChannelType) : Array(UInt8)","args_html":"(channel_type : ChannelType) : Array(UInt8)","location":{"filename":"src/cr-image/image.cr","line_number":51,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/image.cr#L51"},"def":{"name":"[]","args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"}],"return_type":"Array(UInt8)","visibility":"Public","body":""}},{"html_id":"[]=(channel_type:ChannelType,channel:Array(UInt8)):Array(UInt8)-instance-method","name":"[]=","doc":"Set the `Array(UInt8)` corresponding to `channel_type`) to `channel`","summary":"

        Set the Array(UInt8) corresponding to channel_type) to channel

        ","abstract":true,"args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"},{"name":"channel","external_name":"channel","restriction":"Array(UInt8)"}],"args_string":"(channel_type : ChannelType, channel : Array(UInt8)) : Array(UInt8)","args_html":"(channel_type : ChannelType, channel : Array(UInt8)) : Array(UInt8)","location":{"filename":"src/cr-image/image.cr","line_number":53,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/image.cr#L53"},"def":{"name":"[]=","args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"},{"name":"channel","external_name":"channel","restriction":"Array(UInt8)"}],"return_type":"Array(UInt8)","visibility":"Public","body":""}},{"html_id":"alpha:Array(UInt8)-instance-method","name":"alpha","doc":"Return the alpha channel","summary":"

        Return the alpha channel

        ","abstract":true,"location":{"filename":"src/cr-image/image.cr","line_number":39,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/image.cr#L39"},"def":{"name":"alpha","return_type":"Array(UInt8)","visibility":"Public","body":""}},{"html_id":"blue:Array(UInt8)-instance-method","name":"blue","doc":"Return the blue channel","summary":"

        Return the blue channel

        ","abstract":true,"location":{"filename":"src/cr-image/image.cr","line_number":37,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/image.cr#L37"},"def":{"name":"blue","return_type":"Array(UInt8)","visibility":"Public","body":""}},{"html_id":"each_channel(&:Array(UInt8),ChannelType->Nil):Nil-instance-method","name":"each_channel","doc":"Run provided block on each channel supported by this image.","summary":"

        Run provided block on each channel supported by this image.

        ","abstract":true,"location":{"filename":"src/cr-image/image.cr","line_number":48,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/image.cr#L48"},"def":{"name":"each_channel","yields":2,"block_arity":2,"block_arg":{"name":"","external_name":"","restriction":"(Array(UInt8), ChannelType -> Nil)"},"return_type":"Nil","visibility":"Public","body":""}},{"html_id":"green:Array(UInt8)-instance-method","name":"green","doc":"Return the green channel","summary":"

        Return the green channel

        ","abstract":true,"location":{"filename":"src/cr-image/image.cr","line_number":35,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/image.cr#L35"},"def":{"name":"green","return_type":"Array(UInt8)","visibility":"Public","body":""}},{"html_id":"height:Int32-instance-method","name":"height","doc":"Height of image","summary":"

        Height of image

        ","abstract":true,"location":{"filename":"src/cr-image/image.cr","line_number":43,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/image.cr#L43"},"def":{"name":"height","return_type":"Int32","visibility":"Public","body":""}},{"html_id":"red:Array(UInt8)-instance-method","name":"red","doc":"Return the red channel","summary":"

        Return the red channel

        ","abstract":true,"location":{"filename":"src/cr-image/image.cr","line_number":33,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/image.cr#L33"},"def":{"name":"red","return_type":"Array(UInt8)","visibility":"Public","body":""}},{"html_id":"size:Int32-instance-method","name":"size","doc":"Size (total pixels) in image (`width` * `height`)","summary":"

        Size (total pixels) in image (#width * #height)

        ","abstract":true,"location":{"filename":"src/cr-image/image.cr","line_number":45,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/image.cr#L45"},"def":{"name":"size","return_type":"Int32","visibility":"Public","body":""}},{"html_id":"width:Int32-instance-method","name":"width","doc":"Width of image","summary":"

        Width of image

        ","abstract":true,"location":{"filename":"src/cr-image/image.cr","line_number":41,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/image.cr#L41"},"def":{"name":"width","return_type":"Int32","visibility":"Public","body":""}}],"macros":[{"html_id":"subsclasses_include(mod)-macro","name":"subsclasses_include","abstract":false,"args":[{"name":"mod","external_name":"mod","restriction":""}],"args_string":"(mod)","args_html":"(mod)","location":{"filename":"src/cr-image/image.cr","line_number":4,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/image.cr#L4"},"def":{"name":"subsclasses_include","args":[{"name":"mod","external_name":"mod","restriction":""}],"visibility":"Public","body":" \n{% for sub in @type.subclasses %}\n class ::{{ sub }}\n include {{ mod }}\n end\n {% end %}\n\n \n"}}]},{"html_id":"cr-image/CrImage/Mask","path":"CrImage/Mask.html","kind":"class","full_name":"CrImage::Mask","name":"Mask","abstract":false,"superclass":{"html_id":"cr-image/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"cr-image/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"cr-image/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cr-image/mask.cr","line_number":39,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L39"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"cr-image/CrImage","kind":"module","full_name":"CrImage","name":"CrImage"},"doc":"Mask is a wrapper around BitArray, where each flag represents a boolean bit of information about a pixel\nfrom an image. This can include whether a particular pixel has a value within certain conditions, OR\nif that pixel should be zeroed out or not.\n\nSee `[]=` methods below for examples of how to manually construct masks.\n\n(x,y) - coordinates. Represent these positions in a Mask of size 10x10:\n\n```\n[\n (0,0), (0,1), (0,2), (0,3), (0,4), (0,5), (0,6), (0,7), (0,8), (0,9),\n (1,0), (1,1), (1,2), (1,3), (1,4), (1,5), (1,6), (1,7), (1,8), (1,9),\n (2,0), (2,1), (2,2), (2,3), (2,4), (2,5), (2,6), (2,7), (2,8), (2,9),\n (3,0), (3,1), (3,2), (3,3), (3,4), (3,5), (3,6), (3,7), (3,8), (3,9),\n (4,0), (4,1), (4,2), (4,3), (4,4), (4,5), (4,6), (4,7), (4,8), (4,9),\n (5,0), (5,1), (5,2), (5,3), (5,4), (5,5), (5,6), (5,7), (5,8), (5,9),\n (6,0), (6,1), (6,2), (6,3), (6,4), (6,5), (6,6), (6,7), (6,8), (6,9),\n (7,0), (7,1), (7,2), (7,3), (7,4), (7,5), (7,6), (7,7), (7,8), (7,9),\n (8,0), (8,1), (8,2), (8,3), (8,4), (8,5), (8,6), (8,7), (8,8), (8,9),\n (9,0), (9,1), (9,2), (9,3), (9,4), (9,5), (9,6), (9,7), (9,8), (9,9),\n]\n```\n\nAnd every position is a Bool value.\n\nDifferent ways to refer to coordinates:\n```\nmask.at(0, 0) # => (0,0)\nmask[0, 0] # => (0,0), same as .at(0, 0)\nmask[0..1, 4] # => (4,0), (4,1)\nmask[3, 3..5] # => (3,3), (3,4), (3,5)\nmask[2..3, 4..5] # => (2,4), (2,5), (3,4), (3,5)\n```\n\nSee `Operation::Crop` and `Operation::MaskApply` for how this can be useful","summary":"

        Mask is a wrapper around BitArray, where each flag represents a boolean bit of information about a pixel from an image.

        ","constructors":[{"html_id":"new(width:Int32,height:Int32,initial:Bool=true)-class-method","name":"new","doc":"Construct a new `Mask` of width x height, preset to `initial`","summary":"

        Construct a new Mask of width x height, preset to initial

        ","abstract":false,"args":[{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"height","external_name":"height","restriction":"Int32"},{"name":"initial","default_value":"true","external_name":"initial","restriction":"Bool"}],"args_string":"(width : Int32, height : Int32, initial : Bool = true)","args_html":"(width : Int32, height : Int32, initial : Bool = true)","location":{"filename":"src/cr-image/mask.cr","line_number":49,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L49"},"def":{"name":"new","args":[{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"height","external_name":"height","restriction":"Int32"},{"name":"initial","default_value":"true","external_name":"initial","restriction":"Bool"}],"visibility":"Public","body":"_ = allocate\n_.initialize(width, height, initial)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(width:Int32,height:Int32,int:Int)-class-method","name":"new","doc":"Construct a new `Mask` from an integer (useful for testing or small mask construction)","summary":"

        Construct a new Mask from an integer (useful for testing or small mask construction)

        ","abstract":false,"args":[{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"height","external_name":"height","restriction":"Int32"},{"name":"int","external_name":"int","restriction":"Int"}],"args_string":"(width : Int32, height : Int32, int : Int)","args_html":"(width : Int32, height : Int32, int : Int)","location":{"filename":"src/cr-image/mask.cr","line_number":61,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L61"},"def":{"name":"new","args":[{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"height","external_name":"height","restriction":"Int32"},{"name":"int","external_name":"int","restriction":"Int"}],"visibility":"Public","body":"_ = allocate\n_.initialize(width, height, int)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(other_bits:Array(BitArray))-class-method","name":"new","doc":"Construct a new `Mask` from an array of `BitArray`. See `#[](xs : Range, ys : Range) : Array(BitArray)`\n\nThis assumes `other_bits[0]` corresponds to `x == 0` in the mask, and the corresponding\n`BitArray` represents all bits for that row. All `BitArray`s must be of the same size in\n`other_bits`.","summary":"

        Construct a new Mask from an array of BitArray.

        ","abstract":false,"args":[{"name":"other_bits","external_name":"other_bits","restriction":"Array(BitArray)"}],"args_string":"(other_bits : Array(BitArray))","args_html":"(other_bits : Array(BitArray))","location":{"filename":"src/cr-image/mask.cr","line_number":77,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L77"},"def":{"name":"new","args":[{"name":"other_bits","external_name":"other_bits","restriction":"Array(BitArray)"}],"visibility":"Public","body":"_ = allocate\n_.initialize(other_bits)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(image:Image,initial:Bool=true)-class-method","name":"new","doc":"Construct a new `Mask` from the dimensions of passed in `image` with an initial bit","summary":"

        Construct a new Mask from the dimensions of passed in image with an initial bit

        ","abstract":false,"args":[{"name":"image","external_name":"image","restriction":"Image"},{"name":"initial","default_value":"true","external_name":"initial","restriction":"Bool"}],"args_string":"(image : Image, initial : Bool = true)","args_html":"(image : Image, initial : Bool = true)","location":{"filename":"src/cr-image/mask.cr","line_number":67,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L67"},"def":{"name":"new","args":[{"name":"image","external_name":"image","restriction":"Image"},{"name":"initial","default_value":"true","external_name":"initial","restriction":"Bool"}],"visibility":"Public","body":"_ = allocate\n_.initialize(image, initial)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(width:Int32,bits:BitArray)-class-method","name":"new","doc":"Construct a new `Mask` with a set width and bits from `bits`","summary":"

        Construct a new Mask with a set width and bits from #bits

        ","abstract":false,"args":[{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"bits","external_name":"bits","restriction":"::BitArray"}],"args_string":"(width : Int32, bits : BitArray)","args_html":"(width : Int32, bits : BitArray)","location":{"filename":"src/cr-image/mask.cr","line_number":44,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L44"},"def":{"name":"new","args":[{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"bits","external_name":"bits","restriction":"::BitArray"}],"visibility":"Public","body":"_ = allocate\n_.initialize(width, bits)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(width:Int32,height:Int32,&block:Int32,Int32->Bool)-class-method","name":"new","doc":"Construct a new `Mask` of width x height using `&block` to determine if a bit should be true or not (passed in `x` and `y` coordinates)","summary":"

        Construct a new Mask of width x height using &block to determine if a bit should be true or not (passed in x and y coordinates)

        ","abstract":false,"args":[{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"height","external_name":"height","restriction":"Int32"}],"args_string":"(width : Int32, height : Int32, &block : Int32, Int32 -> Bool)","args_html":"(width : Int32, height : Int32, &block : Int32, Int32 -> Bool)","location":{"filename":"src/cr-image/mask.cr","line_number":54,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L54"},"def":{"name":"new","args":[{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"height","external_name":"height","restriction":"Int32"}],"yields":2,"block_arity":2,"block_arg":{"name":"block","external_name":"block","restriction":"(Int32, Int32 -> Bool)"},"visibility":"Public","body":"_ = allocate\n_.initialize(width, height, &block) do |_arg0, _arg1|\n yield _arg0, _arg1\nend\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"==(other:Mask)-instance-method","name":"==","abstract":false,"args":[{"name":"other","external_name":"other","restriction":"Mask"}],"args_string":"(other : Mask)","args_html":"(other : Mask)","location":{"filename":"src/cr-image/mask.cr","line_number":166,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L166"},"def":{"name":"==","args":[{"name":"other","external_name":"other","restriction":"Mask"}],"visibility":"Public","body":"(width == other.width) && (bits == other.bits)"}},{"html_id":"[](x:Int32,y:Int32):Bool-instance-method","name":"[]","doc":"Return the bit at `x` and `y`","summary":"

        Return the bit at x and y

        ","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"y","external_name":"y","restriction":"Int32"}],"args_string":"(x : Int32, y : Int32) : Bool","args_html":"(x : Int32, y : Int32) : Bool","location":{"filename":"src/cr-image/mask.cr","line_number":136,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L136"},"def":{"name":"[]","args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"y","external_name":"y","restriction":"Int32"}],"return_type":"Bool","visibility":"Public","body":"if x >= width || y >= height\n raise(IndexError.new(\"Out of bounds: this mask is #{width}x#{height}, and (#{x},#{y}) is outside of that\"))\nend\n@bits[(y * width) + x]\n"}},{"html_id":"[](xs:Range,y:Int32):BitArray-instance-method","name":"[]","doc":"Return a new `BitArray` corresponding to the partial row specified","summary":"

        Return a new BitArray corresponding to the partial row specified

        ","abstract":false,"args":[{"name":"xs","external_name":"xs","restriction":"Range"},{"name":"y","external_name":"y","restriction":"Int32"}],"args_string":"(xs : Range, y : Int32) : BitArray","args_html":"(xs : Range, y : Int32) : BitArray","location":{"filename":"src/cr-image/mask.cr","line_number":142,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L142"},"def":{"name":"[]","args":[{"name":"xs","external_name":"xs","restriction":"Range"},{"name":"y","external_name":"y","restriction":"Int32"}],"return_type":"BitArray","visibility":"Public","body":"start, count = resolve_to_start_and_count(xs, width)\nBitArray.new(count) do |x|\n self[x + start, y]\nend\n"}},{"html_id":"[](x:Int32,ys:Range):BitArray-instance-method","name":"[]","doc":"Return a new `BitArray` corresponding to the partial column specified","summary":"

        Return a new BitArray corresponding to the partial column specified

        ","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"ys","external_name":"ys","restriction":"Range"}],"args_string":"(x : Int32, ys : Range) : BitArray","args_html":"(x : Int32, ys : Range) : BitArray","location":{"filename":"src/cr-image/mask.cr","line_number":148,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L148"},"def":{"name":"[]","args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"ys","external_name":"ys","restriction":"Range"}],"return_type":"BitArray","visibility":"Public","body":"start, count = resolve_to_start_and_count(ys, height)\nBitArray.new(count) do |y|\n self[x, y + start]\nend\n"}},{"html_id":"[](xs:Range,ys:Range):Array(BitArray)-instance-method","name":"[]","doc":"Return an `Array(BitArray)` for the partial box (of partial rows and partial columns) of this mask.\n\nCan be used to construct another mask from.","summary":"

        Return an Array(BitArray) for the partial box (of partial rows and partial columns) of this mask.

        ","abstract":false,"args":[{"name":"xs","external_name":"xs","restriction":"Range"},{"name":"ys","external_name":"ys","restriction":"Range"}],"args_string":"(xs : Range, ys : Range) : Array(BitArray)","args_html":"(xs : Range, ys : Range) : Array(BitArray)","location":{"filename":"src/cr-image/mask.cr","line_number":156,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L156"},"def":{"name":"[]","args":[{"name":"xs","external_name":"xs","restriction":"Range"},{"name":"ys","external_name":"ys","restriction":"Range"}],"return_type":"Array(BitArray)","visibility":"Public","body":"start_x, count_x = resolve_to_start_and_count(xs, width)\nstart_y, count_y = resolve_to_start_and_count(ys, height)\ncount_y.times.to_a.map do |y|\n BitArray.new(count_x) do |x|\n self[x + start_x, y + start_y]\n end\nend\n"}},{"html_id":"[]=(x:Int32,y:Int32,value:Bool):Bool-instance-method","name":"[]=","doc":"Set the bit for coordinate `x` and `y`\n\n```\nmask = CrImage::Mask.new(50, 50, false)\nmask[20, 20] = true\nmask.to_gray.save(\"mask_point.jpg\")\n```\n\"Black","summary":"

        Set the bit for coordinate x and y

        ","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"y","external_name":"y","restriction":"Int32"},{"name":"value","external_name":"value","restriction":"Bool"}],"args_string":"(x : Int32, y : Int32, value : Bool) : Bool","args_html":"(x : Int32, y : Int32, value : Bool) : Bool","location":{"filename":"src/cr-image/mask.cr","line_number":186,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L186"},"def":{"name":"[]=","args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"y","external_name":"y","restriction":"Int32"},{"name":"value","external_name":"value","restriction":"Bool"}],"return_type":"Bool","visibility":"Public","body":"self.set(x, y, value)"}},{"html_id":"[]=(xs:Range,y:Int32,value:Bool):Bool-instance-method","name":"[]=","doc":"Set the bits for partial row `xs` at column `y`\n\n```\nmask = CrImage::Mask.new(50, 50, false)\nmask[20..40, 20] = true\nmask.to_gray.save(\"mask_partial_row.jpg\")\n```\n\"Black","summary":"

        Set the bits for partial row xs at column y

        ","abstract":false,"args":[{"name":"xs","external_name":"xs","restriction":"Range"},{"name":"y","external_name":"y","restriction":"Int32"},{"name":"value","external_name":"value","restriction":"Bool"}],"args_string":"(xs : Range, y : Int32, value : Bool) : Bool","args_html":"(xs : Range, y : Int32, value : Bool) : Bool","location":{"filename":"src/cr-image/mask.cr","line_number":198,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L198"},"def":{"name":"[]=","args":[{"name":"xs","external_name":"xs","restriction":"Range"},{"name":"y","external_name":"y","restriction":"Int32"},{"name":"value","external_name":"value","restriction":"Bool"}],"return_type":"Bool","visibility":"Public","body":"if y >= height\n raise(IndexError.new(\"Out of bounds: #{y} is beyond the bounds of this mask's height of #{height}\"))\nend\nstart_x, count_x = resolve_to_start_and_count(xs, width)\n@bits.fill(value, (y * width) + start_x, count_x)\nclear_caches\nvalue\n"}},{"html_id":"[]=(x:Int32,ys:Range,value:Bool):Bool-instance-method","name":"[]=","doc":"Set the bits for row `x` and partial columns `ys`\n\n```\nmask = CrImage::Mask.new(50, 50, false)\nmask[20..40, 20] = true\nmask.to_gray.save(\"mask_partial_column.jpg\")\n```\n\"Black","summary":"

        Set the bits for row x and partial columns ys

        ","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"ys","external_name":"ys","restriction":"Range"},{"name":"value","external_name":"value","restriction":"Bool"}],"args_string":"(x : Int32, ys : Range, value : Bool) : Bool","args_html":"(x : Int32, ys : Range, value : Bool) : Bool","location":{"filename":"src/cr-image/mask.cr","line_number":214,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L214"},"def":{"name":"[]=","args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"ys","external_name":"ys","restriction":"Range"},{"name":"value","external_name":"value","restriction":"Bool"}],"return_type":"Bool","visibility":"Public","body":"if x >= width\n raise(IndexError.new(\"Out of bounds: #{x} is beyond the bounds of this mask's width of #{width}\"))\nend\nstart_y, count_y = resolve_to_start_and_count(ys, height)\ncount_y.times.to_a.each do |y|\n set(x, y + start_y, value)\nend\nvalue\n"}},{"html_id":"[]=(xs:Range,ys:Range,value:Bool):Bool-instance-method","name":"[]=","doc":"Set the bits for partial rows `xs` and partial columns `ys`\n\n```\nmask = CrImage::Mask.new(50, 50, false)\nmask[20..40, 20..40] = true\nmask.to_gray.save(\"mask_partial_column.jpg\")\n```\n\"Black","summary":"

        Set the bits for partial rows xs and partial columns ys

        ","abstract":false,"args":[{"name":"xs","external_name":"xs","restriction":"Range"},{"name":"ys","external_name":"ys","restriction":"Range"},{"name":"value","external_name":"value","restriction":"Bool"}],"args_string":"(xs : Range, ys : Range, value : Bool) : Bool","args_html":"(xs : Range, ys : Range, value : Bool) : Bool","location":{"filename":"src/cr-image/mask.cr","line_number":231,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L231"},"def":{"name":"[]=","args":[{"name":"xs","external_name":"xs","restriction":"Range"},{"name":"ys","external_name":"ys","restriction":"Range"},{"name":"value","external_name":"value","restriction":"Bool"}],"return_type":"Bool","visibility":"Public","body":"start_x, count_x = resolve_to_start_and_count(xs, width)\nstart_y, count_y = resolve_to_start_and_count(ys, height)\ncount_y.times.to_a.each do |y|\n @bits.fill(value, ((y + start_y) * width) + start_x, count_x)\nend\nclear_caches\nvalue\n"}},{"html_id":"apply(image:Image):Image-instance-method","name":"apply","doc":"Apply this mask to the provided image with `Operation::MaskApply#apply`","summary":"

        Apply this mask to the provided image with Operation::MaskApply#apply

        ","abstract":false,"args":[{"name":"image","external_name":"image","restriction":"Image"}],"args_string":"(image : Image) : Image","args_html":"(image : Image) : Image","location":{"filename":"src/cr-image/mask.cr","line_number":247,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L247"},"def":{"name":"apply","args":[{"name":"image","external_name":"image","restriction":"Image"}],"return_type":"Image","visibility":"Public","body":"image.apply(self)"}},{"html_id":"apply(image:Image,&block:Int32,Int32,UInt8,ChannelType->UInt8):Image-instance-method","name":"apply","doc":"Apply this mask to the provided image with `Operation::MaskApply#apply`","summary":"

        Apply this mask to the provided image with Operation::MaskApply#apply

        ","abstract":false,"args":[{"name":"image","external_name":"image","restriction":"Image"}],"args_string":"(image : Image, &block : Int32, Int32, UInt8, ChannelType -> UInt8) : Image","args_html":"(image : Image, &block : Int32, Int32, UInt8, ChannelType -> UInt8) : Image","location":{"filename":"src/cr-image/mask.cr","line_number":252,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L252"},"def":{"name":"apply","args":[{"name":"image","external_name":"image","restriction":"Image"}],"yields":4,"block_arity":4,"block_arg":{"name":"block","external_name":"block","restriction":"(Int32, Int32, UInt8, ChannelType -> UInt8)"},"return_type":"Image","visibility":"Public","body":"image.apply(self, &block)"}},{"html_id":"at(index:Int32):Bool-instance-method","name":"at","doc":"Return the bit at `index`","summary":"

        Return the bit at index

        ","abstract":false,"args":[{"name":"index","external_name":"index","restriction":"Int32"}],"args_string":"(index : Int32) : Bool","args_html":"(index : Int32) : Bool","location":{"filename":"src/cr-image/mask.cr","line_number":124,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L124"},"def":{"name":"at","args":[{"name":"index","external_name":"index","restriction":"Int32"}],"return_type":"Bool","visibility":"Public","body":"if index >= size\n raise(\"Index #{index} exceeds mask size #{@bits.size}\")\nend\n@bits[index]\n"}},{"html_id":"bits:BitArray-instance-method","name":"bits","abstract":false,"location":{"filename":"src/cr-image/mask.cr","line_number":41,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L41"},"def":{"name":"bits","return_type":"BitArray","visibility":"Public","body":"@bits"}},{"html_id":"clone-instance-method","name":"clone","doc":"Create a new `Mask` from this one without modifying it","summary":"

        Create a new Mask from this one without modifying it

        ","abstract":false,"location":{"filename":"src/cr-image/mask.cr","line_number":95,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L95"},"def":{"name":"clone","visibility":"Public","body":"Mask.new(width, bits.dup)"}},{"html_id":"height:Int32-instance-method","name":"height","abstract":false,"location":{"filename":"src/cr-image/mask.cr","line_number":99,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L99"},"def":{"name":"height","return_type":"Int32","visibility":"Public","body":"@bits.size // width"}},{"html_id":"invert-instance-method","name":"invert","doc":"Return a new `Mask` that's a copy of this one with all bits inverted.","summary":"

        Return a new Mask that's a copy of this one with all bits inverted.

        ","abstract":false,"location":{"filename":"src/cr-image/mask.cr","line_number":117,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L117"},"def":{"name":"invert","visibility":"Public","body":"new_bits = @bits.dup\nnew_bits.invert\nMask.new(width, new_bits)\n"}},{"html_id":"invert!-instance-method","name":"invert!","doc":"Invert all bits in this instance of `Mask`. Modifies self.\n\n\"Black\n\nBecomes\n\n\"White","summary":"

        Invert all bits in this instance of Mask.

        ","abstract":false,"location":{"filename":"src/cr-image/mask.cr","line_number":110,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L110"},"def":{"name":"invert!","visibility":"Public","body":"@bits.invert\nclear_caches\nself\n"}},{"html_id":"region:Region-instance-method","name":"region","doc":"Returns the bounding box of the mask where all true bits are contained. Any pixels outside of the region are false\n\n```\nmask = CrImage::Mask.new(50, 50, false)\nmask[20..40, 20] = true\nmask[20, 20..40] = true\nmask.region # => Region(x: 20, y: 20, width: 20, height: 20)\n```\n\n\"Black","summary":"

        Returns the bounding box of the mask where all true bits are contained.

        ","abstract":false,"location":{"filename":"src/cr-image/mask.cr","line_number":274,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L274"},"def":{"name":"region","return_type":"Region","visibility":"Public","body":"@region || (@region = calculate_region)"}},{"html_id":"segments(*,diagonal:Bool=true):Array(Mask)-instance-method","name":"segments","doc":"Return an array of `Mask`s, each one corresponding to an area of contiguous true bits (identified from flood fills).\n\nMay specify `diagonal: false` for only 4-way (up, down, left, right) flood fill instead of default 8-way.\nStarting with sample mask:\n```\nmask = CrImage::Mask.new(50, 50, false)\n\nmask[5..45, 5..45] = true\nmask[15..35, 15..35] = false\nmask[21..25, 21..25] = true\nmask[26..30, 26..30] = true\n```\n\n\"Black\n\nIts segments look like:\n```\nmask.segments.each_with_index do |segment, i|\n segment.to_gray.save(\"mask_8-way_segments_example_#{i}.jpg\")\nend\n```\nYields the images:\n\n\"Black\n\"Black\n\nUsing `diagonal: false` yields:\n```\nmask.segments(diagonal: false).each_with_index do |segment, i|\n segment.to_gray.save(\"mask_4-way_segments_example_#{i}.jpg\")\nend\n```\nYields the images:\n\n\"Black\n\"Black\n\"Black","summary":"

        Return an array of Masks, each one corresponding to an area of contiguous true bits (identified from flood fills).

        ","abstract":false,"args":[{"name":"","external_name":"","restriction":""},{"name":"diagonal","default_value":"true","external_name":"diagonal","restriction":"Bool"}],"args_string":"(*, diagonal : Bool = true) : Array(Mask)","args_html":"(*, diagonal : Bool = true) : Array(Mask)","location":{"filename":"src/cr-image/mask.cr","line_number":342,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L342"},"def":{"name":"segments","args":[{"name":"","external_name":"","restriction":""},{"name":"diagonal","default_value":"true","external_name":"diagonal","restriction":"Bool"}],"splat_index":0,"return_type":"Array(Mask)","visibility":"Public","body":"diagonal ? (@segments_8_way || (@segments_8_way = calculate_segments(diagonal))) : (@segments_4_way || (@segments_4_way = calculate_segments(diagonal)))"}},{"html_id":"set(x:Int32,y:Int32,value:Bool):Bool-instance-method","name":"set","doc":"Set the bit for coordinate `x` and `y`","summary":"

        Set the bit for coordinate x and y

        ","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"y","external_name":"y","restriction":"Int32"},{"name":"value","external_name":"value","restriction":"Bool"}],"args_string":"(x : Int32, y : Int32, value : Bool) : Bool","args_html":"(x : Int32, y : Int32, value : Bool) : Bool","location":{"filename":"src/cr-image/mask.cr","line_number":172,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L172"},"def":{"name":"set","args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"y","external_name":"y","restriction":"Int32"},{"name":"value","external_name":"value","restriction":"Bool"}],"return_type":"Bool","visibility":"Public","body":"if x >= width || y >= height\n raise(IndexError.new(\"Out of bounds: this mask is #{width}x#{height}, and (#{x},#{y}) is outside of that\"))\nend\nclear_caches\n@bits[(y * width) + x] = value\n"}},{"html_id":"size(*args,**options)-instance-method","name":"size","doc":"How many bits are stored in this `Mask`","summary":"

        How many bits are stored in this Mask

        ","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/cr-image/mask.cr","line_number":92,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L92"},"def":{"name":"size","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"bits.size(*args, **options)"}},{"html_id":"size(*args,**options,&)-instance-method","name":"size","doc":"How many bits are stored in this `Mask`","summary":"

        How many bits are stored in this Mask

        ","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/cr-image/mask.cr","line_number":92,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L92"},"def":{"name":"size","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"bits.size(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"to_gray:GrayscaleImage-instance-method","name":"to_gray","doc":"Convert this `Mask` to a `GrayscaleImage`, with false bits becoming 0, and true bits becoming 255","summary":"

        Convert this Mask to a GrayscaleImage, with false bits becoming 0, and true bits becoming 255

        ","abstract":false,"location":{"filename":"src/cr-image/mask.cr","line_number":242,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L242"},"def":{"name":"to_gray","return_type":"GrayscaleImage","visibility":"Public","body":"GrayscaleImage.new(bits.map do |b|\n b ? 255_u8 : 0_u8\nend, width, height)"}},{"html_id":"width:Int32-instance-method","name":"width","abstract":false,"location":{"filename":"src/cr-image/mask.cr","line_number":40,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/mask.cr#L40"},"def":{"name":"width","return_type":"Int32","visibility":"Public","body":"@width"}}]},{"html_id":"cr-image/CrImage/Operation","path":"CrImage/Operation.html","kind":"module","full_name":"CrImage::Operation","name":"Operation","abstract":false,"locations":[{"filename":"src/cr-image/operation/bilinear_resize.cr","line_number":14,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/bilinear_resize.cr#L14"},{"filename":"src/cr-image/operation/operation.cr","line_number":2,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/operation.cr#L2"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"cr-image/CrImage","kind":"module","full_name":"CrImage","name":"CrImage"},"doc":"Module for containing individual operations for `Image` classes.","summary":"

        Module for containing individual operations for Image classes.

        ","types":[{"html_id":"cr-image/CrImage/Operation/BilinearResize","path":"CrImage/Operation/BilinearResize.html","kind":"module","full_name":"CrImage::Operation::BilinearResize","name":"BilinearResize","abstract":false,"locations":[{"filename":"src/cr-image/operation/bilinear_resize.cr","line_number":14,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/bilinear_resize.cr#L14"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"cr-image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"cr-image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"cr-image/CrImage/Operation","kind":"module","full_name":"CrImage::Operation","name":"Operation"},"doc":"Resize an image using a bilinear resizing algorithm.\n\nTaking sample `image`:\n\n\"Woman\n\n```\nputs image.width, image.height # => 159x199\nimage.bilinear_resize(40, 50).save(\"small_sample.jpg\")\nimage.bilinear_resize(200, 250).save(\"larger_sample.jpg\")\n```\n\"Sample\n\"Sample","summary":"

        Resize an image using a bilinear resizing algorithm.

        ","instance_methods":[{"html_id":"bilinear_resize(width:Int32,height:Int32):self-instance-method","name":"bilinear_resize","doc":"Resizes image to new dimensions","summary":"

        Resizes image to new dimensions

        ","abstract":false,"args":[{"name":"width","external_name":"width","restriction":"Int32"},{"name":"height","external_name":"height","restriction":"Int32"}],"args_string":"(width : Int32, height : Int32) : self","args_html":"(width : Int32, height : Int32) : self","location":{"filename":"src/cr-image/operation/bilinear_resize.cr","line_number":16,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/bilinear_resize.cr#L16"},"def":{"name":"bilinear_resize","args":[{"name":"width","external_name":"width","restriction":"Int32"},{"name":"height","external_name":"height","restriction":"Int32"}],"return_type":"self","visibility":"Public","body":"clone.bilinear_resize!(width, height)"}},{"html_id":"bilinear_resize!(width:Int32,height:Int32):self-instance-method","name":"bilinear_resize!","doc":"Resizes image to new dimensions. Modifies self.","summary":"

        Resizes image to new dimensions.

        ","abstract":false,"args":[{"name":"width","external_name":"width","restriction":"Int32"},{"name":"height","external_name":"height","restriction":"Int32"}],"args_string":"(width : Int32, height : Int32) : self","args_html":"(width : Int32, height : Int32) : self","location":{"filename":"src/cr-image/operation/bilinear_resize.cr","line_number":21,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/bilinear_resize.cr#L21"},"def":{"name":"bilinear_resize!","args":[{"name":"width","external_name":"width","restriction":"Int32"},{"name":"height","external_name":"height","restriction":"Int32"}],"return_type":"self","visibility":"Public","body":"x_ratio = width > 1 ? (@width - 1) / (width - 1) : 0\ny_ratio = height > 1 ? (@height - 1) / (height - 1) : 0\neach_channel do |channel, channel_type|\n resized_channel = Array.new(width * height) do\n 0_u8\n end\n height.times do |h|\n width.times do |w|\n x = w * x_ratio\n y = h * y_ratio\n x_ceil = Math.min(@width - 1, x.ceil.to_i)\n x_floor = x.floor.to_i\n y_ceil = Math.min(@height - 1, y.ceil.to_i)\n y_floor = y.floor.to_i\n value = case\n when (x_ceil == x_floor) && (y_ceil == y_floor)\n x_index = x.to_i\n y_index = y.to_i\n channel.unsafe_fetch((@width * y_index) + x_index)\n when x_ceil == x_floor\n x_index = x.to_i\n q_1 = channel.unsafe_fetch((@width * y_ceil) + x_index)\n q_2 = channel.unsafe_fetch((@width * y_floor) + x_index)\n ((q_2 * (y_ceil - y)) + (q_1 * (y - y_floor))).to_u8\n when y_ceil == y_floor\n y_index = y.to_i\n q_1 = channel.unsafe_fetch((@width * y_index) + x_ceil)\n q_2 = channel.unsafe_fetch((@width * y_index) + x_floor)\n ((q_2 * (x_ceil - x)) + (q_1 * (x - x_floor))).to_u8\n else\n v_1 = channel.unsafe_fetch((@width * y_floor) + x_floor)\n v_2 = channel.unsafe_fetch((@width * y_floor) + x_ceil)\n v_3 = channel.unsafe_fetch((@width * y_ceil) + x_floor)\n v_4 = channel.unsafe_fetch((@width * y_ceil) + x_ceil)\n q_1 = (v_1 * (x_ceil - x)) + (v_2 * (x - x_floor))\n q_2 = (v_3 * (x_ceil - x)) + (v_4 * (x - x_floor))\n ((q_1 * (y_ceil - y)) + (q_2 * (y - y_floor))).to_u8\n end\n resized_channel.unsafe_put((width * h) + w, value)\n end\n end\n self[channel_type] = resized_channel\nend\n@width = width\n@height = height\nself\n"}}]},{"html_id":"cr-image/CrImage/Operation/BoxBlur","path":"CrImage/Operation/BoxBlur.html","kind":"module","full_name":"CrImage::Operation::BoxBlur","name":"BoxBlur","abstract":false,"locations":[{"filename":"src/cr-image/operation/box_blur.cr","line_number":13,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/box_blur.cr#L13"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"cr-image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"cr-image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"cr-image/CrImage/Operation","kind":"module","full_name":"CrImage::Operation","name":"Operation"},"doc":"Blurs the image\n\nTaking sample `image`:\n\n\"Woman\n\n```\nimage.box_blur(1).save(\"blurred_1_sample.jpg\")\nimage.box_blur(5).save(\"blurred_5_sample.jpg\")\n```\n\"Blurred\n\"Blurred","summary":"

        Blurs the image

        ","instance_methods":[{"html_id":"box_blur(value:Int32):self-instance-method","name":"box_blur","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Int32"}],"args_string":"(value : Int32) : self","args_html":"(value : Int32) : self","location":{"filename":"src/cr-image/operation/box_blur.cr","line_number":14,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/box_blur.cr#L14"},"def":{"name":"box_blur","args":[{"name":"value","external_name":"value","restriction":"Int32"}],"return_type":"self","visibility":"Public","body":"clone.box_blur!(value)"}},{"html_id":"box_blur!(value:Int32):self-instance-method","name":"box_blur!","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Int32"}],"args_string":"(value : Int32) : self","args_html":"(value : Int32) : self","location":{"filename":"src/cr-image/operation/box_blur.cr","line_number":18,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/box_blur.cr#L18"},"def":{"name":"box_blur!","args":[{"name":"value","external_name":"value","restriction":"Int32"}],"return_type":"self","visibility":"Public","body":"horizontal_blur!(value)\nvertical_blur!(value)\n"}}]},{"html_id":"cr-image/CrImage/Operation/Brightness","path":"CrImage/Operation/Brightness.html","kind":"module","full_name":"CrImage::Operation::Brightness","name":"Brightness","abstract":false,"locations":[{"filename":"src/cr-image/operation/brightness.cr","line_number":11,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/brightness.cr#L11"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"cr-image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"cr-image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"cr-image/CrImage/Operation","kind":"module","full_name":"CrImage::Operation","name":"Operation"},"doc":"Brightens an image (increases white value)\n\nTaking sample `image`:\n\n\"Woman\n\n```\nimage.brightness(2.0)\n```\n\"Brightened","summary":"

        Brightens an image (increases white value)

        ","instance_methods":[{"html_id":"brightness(value:Float64):self-instance-method","name":"brightness","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Float64"}],"args_string":"(value : Float64) : self","args_html":"(value : Float64) : self","location":{"filename":"src/cr-image/operation/brightness.cr","line_number":12,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/brightness.cr#L12"},"def":{"name":"brightness","args":[{"name":"value","external_name":"value","restriction":"Float64"}],"return_type":"self","visibility":"Public","body":"clone.brightness!(value)"}},{"html_id":"brightness!(value:Float64):self-instance-method","name":"brightness!","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Float64"}],"args_string":"(value : Float64) : self","args_html":"(value : Float64) : self","location":{"filename":"src/cr-image/operation/brightness.cr","line_number":16,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/brightness.cr#L16"},"def":{"name":"brightness!","args":[{"name":"value","external_name":"value","restriction":"Float64"}],"return_type":"self","visibility":"Public","body":"each_channel do |channel|\n size.times do |index|\n channel.unsafe_put(index, (Math.min(255, ( (channel.unsafe_fetch(index)) * value))).to_u8)\n end\nend\nself\n"}}]},{"html_id":"cr-image/CrImage/Operation/ChannelSwap","path":"CrImage/Operation/ChannelSwap.html","kind":"module","full_name":"CrImage::Operation::ChannelSwap","name":"ChannelSwap","abstract":false,"locations":[{"filename":"src/cr-image/operation/channel_swap.cr","line_number":11,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/channel_swap.cr#L11"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"cr-image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"cr-image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"cr-image/CrImage/Operation","kind":"module","full_name":"CrImage::Operation","name":"Operation"},"doc":"Swaps channels of `ChannelType` supported by an image\n\nTaking sample `image`:\n\n\"Woman\n\n```\nimage.channel_swap(:green, :red) # Crystal autocasting of symbols to Pluto::ChannelType enum is magic\n```\n\"Channel","summary":"

        Swaps channels of ChannelType supported by an image

        ","instance_methods":[{"html_id":"channel_swap(a:ChannelType,b:ChannelType):self-instance-method","name":"channel_swap","abstract":false,"args":[{"name":"a","external_name":"a","restriction":"ChannelType"},{"name":"b","external_name":"b","restriction":"ChannelType"}],"args_string":"(a : ChannelType, b : ChannelType) : self","args_html":"(a : ChannelType, b : ChannelType) : self","location":{"filename":"src/cr-image/operation/channel_swap.cr","line_number":12,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/channel_swap.cr#L12"},"def":{"name":"channel_swap","args":[{"name":"a","external_name":"a","restriction":"ChannelType"},{"name":"b","external_name":"b","restriction":"ChannelType"}],"return_type":"self","visibility":"Public","body":"clone.channel_swap!(a, b)"}},{"html_id":"channel_swap!(a:ChannelType,b:ChannelType):self-instance-method","name":"channel_swap!","abstract":false,"args":[{"name":"a","external_name":"a","restriction":"ChannelType"},{"name":"b","external_name":"b","restriction":"ChannelType"}],"args_string":"(a : ChannelType, b : ChannelType) : self","args_html":"(a : ChannelType, b : ChannelType) : self","location":{"filename":"src/cr-image/operation/channel_swap.cr","line_number":16,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/channel_swap.cr#L16"},"def":{"name":"channel_swap!","args":[{"name":"a","external_name":"a","restriction":"ChannelType"},{"name":"b","external_name":"b","restriction":"ChannelType"}],"return_type":"self","visibility":"Public","body":"ch_a, ch_b = self[a], self[b]\nself[a] = ch_b\nself[b] = ch_a\nself\n"}}]},{"html_id":"cr-image/CrImage/Operation/Contrast","path":"CrImage/Operation/Contrast.html","kind":"module","full_name":"CrImage::Operation::Contrast","name":"Contrast","abstract":false,"locations":[{"filename":"src/cr-image/operation/contrast.cr","line_number":11,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/contrast.cr#L11"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"cr-image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"cr-image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"cr-image/CrImage/Operation","kind":"module","full_name":"CrImage::Operation","name":"Operation"},"doc":"Increases contrast of an image\n\nTaking sample `image`:\n\n\"Woman\n\n```\nimage.contrast(20)\n```\n\"Contrasted","summary":"

        Increases contrast of an image

        ","instance_methods":[{"html_id":"contrast(value:Float64):self-instance-method","name":"contrast","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Float64"}],"args_string":"(value : Float64) : self","args_html":"(value : Float64) : self","location":{"filename":"src/cr-image/operation/contrast.cr","line_number":12,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/contrast.cr#L12"},"def":{"name":"contrast","args":[{"name":"value","external_name":"value","restriction":"Float64"}],"return_type":"self","visibility":"Public","body":"clone.contrast!(value)"}},{"html_id":"contrast!(value:Float64):self-instance-method","name":"contrast!","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Float64"}],"args_string":"(value : Float64) : self","args_html":"(value : Float64) : self","location":{"filename":"src/cr-image/operation/contrast.cr","line_number":16,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/contrast.cr#L16"},"def":{"name":"contrast!","args":[{"name":"value","external_name":"value","restriction":"Float64"}],"return_type":"self","visibility":"Public","body":"factor = (259 * (value + 255)) / (255 * (259 - value))\neach_channel do |channel|\n size.times do |index|\n channel.unsafe_put(index, (Math.min(255, Math.max(0, (factor * ((channel.unsafe_fetch(index)).to_i - 128)) + 128))).to_u8)\n end\nend\nself\n"}}]},{"html_id":"cr-image/CrImage/Operation/Crop","path":"CrImage/Operation/Crop.html","kind":"module","full_name":"CrImage::Operation::Crop","name":"Crop","abstract":false,"locations":[{"filename":"src/cr-image/operation/crop.cr","line_number":13,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/crop.cr#L13"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"cr-image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"cr-image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"cr-image/CrImage/Operation","kind":"module","full_name":"CrImage::Operation","name":"Operation"},"doc":"Crops an image\n\nTaking sample `image`:\n\n\"Woman\n\n```\n# These calls are equivalent\nimage.crop(40, 30, 80, 80)\nimage[40...120, 30...110]\n```\n\"Cropped","summary":"

        Crops an image

        ","instance_methods":[{"html_id":"[](xrange:Range(Int32,Int32)|Range(Int32,Nil)|Range(Nil,Int32),yrange:Range(Int32,Int32)|Range(Int32,Nil)|Range(Nil,Int32)):self-instance-method","name":"[]","abstract":false,"args":[{"name":"xrange","external_name":"xrange","restriction":"Range(Int32, Int32) | Range(Int32, Nil) | Range(Nil, Int32)"},{"name":"yrange","external_name":"yrange","restriction":"Range(Int32, Int32) | Range(Int32, Nil) | Range(Nil, Int32)"}],"args_string":"(xrange : Range(Int32, Int32) | Range(Int32, Nil) | Range(Nil, Int32), yrange : Range(Int32, Int32) | Range(Int32, Nil) | Range(Nil, Int32)) : self","args_html":"(xrange : Range(Int32, Int32) | Range(Int32, Nil) | Range(Nil, Int32), yrange : Range(Int32, Int32) | Range(Int32, Nil) | Range(Nil, Int32)) : self","location":{"filename":"src/cr-image/operation/crop.cr","line_number":22,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/crop.cr#L22"},"def":{"name":"[]","args":[{"name":"xrange","external_name":"xrange","restriction":"Range(Int32, Int32) | Range(Int32, Nil) | Range(Nil, Int32)"},{"name":"yrange","external_name":"yrange","restriction":"Range(Int32, Int32) | Range(Int32, Nil) | Range(Nil, Int32)"}],"return_type":"self","visibility":"Public","body":"xstart, xcount = resolve_to_start_and_count(xrange, width)\nystart, ycount = resolve_to_start_and_count(yrange, height)\ncrop(xstart, ystart, xcount, ycount)\n"}},{"html_id":"crop(x:Int32,y:Int32,new_width:Int32,new_height:Int32):self-instance-method","name":"crop","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"y","external_name":"y","restriction":"Int32"},{"name":"new_width","external_name":"new_width","restriction":"Int32"},{"name":"new_height","external_name":"new_height","restriction":"Int32"}],"args_string":"(x : Int32, y : Int32, new_width : Int32, new_height : Int32) : self","args_html":"(x : Int32, y : Int32, new_width : Int32, new_height : Int32) : self","location":{"filename":"src/cr-image/operation/crop.cr","line_number":18,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/crop.cr#L18"},"def":{"name":"crop","args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"y","external_name":"y","restriction":"Int32"},{"name":"new_width","external_name":"new_width","restriction":"Int32"},{"name":"new_height","external_name":"new_height","restriction":"Int32"}],"return_type":"self","visibility":"Public","body":"clone.crop!(x, y, new_width, new_height)"}},{"html_id":"crop(region:Region):self-instance-method","name":"crop","abstract":false,"args":[{"name":"region","external_name":"region","restriction":"Region"}],"args_string":"(region : Region) : self","args_html":"(region : Region) : self","location":{"filename":"src/cr-image/operation/crop.cr","line_number":14,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/crop.cr#L14"},"def":{"name":"crop","args":[{"name":"region","external_name":"region","restriction":"Region"}],"return_type":"self","visibility":"Public","body":"crop(*region.to_tuple)"}},{"html_id":"crop!(x:Int32,y:Int32,new_width:Int32,new_height:Int32):self-instance-method","name":"crop!","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"y","external_name":"y","restriction":"Int32"},{"name":"new_width","external_name":"new_width","restriction":"Int32"},{"name":"new_height","external_name":"new_height","restriction":"Int32"}],"args_string":"(x : Int32, y : Int32, new_width : Int32, new_height : Int32) : self","args_html":"(x : Int32, y : Int32, new_width : Int32, new_height : Int32) : self","location":{"filename":"src/cr-image/operation/crop.cr","line_number":32,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/crop.cr#L32"},"def":{"name":"crop!","args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"y","external_name":"y","restriction":"Int32"},{"name":"new_width","external_name":"new_width","restriction":"Int32"},{"name":"new_height","external_name":"new_height","restriction":"Int32"}],"return_type":"self","visibility":"Public","body":"if (x + new_width) > width\n raise(\"Crop dimensions extend #{(x + new_width) - width} pixels beyond width of the image (#{width})\")\nend\nif (y + new_height) > height\n raise(\"Crop dimensions extend #{(y + new_height) - height} pixels beyond height of the image (#{height})\")\nend\nnew_size = new_width * new_height\nheight_offset = y * width\neach_channel do |channel, channel_type|\n resized_channel = Array.new(new_size) do\n 0_u8\n end\n new_height.times do |new_y|\n orig_index = (height_offset + (new_y * width)) + x\n resized_channel[new_y * new_width, new_width] = channel[orig_index, new_width]\n end\n self[channel_type] = resized_channel\nend\n@width = new_width\n@height = new_height\nself\n"}},{"html_id":"crop!(region:Region):self-instance-method","name":"crop!","abstract":false,"args":[{"name":"region","external_name":"region","restriction":"Region"}],"args_string":"(region : Region) : self","args_html":"(region : Region) : self","location":{"filename":"src/cr-image/operation/crop.cr","line_number":28,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/crop.cr#L28"},"def":{"name":"crop!","args":[{"name":"region","external_name":"region","restriction":"Region"}],"return_type":"self","visibility":"Public","body":"crop!(*region.to_tuple)"}}]},{"html_id":"cr-image/CrImage/Operation/Draw","path":"CrImage/Operation/Draw.html","kind":"module","full_name":"CrImage::Operation::Draw","name":"Draw","abstract":false,"locations":[{"filename":"src/cr-image/operation/draw.cr","line_number":15,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/draw.cr#L15"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"cr-image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"cr-image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"cr-image/CrImage/Operation","kind":"module","full_name":"CrImage::Operation","name":"Operation"},"doc":"Draws shapes in the image\n\nTaking sample `image`:\n\n\"Woman\n\n```\nimage.draw_square(40, 30, 80, 80, CrImage::Color.of(\"#00f\"))\nimage.draw_circle(80, 70, 40, CrImage::Color.of(\"#00f\"))\n```\n\"Woman\n\"Woman\n\nCan also use the `fill: true` parameter to fill in the drawn shapes","summary":"

        Draws shapes in the image

        ","instance_methods":[{"html_id":"draw_circle(x:Int,y:Int,radius:Int,color:Color,*,fill:Bool=false):self-instance-method","name":"draw_circle","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int"},{"name":"y","external_name":"y","restriction":"Int"},{"name":"radius","external_name":"radius","restriction":"Int"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"}],"args_string":"(x : Int, y : Int, radius : Int, color : Color, *, fill : Bool = false) : self","args_html":"(x : Int, y : Int, radius : Int, color : Color, *, fill : Bool = false) : self","location":{"filename":"src/cr-image/operation/draw.cr","line_number":56,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/draw.cr#L56"},"def":{"name":"draw_circle","args":[{"name":"x","external_name":"x","restriction":"Int"},{"name":"y","external_name":"y","restriction":"Int"},{"name":"radius","external_name":"radius","restriction":"Int"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"}],"splat_index":4,"return_type":"self","visibility":"Public","body":"clone.draw_circle!(x, y, radius, color, fill: fill)"}},{"html_id":"draw_circle(region:Region,radius:Int,color:Color,*,fill:Bool=false):self-instance-method","name":"draw_circle","doc":"Draw a circle around the region's center (see `Region#center`)","summary":"

        Draw a circle around the region's center (see Region#center)

        ","abstract":false,"args":[{"name":"region","external_name":"region","restriction":"Region"},{"name":"radius","external_name":"radius","restriction":"Int"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"}],"args_string":"(region : Region, radius : Int, color : Color, *, fill : Bool = false) : self","args_html":"(region : Region, radius : Int, color : Color, *, fill : Bool = false) : self","location":{"filename":"src/cr-image/operation/draw.cr","line_number":52,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/draw.cr#L52"},"def":{"name":"draw_circle","args":[{"name":"region","external_name":"region","restriction":"Region"},{"name":"radius","external_name":"radius","restriction":"Int"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"}],"splat_index":3,"return_type":"self","visibility":"Public","body":"clone.draw_circle!(*region.center, radius, color, fill: fill)"}},{"html_id":"draw_circle!(region:Region,color:Color,*,fill:Bool=false,radius:Int32|Nil=nil):self-instance-method","name":"draw_circle!","doc":"Draw a circle around the region's center (see `Region#center`)","summary":"

        Draw a circle around the region's center (see Region#center)

        ","abstract":false,"args":[{"name":"region","external_name":"region","restriction":"Region"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"},{"name":"radius","default_value":"nil","external_name":"radius","restriction":"Int32 | ::Nil"}],"args_string":"(region : Region, color : Color, *, fill : Bool = false, radius : Int32 | Nil = nil) : self","args_html":"(region : Region, color : Color, *, fill : Bool = false, radius : Int32 | Nil = nil) : self","location":{"filename":"src/cr-image/operation/draw.cr","line_number":61,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/draw.cr#L61"},"def":{"name":"draw_circle!","args":[{"name":"region","external_name":"region","restriction":"Region"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"},{"name":"radius","default_value":"nil","external_name":"radius","restriction":"Int32 | ::Nil"}],"splat_index":2,"return_type":"self","visibility":"Public","body":"draw_circle!(*region.center, radius, color, fill: fill)"}},{"html_id":"draw_square(x:Int,y:Int,box_width:Int,box_height:Int,color:Color,*,fill:Bool=false):self-instance-method","name":"draw_square","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int"},{"name":"y","external_name":"y","restriction":"Int"},{"name":"box_width","external_name":"box_width","restriction":"Int"},{"name":"box_height","external_name":"box_height","restriction":"Int"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"}],"args_string":"(x : Int, y : Int, box_width : Int, box_height : Int, color : Color, *, fill : Bool = false) : self","args_html":"(x : Int, y : Int, box_width : Int, box_height : Int, color : Color, *, fill : Bool = false) : self","location":{"filename":"src/cr-image/operation/draw.cr","line_number":20,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/draw.cr#L20"},"def":{"name":"draw_square","args":[{"name":"x","external_name":"x","restriction":"Int"},{"name":"y","external_name":"y","restriction":"Int"},{"name":"box_width","external_name":"box_width","restriction":"Int"},{"name":"box_height","external_name":"box_height","restriction":"Int"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"}],"splat_index":5,"return_type":"self","visibility":"Public","body":"clone.draw_square!(x, y, box_width, box_height, color, fill: fill)"}},{"html_id":"draw_square(region:Region,color:Color,*,fill:Bool=false):self-instance-method","name":"draw_square","abstract":false,"args":[{"name":"region","external_name":"region","restriction":"Region"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"}],"args_string":"(region : Region, color : Color, *, fill : Bool = false) : self","args_html":"(region : Region, color : Color, *, fill : Bool = false) : self","location":{"filename":"src/cr-image/operation/draw.cr","line_number":16,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/draw.cr#L16"},"def":{"name":"draw_square","args":[{"name":"region","external_name":"region","restriction":"Region"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"}],"splat_index":2,"return_type":"self","visibility":"Public","body":"clone.draw_square!(region, color, fill: fill)"}},{"html_id":"draw_square!(x:Int,y:Int,box_width:Int,box_height:Int,color:Color,*,fill:Bool=false):self-instance-method","name":"draw_square!","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int"},{"name":"y","external_name":"y","restriction":"Int"},{"name":"box_width","external_name":"box_width","restriction":"Int"},{"name":"box_height","external_name":"box_height","restriction":"Int"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"}],"args_string":"(x : Int, y : Int, box_width : Int, box_height : Int, color : Color, *, fill : Bool = false) : self","args_html":"(x : Int, y : Int, box_width : Int, box_height : Int, color : Color, *, fill : Bool = false) : self","location":{"filename":"src/cr-image/operation/draw.cr","line_number":28,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/draw.cr#L28"},"def":{"name":"draw_square!","args":[{"name":"x","external_name":"x","restriction":"Int"},{"name":"y","external_name":"y","restriction":"Int"},{"name":"box_width","external_name":"box_width","restriction":"Int"},{"name":"box_height","external_name":"box_height","restriction":"Int"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"}],"splat_index":5,"return_type":"self","visibility":"Public","body":"if (x + box_width) > width\n raise(\"Box dimensions extend #{(x + box_width) - width} pixels beyond width of the image (#{width})\")\nend\nif (y + box_height) > height\n raise(\"Box dimensions extend #{(y + box_height) - height} pixels beyond height of the image (#{height})\")\nend\nx_i = x.to_i\ny_i = y.to_i\neach_channel do |channel, channel_type|\n channel[( (y_i * width) + x_i), box_width] = Array(UInt8).new(box_width) do\n color[channel_type]\n end\n channel[((y_i + box_height) * width) + x_i, box_width] = Array(UInt8).new(box_width) do\n color[channel_type]\n end\n box_height.times do |i|\n if i == 0\n next\n end\n if fill\n channel[( ((y_i + i) * width) + x_i), box_width] = Array(UInt8).new(box_width) do\n color[channel_type]\n end\n else\n channel.unsafe_put(((y_i + i) * width) + x_i, color[channel_type])\n channel.unsafe_put((((y_i + i) * width) + x_i) + box_width, color[channel_type])\n end\n end\nend\nself\n"}},{"html_id":"draw_square!(region:Region,color:Color,*,fill:Bool=false):self-instance-method","name":"draw_square!","abstract":false,"args":[{"name":"region","external_name":"region","restriction":"Region"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"}],"args_string":"(region : Region, color : Color, *, fill : Bool = false) : self","args_html":"(region : Region, color : Color, *, fill : Bool = false) : self","location":{"filename":"src/cr-image/operation/draw.cr","line_number":24,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/draw.cr#L24"},"def":{"name":"draw_square!","args":[{"name":"region","external_name":"region","restriction":"Region"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"}],"splat_index":2,"return_type":"self","visibility":"Public","body":"draw_square!(*region.to_tuple, color, fill: fill)"}}]},{"html_id":"cr-image/CrImage/Operation/GaussianBlur","path":"CrImage/Operation/GaussianBlur.html","kind":"module","full_name":"CrImage::Operation::GaussianBlur","name":"GaussianBlur","abstract":false,"locations":[{"filename":"src/cr-image/operation/gaussian_blur.cr","line_number":13,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/gaussian_blur.cr#L13"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"cr-image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"cr-image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"cr-image/CrImage/Operation","kind":"module","full_name":"CrImage::Operation","name":"Operation"},"doc":"Applies a 3x3 Gaussian blur. Implementation derived from [here](https://blog.ivank.net/fastest-gaussian-blur.html)\n\nTaking sample `image`:\n\n\"Woman\n\n```\nimage.gaussian_blur(1).save(\"gaussian_1_sample.jpg\")\nimage.gaussian_blur(5).save(\"gaussian_5_sample.jpg\")\n```\n\"Blurred\n\"Blurred","summary":"

        Applies a 3x3 Gaussian blur.

        ","instance_methods":[{"html_id":"gaussian_blur(sigma:Int32):self-instance-method","name":"gaussian_blur","abstract":false,"args":[{"name":"sigma","external_name":"sigma","restriction":"Int32"}],"args_string":"(sigma : Int32) : self","args_html":"(sigma : Int32) : self","location":{"filename":"src/cr-image/operation/gaussian_blur.cr","line_number":14,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/gaussian_blur.cr#L14"},"def":{"name":"gaussian_blur","args":[{"name":"sigma","external_name":"sigma","restriction":"Int32"}],"return_type":"self","visibility":"Public","body":"clone.gaussian_blur!(sigma)"}},{"html_id":"gaussian_blur!(sigma:Int32):self-instance-method","name":"gaussian_blur!","abstract":false,"args":[{"name":"sigma","external_name":"sigma","restriction":"Int32"}],"args_string":"(sigma : Int32) : self","args_html":"(sigma : Int32) : self","location":{"filename":"src/cr-image/operation/gaussian_blur.cr","line_number":18,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/gaussian_blur.cr#L18"},"def":{"name":"gaussian_blur!","args":[{"name":"sigma","external_name":"sigma","restriction":"Int32"}],"return_type":"self","visibility":"Public","body":"n = 3\nw_ideal = Math.sqrt((((12 * sigma) * sigma) / n) + 1)\nw_l = w_ideal.floor.to_i\nif (w_l % 2) == 0\n w_l = w_l - 1\nend\nm_ideal = (((((12 * sigma) * sigma) - ((n * w_l) * w_l)) - ((4 * n) * w_l)) - (3 * n)) / ((-4 * w_l) - 4)\nm = m_ideal.round\nsizes = [] of Int32\nn.times do |i|\n sizes << (if i < m\n w_l\n else\n w_l + 2\n end)\nend\nbox_blur!(((sizes.unsafe_fetch(0)) - 1) // 2)\nbox_blur!(((sizes.unsafe_fetch(1)) - 1) // 2)\nbox_blur!(((sizes.unsafe_fetch(2)) - 1) // 2)\nself\n"}}]},{"html_id":"cr-image/CrImage/Operation/HistogramEqualize","path":"CrImage/Operation/HistogramEqualize.html","kind":"module","full_name":"CrImage::Operation::HistogramEqualize","name":"HistogramEqualize","abstract":false,"locations":[{"filename":"src/cr-image/operation/histogram.cr","line_number":19,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/histogram.cr#L19"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"cr-image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"cr-image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"cr-image/CrImage/Operation","kind":"module","full_name":"CrImage::Operation","name":"Operation"},"doc":"Provides methods for histogram and histogram equalization. Follows method outlined [here](https://www.sci.utah.edu/~acoste/uou/Image/project1/Arthur_COSTE_Project_1_report.html)\n\nIf an image is particularly dark or particularly bright with low contrast, the `Operation::Contrast#contrast` method will only\nmake the image darker or lighter. For images like these, equalizing the image along its histogram will produce better results.\n\n\"A\n\n```\nimage.contrast(10).save(\"contrast.jpg\")\nimage.histogram_equalize.save(\"equalized.jpg\")\n```\n\"Darker\n\"A\n\nThis method does not work well when a given method has a bimodal distribution of color pixels. For example:\n\n\"Woman\n\"Highly","summary":"

        Provides methods for histogram and histogram equalization.

        ","instance_methods":[{"html_id":"histogram(channel_type:ChannelType):Histogram-instance-method","name":"histogram","abstract":false,"args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"}],"args_string":"(channel_type : ChannelType) : Histogram","args_html":"(channel_type : ChannelType) : Histogram","location":{"filename":"src/cr-image/operation/histogram.cr","line_number":93,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/histogram.cr#L93"},"def":{"name":"histogram","args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"}],"return_type":"Histogram","visibility":"Public","body":"Histogram.new(self, channel_type)"}},{"html_id":"histogram_equalize:self-instance-method","name":"histogram_equalize","abstract":false,"location":{"filename":"src/cr-image/operation/histogram.cr","line_number":97,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/histogram.cr#L97"},"def":{"name":"histogram_equalize","return_type":"self","visibility":"Public","body":"clone.histogram_equalize!"}},{"html_id":"histogram_equalize!:self-instance-method","name":"histogram_equalize!","abstract":false,"location":{"filename":"src/cr-image/operation/histogram.cr","line_number":101,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/histogram.cr#L101"},"def":{"name":"histogram_equalize!","return_type":"self","visibility":"Public","body":"each_channel do |channel, channel_type|\n if channel_type.alpha?\n next\n end\n remap = (histogram(channel_type)).equalize\n size.times do |i|\n channel.unsafe_put(i, remap[channel.unsafe_fetch(i)])\n end\nend\nself\n"}}],"types":[{"html_id":"cr-image/CrImage/Operation/HistogramEqualize/Histogram","path":"CrImage/Operation/HistogramEqualize/Histogram.html","kind":"class","full_name":"CrImage::Operation::HistogramEqualize::Histogram","name":"Histogram","abstract":false,"superclass":{"html_id":"cr-image/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"cr-image/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"cr-image/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cr-image/operation/histogram.cr","line_number":21,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/histogram.cr#L21"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"cr-image/CrImage/Operation/HistogramEqualize","kind":"module","full_name":"CrImage::Operation::HistogramEqualize","name":"HistogramEqualize"},"doc":"A histogram of an `Image` for a specific `ChannelType`","summary":"

        A histogram of an Image for a specific ChannelType

        ","constructors":[{"html_id":"new(image:Image,channel_type:ChannelType)-class-method","name":"new","abstract":false,"args":[{"name":"image","external_name":"image","restriction":"Image"},{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"}],"args_string":"(image : Image, channel_type : ChannelType)","args_html":"(image : Image, channel_type : ChannelType)","location":{"filename":"src/cr-image/operation/histogram.cr","line_number":22,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/histogram.cr#L22"},"def":{"name":"new","args":[{"name":"image","external_name":"image","restriction":"Image"},{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"}],"visibility":"Public","body":"_ = allocate\n_.initialize(image, channel_type)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"cdf:Hash(UInt8,Float64)-instance-method","name":"cdf","doc":"Get the cumulative distribution for the image's histogram","summary":"

        Get the cumulative distribution for the image's histogram

        ","abstract":false,"location":{"filename":"src/cr-image/operation/histogram.cr","line_number":54,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/histogram.cr#L54"},"def":{"name":"cdf","return_type":"Hash(UInt8, Float64)","visibility":"Public","body":"total = 0_f64\n@cumulative_distribution_histogram || (@cumulative_distribution_histogram = normalize.map do |pixel, probability|\n original = total\n total = total + probability\n {pixel, original}\nend.to_h)\n"}},{"html_id":"counts:Hash(UInt8,Int32)-instance-method","name":"counts","doc":"Get the raw counts for a given pixel value (0-255) in the image","summary":"

        Get the raw counts for a given pixel value (0-255) in the image

        ","abstract":false,"location":{"filename":"src/cr-image/operation/histogram.cr","line_number":28,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/histogram.cr#L28"},"def":{"name":"counts","return_type":"Hash(UInt8, Int32)","visibility":"Public","body":"@internal_hist || (@internal_hist = calculate_counts)"}},{"html_id":"equalize:Hash(UInt8,UInt8)-instance-method","name":"equalize","doc":"Remap the cumalitive distribution of pixels to get a new, more spread out pixel value","summary":"

        Remap the cumalitive distribution of pixels to get a new, more spread out pixel value

        ","abstract":false,"location":{"filename":"src/cr-image/operation/histogram.cr","line_number":64,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/histogram.cr#L64"},"def":{"name":"equalize","return_type":"Hash(UInt8, UInt8)","visibility":"Public","body":"cdf.map do |pixel, cumalative|\n {pixel, ((cumalative * 255).clamp(0, 255)).to_u8}\nend.to_h"}},{"html_id":"normalize:Hash(UInt8,Float64)-instance-method","name":"normalize","doc":"Get pixel counts normalized - all values between 0.0 and 1.0","summary":"

        Get pixel counts normalized - all values between 0.0 and 1.0

        ","abstract":false,"location":{"filename":"src/cr-image/operation/histogram.cr","line_number":45,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/histogram.cr#L45"},"def":{"name":"normalize","return_type":"Hash(UInt8, Float64)","visibility":"Public","body":"counts.map do |pixel, count|\n {pixel, count.to_f / @image.size}\nend.to_h"}}]}]},{"html_id":"cr-image/CrImage/Operation/HorizontalBlur","path":"CrImage/Operation/HorizontalBlur.html","kind":"module","full_name":"CrImage::Operation::HorizontalBlur","name":"HorizontalBlur","abstract":false,"locations":[{"filename":"src/cr-image/operation/horizontal_blur.cr","line_number":13,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/horizontal_blur.cr#L13"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"cr-image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"cr-image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"cr-image/CrImage/Operation","kind":"module","full_name":"CrImage::Operation","name":"Operation"},"doc":"Blur an image along the horizontal axis\n\nTaking sample `image`:\n\n\"Woman\n\n```\nimage.horizontal_blur(1).save(\"horizontal_1_sample.jpg\")\nimage.horizontal_blur(5).save(\"horizontal_5_sample.jpg\")\n```\n\"Blurred\n\"Blurred","summary":"

        Blur an image along the horizontal axis

        ","instance_methods":[{"html_id":"horizontal_blur(value:Int32):self-instance-method","name":"horizontal_blur","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Int32"}],"args_string":"(value : Int32) : self","args_html":"(value : Int32) : self","location":{"filename":"src/cr-image/operation/horizontal_blur.cr","line_number":14,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/horizontal_blur.cr#L14"},"def":{"name":"horizontal_blur","args":[{"name":"value","external_name":"value","restriction":"Int32"}],"return_type":"self","visibility":"Public","body":"clone.horizontal_blur!(value)"}},{"html_id":"horizontal_blur!(value:Int32):self-instance-method","name":"horizontal_blur!","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Int32"}],"args_string":"(value : Int32) : self","args_html":"(value : Int32) : self","location":{"filename":"src/cr-image/operation/horizontal_blur.cr","line_number":18,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/horizontal_blur.cr#L18"},"def":{"name":"horizontal_blur!","args":[{"name":"value","external_name":"value","restriction":"Int32"}],"return_type":"self","visibility":"Public","body":"buffer = Bytes.new(size, 0)\nmultiplier = 1 / ((value + value) + 1)\neach_channel do |channel|\n @height.times do |y|\n c_index : Int32 = y * @width\n l_index : Int32 = c_index\n r_index : Int32 = c_index + value\n f_value : Int32 = (channel.unsafe_fetch(c_index)).to_i\n l_value : Int32 = (channel.unsafe_fetch((c_index + @width) - 1)).to_i\n c_value : Int32 = (value + 1) * f_value\n (0..(value - 1)).each do\n c_value = c_value + (channel.unsafe_fetch(c_index))\n end\n (0..value).each do\n c_value = c_value + ((channel.unsafe_fetch(r_index)).to_i - f_value)\n buffer.unsafe_put(c_index, ((c_value * multiplier).clamp(0, 255)).to_u8)\n r_index = r_index + 1\n c_index = c_index + 1\n end\n ((value + 1)..((@width - value) - 1)).each do\n c_value = c_value + ((channel.unsafe_fetch(r_index)).to_i - (channel.unsafe_fetch(l_index)).to_i)\n buffer.unsafe_put(c_index, ((c_value * multiplier).clamp(0, 255)).to_u8)\n r_index = r_index + 1\n l_index = l_index + 1\n c_index = c_index + 1\n end\n ((@width - value)..(@width - 1)).each do\n c_value = c_value + (l_value - (channel.unsafe_fetch(l_index)).to_i)\n buffer.unsafe_put(c_index, ((c_value * multiplier).clamp(0, 255)).to_u8)\n l_index = l_index + 1\n c_index = c_index + 1\n end\n end\n (channel.@buffer).copy_from(buffer.to_unsafe, buffer.size)\nend\nself\n"}}]},{"html_id":"cr-image/CrImage/Operation/MaskApply","path":"CrImage/Operation/MaskApply.html","kind":"module","full_name":"CrImage::Operation::MaskApply","name":"MaskApply","abstract":false,"locations":[{"filename":"src/cr-image/operation/mask_apply.cr","line_number":27,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/mask_apply.cr#L27"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"cr-image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"cr-image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"cr-image/CrImage/Operation","kind":"module","full_name":"CrImage::Operation","name":"Operation"},"doc":"Apply a mask to an image\n\nTaking sample `image`:\n\n\"Woman\n\nAnd mask\n\n\"Black\n\n```\nmask = CrImage::Mask.new(image, false)\nmask[50..90, 65..75] = true\nmask.to_gray.save(\"apply_mask_mask.jpg\")\n\nimage.apply(mask).save(\"apply_mask.jpg\")\n\nimage.apply_color(mask, CrImage::Color.of(\"#00f\")).save(\"apply_mask_color.jpg\")\n\nimage.apply(mask) do |x, y, pixel, channel_type|\n Math.min(255, pixel + 50).to_u8 if channel_type.blue?\nend.save(\"apply_mask_block.jpg\")\n```\n\"Image\n\"Thin\n\"Thin","summary":"

        Apply a mask to an image

        ","instance_methods":[{"html_id":"apply(mask:Mask):self-instance-method","name":"apply","doc":"Black out all pixels but those found in the mask","summary":"

        Black out all pixels but those found in the mask

        ","abstract":false,"args":[{"name":"mask","external_name":"mask","restriction":"Mask"}],"args_string":"(mask : Mask) : self","args_html":"(mask : Mask) : self","location":{"filename":"src/cr-image/operation/mask_apply.cr","line_number":29,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/mask_apply.cr#L29"},"def":{"name":"apply","args":[{"name":"mask","external_name":"mask","restriction":"Mask"}],"return_type":"self","visibility":"Public","body":"clone.apply!(mask)"}},{"html_id":"apply(mask:Mask,&block:Int32,Int32,UInt8,ChannelType->UInt8|Nil):self-instance-method","name":"apply","doc":"Apply block to all pixels that match mask, replacing pixel value if block returns non-nil value.\n\nDoes not change values not matched by the mask","summary":"

        Apply block to all pixels that match mask, replacing pixel value if block returns non-nil value.

        ","abstract":false,"args":[{"name":"mask","external_name":"mask","restriction":"Mask"}],"args_string":"(mask : Mask, &block : Int32, Int32, UInt8, ChannelType -> UInt8 | Nil) : self","args_html":"(mask : Mask, &block : Int32, Int32, UInt8, ChannelType -> UInt8 | Nil) : self","location":{"filename":"src/cr-image/operation/mask_apply.cr","line_number":36,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/mask_apply.cr#L36"},"def":{"name":"apply","args":[{"name":"mask","external_name":"mask","restriction":"Mask"}],"yields":4,"block_arity":4,"block_arg":{"name":"block","external_name":"block","restriction":"(Int32, Int32, UInt8, ChannelType -> UInt8 | ::Nil)"},"return_type":"self","visibility":"Public","body":"clone.apply!(mask, &block)"}},{"html_id":"apply!(mask:Mask):self-instance-method","name":"apply!","doc":"TODO: add apply version that accepts 1+ ChannelType that the mask should apply to (i.e. make a background completely transparent, not just transparent black)","summary":"

        TODO add apply version that accepts 1+ ChannelType that the mask should apply to (i.e.

        ","abstract":false,"args":[{"name":"mask","external_name":"mask","restriction":"Mask"}],"args_string":"(mask : Mask) : self","args_html":"(mask : Mask) : self","location":{"filename":"src/cr-image/operation/mask_apply.cr","line_number":46,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/mask_apply.cr#L46"},"def":{"name":"apply!","args":[{"name":"mask","external_name":"mask","restriction":"Mask"}],"return_type":"self","visibility":"Public","body":"if (mask.width == width) && (mask.height == height)\nelse\n raise(\"Mask of #{mask.width}x#{mask.height} doesn't match image dimensions #{width}x#{height}\")\nend\neach_channel do |channel|\n channel.map_with_index! do |pixel, i|\n mask.at(i) ? pixel : 0_u8\n end\nend\nself\n"}},{"html_id":"apply!(mask:Mask,&block:Int32,Int32,UInt8,ChannelType->UInt8|Nil):self-instance-method","name":"apply!","abstract":false,"args":[{"name":"mask","external_name":"mask","restriction":"Mask"}],"args_string":"(mask : Mask, &block : Int32, Int32, UInt8, ChannelType -> UInt8 | Nil) : self","args_html":"(mask : Mask, &block : Int32, Int32, UInt8, ChannelType -> UInt8 | Nil) : self","location":{"filename":"src/cr-image/operation/mask_apply.cr","line_number":55,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/mask_apply.cr#L55"},"def":{"name":"apply!","args":[{"name":"mask","external_name":"mask","restriction":"Mask"}],"yields":4,"block_arity":4,"block_arg":{"name":"block","external_name":"block","restriction":"(Int32, Int32, UInt8, ChannelType -> UInt8 | ::Nil)"},"return_type":"self","visibility":"Public","body":"if (mask.width == width) && (mask.height == height)\nelse\n raise(\"Mask of #{mask.width}x#{mask.height} doesn't match image dimensions #{width}x#{height}\")\nend\neach_channel do |channel, channel_type|\n channel.map_with_index! do |pixel, i|\n mask.at(i) ? (block.call(i % width, i // width, pixel, channel_type)) || pixel : pixel\n end\nend\nself\n"}},{"html_id":"apply_color(mask:Mask,color:Color):self-instance-method","name":"apply_color","doc":"Change the color of all pixels that match the mask","summary":"

        Change the color of all pixels that match the mask

        ","abstract":false,"args":[{"name":"mask","external_name":"mask","restriction":"Mask"},{"name":"color","external_name":"color","restriction":"Color"}],"args_string":"(mask : Mask, color : Color) : self","args_html":"(mask : Mask, color : Color) : self","location":{"filename":"src/cr-image/operation/mask_apply.cr","line_number":41,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/mask_apply.cr#L41"},"def":{"name":"apply_color","args":[{"name":"mask","external_name":"mask","restriction":"Mask"},{"name":"color","external_name":"color","restriction":"Color"}],"return_type":"self","visibility":"Public","body":"clone.apply_color!(mask, color)"}},{"html_id":"apply_color!(mask:Mask,color:Color):self-instance-method","name":"apply_color!","abstract":false,"args":[{"name":"mask","external_name":"mask","restriction":"Mask"},{"name":"color","external_name":"color","restriction":"Color"}],"args_string":"(mask : Mask, color : Color) : self","args_html":"(mask : Mask, color : Color) : self","location":{"filename":"src/cr-image/operation/mask_apply.cr","line_number":66,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/mask_apply.cr#L66"},"def":{"name":"apply_color!","args":[{"name":"mask","external_name":"mask","restriction":"Mask"},{"name":"color","external_name":"color","restriction":"Color"}],"return_type":"self","visibility":"Public","body":"apply!(mask) do |_, _, _, channel_type|\n color[channel_type]\nend"}}]},{"html_id":"cr-image/CrImage/Operation/VerticalBlur","path":"CrImage/Operation/VerticalBlur.html","kind":"module","full_name":"CrImage::Operation::VerticalBlur","name":"VerticalBlur","abstract":false,"locations":[{"filename":"src/cr-image/operation/vertical_blur.cr","line_number":13,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/vertical_blur.cr#L13"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"cr-image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"cr-image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"cr-image/CrImage/Operation","kind":"module","full_name":"CrImage::Operation","name":"Operation"},"doc":"Blur an image along the vertical axis\n\nTaking sample `image`:\n\n\"Woman\n\n```\nimage.vertical_blur(1).save(\"vertical_1_sample.jpg\")\nimage.vertical_blur(5).save(\"vertical_5_sample.jpg\")\n```\n\"Blurred\n\"Blurred","summary":"

        Blur an image along the vertical axis

        ","instance_methods":[{"html_id":"vertical_blur(value:Int32):self-instance-method","name":"vertical_blur","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Int32"}],"args_string":"(value : Int32) : self","args_html":"(value : Int32) : self","location":{"filename":"src/cr-image/operation/vertical_blur.cr","line_number":14,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/vertical_blur.cr#L14"},"def":{"name":"vertical_blur","args":[{"name":"value","external_name":"value","restriction":"Int32"}],"return_type":"self","visibility":"Public","body":"clone.vertical_blur!(value)"}},{"html_id":"vertical_blur!(value:Int32):self-instance-method","name":"vertical_blur!","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Int32"}],"args_string":"(value : Int32) : self","args_html":"(value : Int32) : self","location":{"filename":"src/cr-image/operation/vertical_blur.cr","line_number":18,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/operation/vertical_blur.cr#L18"},"def":{"name":"vertical_blur!","args":[{"name":"value","external_name":"value","restriction":"Int32"}],"return_type":"self","visibility":"Public","body":"buffer = Bytes.new(size, 0)\nmultiplier = 1 / ((value + value) + 1)\neach_channel do |channel|\n @width.times do |x|\n c_index : Int32 = x\n l_index : Int32 = c_index\n r_index : Int32 = c_index + (value * @width)\n f_value : Int32 = (channel.unsafe_fetch(c_index)).to_i\n l_value : Int32 = (channel.unsafe_fetch(c_index + (@width * (@height - 1)))).to_i\n c_value : Int32 = (value + 1) * f_value\n (0..(value - 1)).each do\n c_value = c_value + (channel.unsafe_fetch(c_index))\n end\n (0..value).each do\n c_value = c_value + ((channel.unsafe_fetch(r_index)).to_i - f_value)\n buffer.unsafe_put(c_index, ((c_value * multiplier).clamp(0, 255)).to_u8)\n r_index = r_index + @width\n c_index = c_index + @width\n end\n ((value + 1)..((@height - value) - 1)).each do\n c_value = c_value + ((channel.unsafe_fetch(r_index)).to_i - (channel.unsafe_fetch(l_index)).to_i)\n buffer.unsafe_put(c_index, ((c_value * multiplier).clamp(0, 255)).to_u8)\n l_index = l_index + @width\n r_index = r_index + @width\n c_index = c_index + @width\n end\n ((@height - value)..(@height - 1)).each do\n c_value = c_value + (l_value - (channel.unsafe_fetch(l_index)).to_i)\n buffer.unsafe_put(c_index, ((c_value * multiplier).clamp(0, 255)).to_u8)\n l_index = l_index + @width\n c_index = c_index + @width\n end\n end\n (channel.@buffer).copy_from(buffer.to_unsafe, buffer.size)\nend\nself\n"}}]}]},{"html_id":"cr-image/CrImage/Region","path":"CrImage/Region.html","kind":"struct","full_name":"CrImage::Region","name":"Region","abstract":false,"superclass":{"html_id":"cr-image/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"cr-image/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"cr-image/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"cr-image/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cr-image/region.cr","line_number":5,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/region.cr#L5"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"cr-image/CrImage","kind":"module","full_name":"CrImage","name":"CrImage"},"doc":"Represents a rectangular area on an `Image` from its upper left corner `x` and `y` coordinates, and a `width` and `height`.\n\nSee `Operation::Crop#crop` and `Operation::Draw#draw_square` for examples using it.","summary":"

        Represents a rectangular area on an Image from its upper left corner #x and #y coordinates, and a #width and #height.

        ","constructors":[{"html_id":"center(x:UInt16,y:UInt16,width:UInt16,height:UInt16):Region-class-method","name":"center","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"UInt16"},{"name":"y","external_name":"y","restriction":"UInt16"},{"name":"width","external_name":"width","restriction":"UInt16"},{"name":"height","external_name":"height","restriction":"UInt16"}],"args_string":"(x : UInt16, y : UInt16, width : UInt16, height : UInt16) : Region","args_html":"(x : UInt16, y : UInt16, width : UInt16, height : UInt16) : Region","location":{"filename":"src/cr-image/region.cr","line_number":11,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/region.cr#L11"},"def":{"name":"center","args":[{"name":"x","external_name":"x","restriction":"UInt16"},{"name":"y","external_name":"y","restriction":"UInt16"},{"name":"width","external_name":"width","restriction":"UInt16"},{"name":"height","external_name":"height","restriction":"UInt16"}],"return_type":"Region","visibility":"Public","body":"new(x - (width // 2), y - (height // 2), width, height)"}},{"html_id":"new(x:UInt16,y:UInt16,width:UInt16,height:UInt16)-class-method","name":"new","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"UInt16"},{"name":"y","external_name":"y","restriction":"UInt16"},{"name":"width","external_name":"width","restriction":"UInt16"},{"name":"height","external_name":"height","restriction":"UInt16"}],"args_string":"(x : UInt16, y : UInt16, width : UInt16, height : UInt16)","args_html":"(x : UInt16, y : UInt16, width : UInt16, height : UInt16)","location":{"filename":"src/cr-image/region.cr","line_number":5,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/region.cr#L5"},"def":{"name":"new","args":[{"name":"x","external_name":"x","restriction":"UInt16"},{"name":"y","external_name":"y","restriction":"UInt16"},{"name":"width","external_name":"width","restriction":"UInt16"},{"name":"height","external_name":"height","restriction":"UInt16"}],"visibility":"Public","body":"_ = allocate\n_.initialize(x, y, width, height)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"center:Tuple(Int32,Int32)-instance-method","name":"center","doc":"Return the `{x, y}` tuple of the center coordinates of this `Region`","summary":"

        Return the {x, y} tuple of the center coordinates of this Region

        ","abstract":false,"location":{"filename":"src/cr-image/region.cr","line_number":21,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/region.cr#L21"},"def":{"name":"center","return_type":"Tuple(Int32, Int32)","visibility":"Public","body":"{(width.to_i // 2) + x.to_i, (height.to_i // 2) + y.to_i}"}},{"html_id":"clone-instance-method","name":"clone","abstract":false,"location":{"filename":"src/cr-image/region.cr","line_number":5,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/region.cr#L5"},"def":{"name":"clone","visibility":"Public","body":"self.class.new(@x.clone, @y.clone, @width.clone, @height.clone)"}},{"html_id":"copy_with(x_x=@x,y_y=@y,width_width=@width,height_height=@height)-instance-method","name":"copy_with","abstract":false,"args":[{"name":"_x","default_value":"@x","external_name":"x","restriction":""},{"name":"_y","default_value":"@y","external_name":"y","restriction":""},{"name":"_width","default_value":"@width","external_name":"width","restriction":""},{"name":"_height","default_value":"@height","external_name":"height","restriction":""}],"args_string":"(x _x = @x, y _y = @y, width _width = @width, height _height = @height)","args_html":"(x _x = @x, y _y = @y, width _width = @width, height _height = @height)","location":{"filename":"src/cr-image/region.cr","line_number":5,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/region.cr#L5"},"def":{"name":"copy_with","args":[{"name":"_x","default_value":"@x","external_name":"x","restriction":""},{"name":"_y","default_value":"@y","external_name":"y","restriction":""},{"name":"_width","default_value":"@width","external_name":"width","restriction":""},{"name":"_height","default_value":"@height","external_name":"height","restriction":""}],"visibility":"Public","body":"self.class.new(_x, _y, _width, _height)"}},{"html_id":"crop(image:Image):Image-instance-method","name":"crop","doc":"Crop a provided `Image` with this region, using `Operation::Crop#crop`","summary":"

        Crop a provided Image with this region, using Operation::Crop#crop

        ","abstract":false,"args":[{"name":"image","external_name":"image","restriction":"Image"}],"args_string":"(image : Image) : Image","args_html":"(image : Image) : Image","location":{"filename":"src/cr-image/region.cr","line_number":16,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/region.cr#L16"},"def":{"name":"crop","args":[{"name":"image","external_name":"image","restriction":"Image"}],"return_type":"Image","visibility":"Public","body":"image.crop(self)"}},{"html_id":"height:UInt16-instance-method","name":"height","abstract":false,"def":{"name":"height","return_type":"UInt16","visibility":"Public","body":"@height"}},{"html_id":"to_tuple:Tuple(Int32,Int32,Int32,Int32)-instance-method","name":"to_tuple","doc":"Return this `Region` as a `x`, `y`, `width`, and `height` tuple","summary":"

        Return this Region as a #x, #y, #width, and #height tuple

        ","abstract":false,"location":{"filename":"src/cr-image/region.cr","line_number":26,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/region.cr#L26"},"def":{"name":"to_tuple","return_type":"Tuple(Int32, Int32, Int32, Int32)","visibility":"Public","body":"{x.to_i, y.to_i, width.to_i, height.to_i}"}},{"html_id":"width:UInt16-instance-method","name":"width","abstract":false,"def":{"name":"width","return_type":"UInt16","visibility":"Public","body":"@width"}},{"html_id":"x:UInt16-instance-method","name":"x","abstract":false,"def":{"name":"x","return_type":"UInt16","visibility":"Public","body":"@x"}},{"html_id":"y:UInt16-instance-method","name":"y","abstract":false,"def":{"name":"y","return_type":"UInt16","visibility":"Public","body":"@y"}}]},{"html_id":"cr-image/CrImage/RGBAImage","path":"CrImage/RGBAImage.html","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage","abstract":false,"superclass":{"html_id":"cr-image/CrImage/Image","kind":"class","full_name":"CrImage::Image","name":"Image"},"ancestors":[{"html_id":"cr-image/CrImage/Operation/MaskApply","kind":"module","full_name":"CrImage::Operation::MaskApply","name":"MaskApply"},{"html_id":"cr-image/CrImage/Format/Save","kind":"module","full_name":"CrImage::Format::Save","name":"Save"},{"html_id":"cr-image/CrImage/Operation/HistogramEqualize","kind":"module","full_name":"CrImage::Operation::HistogramEqualize","name":"HistogramEqualize"},{"html_id":"cr-image/CrImage/Operation/Draw","kind":"module","full_name":"CrImage::Operation::Draw","name":"Draw"},{"html_id":"cr-image/CrImage/Operation/Crop","kind":"module","full_name":"CrImage::Operation::Crop","name":"Crop"},{"html_id":"cr-image/CrImage/Operation/VerticalBlur","kind":"module","full_name":"CrImage::Operation::VerticalBlur","name":"VerticalBlur"},{"html_id":"cr-image/CrImage/Operation/HorizontalBlur","kind":"module","full_name":"CrImage::Operation::HorizontalBlur","name":"HorizontalBlur"},{"html_id":"cr-image/CrImage/Operation/GaussianBlur","kind":"module","full_name":"CrImage::Operation::GaussianBlur","name":"GaussianBlur"},{"html_id":"cr-image/CrImage/Operation/Contrast","kind":"module","full_name":"CrImage::Operation::Contrast","name":"Contrast"},{"html_id":"cr-image/CrImage/Operation/ChannelSwap","kind":"module","full_name":"CrImage::Operation::ChannelSwap","name":"ChannelSwap"},{"html_id":"cr-image/CrImage/Operation/Brightness","kind":"module","full_name":"CrImage::Operation::Brightness","name":"Brightness"},{"html_id":"cr-image/CrImage/Operation/BoxBlur","kind":"module","full_name":"CrImage::Operation::BoxBlur","name":"BoxBlur"},{"html_id":"cr-image/CrImage/Operation/BilinearResize","kind":"module","full_name":"CrImage::Operation::BilinearResize","name":"BilinearResize"},{"html_id":"cr-image/CrImage/Format/PPM","kind":"module","full_name":"CrImage::Format::PPM","name":"PPM"},{"html_id":"cr-image/CrImage/Image","kind":"class","full_name":"CrImage::Image","name":"Image"},{"html_id":"cr-image/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"cr-image/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cr-image/rgba_image.cr","line_number":2,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/rgba_image.cr#L2"}],"repository_name":"cr-image","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"cr-image/CrImage/Format/PPM","kind":"module","full_name":"CrImage::Format::PPM","name":"PPM"},{"html_id":"cr-image/CrImage/Format/Save","kind":"module","full_name":"CrImage::Format::Save","name":"Save"},{"html_id":"cr-image/CrImage/Operation/BilinearResize","kind":"module","full_name":"CrImage::Operation::BilinearResize","name":"BilinearResize"},{"html_id":"cr-image/CrImage/Operation/BoxBlur","kind":"module","full_name":"CrImage::Operation::BoxBlur","name":"BoxBlur"},{"html_id":"cr-image/CrImage/Operation/Brightness","kind":"module","full_name":"CrImage::Operation::Brightness","name":"Brightness"},{"html_id":"cr-image/CrImage/Operation/ChannelSwap","kind":"module","full_name":"CrImage::Operation::ChannelSwap","name":"ChannelSwap"},{"html_id":"cr-image/CrImage/Operation/Contrast","kind":"module","full_name":"CrImage::Operation::Contrast","name":"Contrast"},{"html_id":"cr-image/CrImage/Operation/Crop","kind":"module","full_name":"CrImage::Operation::Crop","name":"Crop"},{"html_id":"cr-image/CrImage/Operation/Draw","kind":"module","full_name":"CrImage::Operation::Draw","name":"Draw"},{"html_id":"cr-image/CrImage/Operation/GaussianBlur","kind":"module","full_name":"CrImage::Operation::GaussianBlur","name":"GaussianBlur"},{"html_id":"cr-image/CrImage/Operation/HistogramEqualize","kind":"module","full_name":"CrImage::Operation::HistogramEqualize","name":"HistogramEqualize"},{"html_id":"cr-image/CrImage/Operation/HorizontalBlur","kind":"module","full_name":"CrImage::Operation::HorizontalBlur","name":"HorizontalBlur"},{"html_id":"cr-image/CrImage/Operation/MaskApply","kind":"module","full_name":"CrImage::Operation::MaskApply","name":"MaskApply"},{"html_id":"cr-image/CrImage/Operation/VerticalBlur","kind":"module","full_name":"CrImage::Operation::VerticalBlur","name":"VerticalBlur"}],"extended_modules":[{"html_id":"cr-image/CrImage/Format/Open","kind":"module","full_name":"CrImage::Format::Open","name":"Open"}],"namespace":{"html_id":"cr-image/CrImage","kind":"module","full_name":"CrImage","name":"CrImage"},"doc":"An image with red, green, blue, and alpha color channels (i.e. a color image). This image type is likely the one read from and written to file (or `IO`).","summary":"

        An image with red, green, blue, and alpha color channels (i.e.

        ","constructors":[{"html_id":"from_ppm(image_data:Bytes):self-class-method","name":"from_ppm","doc":"Read `image_data` as PPM encoded bytes","summary":"

        Read image_data as PPM encoded bytes

        ","abstract":false,"args":[{"name":"image_data","external_name":"image_data","restriction":"Bytes"}],"args_string":"(image_data : Bytes) : self","args_html":"(image_data : Bytes) : self","def":{"name":"from_ppm","args":[{"name":"image_data","external_name":"image_data","restriction":"Bytes"}],"return_type":"self","visibility":"Public","body":"from_ppm(IO::Memory.new(image_data))"}},{"html_id":"from_ppm(io:IO):self-class-method","name":"from_ppm","doc":"Read bytes from `io` as PPM encoded","summary":"

        Read bytes from io as PPM encoded

        ","abstract":false,"args":[{"name":"io","external_name":"io","restriction":"IO"}],"args_string":"(io : IO) : self","args_html":"(io : IO) : self","def":{"name":"from_ppm","args":[{"name":"io","external_name":"io","restriction":"IO"}],"return_type":"self","visibility":"Public","body":"_magic_number = io.gets(\"\\n\", chomp: true)\nwidth = (io.gets(\" \", chomp: true)).try(&.to_i)\nheight = (io.gets(\"\\n\", chomp: true)).try(&.to_i)\n_maximum_color_value = io.gets(\"\\n\", chomp: true)\nif width && height\n red = Array.new(width * height) do\n 0_u8\n end\n green = Array.new(width * height) do\n 0_u8\n end\n blue = Array.new(width * height) do\n 0_u8\n end\n alpha = Array.new(width * height) do\n 255_u8\n end\n (width * height).times do |index|\n red_byte = io.read_byte\n green_byte = io.read_byte\n blue_byte = io.read_byte\n if (red_byte && green_byte) && blue_byte\n red.unsafe_put(index, red_byte)\n green.unsafe_put(index, green_byte)\n blue.unsafe_put(index, blue_byte)\n else\n raise(\"The image ends prematurely\")\n end\n end\n new(red, green, blue, alpha, width, height)\nelse\n raise(\"The image doesn't have width or height\")\nend\n"}},{"html_id":"new(red:Array(UInt8),green:Array(UInt8),blue:Array(UInt8),alpha:Array(UInt8),width:Int32,height:Int32)-class-method","name":"new","abstract":false,"args":[{"name":"red","external_name":"red","restriction":"::Array(::UInt8)"},{"name":"green","external_name":"green","restriction":"::Array(::UInt8)"},{"name":"blue","external_name":"blue","restriction":"::Array(::UInt8)"},{"name":"alpha","external_name":"alpha","restriction":"::Array(::UInt8)"},{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"height","external_name":"height","restriction":"::Int32"}],"args_string":"(red : Array(UInt8), green : Array(UInt8), blue : Array(UInt8), alpha : Array(UInt8), width : Int32, height : Int32)","args_html":"(red : Array(UInt8), green : Array(UInt8), blue : Array(UInt8), alpha : Array(UInt8), width : Int32, height : Int32)","location":{"filename":"src/cr-image/rgba_image.cr","line_number":10,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/rgba_image.cr#L10"},"def":{"name":"new","args":[{"name":"red","external_name":"red","restriction":"::Array(::UInt8)"},{"name":"green","external_name":"green","restriction":"::Array(::UInt8)"},{"name":"blue","external_name":"blue","restriction":"::Array(::UInt8)"},{"name":"alpha","external_name":"alpha","restriction":"::Array(::UInt8)"},{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"height","external_name":"height","restriction":"::Int32"}],"visibility":"Public","body":"_ = allocate\n_.initialize(red, green, blue, alpha, width, height)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"[](channel_type:ChannelType):Array(UInt8)-instance-method","name":"[]","doc":"Return the channel corresponding to `channel_type`","summary":"

        Return the channel corresponding to channel_type

        ","abstract":false,"args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"}],"args_string":"(channel_type : ChannelType) : Array(UInt8)","args_html":"(channel_type : ChannelType) : Array(UInt8)","location":{"filename":"src/cr-image/rgba_image.cr","line_number":35,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/rgba_image.cr#L35"},"def":{"name":"[]","args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"}],"return_type":"Array(UInt8)","visibility":"Public","body":"case channel_type\nwhen ChannelType::Red\n @red\nwhen ChannelType::Green\n @green\nwhen ChannelType::Blue\n @blue\nwhen ChannelType::Alpha\n @alpha\nelse\n raise(\"Unknown channel type #{channel_type} for RGBAImage\")\nend"}},{"html_id":"[]=(channel_type:ChannelType,channel:Array(UInt8)):Array(UInt8)-instance-method","name":"[]=","doc":"Set the corresponding `channel_type` with `channel`","summary":"

        Set the corresponding channel_type with channel

        ","abstract":false,"args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"},{"name":"channel","external_name":"channel","restriction":"Array(UInt8)"}],"args_string":"(channel_type : ChannelType, channel : Array(UInt8)) : Array(UInt8)","args_html":"(channel_type : ChannelType, channel : Array(UInt8)) : Array(UInt8)","location":{"filename":"src/cr-image/rgba_image.cr","line_number":46,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/rgba_image.cr#L46"},"def":{"name":"[]=","args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"},{"name":"channel","external_name":"channel","restriction":"Array(UInt8)"}],"return_type":"Array(UInt8)","visibility":"Public","body":"case channel_type\nwhen ChannelType::Red\n @red = channel\nwhen ChannelType::Green\n @green = channel\nwhen ChannelType::Blue\n @blue = channel\nwhen ChannelType::Alpha\n @alpha = channel\nelse\n raise(\"Unknown channel type #{channel_type} for RGBAImage\")\nend"}},{"html_id":"alpha:Array(UInt8)-instance-method","name":"alpha","doc":"Return the alpha channel","summary":"

        Return the alpha channel

        ","abstract":false,"location":{"filename":"src/cr-image/rgba_image.cr","line_number":6,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/rgba_image.cr#L6"},"def":{"name":"alpha","return_type":"Array(UInt8)","visibility":"Public","body":"@alpha"}},{"html_id":"alpha=(alpha:Array(UInt8))-instance-method","name":"alpha=","abstract":false,"args":[{"name":"alpha","external_name":"alpha","restriction":"Array(UInt8)"}],"args_string":"(alpha : Array(UInt8))","args_html":"(alpha : Array(UInt8))","location":{"filename":"src/cr-image/rgba_image.cr","line_number":6,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/rgba_image.cr#L6"},"def":{"name":"alpha=","args":[{"name":"alpha","external_name":"alpha","restriction":"Array(UInt8)"}],"visibility":"Public","body":"@alpha = alpha"}},{"html_id":"blue:Array(UInt8)-instance-method","name":"blue","doc":"Return the blue channel","summary":"

        Return the blue channel

        ","abstract":false,"location":{"filename":"src/cr-image/rgba_image.cr","line_number":5,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/rgba_image.cr#L5"},"def":{"name":"blue","return_type":"Array(UInt8)","visibility":"Public","body":"@blue"}},{"html_id":"blue=(blue:Array(UInt8))-instance-method","name":"blue=","abstract":false,"args":[{"name":"blue","external_name":"blue","restriction":"Array(UInt8)"}],"args_string":"(blue : Array(UInt8))","args_html":"(blue : Array(UInt8))","location":{"filename":"src/cr-image/rgba_image.cr","line_number":5,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/rgba_image.cr#L5"},"def":{"name":"blue=","args":[{"name":"blue","external_name":"blue","restriction":"Array(UInt8)"}],"visibility":"Public","body":"@blue = blue"}},{"html_id":"clone:RGBAImage-instance-method","name":"clone","doc":"Create a copy of this image","summary":"

        Create a copy of this image

        ","abstract":false,"location":{"filename":"src/cr-image/rgba_image.cr","line_number":14,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/rgba_image.cr#L14"},"def":{"name":"clone","return_type":"RGBAImage","visibility":"Public","body":"self.class.new(@red.clone, @green.clone, @blue.clone, @alpha.clone, @width, @height)"}},{"html_id":"each_channel(&:Array(UInt8),ChannelType->Nil):Nil-instance-method","name":"each_channel","doc":"Run provided block with the `ChannelType::Red`, `ChannelType::Green`, `ChannelType::Blue`, and `ChannelType::Alpha` channels.","summary":"

        Run provided block with the ChannelType::Red, ChannelType::Green, ChannelType::Blue, and ChannelType::Alpha channels.

        ","abstract":false,"location":{"filename":"src/cr-image/rgba_image.cr","line_number":26,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/rgba_image.cr#L26"},"def":{"name":"each_channel","yields":2,"block_arity":2,"block_arg":{"name":"","external_name":"","restriction":"(Array(UInt8), ChannelType -> Nil)"},"return_type":"Nil","visibility":"Public","body":"yield @red, ChannelType::Red\nyield @green, ChannelType::Green\nyield @blue, ChannelType::Blue\nyield @alpha, ChannelType::Alpha\nnil\n"}},{"html_id":"green:Array(UInt8)-instance-method","name":"green","doc":"Return the green channel","summary":"

        Return the green channel

        ","abstract":false,"location":{"filename":"src/cr-image/rgba_image.cr","line_number":4,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/rgba_image.cr#L4"},"def":{"name":"green","return_type":"Array(UInt8)","visibility":"Public","body":"@green"}},{"html_id":"green=(green:Array(UInt8))-instance-method","name":"green=","abstract":false,"args":[{"name":"green","external_name":"green","restriction":"Array(UInt8)"}],"args_string":"(green : Array(UInt8))","args_html":"(green : Array(UInt8))","location":{"filename":"src/cr-image/rgba_image.cr","line_number":4,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/rgba_image.cr#L4"},"def":{"name":"green=","args":[{"name":"green","external_name":"green","restriction":"Array(UInt8)"}],"visibility":"Public","body":"@green = green"}},{"html_id":"height:Int32-instance-method","name":"height","doc":"Height of image","summary":"

        Height of image

        ","abstract":false,"location":{"filename":"src/cr-image/rgba_image.cr","line_number":8,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/rgba_image.cr#L8"},"def":{"name":"height","return_type":"Int32","visibility":"Public","body":"@height"}},{"html_id":"height=(height:Int32)-instance-method","name":"height=","abstract":false,"args":[{"name":"height","external_name":"height","restriction":"Int32"}],"args_string":"(height : Int32)","args_html":"(height : Int32)","location":{"filename":"src/cr-image/rgba_image.cr","line_number":8,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/rgba_image.cr#L8"},"def":{"name":"height=","args":[{"name":"height","external_name":"height","restriction":"Int32"}],"visibility":"Public","body":"@height = height"}},{"html_id":"red:Array(UInt8)-instance-method","name":"red","doc":"Return the red channel","summary":"

        Return the red channel

        ","abstract":false,"location":{"filename":"src/cr-image/rgba_image.cr","line_number":3,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/rgba_image.cr#L3"},"def":{"name":"red","return_type":"Array(UInt8)","visibility":"Public","body":"@red"}},{"html_id":"red=(red:Array(UInt8))-instance-method","name":"red=","abstract":false,"args":[{"name":"red","external_name":"red","restriction":"Array(UInt8)"}],"args_string":"(red : Array(UInt8))","args_html":"(red : Array(UInt8))","location":{"filename":"src/cr-image/rgba_image.cr","line_number":3,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/rgba_image.cr#L3"},"def":{"name":"red=","args":[{"name":"red","external_name":"red","restriction":"Array(UInt8)"}],"visibility":"Public","body":"@red = red"}},{"html_id":"size:Int32-instance-method","name":"size","doc":"Return the number of pixels in this image","summary":"

        Return the number of pixels in this image

        ","abstract":false,"location":{"filename":"src/cr-image/rgba_image.cr","line_number":74,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/rgba_image.cr#L74"},"def":{"name":"size","return_type":"Int32","visibility":"Public","body":"@width * @height"}},{"html_id":"to_gray(red_multiplier:Float=0.299,green_multiplier:Float=0.587,blue_multiplier:Float=0.114):GrayscaleImage-instance-method","name":"to_gray","doc":"Convert color image to `GrayscaleImage`, using the NTSC formula as default values.\n\n\"Woman\n\nBecomes\n\n\"Woman","summary":"

        Convert color image to GrayscaleImage, using the NTSC formula as default values.

        ","abstract":false,"args":[{"name":"red_multiplier","default_value":"0.299","external_name":"red_multiplier","restriction":"Float"},{"name":"green_multiplier","default_value":"0.587","external_name":"green_multiplier","restriction":"Float"},{"name":"blue_multiplier","default_value":"0.114","external_name":"blue_multiplier","restriction":"Float"}],"args_string":"(red_multiplier : Float = 0.299, green_multiplier : Float = 0.587, blue_multiplier : Float = 0.114) : GrayscaleImage","args_html":"(red_multiplier : Float = 0.299, green_multiplier : Float = 0.587, blue_multiplier : Float = 0.114) : GrayscaleImage","location":{"filename":"src/cr-image/rgba_image.cr","line_number":63,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/rgba_image.cr#L63"},"def":{"name":"to_gray","args":[{"name":"red_multiplier","default_value":"0.299","external_name":"red_multiplier","restriction":"Float"},{"name":"green_multiplier","default_value":"0.587","external_name":"green_multiplier","restriction":"Float"},{"name":"blue_multiplier","default_value":"0.114","external_name":"blue_multiplier","restriction":"Float"}],"return_type":"GrayscaleImage","visibility":"Public","body":"GrayscaleImage.new(red.map_with_index do |red_pix, i|\n (Math.min(255, ((red_pix * red_multiplier) + (@green[i] * green_multiplier)) + (@blue[i] * blue_multiplier))).to_u8\nend, width, height)"}},{"html_id":"width:Int32-instance-method","name":"width","doc":"Width of image","summary":"

        Width of image

        ","abstract":false,"location":{"filename":"src/cr-image/rgba_image.cr","line_number":7,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/rgba_image.cr#L7"},"def":{"name":"width","return_type":"Int32","visibility":"Public","body":"@width"}},{"html_id":"width=(width:Int32)-instance-method","name":"width=","abstract":false,"args":[{"name":"width","external_name":"width","restriction":"Int32"}],"args_string":"(width : Int32)","args_html":"(width : Int32)","location":{"filename":"src/cr-image/rgba_image.cr","line_number":7,"url":"https://github.com/Vici37/cr-image/blob/058a55cab939a7442a43c0b19c5a129e0ed5c02a/src/cr-image/rgba_image.cr#L7"},"def":{"name":"width=","args":[{"name":"width","external_name":"width","restriction":"Int32"}],"visibility":"Public","body":"@width = width"}}]}]}]}}) \ No newline at end of file +crystal_doc_search_index_callback({"repository_name":"Crystal Image","body":"

        Crystal Image (Processing)

        \n\nThis shard aims to provide feature rich image processing abilities, both for the purpose of\nimage manipulation as well as feature / information extraction from those images.\n\nThe code here takes imense inspiration from [Pluto](https://github.com/phenopolis/pluto) and [Stumpy](https://github.com/stumpycr/stumpy_core), with\nan eventual goal to be able to convert between images of this and those libraries.\n\nAll sample images used are from [Unsplash](https://unsplash.com/).\n\n## Installation\n\n1. Add the dependency to your `shard.yml`:\n\n ```yaml\n dependencies:\n cr-image:\n github: vici37/cr-image\n ```\n\n2. Run `shards install`\n\n## Usage\n\nCrImage supports the formats:\n* PPM\n* JPEG (requires `libturbojpeg`)\n* PNG (requirens `libspng`)\n* WebP (requires `libwebp`)\n\nFor the formats that require a linked library, they must be `require`d explicitly:\n\n```crystal\nrequire \"cr-image\"\nrequire \"cr-image/jpeg\"\nrequire \"cr-image/png\"\nrequire \"cr-image/webp\"\n\n# Or, alternatively\nrequire \"cr-image/all_formats\"\n```\n\n### Example\n\nAssuming an image `moon.jpg` already exists\n\n\"Picture\n\n```crystal\nrequire \"cr-image\"\n\nimage = CrImage::RGBAImage.open(\"moon.jpg\")\n\n# create a mask identifying all pixels with light (i.e. the moon)\nmoon_mask = image\n .to_gray\n .threshold(8) # pixels are UInt8, with 0 as black and 255 as white\n\n# Crop out the moon from the image, and save it to a new file\nimage.crop(\n moon_mask.region # smallest area that encompasses all true bits in mask\n).save(\"moon_cropped.jpg\")\n\n```\n\nYields this image:\n\n\"Cropped\n\n[See documentation](http://troy.sornson.io/cr-image/) for more examples.\n\n### (Pluto)[https://github.com/phenopolis/pluto] and (Stumpy)[https://github.com/stumpycr/stumpy_core] Conversion\n\nIf your library or application already uses Pluto or Stumpy and you want to use\nsome of the functionality of this library, CrImage also provides some optional\nconversion methods:\n\n```crystal\nrequire \"cr-image/pluto\"\npluto_image # => Pluto::ImageRGBA\npluto_image_rgba.to_crimage # => CrImage::RGBAImage\n\ncr_image # => CrImage::RGBAImage\ncr_image.to_pluto # => Pluto::ImageRGBA\n```\n\n```crystal\nrequire \"cr-image/stumpy\"\nstumpy_canvas # => StumpyCore::Canvas\nstumpy_canvas.to_crimage # => CrImage::RGBAImage\n\ncr_image # => CrImage::RGBAImage\ncr_image.to_stumpy # => StumpyCore::Canvas\n```\n\n*NOTE:* Stumpy uses `UInt16` for its underlying raw image storage per channel per pixel, while Pluto and\nCrImage uses `UInt8`. Converting from a Stumpy `Canvas` object to `RGBAImage` may lose quality if the original\nimage used 16 bit color channels (i.e. 16-bit PNG). Most image formats tend to use 8-bit color channels.\n\n## Development\n\nThis requires `libwebp`, `libspng`, and `libturbojpeg` to run. Then:\n\n```\n> make test\n```\n\nTo ensure all tests run and pass.\n\n## Contributing\n\n1. [Fork it](https://github.com/Vici37/cr-image/fork)\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n- [Troy Sornson](https://github.com/Vici37) - creator and maintainer\n","program":{"html_id":"Crystal Image/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"locations":[],"repository_name":"Crystal Image","program":true,"enum":false,"alias":false,"const":false,"types":[{"html_id":"Crystal Image/CrImage","path":"CrImage.html","kind":"module","full_name":"CrImage","name":"CrImage","abstract":false,"locations":[{"filename":"src/cr-image/operation/bilinear_resize.cr","line_number":14,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/bilinear_resize.cr#L14"},{"filename":"src/cr-image/region.cr","line_number":1,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/region.cr#L1"},{"filename":"src/lib-formats/bindings/lib_jpeg_turbo.cr","line_number":1,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/lib-formats/bindings/lib_jpeg_turbo.cr#L1"},{"filename":"src/lib-formats/bindings/lib_spng.cr","line_number":1,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/lib-formats/bindings/lib_spng.cr#L1"},{"filename":"src/lib-formats/bindings/lib_webp.cr","line_number":1,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/lib-formats/bindings/lib_webp.cr#L1"},{"filename":"src/stumpy.cr","line_number":28,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/stumpy.cr#L28"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"types":[{"html_id":"Crystal Image/CrImage/ChannelType","path":"CrImage/ChannelType.html","kind":"enum","full_name":"CrImage::ChannelType","name":"ChannelType","abstract":false,"ancestors":[{"html_id":"Crystal Image/Enum","kind":"struct","full_name":"Enum","name":"Enum"},{"html_id":"Crystal Image/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"Crystal Image/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"Crystal Image/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cr-image/channel_type.cr","line_number":4,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/channel_type.cr#L4"}],"repository_name":"Crystal Image","program":false,"enum":true,"alias":false,"const":false,"constants":[{"id":"Red","name":"Red","value":"0"},{"id":"Green","name":"Green","value":"1"},{"id":"Blue","name":"Blue","value":"2"},{"id":"Gray","name":"Gray","value":"3"},{"id":"Alpha","name":"Alpha","value":"4"}],"namespace":{"html_id":"Crystal Image/CrImage","kind":"module","full_name":"CrImage","name":"CrImage"},"doc":"Enum representing different image channels supported by CrImage\n\nSee `RGBAImage#each_channel` and `GrayscaleImage#each_channel`","summary":"

        Enum representing different image channels supported by CrImage

        ","instance_methods":[{"html_id":"alpha?-instance-method","name":"alpha?","abstract":false,"location":{"filename":"src/cr-image/channel_type.cr","line_number":9,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/channel_type.cr#L9"},"def":{"name":"alpha?","visibility":"Public","body":"self == Alpha"}},{"html_id":"blue?-instance-method","name":"blue?","abstract":false,"location":{"filename":"src/cr-image/channel_type.cr","line_number":7,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/channel_type.cr#L7"},"def":{"name":"blue?","visibility":"Public","body":"self == Blue"}},{"html_id":"gray?-instance-method","name":"gray?","abstract":false,"location":{"filename":"src/cr-image/channel_type.cr","line_number":8,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/channel_type.cr#L8"},"def":{"name":"gray?","visibility":"Public","body":"self == Gray"}},{"html_id":"green?-instance-method","name":"green?","abstract":false,"location":{"filename":"src/cr-image/channel_type.cr","line_number":6,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/channel_type.cr#L6"},"def":{"name":"green?","visibility":"Public","body":"self == Green"}},{"html_id":"red?-instance-method","name":"red?","abstract":false,"location":{"filename":"src/cr-image/channel_type.cr","line_number":5,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/channel_type.cr#L5"},"def":{"name":"red?","visibility":"Public","body":"self == Red"}}]},{"html_id":"Crystal Image/CrImage/Color","path":"CrImage/Color.html","kind":"class","full_name":"CrImage::Color","name":"Color","abstract":false,"superclass":{"html_id":"Crystal Image/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"Crystal Image/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"Crystal Image/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cr-image/color.cr","line_number":5,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/color.cr#L5"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"Crystal Image/CrImage","kind":"module","full_name":"CrImage","name":"CrImage"},"doc":"Utility class for parsing and representing colors that can be used for certain\nmethods in CrImage.\n\nSee `Operation::MaskApply#apply_color`, `Operation::Draw#draw_square`, or `Operation::Draw#draw_circle`","summary":"

        Utility class for parsing and representing colors that can be used for certain methods in CrImage.

        ","constructors":[{"html_id":"new(red:UInt8,green:UInt8,blue:UInt8,alpha:UInt8=255)-class-method","name":"new","abstract":false,"args":[{"name":"red","external_name":"red","restriction":"UInt8"},{"name":"green","external_name":"green","restriction":"UInt8"},{"name":"blue","external_name":"blue","restriction":"UInt8"},{"name":"alpha","default_value":"255","external_name":"alpha","restriction":"UInt8"}],"args_string":"(red : UInt8, green : UInt8, blue : UInt8, alpha : UInt8 = 255)","args_html":"(red : UInt8, green : UInt8, blue : UInt8, alpha : UInt8 = 255)","location":{"filename":"src/cr-image/color.cr","line_number":8,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/color.cr#L8"},"def":{"name":"new","args":[{"name":"red","external_name":"red","restriction":"UInt8"},{"name":"green","external_name":"green","restriction":"UInt8"},{"name":"blue","external_name":"blue","restriction":"UInt8"},{"name":"alpha","default_value":"255","external_name":"alpha","restriction":"UInt8"}],"visibility":"Public","body":"_ = allocate\n_.initialize(red, green, blue, alpha)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"of(color:String):Color-class-method","name":"of","doc":"Parse color from a hex string:\n\n```\nColor.of(\"#1\") # same as \"#11\" => Color.new(17, 17, 17, 255)\nColor.of(\"#01\") # => Color.new(1, 1, 1, 255)\nColor.of(\"#123\") # same as \"#112233\" => Color.new(17, 34, 51, 255)\nColor.of(\"#1234\") # same as \"#11223344\" => Color.new(34, 51, 68, 17)\nColor.of(\"#010203\") # => Color.new(1, 2, 3, 255)\nColor.of(\"#01020304\") # => Color.new(2, 3, 4, 1)\n```","summary":"

        Parse color from a hex string:

        ","abstract":false,"args":[{"name":"color","external_name":"color","restriction":"String"}],"args_string":"(color : String) : Color","args_html":"(color : String) : Color","location":{"filename":"src/cr-image/color.cr","line_number":45,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/color.cr#L45"},"def":{"name":"of","args":[{"name":"color","external_name":"color","restriction":"String"}],"return_type":"Color","visibility":"Public","body":"if ((!(color.starts_with?(\"#\"))) || (!({2, 3, 4, 5, 7, 9}.includes?(color.size)))) || (color.match(/^#[^0-9a-f]/i))\n raise(\"Invalid hex color '#{color}': must start with '#' followed by 1, 2, 3, 4, 6, or 9 alphanumeric characters (0-9 or a-f)\")\nend\ncase color.size\nwhen 2\n gray = (color[1].to_i(16)).to_u8\n gray = (gray << 4) + gray\n self.new(gray, gray, gray)\nwhen 3\n gray = (color[1, 2].to_i(16)).to_u8\n self.new(gray, gray, gray)\nwhen 4\n red = (color[1].to_i(16)).to_u8\n green = (color[2].to_i(16)).to_u8\n blue = (color[3].to_i(16)).to_u8\n self.new((red << 4) + red, (green << 4) + green, (blue << 4) + blue)\nwhen 5\n alpha = (color[1].to_i(16)).to_u8\n red = (color[2].to_i(16)).to_u8\n green = (color[3].to_i(16)).to_u8\n blue = (color[4].to_i(16)).to_u8\n self.new((red << 4) + red, (green << 4) + green, (blue << 4) + blue, (alpha << 4) + alpha)\nwhen 7\n red = (color[1, 2].to_i(16)).to_u8\n green = (color[3, 2].to_i(16)).to_u8\n blue = (color[5, 2].to_i(16)).to_u8\n self.new(red, green, blue)\nelse\n alpha = (color[1, 2].to_i(16)).to_u8\n red = (color[3, 2].to_i(16)).to_u8\n green = (color[5, 2].to_i(16)).to_u8\n blue = (color[7, 2].to_i(16)).to_u8\n self.new(red, green, blue, alpha)\nend\n"}},{"html_id":"random:Color-class-method","name":"random","doc":"Generate a random color with full (255) opacity","summary":"

        Generate a random color with full (255) opacity

        ","abstract":false,"location":{"filename":"src/cr-image/color.cr","line_number":12,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/color.cr#L12"},"def":{"name":"random","return_type":"Color","visibility":"Public","body":"r = Random.new\nnew(r.rand(UInt8), r.rand(UInt8), r.rand(UInt8), 255_u8)\n"}}],"instance_methods":[{"html_id":"==(other:Color):Bool-instance-method","name":"==","abstract":false,"args":[{"name":"other","external_name":"other","restriction":"Color"}],"args_string":"(other : Color) : Bool","args_html":"(other : Color) : Bool","location":{"filename":"src/cr-image/color.cr","line_number":89,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/color.cr#L89"},"def":{"name":"==","args":[{"name":"other","external_name":"other","restriction":"Color"}],"return_type":"Bool","visibility":"Public","body":"(((red == other.red) && (green == other.green)) && (blue == other.blue)) && (alpha == other.alpha)"}},{"html_id":"[](channel_type:ChannelType):UInt8-instance-method","name":"[]","doc":"Receive the UInt8 portion of this color corresponding to `channel_type`","summary":"

        Receive the UInt8 portion of this color corresponding to channel_type

        ","abstract":false,"args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"}],"args_string":"(channel_type : ChannelType) : UInt8","args_html":"(channel_type : ChannelType) : UInt8","location":{"filename":"src/cr-image/color.cr","line_number":25,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/color.cr#L25"},"def":{"name":"[]","args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"}],"return_type":"UInt8","visibility":"Public","body":"case channel_type\nin ChannelType::Red\n red\nin ChannelType::Green\n green\nin ChannelType::Blue\n blue\nin ChannelType::Alpha\n alpha\nin ChannelType::Gray\n gray\nend"}},{"html_id":"alpha:UInt8-instance-method","name":"alpha","abstract":false,"location":{"filename":"src/cr-image/color.cr","line_number":6,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/color.cr#L6"},"def":{"name":"alpha","visibility":"Public","body":"@alpha"}},{"html_id":"blue:UInt8-instance-method","name":"blue","abstract":false,"location":{"filename":"src/cr-image/color.cr","line_number":6,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/color.cr#L6"},"def":{"name":"blue","visibility":"Public","body":"@blue"}},{"html_id":"gray(red_multiplier:Float=0.299,green_multiplier:Float=0.587,blue_multiplier:Float=0.114):UInt8-instance-method","name":"gray","doc":"Convert this Color to a single UInt8 gray value","summary":"

        Convert this Color to a single UInt8 gray value

        ","abstract":false,"args":[{"name":"red_multiplier","default_value":"0.299","external_name":"red_multiplier","restriction":"Float"},{"name":"green_multiplier","default_value":"0.587","external_name":"green_multiplier","restriction":"Float"},{"name":"blue_multiplier","default_value":"0.114","external_name":"blue_multiplier","restriction":"Float"}],"args_string":"(red_multiplier : Float = 0.299, green_multiplier : Float = 0.587, blue_multiplier : Float = 0.114) : UInt8","args_html":"(red_multiplier : Float = 0.299, green_multiplier : Float = 0.587, blue_multiplier : Float = 0.114) : UInt8","location":{"filename":"src/cr-image/color.cr","line_number":18,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/color.cr#L18"},"def":{"name":"gray","args":[{"name":"red_multiplier","default_value":"0.299","external_name":"red_multiplier","restriction":"Float"},{"name":"green_multiplier","default_value":"0.587","external_name":"green_multiplier","restriction":"Float"},{"name":"blue_multiplier","default_value":"0.114","external_name":"blue_multiplier","restriction":"Float"}],"return_type":"UInt8","visibility":"Public","body":"Math.min(255_u8, (((red * red_multiplier) + (blue * blue_multiplier)) + (green * green_multiplier)).to_u8)"}},{"html_id":"green:UInt8-instance-method","name":"green","abstract":false,"location":{"filename":"src/cr-image/color.cr","line_number":6,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/color.cr#L6"},"def":{"name":"green","visibility":"Public","body":"@green"}},{"html_id":"red:UInt8-instance-method","name":"red","abstract":false,"location":{"filename":"src/cr-image/color.cr","line_number":6,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/color.cr#L6"},"def":{"name":"red","visibility":"Public","body":"@red"}}]},{"html_id":"Crystal Image/CrImage/Exception","path":"CrImage/Exception.html","kind":"class","full_name":"CrImage::Exception","name":"Exception","abstract":false,"superclass":{"html_id":"Crystal Image/Exception","kind":"class","full_name":"Exception","name":"Exception"},"ancestors":[{"html_id":"Crystal Image/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"Crystal Image/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"Crystal Image/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cr-image/exception.cr","line_number":2,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/exception.cr#L2"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"Crystal Image/CrImage","kind":"module","full_name":"CrImage","name":"CrImage"},"doc":"Exception class for any errors thrown by CrImage","summary":"

        Exception class for any errors thrown by CrImage

        ","constructors":[{"html_id":"new(message:String)-class-method","name":"new","abstract":false,"args":[{"name":"message","external_name":"message","restriction":"String"}],"args_string":"(message : String)","args_html":"(message : String)","location":{"filename":"src/cr-image/exception.cr","line_number":5,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/exception.cr#L5"},"def":{"name":"new","args":[{"name":"message","external_name":"message","restriction":"String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(message)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(error_code:Int32)-class-method","name":"new","abstract":false,"args":[{"name":"error_code","external_name":"error_code","restriction":"Int32"}],"args_string":"(error_code : Int32)","args_html":"(error_code : Int32)","location":{"filename":"src/cr-image/exception.cr","line_number":9,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/exception.cr#L9"},"def":{"name":"new","args":[{"name":"error_code","external_name":"error_code","restriction":"Int32"}],"visibility":"Public","body":"_ = allocate\n_.initialize(error_code)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(handle:LibJPEGTurbo::Handle)-class-method","name":"new","abstract":false,"args":[{"name":"handle","external_name":"handle","restriction":"LibJPEGTurbo::Handle"}],"args_string":"(handle : LibJPEGTurbo::Handle)","args_html":"(handle : LibJPEGTurbo::Handle)","location":{"filename":"src/cr-image/exception.cr","line_number":13,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/exception.cr#L13"},"def":{"name":"new","args":[{"name":"handle","external_name":"handle","restriction":"LibJPEGTurbo::Handle"}],"visibility":"Public","body":"_ = allocate\n_.initialize(handle)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"error_code:Int32|Nil-instance-method","name":"error_code","abstract":false,"location":{"filename":"src/cr-image/exception.cr","line_number":3,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/exception.cr#L3"},"def":{"name":"error_code","return_type":"Int32 | ::Nil","visibility":"Public","body":"@error_code"}}]},{"html_id":"Crystal Image/CrImage/Format","path":"CrImage/Format.html","kind":"module","full_name":"CrImage::Format","name":"Format","abstract":false,"locations":[{"filename":"src/cr-image/format/save.cr","line_number":12,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/format/save.cr#L12"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"SUPPORTED_FORMATS","name":"SUPPORTED_FORMATS","value":"[{extension: \".ppm\", method: \"ppm\"}, {extension: \".jpeg\", method: \"jpeg\"}, {extension: \".jpg\", method: \"jpeg\"}, {extension: \".png\", method: \"png\"}, {extension: \".webp\", method: \"webp\"}] of Nil"}],"namespace":{"html_id":"Crystal Image/CrImage","kind":"module","full_name":"CrImage","name":"CrImage"},"doc":"Provides a convenience method for saving image files to the filesystem.\nCurrently supports:\n* PPM (`.ppm`)\n* WebP (`.webp`)\n* JPEG (`.jpeg`, `.jpg`)\n* PNG (`.png`)\n\n```\nimage.save(\"image.jpg\")\n```\nSee `Open` for a convenience method to read images from the filesystem","summary":"

        Provides a convenience method for saving image files to the filesystem.

        ","types":[{"html_id":"Crystal Image/CrImage/Format/JPEG","path":"CrImage/Format/JPEG.html","kind":"module","full_name":"CrImage::Format::JPEG","name":"JPEG","abstract":false,"locations":[{"filename":"src/lib-formats/jpeg.cr","line_number":15,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/lib-formats/jpeg.cr#L15"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"Crystal Image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"Crystal Image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"Crystal Image/CrImage/Format","kind":"module","full_name":"CrImage::Format","name":"Format"},"doc":"Provides methods to read from and write to jpeg. Requires `libturbojpeg` to function.\n\n```\nimage = File.open(\"image.jpg\") { |file| CrImage::RGBAImage.from_jpeg(file) }\nFile.open(\"other_image.jpg\") { |file| image.to_jpeg(file) }\n```\nAlternatively, you can use the convenience methods in the `Open` and `Save` modules\nto acheive the same thing:\n```\nimage = CrImage::RGBAImage.open(\"image.jpg\")\nimage.save(\"other_image.jpg\")\n```","summary":"

        Provides methods to read from and write to jpeg.

        ","instance_methods":[{"html_id":"to_jpeg(io:IO,quality:Int32=100):Nil-instance-method","name":"to_jpeg","doc":"Output the image as JPEG to `io`","summary":"

        Output the image as JPEG to io

        ","abstract":false,"args":[{"name":"io","external_name":"io","restriction":"IO"},{"name":"quality","default_value":"100","external_name":"quality","restriction":"Int32"}],"args_string":"(io : IO, quality : Int32 = 100) : Nil","args_html":"(io : IO, quality : Int32 = 100) : Nil","location":{"filename":"src/lib-formats/jpeg.cr","line_number":74,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/lib-formats/jpeg.cr#L74"},"def":{"name":"to_jpeg","args":[{"name":"io","external_name":"io","restriction":"IO"},{"name":"quality","default_value":"100","external_name":"quality","restriction":"Int32"}],"return_type":"Nil","visibility":"Public","body":"handle = LibJPEGTurbo.init_compress\nimage_data = IO::Memory.new(size * 3)\nsize.times do |index|\n image_data.write_byte(red.unsafe_fetch(index))\n image_data.write_byte(green.unsafe_fetch(index))\n image_data.write_byte(blue.unsafe_fetch(index))\nend\nbuffer = Pointer(UInt8).null\ncheck_jpeg(handle, LibJPEGTurbo.compress2(handle, image_data.buffer, @width, 0, @height, LibJPEGTurbo::PixelFormat::RGB, pointerof(buffer), out size, LibJPEGTurbo::Subsampling::S444, quality, 0))\ncheck_jpeg(handle, LibJPEGTurbo.destroy(handle))\nbytes = Bytes.new(buffer, size)\nio.write(bytes)\nLibJPEGTurbo.free(buffer)\n"}}]},{"html_id":"Crystal Image/CrImage/Format/Open","path":"CrImage/Format/Open.html","kind":"module","full_name":"CrImage::Format::Open","name":"Open","abstract":false,"locations":[{"filename":"src/cr-image/format/open.cr","line_number":12,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/format/open.cr#L12"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"Crystal Image/CrImage/Format","kind":"module","full_name":"CrImage::Format","name":"Format"},"doc":"Provides a convenience method for opening up image files from the filesystem.\nCurrently supports:\n* PPM (`.ppm`)\n* WebP (`.webp`)\n* JPEG (`.jpeg`, `.jpg`)\n* PNG (`.png`)\n\n```\nimage = CrImage::RGBAImage.open(\"image.jpg\")\n```\nSee `Save` for a convenience method to write to the filesystem.","summary":"

        Provides a convenience method for opening up image files from the filesystem.

        ","instance_methods":[{"html_id":"open(filename:String):self-instance-method","name":"open","doc":"Reads this image from file using the provided filename.","summary":"

        Reads this image from file using the provided filename.

        ","abstract":false,"args":[{"name":"filename","external_name":"filename","restriction":"String"}],"args_string":"(filename : String) : self","args_html":"(filename : String) : self","location":{"filename":"src/cr-image/format/open.cr","line_number":14,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/format/open.cr#L14"},"def":{"name":"open","args":[{"name":"filename","external_name":"filename","restriction":"String"}],"return_type":"self","visibility":"Public","body":"{% if true %}\n case filename\n {% for format in SUPPORTED_FORMATS %}\n when .ends_with?({{ format[:extension] }}) then File.open(filename) { |file| self.from_{{ format[:method].id }}(file) }\n {% end %}\n else raise Exception.new \"Unknown file extension for filename #{filename}, cr-image only supports {{ (CrImage::Format::SUPPORTED_FORMATS.map do |__arg0|\n __arg0[:extension].id\nend.join(\", \")).id }}\"\n end\n {% end %}"}}]},{"html_id":"Crystal Image/CrImage/Format/PNG","path":"CrImage/Format/PNG.html","kind":"module","full_name":"CrImage::Format::PNG","name":"PNG","abstract":false,"locations":[{"filename":"src/lib-formats/png.cr","line_number":15,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/lib-formats/png.cr#L15"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"Crystal Image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"Crystal Image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"Crystal Image/CrImage/Format","kind":"module","full_name":"CrImage::Format","name":"Format"},"doc":"Provides methods to read from and write to PNG. Requires `libspng` to function.\n\n```\nimage = File.open(\"image.png\") { |file| CrImage::RGBAImage.from_png(file) }\nFile.open(\"other_image.png\") { |file| image.to_png(file) }\n```\nAlternatively, you can use the convenience methods in the `Open` and `Save` modules\nto acheive the same thing:\n```\nimage = CrImage::RGBAImage.open(\"image.png\")\nimage.save(\"other_image.png\")\n```","summary":"

        Provides methods to read from and write to PNG.

        ","instance_methods":[{"html_id":"to_png(io:IO):Nil-instance-method","name":"to_png","doc":"Output the image as PNG to `io`","summary":"

        Output the image as PNG to io

        ","abstract":false,"args":[{"name":"io","external_name":"io","restriction":"IO"}],"args_string":"(io : IO) : Nil","args_html":"(io : IO) : Nil","location":{"filename":"src/lib-formats/png.cr","line_number":72,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/lib-formats/png.cr#L72"},"def":{"name":"to_png","args":[{"name":"io","external_name":"io","restriction":"IO"}],"return_type":"Nil","visibility":"Public","body":"image_data = IO::Memory.new(size * 4)\nsize.times do |index|\n image_data.write_byte(red.unsafe_fetch(index))\n image_data.write_byte(green.unsafe_fetch(index))\n image_data.write_byte(blue.unsafe_fetch(index))\n image_data.write_byte(alpha.unsafe_fetch(index))\nend\nctx = LibSPNG.ctx_new(LibSPNG::CtxFlags::Encoder)\nif ctx\nelse\n raise(::CrImage::Exception.new(\"Failed to create a context\"))\nend\nLibSPNG.set_option(ctx, LibSPNG::Option::EncodeToBuffer, true)\nLibSPNG.set_png_buffer(ctx, image_data.buffer, image_data.size)\nihdr = LibSPNG::IHDR.new\nihdr.width = @width\nihdr.height = @height\nihdr.color_type = LibSPNG::ColorType::TrueColorAlpha\nihdr.bit_depth = 8\nLibSPNG.set_ihdr(ctx, pointerof(ihdr))\nerror = LibSPNG.encode_image(ctx, image_data.buffer, image_data.size, LibSPNG::Format::PNG, LibSPNG::EncodeFlags::Finalize)\ncheck_png(error)\nbuffer = LibSPNG.get_png_buffer(ctx, out size, pointerof(error))\nif ctx\nelse\n raise(::CrImage::Exception.new(\"Failed to get a buffer\"))\nend\nbytes = Bytes.new(buffer, size)\nio.write(bytes)\nLibC.free(buffer)\n"}}]},{"html_id":"Crystal Image/CrImage/Format/PPM","path":"CrImage/Format/PPM.html","kind":"module","full_name":"CrImage::Format::PPM","name":"PPM","abstract":false,"locations":[{"filename":"src/cr-image/format/ppm.cr","line_number":13,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/format/ppm.cr#L13"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"Crystal Image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"Crystal Image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"Crystal Image/CrImage/Format","kind":"module","full_name":"CrImage::Format","name":"Format"},"doc":"Provides methods to read from and write to PPM.\n\n```\nimage = File.open(\"image.ppm\") { |file| CrImage::RGBAImage.from_ppm(file) }\nFile.open(\"other_image.ppm\") { |file| image.to_ppm(file) }\n```\nAlternatively, you can use the convenience methods in the `Open` and `Save` modules\nto acheive the same thing:\n```\nimage = CrImage::RGBAImage.open(\"image.ppm\")\nimage.save(\"other_image.ppm\")\n```","summary":"

        Provides methods to read from and write to PPM.

        ","instance_methods":[{"html_id":"to_ppm(io:IO):Nil-instance-method","name":"to_ppm","doc":"Output this image to `io` using PPM image encoding","summary":"

        Output this image to io using PPM image encoding

        ","abstract":false,"args":[{"name":"io","external_name":"io","restriction":"IO"}],"args_string":"(io : IO) : Nil","args_html":"(io : IO) : Nil","location":{"filename":"src/cr-image/format/ppm.cr","line_number":56,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/format/ppm.cr#L56"},"def":{"name":"to_ppm","args":[{"name":"io","external_name":"io","restriction":"IO"}],"return_type":"Nil","visibility":"Public","body":"io << \"P6\\n\"\n(((io << @width) << \" \") << @height) << \"\\n\"\nio << \"255\\n\"\nsize.times do |index|\n io.write_byte(red.unsafe_fetch(index))\n io.write_byte(green.unsafe_fetch(index))\n io.write_byte(blue.unsafe_fetch(index))\nend\n"}}]},{"html_id":"Crystal Image/CrImage/Format/Save","path":"CrImage/Format/Save.html","kind":"module","full_name":"CrImage::Format::Save","name":"Save","abstract":false,"locations":[{"filename":"src/cr-image/format/save.cr","line_number":15,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/format/save.cr#L15"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"Crystal Image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"Crystal Image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"Crystal Image/CrImage/Format","kind":"module","full_name":"CrImage::Format","name":"Format"},"instance_methods":[{"html_id":"save(filename:String):self-instance-method","name":"save","doc":"Write this image to file using the provided filename.\n\nThis method _will not_ create intermediate directory paths. This method will throw an\nerror if they don't exist.","summary":"

        Write this image to file using the provided filename.

        ","abstract":false,"args":[{"name":"filename","external_name":"filename","restriction":"String"}],"args_string":"(filename : String) : self","args_html":"(filename : String) : self","location":{"filename":"src/cr-image/format/save.cr","line_number":20,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/format/save.cr#L20"},"def":{"name":"save","args":[{"name":"filename","external_name":"filename","restriction":"String"}],"return_type":"self","visibility":"Public","body":"File.open(filename, \"w\") do |file|\n {% if true %}\n case filename\n {% for format in SUPPORTED_FORMATS %}\n when .ends_with?({{ format[:extension] }}) then to_{{ format[:method].id }}(file)\n {% end %}\n else raise Exception.new \"Unknown file extension for filename #{filename}, cr-image only supports {{ (CrImage::Format::SUPPORTED_FORMATS.map do |__arg0|\n __arg0[:extension].id\n end.join(\", \")).id }}\"\n end\n {% end %}\nend\nself\n"}}]},{"html_id":"Crystal Image/CrImage/Format/WebP","path":"CrImage/Format/WebP.html","kind":"module","full_name":"CrImage::Format::WebP","name":"WebP","abstract":false,"locations":[{"filename":"src/lib-formats/webp.cr","line_number":15,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/lib-formats/webp.cr#L15"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"Crystal Image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"Crystal Image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"Crystal Image/CrImage/Format","kind":"module","full_name":"CrImage::Format","name":"Format"},"doc":"Provides methods to read from and write to WebP. Requires `libwebp` to function.\n\n```\nimage = File.open(\"image.webp\") { |file| CrImage::RGBAImage.from_webp(file) }\nFile.open(\"other_image.webp\") { |file| image.to_webp(file) }\n```\nAlternatively, you can use the convenience methods in the `Open` and `Save` modules\nto acheive the same thing:\n```\nimage = CrImage::RGBAImage.open(\"image.webp\")\nimage.save(\"other_image.webp\")\n```","summary":"

        Provides methods to read from and write to WebP.

        ","instance_methods":[{"html_id":"to_webp(io:IO):Nil-instance-method","name":"to_webp","doc":"Write image to `io` using WebP encoding","summary":"

        Write image to io using WebP encoding

        ","abstract":false,"args":[{"name":"io","external_name":"io","restriction":"IO"}],"args_string":"(io : IO) : Nil","args_html":"(io : IO) : Nil","location":{"filename":"src/lib-formats/webp.cr","line_number":58,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/lib-formats/webp.cr#L58"},"def":{"name":"to_webp","args":[{"name":"io","external_name":"io","restriction":"IO"}],"return_type":"Nil","visibility":"Public","body":"image_data = String.build do |string|\n size.times do |index|\n string.write_byte(red.unsafe_fetch(index))\n string.write_byte(green.unsafe_fetch(index))\n string.write_byte(blue.unsafe_fetch(index))\n string.write_byte(alpha.unsafe_fetch(index))\n end\nend\nsize = LibWebP.encode_lossless_rgba(image_data, @width, @height, @width * 4, out buffer)\ncheck_webp(size)\nbytes = Bytes.new(buffer, size)\nio.write(bytes)\nLibWebP.free(buffer)\n"}}]}]},{"html_id":"Crystal Image/CrImage/GrayscaleImage","path":"CrImage/GrayscaleImage.html","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage","abstract":false,"superclass":{"html_id":"Crystal Image/CrImage/Image","kind":"class","full_name":"CrImage::Image","name":"Image"},"ancestors":[{"html_id":"Crystal Image/CrImage/Format/WebP","kind":"module","full_name":"CrImage::Format::WebP","name":"WebP"},{"html_id":"Crystal Image/CrImage/Format/PNG","kind":"module","full_name":"CrImage::Format::PNG","name":"PNG"},{"html_id":"Crystal Image/CrImage/Format/JPEG","kind":"module","full_name":"CrImage::Format::JPEG","name":"JPEG"},{"html_id":"Crystal Image/CrImage/Operation/MaskApply","kind":"module","full_name":"CrImage::Operation::MaskApply","name":"MaskApply"},{"html_id":"Crystal Image/CrImage/Format/Save","kind":"module","full_name":"CrImage::Format::Save","name":"Save"},{"html_id":"Crystal Image/CrImage/Operation/HistogramEqualize","kind":"module","full_name":"CrImage::Operation::HistogramEqualize","name":"HistogramEqualize"},{"html_id":"Crystal Image/CrImage/Operation/Draw","kind":"module","full_name":"CrImage::Operation::Draw","name":"Draw"},{"html_id":"Crystal Image/CrImage/Operation/Crop","kind":"module","full_name":"CrImage::Operation::Crop","name":"Crop"},{"html_id":"Crystal Image/CrImage/Operation/VerticalBlur","kind":"module","full_name":"CrImage::Operation::VerticalBlur","name":"VerticalBlur"},{"html_id":"Crystal Image/CrImage/Operation/HorizontalBlur","kind":"module","full_name":"CrImage::Operation::HorizontalBlur","name":"HorizontalBlur"},{"html_id":"Crystal Image/CrImage/Operation/GaussianBlur","kind":"module","full_name":"CrImage::Operation::GaussianBlur","name":"GaussianBlur"},{"html_id":"Crystal Image/CrImage/Operation/Contrast","kind":"module","full_name":"CrImage::Operation::Contrast","name":"Contrast"},{"html_id":"Crystal Image/CrImage/Operation/ChannelSwap","kind":"module","full_name":"CrImage::Operation::ChannelSwap","name":"ChannelSwap"},{"html_id":"Crystal Image/CrImage/Operation/Brightness","kind":"module","full_name":"CrImage::Operation::Brightness","name":"Brightness"},{"html_id":"Crystal Image/CrImage/Operation/BoxBlur","kind":"module","full_name":"CrImage::Operation::BoxBlur","name":"BoxBlur"},{"html_id":"Crystal Image/CrImage/Operation/BilinearResize","kind":"module","full_name":"CrImage::Operation::BilinearResize","name":"BilinearResize"},{"html_id":"Crystal Image/CrImage/Format/PPM","kind":"module","full_name":"CrImage::Format::PPM","name":"PPM"},{"html_id":"Crystal Image/CrImage/Image","kind":"class","full_name":"CrImage::Image","name":"Image"},{"html_id":"Crystal Image/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"Crystal Image/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cr-image/grayscale_image.cr","line_number":13,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L13"},{"filename":"src/jpeg.cr","line_number":4,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/jpeg.cr#L4"},{"filename":"src/png.cr","line_number":4,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/png.cr#L4"},{"filename":"src/stumpy.cr","line_number":38,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/stumpy.cr#L38"},{"filename":"src/webp.cr","line_number":4,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/webp.cr#L4"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"Crystal Image/CrImage/Format/JPEG","kind":"module","full_name":"CrImage::Format::JPEG","name":"JPEG"},{"html_id":"Crystal Image/CrImage/Format/PNG","kind":"module","full_name":"CrImage::Format::PNG","name":"PNG"},{"html_id":"Crystal Image/CrImage/Format/PPM","kind":"module","full_name":"CrImage::Format::PPM","name":"PPM"},{"html_id":"Crystal Image/CrImage/Format/Save","kind":"module","full_name":"CrImage::Format::Save","name":"Save"},{"html_id":"Crystal Image/CrImage/Format/WebP","kind":"module","full_name":"CrImage::Format::WebP","name":"WebP"},{"html_id":"Crystal Image/CrImage/Operation/BilinearResize","kind":"module","full_name":"CrImage::Operation::BilinearResize","name":"BilinearResize"},{"html_id":"Crystal Image/CrImage/Operation/BoxBlur","kind":"module","full_name":"CrImage::Operation::BoxBlur","name":"BoxBlur"},{"html_id":"Crystal Image/CrImage/Operation/Brightness","kind":"module","full_name":"CrImage::Operation::Brightness","name":"Brightness"},{"html_id":"Crystal Image/CrImage/Operation/ChannelSwap","kind":"module","full_name":"CrImage::Operation::ChannelSwap","name":"ChannelSwap"},{"html_id":"Crystal Image/CrImage/Operation/Contrast","kind":"module","full_name":"CrImage::Operation::Contrast","name":"Contrast"},{"html_id":"Crystal Image/CrImage/Operation/Crop","kind":"module","full_name":"CrImage::Operation::Crop","name":"Crop"},{"html_id":"Crystal Image/CrImage/Operation/Draw","kind":"module","full_name":"CrImage::Operation::Draw","name":"Draw"},{"html_id":"Crystal Image/CrImage/Operation/GaussianBlur","kind":"module","full_name":"CrImage::Operation::GaussianBlur","name":"GaussianBlur"},{"html_id":"Crystal Image/CrImage/Operation/HistogramEqualize","kind":"module","full_name":"CrImage::Operation::HistogramEqualize","name":"HistogramEqualize"},{"html_id":"Crystal Image/CrImage/Operation/HorizontalBlur","kind":"module","full_name":"CrImage::Operation::HorizontalBlur","name":"HorizontalBlur"},{"html_id":"Crystal Image/CrImage/Operation/MaskApply","kind":"module","full_name":"CrImage::Operation::MaskApply","name":"MaskApply"},{"html_id":"Crystal Image/CrImage/Operation/VerticalBlur","kind":"module","full_name":"CrImage::Operation::VerticalBlur","name":"VerticalBlur"}],"extended_modules":[{"html_id":"Crystal Image/CrImage/Format/Open","kind":"module","full_name":"CrImage::Format::Open","name":"Open"}],"namespace":{"html_id":"Crystal Image/CrImage","kind":"module","full_name":"CrImage","name":"CrImage"},"doc":"An image in Grayscale. These image types are the easiest to perform feature and information extraction from, where\nthere is only one channel to examine, and so has methods for constructing `Mask`s from (see `#threshold` below).\n\nAn `RGBAImage` would become a `GrayscaleImage` this way:\n```\nimage.to_gray\n```\n\n\"Woman\n\"Woman","summary":"

        An image in Grayscale.

        ","constructors":[{"html_id":"from_jpeg(image_data:Bytes):self-class-method","name":"from_jpeg","doc":"Read `image_data` as JPEG encoded bytes","summary":"

        Read image_data as JPEG encoded bytes

        ","abstract":false,"args":[{"name":"image_data","external_name":"image_data","restriction":"Bytes"}],"args_string":"(image_data : Bytes) : self","args_html":"(image_data : Bytes) : self","def":{"name":"from_jpeg","args":[{"name":"image_data","external_name":"image_data","restriction":"Bytes"}],"return_type":"self","visibility":"Public","body":"handle = LibJPEGTurbo.init_decompress\ncheck_jpeg(handle, LibJPEGTurbo.decompress_header3(handle, image_data, image_data.size, out width, out height, out _subsampling, out _colorspace))\nbuffer = Bytes.new((width * height) * 3, 0)\ncheck_jpeg(handle, LibJPEGTurbo.decompress2(handle, image_data, LibC::ULong.new(image_data.size), buffer, width, 0, height, LibJPEGTurbo::PixelFormat::RGB, 0))\ncheck_jpeg(handle, LibJPEGTurbo.destroy(handle))\nred = Array.new(width * height) do\n 0_u8\nend\ngreen = Array.new(width * height) do\n 0_u8\nend\nblue = Array.new(width * height) do\n 0_u8\nend\nalpha = Array.new(width * height) do\n 255_u8\nend\n(width * height).times do |index|\n red.unsafe_put(index, buffer[index * 3])\n green.unsafe_put(index, buffer[(index * 3) + 1])\n blue.unsafe_put(index, buffer[(index * 3) + 2])\nend\nnew(red, green, blue, alpha, width, height)\n"}},{"html_id":"from_jpeg(io:IO):self-class-method","name":"from_jpeg","doc":"Construct an Image from reading in bytes from `io`","summary":"

        Construct an Image from reading in bytes from io

        ","abstract":false,"args":[{"name":"io","external_name":"io","restriction":"IO"}],"args_string":"(io : IO) : self","args_html":"(io : IO) : self","def":{"name":"from_jpeg","args":[{"name":"io","external_name":"io","restriction":"IO"}],"return_type":"self","visibility":"Public","body":"from_jpeg(io.getb_to_end)"}},{"html_id":"from_png(image_data:Bytes):self-class-method","name":"from_png","doc":"Read `image_data` and PNG encoded bytes","summary":"

        Read image_data and PNG encoded bytes

        ","abstract":false,"args":[{"name":"image_data","external_name":"image_data","restriction":"Bytes"}],"args_string":"(image_data : Bytes) : self","args_html":"(image_data : Bytes) : self","def":{"name":"from_png","args":[{"name":"image_data","external_name":"image_data","restriction":"Bytes"}],"return_type":"self","visibility":"Public","body":"ctx = LibSPNG.ctx_new(LibSPNG::CtxFlags::None)\nif ctx\nelse\n raise(::CrImage::Exception.new(\"Failed to create a context\"))\nend\nLibSPNG.set_png_buffer(ctx, image_data, image_data.size)\ncheck_png(LibSPNG.get_ihdr(ctx, out ihdr))\ncheck_png(LibSPNG.decoded_image_size(ctx, LibSPNG::Format::RGBA8, out image_size))\nimage = Bytes.new(image_size.to_i, 0_u8)\ncheck_png(LibSPNG.decode_image(ctx, image, image_size, LibSPNG::Format::RGBA8, LibSPNG::DecodeFlags::None))\nLibSPNG.ctx_free(ctx)\nsize = image_size // 4\nwidth = size // ihdr.height\nheight = ihdr.height\nred = Array.new(size) do\n 0_u8\nend\ngreen = Array.new(size) do\n 0_u8\nend\nblue = Array.new(size) do\n 0_u8\nend\nalpha = Array.new(size) do\n 0_u8\nend\nsize.times do |index|\n position = index * 4\n red.unsafe_put(index, image[position + 0])\n green.unsafe_put(index, image[position + 1])\n blue.unsafe_put(index, image[position + 2])\n alpha.unsafe_put(index, image[position + 3])\nend\nnew(red, green, blue, alpha, width.to_i, height.to_i)\n"}},{"html_id":"from_png(io:IO):self-class-method","name":"from_png","doc":"Construct an Image by reading bytes from `io`","summary":"

        Construct an Image by reading bytes from io

        ","abstract":false,"args":[{"name":"io","external_name":"io","restriction":"IO"}],"args_string":"(io : IO) : self","args_html":"(io : IO) : self","def":{"name":"from_png","args":[{"name":"io","external_name":"io","restriction":"IO"}],"return_type":"self","visibility":"Public","body":"from_png(io.getb_to_end)"}},{"html_id":"from_ppm(image_data:Bytes):self-class-method","name":"from_ppm","doc":"Read `image_data` as PPM encoded bytes","summary":"

        Read image_data as PPM encoded bytes

        ","abstract":false,"args":[{"name":"image_data","external_name":"image_data","restriction":"Bytes"}],"args_string":"(image_data : Bytes) : self","args_html":"(image_data : Bytes) : self","def":{"name":"from_ppm","args":[{"name":"image_data","external_name":"image_data","restriction":"Bytes"}],"return_type":"self","visibility":"Public","body":"from_ppm(IO::Memory.new(image_data))"}},{"html_id":"from_ppm(io:IO):self-class-method","name":"from_ppm","doc":"Read bytes from `io` as PPM encoded","summary":"

        Read bytes from io as PPM encoded

        ","abstract":false,"args":[{"name":"io","external_name":"io","restriction":"IO"}],"args_string":"(io : IO) : self","args_html":"(io : IO) : self","def":{"name":"from_ppm","args":[{"name":"io","external_name":"io","restriction":"IO"}],"return_type":"self","visibility":"Public","body":"_magic_number = io.gets(\"\\n\", chomp: true)\nwidth = (io.gets(\" \", chomp: true)).try(&.to_i)\nheight = (io.gets(\"\\n\", chomp: true)).try(&.to_i)\n_maximum_color_value = io.gets(\"\\n\", chomp: true)\nif width && height\n red = Array.new(width * height) do\n 0_u8\n end\n green = Array.new(width * height) do\n 0_u8\n end\n blue = Array.new(width * height) do\n 0_u8\n end\n alpha = Array.new(width * height) do\n 255_u8\n end\n (width * height).times do |index|\n red_byte = io.read_byte\n green_byte = io.read_byte\n blue_byte = io.read_byte\n if (red_byte && green_byte) && blue_byte\n red.unsafe_put(index, red_byte)\n green.unsafe_put(index, green_byte)\n blue.unsafe_put(index, blue_byte)\n else\n raise(\"The image ends prematurely\")\n end\n end\n new(red, green, blue, alpha, width, height)\nelse\n raise(\"The image doesn't have width or height\")\nend\n"}},{"html_id":"from_webp(image_data:Bytes):self-class-method","name":"from_webp","doc":"Read `image_data` as WebP encoded bytes","summary":"

        Read image_data as WebP encoded bytes

        ","abstract":false,"args":[{"name":"image_data","external_name":"image_data","restriction":"Bytes"}],"args_string":"(image_data : Bytes) : self","args_html":"(image_data : Bytes) : self","def":{"name":"from_webp","args":[{"name":"image_data","external_name":"image_data","restriction":"Bytes"}],"return_type":"self","visibility":"Public","body":"check_webp(LibWebP.get_info(image_data, image_data.size, out width, out height))\nbuffer = LibWebP.decode_rgba(image_data, image_data.size, pointerof(width), pointerof(height))\nred = Array.new(width * height) do\n 0_u8\nend\ngreen = Array.new(width * height) do\n 0_u8\nend\nblue = Array.new(width * height) do\n 0_u8\nend\nalpha = Array.new(width * height) do\n 0_u8\nend\n(width * height).times do |index|\n red.unsafe_put(index, buffer[index * 4])\n green.unsafe_put(index, buffer[(index * 4) + 1])\n blue.unsafe_put(index, buffer[(index * 4) + 2])\n alpha.unsafe_put(index, buffer[(index * 4) + 3])\nend\nLibWebP.free(buffer)\nnew(red, green, blue, alpha, width, height)\n"}},{"html_id":"from_webp(io:IO):self-class-method","name":"from_webp","doc":"Read bytes from `io` as WebP encoded","summary":"

        Read bytes from io as WebP encoded

        ","abstract":false,"args":[{"name":"io","external_name":"io","restriction":"IO"}],"args_string":"(io : IO) : self","args_html":"(io : IO) : self","def":{"name":"from_webp","args":[{"name":"io","external_name":"io","restriction":"IO"}],"return_type":"self","visibility":"Public","body":"from_webp(io.getb_to_end)"}},{"html_id":"new(red:Array(UInt8),green:Array(UInt8),blue:Array(UInt8),alpha:Array(UInt8),width:Int32,height:Int32)-class-method","name":"new","doc":"Create a GrayscaleImage from a set of color channels (delegates to `RGBAImage#to_gray`)","summary":"

        Create a GrayscaleImage from a set of color channels (delegates to RGBAImage#to_gray)

        ","abstract":false,"args":[{"name":"red","external_name":"red","restriction":"Array(UInt8)"},{"name":"green","external_name":"green","restriction":"Array(UInt8)"},{"name":"blue","external_name":"blue","restriction":"Array(UInt8)"},{"name":"alpha","external_name":"alpha","restriction":"Array(UInt8)"},{"name":"width","external_name":"width","restriction":"Int32"},{"name":"height","external_name":"height","restriction":"Int32"}],"args_string":"(red : Array(UInt8), green : Array(UInt8), blue : Array(UInt8), alpha : Array(UInt8), width : Int32, height : Int32)","args_html":"(red : Array(UInt8), green : Array(UInt8), blue : Array(UInt8), alpha : Array(UInt8), width : Int32, height : Int32)","location":{"filename":"src/cr-image/grayscale_image.cr","line_number":20,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L20"},"def":{"name":"new","args":[{"name":"red","external_name":"red","restriction":"Array(UInt8)"},{"name":"green","external_name":"green","restriction":"Array(UInt8)"},{"name":"blue","external_name":"blue","restriction":"Array(UInt8)"},{"name":"alpha","external_name":"alpha","restriction":"Array(UInt8)"},{"name":"width","external_name":"width","restriction":"Int32"},{"name":"height","external_name":"height","restriction":"Int32"}],"visibility":"Public","body":"(RGBAImage.new(red, green, blue, alpha, width, height)).to_gray"}},{"html_id":"new(gray:Array(UInt8),alpha:Array(UInt8),width:Int32,height:Int32)-class-method","name":"new","abstract":false,"args":[{"name":"gray","external_name":"gray","restriction":"::Array(::UInt8)"},{"name":"alpha","external_name":"alpha","restriction":"::Array(::UInt8)"},{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"height","external_name":"height","restriction":"::Int32"}],"args_string":"(gray : Array(UInt8), alpha : Array(UInt8), width : Int32, height : Int32)","args_html":"(gray : Array(UInt8), alpha : Array(UInt8), width : Int32, height : Int32)","location":{"filename":"src/cr-image/grayscale_image.cr","line_number":24,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L24"},"def":{"name":"new","args":[{"name":"gray","external_name":"gray","restriction":"::Array(::UInt8)"},{"name":"alpha","external_name":"alpha","restriction":"::Array(::UInt8)"},{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"height","external_name":"height","restriction":"::Int32"}],"visibility":"Public","body":"_ = allocate\n_.initialize(gray, alpha, width, height)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(gray:Array(UInt8),width:Int32,height:Int32)-class-method","name":"new","doc":"Create a GrayscaleImage with only an `Array(UInt8)` (alpha channel initialized as `255` throughout)","summary":"

        Create a GrayscaleImage with only an Array(UInt8) (alpha channel initialized as 255 throughout)

        ","abstract":false,"args":[{"name":"gray","external_name":"gray","restriction":"::Array(::UInt8)"},{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"height","external_name":"height","restriction":"::Int32"}],"args_string":"(gray : Array(UInt8), width : Int32, height : Int32)","args_html":"(gray : Array(UInt8), width : Int32, height : Int32)","location":{"filename":"src/cr-image/grayscale_image.cr","line_number":28,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L28"},"def":{"name":"new","args":[{"name":"gray","external_name":"gray","restriction":"::Array(::UInt8)"},{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"height","external_name":"height","restriction":"::Int32"}],"visibility":"Public","body":"_ = allocate\n_.initialize(gray, width, height)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"[](x:Int32,y:Int32):Pixel-instance-method","name":"[]","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"y","external_name":"y","restriction":"Int32"}],"args_string":"(x : Int32, y : Int32) : Pixel","args_html":"(x : Int32, y : Int32) : Pixel","location":{"filename":"src/cr-image/grayscale_image.cr","line_number":73,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L73"},"def":{"name":"[]","args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"y","external_name":"y","restriction":"Int32"}],"return_type":"Pixel","visibility":"Public","body":"index = (y * width) + x\nPixel.new(gray[index], alpha[index])\n"}},{"html_id":"[](channel_type:ChannelType):Array(UInt8)-instance-method","name":"[]","doc":"Return the `Array(UInt8)` corresponding to `channel_type`","summary":"

        Return the Array(UInt8) corresponding to channel_type

        ","abstract":false,"args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"}],"args_string":"(channel_type : ChannelType) : Array(UInt8)","args_html":"(channel_type : ChannelType) : Array(UInt8)","location":{"filename":"src/cr-image/grayscale_image.cr","line_number":79,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L79"},"def":{"name":"[]","args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"}],"return_type":"Array(UInt8)","visibility":"Public","body":"if channel_type == ChannelType::Alpha\n return @alpha\nend\n@gray\n"}},{"html_id":"[]=(channel_type:ChannelType,channel:Array(UInt8)):Array(UInt8)-instance-method","name":"[]=","doc":"Set the underlying `Array(UInt8)` of `channel_type` to the new `channel`.\n\nWarning: this method does not check the size of the incoming array, and if it's a different\nsize from what the current image represents, this could break it. We recommend against using\nthis method except for from other methods that will be updating the `width` and `height` immediately after.","summary":"

        Set the underlying Array(UInt8) of channel_type to the new channel.

        ","abstract":false,"args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"},{"name":"channel","external_name":"channel","restriction":"Array(UInt8)"}],"args_string":"(channel_type : ChannelType, channel : Array(UInt8)) : Array(UInt8)","args_html":"(channel_type : ChannelType, channel : Array(UInt8)) : Array(UInt8)","location":{"filename":"src/cr-image/grayscale_image.cr","line_number":89,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L89"},"def":{"name":"[]=","args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"},{"name":"channel","external_name":"channel","restriction":"Array(UInt8)"}],"return_type":"Array(UInt8)","visibility":"Public","body":"case channel_type\nwhen ChannelType::Gray\n self.gray = channel\nwhen ChannelType::Alpha\n self.alpha = channel\nelse\n raise(\"Unknown channel type #{channel_type} for GrayscaleImage\")\nend"}},{"html_id":"alpha:Array(UInt8)-instance-method","name":"alpha","doc":"Return `alpha` channel","summary":"

        Return #alpha channel

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":58,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L58"},"def":{"name":"alpha","return_type":"Array(UInt8)","visibility":"Public","body":"@alpha"}},{"html_id":"alpha=(alpha:Array(UInt8))-instance-method","name":"alpha=","abstract":false,"args":[{"name":"alpha","external_name":"alpha","restriction":"Array(UInt8)"}],"args_string":"(alpha : Array(UInt8))","args_html":"(alpha : Array(UInt8))","location":{"filename":"src/cr-image/grayscale_image.cr","line_number":15,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L15"},"def":{"name":"alpha=","args":[{"name":"alpha","external_name":"alpha","restriction":"Array(UInt8)"}],"visibility":"Public","body":"@alpha = alpha"}},{"html_id":"blue:Array(UInt8)-instance-method","name":"blue","doc":"Return the \"`blue`\" channel (returns `gray`)","summary":"

        Return the "#blue" channel (returns #gray)

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":53,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L53"},"def":{"name":"blue","return_type":"Array(UInt8)","visibility":"Public","body":"@gray"}},{"html_id":"clone:GrayscaleImage-instance-method","name":"clone","doc":"Create a new GrayscaleImage as a copy of this one","summary":"

        Create a new GrayscaleImage as a copy of this one

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":33,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L33"},"def":{"name":"clone","return_type":"GrayscaleImage","visibility":"Public","body":"self.class.new(@gray.clone, @alpha.clone, @width, @height)"}},{"html_id":"each_channel(&:Array(UInt8),ChannelType->Nil):Nil-instance-method","name":"each_channel","doc":"Run provided block with the `ChannelType::Gray` and `ChannelType::Alpha` channels and channel types.","summary":"

        Run provided block with the ChannelType::Gray and ChannelType::Alpha channels and channel types.

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":63,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L63"},"def":{"name":"each_channel","yields":2,"block_arity":2,"block_arg":{"name":"","external_name":"","restriction":"(Array(UInt8), ChannelType -> Nil)"},"return_type":"Nil","visibility":"Public","body":"yield @gray, ChannelType::Gray\nyield @alpha, ChannelType::Alpha\nnil\n"}},{"html_id":"gray:Array(UInt8)-instance-method","name":"gray","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":14,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L14"},"def":{"name":"gray","return_type":"Array(UInt8)","visibility":"Public","body":"@gray"}},{"html_id":"gray=(gray:Array(UInt8))-instance-method","name":"gray=","abstract":false,"args":[{"name":"gray","external_name":"gray","restriction":"Array(UInt8)"}],"args_string":"(gray : Array(UInt8))","args_html":"(gray : Array(UInt8))","location":{"filename":"src/cr-image/grayscale_image.cr","line_number":14,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L14"},"def":{"name":"gray=","args":[{"name":"gray","external_name":"gray","restriction":"Array(UInt8)"}],"visibility":"Public","body":"@gray = gray"}},{"html_id":"green:Array(UInt8)-instance-method","name":"green","doc":"Return the \"`green`\" channel (returns `gray`)","summary":"

        Return the "#green" channel (returns #gray)

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":48,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L48"},"def":{"name":"green","return_type":"Array(UInt8)","visibility":"Public","body":"@gray"}},{"html_id":"height:Int32-instance-method","name":"height","doc":"Height of image","summary":"

        Height of image

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":17,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L17"},"def":{"name":"height","return_type":"Int32","visibility":"Public","body":"@height"}},{"html_id":"height=(height:Int32)-instance-method","name":"height=","abstract":false,"args":[{"name":"height","external_name":"height","restriction":"Int32"}],"args_string":"(height : Int32)","args_html":"(height : Int32)","location":{"filename":"src/cr-image/grayscale_image.cr","line_number":17,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L17"},"def":{"name":"height=","args":[{"name":"height","external_name":"height","restriction":"Int32"}],"visibility":"Public","body":"@height = height"}},{"html_id":"invert-instance-method","name":"invert","doc":"Invert grayscale pixels (replace each pixel will `255 - p` for all `p` in `@gray`).\n\n\"Woman\n\nBecomes\n\n\"Woman","summary":"

        Invert grayscale pixels (replace each pixel will 255 - p for all p in @gray).

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":121,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L121"},"def":{"name":"invert","visibility":"Public","body":"clone.invert!"}},{"html_id":"invert!-instance-method","name":"invert!","doc":"Invert grayscale pixels (replace each pixel will `255 - p` for all `p` in `@gray`). Modifies self.\n\n\"Woman\n\nBecomes\n\n\"Woman","summary":"

        Invert grayscale pixels (replace each pixel will 255 - p for all p in @gray).

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":132,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L132"},"def":{"name":"invert!","visibility":"Public","body":"@gray.map! do |pix|\n 255_u8 - pix\nend\nself\n"}},{"html_id":"mask_from(&block:Int32,Int32,UInt8->Bool):Mask-instance-method","name":"mask_from","doc":"Construct a `Mask` from this `GrayscaleImage` using the passed in block to determine if a given pixel should be true or not\n\n```\n# Construct a mask identifying the bright pixels in the bottom left corner of image\nimage.to_gray.mask_from do |x, y, pixel|\n x < image.width // 2 && # left half of image\n y > (image.height // 2) && # bottom half of image\n pixel > 128 # only \"bright\" pixels\nend\n```\n\"Woman\n->\n\"Mask","summary":"

        Construct a Mask from this GrayscaleImage using the passed in block to determine if a given pixel should be true or not

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":150,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L150"},"def":{"name":"mask_from","yields":3,"block_arity":3,"block_arg":{"name":"block","external_name":"block","restriction":"(Int32, Int32, UInt8 -> Bool)"},"return_type":"Mask","visibility":"Public","body":"Mask.new(width, BitArray.new(size) do |i|\n block.call(i % width, i // width, @gray[i])\nend)"}},{"html_id":"red:Array(UInt8)-instance-method","name":"red","doc":"Return the \"`red`\" channel (returns `gray`)","summary":"

        Return the "#red" channel (returns #gray)

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":43,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L43"},"def":{"name":"red","return_type":"Array(UInt8)","visibility":"Public","body":"@gray"}},{"html_id":"size:Int32-instance-method","name":"size","doc":"Return the number of pixels this image contains","summary":"

        Return the number of pixels this image contains

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":110,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L110"},"def":{"name":"size","return_type":"Int32","visibility":"Public","body":"@width * @height"}},{"html_id":"threshold(threshold:Int):Mask-instance-method","name":"threshold","doc":"Construct a simple threshold `Mask` containing all pixels with a `UInt8` value greater than `threshold`\nGiven sample image:\n\n\"Woman\n\n```\nimage\n .to_gray # convert color image to grayscale one\n .threshold(128) # generate a mask using threshold operator\n .to_gray # convert mask to grayscale image\n .save(\"threshold_example.jpg\") # save mask as grayscale\n```\n\"Black","summary":"

        Construct a simple threshold Mask containing all pixels with a UInt8 value greater than #threshold Given sample image:

        ","abstract":false,"args":[{"name":"threshold","external_name":"threshold","restriction":"Int"}],"args_string":"(threshold : Int) : Mask","args_html":"(threshold : Int) : Mask","location":{"filename":"src/cr-image/grayscale_image.cr","line_number":169,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L169"},"def":{"name":"threshold","args":[{"name":"threshold","external_name":"threshold","restriction":"Int"}],"return_type":"Mask","visibility":"Public","body":"mask_from do |_, _, pixel|\n pixel >= threshold\nend"}},{"html_id":"to_gray:GrayscaleImage-instance-method","name":"to_gray","doc":"Returns self","summary":"

        Returns self

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":105,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L105"},"def":{"name":"to_gray","return_type":"GrayscaleImage","visibility":"Public","body":"self"}},{"html_id":"to_rgba:RGBAImage-instance-method","name":"to_rgba","doc":"Convert this `GrayscaleImage` to an `RGBAImage`.\n\nNo color will be provided, all pixels will remain gray.","summary":"

        Convert this GrayscaleImage to an RGBAImage.

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":100,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L100"},"def":{"name":"to_rgba","return_type":"RGBAImage","visibility":"Public","body":"RGBAImage.new(@gray.clone, @gray.clone, @gray.clone, @alpha.clone, width, height)"}},{"html_id":"to_stumpy:StumpyCore::Canvas-instance-method","name":"to_stumpy","abstract":false,"location":{"filename":"src/stumpy.cr","line_number":39,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/stumpy.cr#L39"},"def":{"name":"to_stumpy","return_type":"StumpyCore::Canvas","visibility":"Public","body":"StumpyCore::Canvas.new(width, height) do |x, y|\n color = self[x, y]\n StumpyCore::RGBA.new(color.gray.to_u16 << 8, color.gray.to_u16 << 8, color.gray.to_u16 << 8, color.alpha.to_u16 << 8)\nend"}},{"html_id":"width:Int32-instance-method","name":"width","doc":"Width of image","summary":"

        Width of image

        ","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":16,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L16"},"def":{"name":"width","return_type":"Int32","visibility":"Public","body":"@width"}},{"html_id":"width=(width:Int32)-instance-method","name":"width=","abstract":false,"args":[{"name":"width","external_name":"width","restriction":"Int32"}],"args_string":"(width : Int32)","args_html":"(width : Int32)","location":{"filename":"src/cr-image/grayscale_image.cr","line_number":16,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L16"},"def":{"name":"width=","args":[{"name":"width","external_name":"width","restriction":"Int32"}],"visibility":"Public","body":"@width = width"}}],"types":[{"html_id":"Crystal Image/CrImage/GrayscaleImage/Pixel","path":"CrImage/GrayscaleImage/Pixel.html","kind":"struct","full_name":"CrImage::GrayscaleImage::Pixel","name":"Pixel","abstract":false,"superclass":{"html_id":"Crystal Image/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"Crystal Image/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"Crystal Image/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"Crystal Image/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cr-image/grayscale_image.cr","line_number":69,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L69"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"Crystal Image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},"constructors":[{"html_id":"new(gray:UInt8,alpha:UInt8)-class-method","name":"new","abstract":false,"args":[{"name":"gray","external_name":"gray","restriction":"UInt8"},{"name":"alpha","external_name":"alpha","restriction":"UInt8"}],"args_string":"(gray : UInt8, alpha : UInt8)","args_html":"(gray : UInt8, alpha : UInt8)","location":{"filename":"src/cr-image/grayscale_image.cr","line_number":69,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L69"},"def":{"name":"new","args":[{"name":"gray","external_name":"gray","restriction":"UInt8"},{"name":"alpha","external_name":"alpha","restriction":"UInt8"}],"visibility":"Public","body":"_ = allocate\n_.initialize(gray, alpha)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"alpha:UInt8-instance-method","name":"alpha","abstract":false,"def":{"name":"alpha","return_type":"UInt8","visibility":"Public","body":"@alpha"}},{"html_id":"clone-instance-method","name":"clone","abstract":false,"location":{"filename":"src/cr-image/grayscale_image.cr","line_number":69,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L69"},"def":{"name":"clone","visibility":"Public","body":"self.class.new(@gray.clone, @alpha.clone)"}},{"html_id":"copy_with(gray_gray=@gray,alpha_alpha=@alpha)-instance-method","name":"copy_with","abstract":false,"args":[{"name":"_gray","default_value":"@gray","external_name":"gray","restriction":""},{"name":"_alpha","default_value":"@alpha","external_name":"alpha","restriction":""}],"args_string":"(gray _gray = @gray, alpha _alpha = @alpha)","args_html":"(gray _gray = @gray, alpha _alpha = @alpha)","location":{"filename":"src/cr-image/grayscale_image.cr","line_number":69,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/grayscale_image.cr#L69"},"def":{"name":"copy_with","args":[{"name":"_gray","default_value":"@gray","external_name":"gray","restriction":""},{"name":"_alpha","default_value":"@alpha","external_name":"alpha","restriction":""}],"visibility":"Public","body":"self.class.new(_gray, _alpha)"}},{"html_id":"gray:UInt8-instance-method","name":"gray","abstract":false,"def":{"name":"gray","return_type":"UInt8","visibility":"Public","body":"@gray"}}]}]},{"html_id":"Crystal Image/CrImage/Image","path":"CrImage/Image.html","kind":"class","full_name":"CrImage::Image","name":"Image","abstract":true,"superclass":{"html_id":"Crystal Image/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"Crystal Image/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"Crystal Image/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cr-image/image.cr","line_number":3,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/image.cr#L3"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"subclasses":[{"html_id":"Crystal Image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"Crystal Image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"Crystal Image/CrImage","kind":"module","full_name":"CrImage","name":"CrImage"},"doc":"Common base class for `GrayscaleImage` and `RGBAImage`. All `Image`s are readable and saveable\nto the filesystem or `IO` stream.","summary":"

        Common base class for GrayscaleImage and RGBAImage.

        ","instance_methods":[{"html_id":"[](channel_type:ChannelType):Array(UInt8)-instance-method","name":"[]","doc":"Get the `Array(UInt8)` corresponding to `channel_type`)","summary":"

        Get the Array(UInt8) corresponding to channel_type)

        ","abstract":true,"args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"}],"args_string":"(channel_type : ChannelType) : Array(UInt8)","args_html":"(channel_type : ChannelType) : Array(UInt8)","location":{"filename":"src/cr-image/image.cr","line_number":51,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/image.cr#L51"},"def":{"name":"[]","args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"}],"return_type":"Array(UInt8)","visibility":"Public","body":""}},{"html_id":"[]=(channel_type:ChannelType,channel:Array(UInt8)):Array(UInt8)-instance-method","name":"[]=","doc":"Set the `Array(UInt8)` corresponding to `channel_type`) to `channel`","summary":"

        Set the Array(UInt8) corresponding to channel_type) to channel

        ","abstract":true,"args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"},{"name":"channel","external_name":"channel","restriction":"Array(UInt8)"}],"args_string":"(channel_type : ChannelType, channel : Array(UInt8)) : Array(UInt8)","args_html":"(channel_type : ChannelType, channel : Array(UInt8)) : Array(UInt8)","location":{"filename":"src/cr-image/image.cr","line_number":53,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/image.cr#L53"},"def":{"name":"[]=","args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"},{"name":"channel","external_name":"channel","restriction":"Array(UInt8)"}],"return_type":"Array(UInt8)","visibility":"Public","body":""}},{"html_id":"alpha:Array(UInt8)-instance-method","name":"alpha","doc":"Return the alpha channel","summary":"

        Return the alpha channel

        ","abstract":true,"location":{"filename":"src/cr-image/image.cr","line_number":39,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/image.cr#L39"},"def":{"name":"alpha","return_type":"Array(UInt8)","visibility":"Public","body":""}},{"html_id":"blue:Array(UInt8)-instance-method","name":"blue","doc":"Return the blue channel","summary":"

        Return the blue channel

        ","abstract":true,"location":{"filename":"src/cr-image/image.cr","line_number":37,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/image.cr#L37"},"def":{"name":"blue","return_type":"Array(UInt8)","visibility":"Public","body":""}},{"html_id":"each_channel(&:Array(UInt8),ChannelType->Nil):Nil-instance-method","name":"each_channel","doc":"Run provided block on each channel supported by this image.","summary":"

        Run provided block on each channel supported by this image.

        ","abstract":true,"location":{"filename":"src/cr-image/image.cr","line_number":48,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/image.cr#L48"},"def":{"name":"each_channel","yields":2,"block_arity":2,"block_arg":{"name":"","external_name":"","restriction":"(Array(UInt8), ChannelType -> Nil)"},"return_type":"Nil","visibility":"Public","body":""}},{"html_id":"green:Array(UInt8)-instance-method","name":"green","doc":"Return the green channel","summary":"

        Return the green channel

        ","abstract":true,"location":{"filename":"src/cr-image/image.cr","line_number":35,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/image.cr#L35"},"def":{"name":"green","return_type":"Array(UInt8)","visibility":"Public","body":""}},{"html_id":"height:Int32-instance-method","name":"height","doc":"Height of image","summary":"

        Height of image

        ","abstract":true,"location":{"filename":"src/cr-image/image.cr","line_number":43,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/image.cr#L43"},"def":{"name":"height","return_type":"Int32","visibility":"Public","body":""}},{"html_id":"red:Array(UInt8)-instance-method","name":"red","doc":"Return the red channel","summary":"

        Return the red channel

        ","abstract":true,"location":{"filename":"src/cr-image/image.cr","line_number":33,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/image.cr#L33"},"def":{"name":"red","return_type":"Array(UInt8)","visibility":"Public","body":""}},{"html_id":"size:Int32-instance-method","name":"size","doc":"Size (total pixels) in image (`width` * `height`)","summary":"

        Size (total pixels) in image (#width * #height)

        ","abstract":true,"location":{"filename":"src/cr-image/image.cr","line_number":45,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/image.cr#L45"},"def":{"name":"size","return_type":"Int32","visibility":"Public","body":""}},{"html_id":"width:Int32-instance-method","name":"width","doc":"Width of image","summary":"

        Width of image

        ","abstract":true,"location":{"filename":"src/cr-image/image.cr","line_number":41,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/image.cr#L41"},"def":{"name":"width","return_type":"Int32","visibility":"Public","body":""}}],"macros":[{"html_id":"subsclasses_include(mod)-macro","name":"subsclasses_include","abstract":false,"args":[{"name":"mod","external_name":"mod","restriction":""}],"args_string":"(mod)","args_html":"(mod)","location":{"filename":"src/cr-image/image.cr","line_number":4,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/image.cr#L4"},"def":{"name":"subsclasses_include","args":[{"name":"mod","external_name":"mod","restriction":""}],"visibility":"Public","body":" \n{% for sub in @type.subclasses %}\n class ::{{ sub }}\n include {{ mod }}\n end\n {% end %}\n\n \n"}}]},{"html_id":"Crystal Image/CrImage/Mask","path":"CrImage/Mask.html","kind":"class","full_name":"CrImage::Mask","name":"Mask","abstract":false,"superclass":{"html_id":"Crystal Image/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"Crystal Image/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"Crystal Image/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cr-image/mask.cr","line_number":39,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L39"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"Crystal Image/CrImage","kind":"module","full_name":"CrImage","name":"CrImage"},"doc":"Mask is a wrapper around BitArray, where each flag represents a boolean bit of information about a pixel\nfrom an image. This can include whether a particular pixel has a value within certain conditions, OR\nif that pixel should be zeroed out or not.\n\nSee `[]=` methods below for examples of how to manually construct masks.\n\n(x,y) - coordinates. Represent these positions in a Mask of size 10x10:\n\n```\n[\n (0,0), (0,1), (0,2), (0,3), (0,4), (0,5), (0,6), (0,7), (0,8), (0,9),\n (1,0), (1,1), (1,2), (1,3), (1,4), (1,5), (1,6), (1,7), (1,8), (1,9),\n (2,0), (2,1), (2,2), (2,3), (2,4), (2,5), (2,6), (2,7), (2,8), (2,9),\n (3,0), (3,1), (3,2), (3,3), (3,4), (3,5), (3,6), (3,7), (3,8), (3,9),\n (4,0), (4,1), (4,2), (4,3), (4,4), (4,5), (4,6), (4,7), (4,8), (4,9),\n (5,0), (5,1), (5,2), (5,3), (5,4), (5,5), (5,6), (5,7), (5,8), (5,9),\n (6,0), (6,1), (6,2), (6,3), (6,4), (6,5), (6,6), (6,7), (6,8), (6,9),\n (7,0), (7,1), (7,2), (7,3), (7,4), (7,5), (7,6), (7,7), (7,8), (7,9),\n (8,0), (8,1), (8,2), (8,3), (8,4), (8,5), (8,6), (8,7), (8,8), (8,9),\n (9,0), (9,1), (9,2), (9,3), (9,4), (9,5), (9,6), (9,7), (9,8), (9,9),\n]\n```\n\nAnd every position is a Bool value.\n\nDifferent ways to refer to coordinates:\n```\nmask.at(0, 0) # => (0,0)\nmask[0, 0] # => (0,0), same as .at(0, 0)\nmask[0..1, 4] # => (4,0), (4,1)\nmask[3, 3..5] # => (3,3), (3,4), (3,5)\nmask[2..3, 4..5] # => (2,4), (2,5), (3,4), (3,5)\n```\n\nSee `Operation::Crop` and `Operation::MaskApply` for how this can be useful","summary":"

        Mask is a wrapper around BitArray, where each flag represents a boolean bit of information about a pixel from an image.

        ","constructors":[{"html_id":"new(width:Int32,height:Int32,initial:Bool=true)-class-method","name":"new","doc":"Construct a new `Mask` of width x height, preset to `initial`","summary":"

        Construct a new Mask of width x height, preset to initial

        ","abstract":false,"args":[{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"height","external_name":"height","restriction":"Int32"},{"name":"initial","default_value":"true","external_name":"initial","restriction":"Bool"}],"args_string":"(width : Int32, height : Int32, initial : Bool = true)","args_html":"(width : Int32, height : Int32, initial : Bool = true)","location":{"filename":"src/cr-image/mask.cr","line_number":49,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L49"},"def":{"name":"new","args":[{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"height","external_name":"height","restriction":"Int32"},{"name":"initial","default_value":"true","external_name":"initial","restriction":"Bool"}],"visibility":"Public","body":"_ = allocate\n_.initialize(width, height, initial)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(width:Int32,height:Int32,int:Int)-class-method","name":"new","doc":"Construct a new `Mask` from an integer (useful for testing or small mask construction)","summary":"

        Construct a new Mask from an integer (useful for testing or small mask construction)

        ","abstract":false,"args":[{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"height","external_name":"height","restriction":"Int32"},{"name":"int","external_name":"int","restriction":"Int"}],"args_string":"(width : Int32, height : Int32, int : Int)","args_html":"(width : Int32, height : Int32, int : Int)","location":{"filename":"src/cr-image/mask.cr","line_number":61,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L61"},"def":{"name":"new","args":[{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"height","external_name":"height","restriction":"Int32"},{"name":"int","external_name":"int","restriction":"Int"}],"visibility":"Public","body":"_ = allocate\n_.initialize(width, height, int)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(other_bits:Array(BitArray))-class-method","name":"new","doc":"Construct a new `Mask` from an array of `BitArray`. See `#[](xs : Range, ys : Range) : Array(BitArray)`\n\nThis assumes `other_bits[0]` corresponds to `x == 0` in the mask, and the corresponding\n`BitArray` represents all bits for that row. All `BitArray`s must be of the same size in\n`other_bits`.","summary":"

        Construct a new Mask from an array of BitArray.

        ","abstract":false,"args":[{"name":"other_bits","external_name":"other_bits","restriction":"Array(BitArray)"}],"args_string":"(other_bits : Array(BitArray))","args_html":"(other_bits : Array(BitArray))","location":{"filename":"src/cr-image/mask.cr","line_number":77,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L77"},"def":{"name":"new","args":[{"name":"other_bits","external_name":"other_bits","restriction":"Array(BitArray)"}],"visibility":"Public","body":"_ = allocate\n_.initialize(other_bits)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(image:Image,initial:Bool=true)-class-method","name":"new","doc":"Construct a new `Mask` from the dimensions of passed in `image` with an initial bit","summary":"

        Construct a new Mask from the dimensions of passed in image with an initial bit

        ","abstract":false,"args":[{"name":"image","external_name":"image","restriction":"Image"},{"name":"initial","default_value":"true","external_name":"initial","restriction":"Bool"}],"args_string":"(image : Image, initial : Bool = true)","args_html":"(image : Image, initial : Bool = true)","location":{"filename":"src/cr-image/mask.cr","line_number":67,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L67"},"def":{"name":"new","args":[{"name":"image","external_name":"image","restriction":"Image"},{"name":"initial","default_value":"true","external_name":"initial","restriction":"Bool"}],"visibility":"Public","body":"_ = allocate\n_.initialize(image, initial)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(width:Int32,bits:BitArray)-class-method","name":"new","doc":"Construct a new `Mask` with a set width and bits from `bits`","summary":"

        Construct a new Mask with a set width and bits from #bits

        ","abstract":false,"args":[{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"bits","external_name":"bits","restriction":"::BitArray"}],"args_string":"(width : Int32, bits : BitArray)","args_html":"(width : Int32, bits : BitArray)","location":{"filename":"src/cr-image/mask.cr","line_number":44,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L44"},"def":{"name":"new","args":[{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"bits","external_name":"bits","restriction":"::BitArray"}],"visibility":"Public","body":"_ = allocate\n_.initialize(width, bits)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(width:Int32,height:Int32,&block:Int32,Int32->Bool)-class-method","name":"new","doc":"Construct a new `Mask` of width x height using `&block` to determine if a bit should be true or not (passed in `x` and `y` coordinates)","summary":"

        Construct a new Mask of width x height using &block to determine if a bit should be true or not (passed in x and y coordinates)

        ","abstract":false,"args":[{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"height","external_name":"height","restriction":"Int32"}],"args_string":"(width : Int32, height : Int32, &block : Int32, Int32 -> Bool)","args_html":"(width : Int32, height : Int32, &block : Int32, Int32 -> Bool)","location":{"filename":"src/cr-image/mask.cr","line_number":54,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L54"},"def":{"name":"new","args":[{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"height","external_name":"height","restriction":"Int32"}],"yields":2,"block_arity":2,"block_arg":{"name":"block","external_name":"block","restriction":"(Int32, Int32 -> Bool)"},"visibility":"Public","body":"_ = allocate\n_.initialize(width, height, &block) do |_arg0, _arg1|\n yield _arg0, _arg1\nend\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"==(other:Mask)-instance-method","name":"==","abstract":false,"args":[{"name":"other","external_name":"other","restriction":"Mask"}],"args_string":"(other : Mask)","args_html":"(other : Mask)","location":{"filename":"src/cr-image/mask.cr","line_number":166,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L166"},"def":{"name":"==","args":[{"name":"other","external_name":"other","restriction":"Mask"}],"visibility":"Public","body":"(width == other.width) && (bits == other.bits)"}},{"html_id":"[](x:Int32,y:Int32):Bool-instance-method","name":"[]","doc":"Return the bit at `x` and `y`","summary":"

        Return the bit at x and y

        ","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"y","external_name":"y","restriction":"Int32"}],"args_string":"(x : Int32, y : Int32) : Bool","args_html":"(x : Int32, y : Int32) : Bool","location":{"filename":"src/cr-image/mask.cr","line_number":136,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L136"},"def":{"name":"[]","args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"y","external_name":"y","restriction":"Int32"}],"return_type":"Bool","visibility":"Public","body":"if x >= width || y >= height\n raise(IndexError.new(\"Out of bounds: this mask is #{width}x#{height}, and (#{x},#{y}) is outside of that\"))\nend\n@bits[(y * width) + x]\n"}},{"html_id":"[](xs:Range,y:Int32):BitArray-instance-method","name":"[]","doc":"Return a new `BitArray` corresponding to the partial row specified","summary":"

        Return a new BitArray corresponding to the partial row specified

        ","abstract":false,"args":[{"name":"xs","external_name":"xs","restriction":"Range"},{"name":"y","external_name":"y","restriction":"Int32"}],"args_string":"(xs : Range, y : Int32) : BitArray","args_html":"(xs : Range, y : Int32) : BitArray","location":{"filename":"src/cr-image/mask.cr","line_number":142,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L142"},"def":{"name":"[]","args":[{"name":"xs","external_name":"xs","restriction":"Range"},{"name":"y","external_name":"y","restriction":"Int32"}],"return_type":"BitArray","visibility":"Public","body":"start, count = resolve_to_start_and_count(xs, width)\nBitArray.new(count) do |x|\n self[x + start, y]\nend\n"}},{"html_id":"[](x:Int32,ys:Range):BitArray-instance-method","name":"[]","doc":"Return a new `BitArray` corresponding to the partial column specified","summary":"

        Return a new BitArray corresponding to the partial column specified

        ","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"ys","external_name":"ys","restriction":"Range"}],"args_string":"(x : Int32, ys : Range) : BitArray","args_html":"(x : Int32, ys : Range) : BitArray","location":{"filename":"src/cr-image/mask.cr","line_number":148,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L148"},"def":{"name":"[]","args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"ys","external_name":"ys","restriction":"Range"}],"return_type":"BitArray","visibility":"Public","body":"start, count = resolve_to_start_and_count(ys, height)\nBitArray.new(count) do |y|\n self[x, y + start]\nend\n"}},{"html_id":"[](xs:Range,ys:Range):Array(BitArray)-instance-method","name":"[]","doc":"Return an `Array(BitArray)` for the partial box (of partial rows and partial columns) of this mask.\n\nCan be used to construct another mask from.","summary":"

        Return an Array(BitArray) for the partial box (of partial rows and partial columns) of this mask.

        ","abstract":false,"args":[{"name":"xs","external_name":"xs","restriction":"Range"},{"name":"ys","external_name":"ys","restriction":"Range"}],"args_string":"(xs : Range, ys : Range) : Array(BitArray)","args_html":"(xs : Range, ys : Range) : Array(BitArray)","location":{"filename":"src/cr-image/mask.cr","line_number":156,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L156"},"def":{"name":"[]","args":[{"name":"xs","external_name":"xs","restriction":"Range"},{"name":"ys","external_name":"ys","restriction":"Range"}],"return_type":"Array(BitArray)","visibility":"Public","body":"start_x, count_x = resolve_to_start_and_count(xs, width)\nstart_y, count_y = resolve_to_start_and_count(ys, height)\ncount_y.times.to_a.map do |y|\n BitArray.new(count_x) do |x|\n self[x + start_x, y + start_y]\n end\nend\n"}},{"html_id":"[]=(x:Int32,y:Int32,value:Bool):Bool-instance-method","name":"[]=","doc":"Set the bit for coordinate `x` and `y`\n\n```\nmask = CrImage::Mask.new(50, 50, false)\nmask[20, 20] = true\nmask.to_gray.save(\"mask_point.jpg\")\n```\n\"Black","summary":"

        Set the bit for coordinate x and y

        ","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"y","external_name":"y","restriction":"Int32"},{"name":"value","external_name":"value","restriction":"Bool"}],"args_string":"(x : Int32, y : Int32, value : Bool) : Bool","args_html":"(x : Int32, y : Int32, value : Bool) : Bool","location":{"filename":"src/cr-image/mask.cr","line_number":186,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L186"},"def":{"name":"[]=","args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"y","external_name":"y","restriction":"Int32"},{"name":"value","external_name":"value","restriction":"Bool"}],"return_type":"Bool","visibility":"Public","body":"self.set(x, y, value)"}},{"html_id":"[]=(xs:Range,y:Int32,value:Bool):Bool-instance-method","name":"[]=","doc":"Set the bits for partial row `xs` at column `y`\n\n```\nmask = CrImage::Mask.new(50, 50, false)\nmask[20..40, 20] = true\nmask.to_gray.save(\"mask_partial_row.jpg\")\n```\n\"Black","summary":"

        Set the bits for partial row xs at column y

        ","abstract":false,"args":[{"name":"xs","external_name":"xs","restriction":"Range"},{"name":"y","external_name":"y","restriction":"Int32"},{"name":"value","external_name":"value","restriction":"Bool"}],"args_string":"(xs : Range, y : Int32, value : Bool) : Bool","args_html":"(xs : Range, y : Int32, value : Bool) : Bool","location":{"filename":"src/cr-image/mask.cr","line_number":198,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L198"},"def":{"name":"[]=","args":[{"name":"xs","external_name":"xs","restriction":"Range"},{"name":"y","external_name":"y","restriction":"Int32"},{"name":"value","external_name":"value","restriction":"Bool"}],"return_type":"Bool","visibility":"Public","body":"if y >= height\n raise(IndexError.new(\"Out of bounds: #{y} is beyond the bounds of this mask's height of #{height}\"))\nend\nstart_x, count_x = resolve_to_start_and_count(xs, width)\n@bits.fill(value, (y * width) + start_x, count_x)\nclear_caches\nvalue\n"}},{"html_id":"[]=(x:Int32,ys:Range,value:Bool):Bool-instance-method","name":"[]=","doc":"Set the bits for row `x` and partial columns `ys`\n\n```\nmask = CrImage::Mask.new(50, 50, false)\nmask[20..40, 20] = true\nmask.to_gray.save(\"mask_partial_column.jpg\")\n```\n\"Black","summary":"

        Set the bits for row x and partial columns ys

        ","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"ys","external_name":"ys","restriction":"Range"},{"name":"value","external_name":"value","restriction":"Bool"}],"args_string":"(x : Int32, ys : Range, value : Bool) : Bool","args_html":"(x : Int32, ys : Range, value : Bool) : Bool","location":{"filename":"src/cr-image/mask.cr","line_number":214,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L214"},"def":{"name":"[]=","args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"ys","external_name":"ys","restriction":"Range"},{"name":"value","external_name":"value","restriction":"Bool"}],"return_type":"Bool","visibility":"Public","body":"if x >= width\n raise(IndexError.new(\"Out of bounds: #{x} is beyond the bounds of this mask's width of #{width}\"))\nend\nstart_y, count_y = resolve_to_start_and_count(ys, height)\ncount_y.times.to_a.each do |y|\n set(x, y + start_y, value)\nend\nvalue\n"}},{"html_id":"[]=(xs:Range,ys:Range,value:Bool):Bool-instance-method","name":"[]=","doc":"Set the bits for partial rows `xs` and partial columns `ys`\n\n```\nmask = CrImage::Mask.new(50, 50, false)\nmask[20..40, 20..40] = true\nmask.to_gray.save(\"mask_partial_column.jpg\")\n```\n\"Black","summary":"

        Set the bits for partial rows xs and partial columns ys

        ","abstract":false,"args":[{"name":"xs","external_name":"xs","restriction":"Range"},{"name":"ys","external_name":"ys","restriction":"Range"},{"name":"value","external_name":"value","restriction":"Bool"}],"args_string":"(xs : Range, ys : Range, value : Bool) : Bool","args_html":"(xs : Range, ys : Range, value : Bool) : Bool","location":{"filename":"src/cr-image/mask.cr","line_number":231,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L231"},"def":{"name":"[]=","args":[{"name":"xs","external_name":"xs","restriction":"Range"},{"name":"ys","external_name":"ys","restriction":"Range"},{"name":"value","external_name":"value","restriction":"Bool"}],"return_type":"Bool","visibility":"Public","body":"start_x, count_x = resolve_to_start_and_count(xs, width)\nstart_y, count_y = resolve_to_start_and_count(ys, height)\ncount_y.times.to_a.each do |y|\n @bits.fill(value, ((y + start_y) * width) + start_x, count_x)\nend\nclear_caches\nvalue\n"}},{"html_id":"apply(image:Image):Image-instance-method","name":"apply","doc":"Apply this mask to the provided image with `Operation::MaskApply#apply`","summary":"

        Apply this mask to the provided image with Operation::MaskApply#apply

        ","abstract":false,"args":[{"name":"image","external_name":"image","restriction":"Image"}],"args_string":"(image : Image) : Image","args_html":"(image : Image) : Image","location":{"filename":"src/cr-image/mask.cr","line_number":247,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L247"},"def":{"name":"apply","args":[{"name":"image","external_name":"image","restriction":"Image"}],"return_type":"Image","visibility":"Public","body":"image.apply(self)"}},{"html_id":"apply(image:Image,&block:Int32,Int32,UInt8,ChannelType->UInt8):Image-instance-method","name":"apply","doc":"Apply this mask to the provided image with `Operation::MaskApply#apply`","summary":"

        Apply this mask to the provided image with Operation::MaskApply#apply

        ","abstract":false,"args":[{"name":"image","external_name":"image","restriction":"Image"}],"args_string":"(image : Image, &block : Int32, Int32, UInt8, ChannelType -> UInt8) : Image","args_html":"(image : Image, &block : Int32, Int32, UInt8, ChannelType -> UInt8) : Image","location":{"filename":"src/cr-image/mask.cr","line_number":252,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L252"},"def":{"name":"apply","args":[{"name":"image","external_name":"image","restriction":"Image"}],"yields":4,"block_arity":4,"block_arg":{"name":"block","external_name":"block","restriction":"(Int32, Int32, UInt8, ChannelType -> UInt8)"},"return_type":"Image","visibility":"Public","body":"image.apply(self, &block)"}},{"html_id":"at(index:Int32):Bool-instance-method","name":"at","doc":"Return the bit at `index`","summary":"

        Return the bit at index

        ","abstract":false,"args":[{"name":"index","external_name":"index","restriction":"Int32"}],"args_string":"(index : Int32) : Bool","args_html":"(index : Int32) : Bool","location":{"filename":"src/cr-image/mask.cr","line_number":124,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L124"},"def":{"name":"at","args":[{"name":"index","external_name":"index","restriction":"Int32"}],"return_type":"Bool","visibility":"Public","body":"if index >= size\n raise(\"Index #{index} exceeds mask size #{@bits.size}\")\nend\n@bits[index]\n"}},{"html_id":"bits:BitArray-instance-method","name":"bits","abstract":false,"location":{"filename":"src/cr-image/mask.cr","line_number":41,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L41"},"def":{"name":"bits","return_type":"BitArray","visibility":"Public","body":"@bits"}},{"html_id":"clone-instance-method","name":"clone","doc":"Create a new `Mask` from this one without modifying it","summary":"

        Create a new Mask from this one without modifying it

        ","abstract":false,"location":{"filename":"src/cr-image/mask.cr","line_number":95,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L95"},"def":{"name":"clone","visibility":"Public","body":"Mask.new(width, bits.dup)"}},{"html_id":"height:Int32-instance-method","name":"height","abstract":false,"location":{"filename":"src/cr-image/mask.cr","line_number":99,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L99"},"def":{"name":"height","return_type":"Int32","visibility":"Public","body":"@bits.size // width"}},{"html_id":"invert-instance-method","name":"invert","doc":"Return a new `Mask` that's a copy of this one with all bits inverted.","summary":"

        Return a new Mask that's a copy of this one with all bits inverted.

        ","abstract":false,"location":{"filename":"src/cr-image/mask.cr","line_number":117,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L117"},"def":{"name":"invert","visibility":"Public","body":"new_bits = @bits.dup\nnew_bits.invert\nMask.new(width, new_bits)\n"}},{"html_id":"invert!-instance-method","name":"invert!","doc":"Invert all bits in this instance of `Mask`. Modifies self.\n\n\"Black\n\nBecomes\n\n\"White","summary":"

        Invert all bits in this instance of Mask.

        ","abstract":false,"location":{"filename":"src/cr-image/mask.cr","line_number":110,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L110"},"def":{"name":"invert!","visibility":"Public","body":"@bits.invert\nclear_caches\nself\n"}},{"html_id":"region:Region-instance-method","name":"region","doc":"Returns the bounding box of the mask where all true bits are contained. Any pixels outside of the region are false\n\n```\nmask = CrImage::Mask.new(50, 50, false)\nmask[20..40, 20] = true\nmask[20, 20..40] = true\nmask.region # => Region(x: 20, y: 20, width: 20, height: 20)\n```\n\n\"Black","summary":"

        Returns the bounding box of the mask where all true bits are contained.

        ","abstract":false,"location":{"filename":"src/cr-image/mask.cr","line_number":274,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L274"},"def":{"name":"region","return_type":"Region","visibility":"Public","body":"@region || (@region = calculate_region)"}},{"html_id":"segments(*,diagonal:Bool=true):Array(Mask)-instance-method","name":"segments","doc":"Return an array of `Mask`s, each one corresponding to an area of contiguous true bits (identified from flood fills).\n\nMay specify `diagonal: false` for only 4-way (up, down, left, right) flood fill instead of default 8-way.\nStarting with sample mask:\n```\nmask = CrImage::Mask.new(50, 50, false)\n\nmask[5..45, 5..45] = true\nmask[15..35, 15..35] = false\nmask[21..25, 21..25] = true\nmask[26..30, 26..30] = true\n```\n\n\"Black\n\nIts segments look like:\n```\nmask.segments.each_with_index do |segment, i|\n segment.to_gray.save(\"mask_8-way_segments_example_#{i}.jpg\")\nend\n```\nYields the images:\n\n\"Black\n\"Black\n\nUsing `diagonal: false` yields:\n```\nmask.segments(diagonal: false).each_with_index do |segment, i|\n segment.to_gray.save(\"mask_4-way_segments_example_#{i}.jpg\")\nend\n```\nYields the images:\n\n\"Black\n\"Black\n\"Black","summary":"

        Return an array of Masks, each one corresponding to an area of contiguous true bits (identified from flood fills).

        ","abstract":false,"args":[{"name":"","external_name":"","restriction":""},{"name":"diagonal","default_value":"true","external_name":"diagonal","restriction":"Bool"}],"args_string":"(*, diagonal : Bool = true) : Array(Mask)","args_html":"(*, diagonal : Bool = true) : Array(Mask)","location":{"filename":"src/cr-image/mask.cr","line_number":342,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L342"},"def":{"name":"segments","args":[{"name":"","external_name":"","restriction":""},{"name":"diagonal","default_value":"true","external_name":"diagonal","restriction":"Bool"}],"splat_index":0,"return_type":"Array(Mask)","visibility":"Public","body":"diagonal ? (@segments_8_way || (@segments_8_way = calculate_segments(diagonal))) : (@segments_4_way || (@segments_4_way = calculate_segments(diagonal)))"}},{"html_id":"set(x:Int32,y:Int32,value:Bool):Bool-instance-method","name":"set","doc":"Set the bit for coordinate `x` and `y`","summary":"

        Set the bit for coordinate x and y

        ","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"y","external_name":"y","restriction":"Int32"},{"name":"value","external_name":"value","restriction":"Bool"}],"args_string":"(x : Int32, y : Int32, value : Bool) : Bool","args_html":"(x : Int32, y : Int32, value : Bool) : Bool","location":{"filename":"src/cr-image/mask.cr","line_number":172,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L172"},"def":{"name":"set","args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"y","external_name":"y","restriction":"Int32"},{"name":"value","external_name":"value","restriction":"Bool"}],"return_type":"Bool","visibility":"Public","body":"if x >= width || y >= height\n raise(IndexError.new(\"Out of bounds: this mask is #{width}x#{height}, and (#{x},#{y}) is outside of that\"))\nend\nclear_caches\n@bits[(y * width) + x] = value\n"}},{"html_id":"size(*args,**options)-instance-method","name":"size","doc":"How many bits are stored in this `Mask`","summary":"

        How many bits are stored in this Mask

        ","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/cr-image/mask.cr","line_number":92,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L92"},"def":{"name":"size","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"bits.size(*args, **options)"}},{"html_id":"size(*args,**options,&)-instance-method","name":"size","doc":"How many bits are stored in this `Mask`","summary":"

        How many bits are stored in this Mask

        ","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/cr-image/mask.cr","line_number":92,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L92"},"def":{"name":"size","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"bits.size(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"to_gray:GrayscaleImage-instance-method","name":"to_gray","doc":"Convert this `Mask` to a `GrayscaleImage`, with false bits becoming 0, and true bits becoming 255","summary":"

        Convert this Mask to a GrayscaleImage, with false bits becoming 0, and true bits becoming 255

        ","abstract":false,"location":{"filename":"src/cr-image/mask.cr","line_number":242,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L242"},"def":{"name":"to_gray","return_type":"GrayscaleImage","visibility":"Public","body":"GrayscaleImage.new(bits.map do |b|\n b ? 255_u8 : 0_u8\nend, width, height)"}},{"html_id":"width:Int32-instance-method","name":"width","abstract":false,"location":{"filename":"src/cr-image/mask.cr","line_number":40,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/mask.cr#L40"},"def":{"name":"width","return_type":"Int32","visibility":"Public","body":"@width"}}]},{"html_id":"Crystal Image/CrImage/Operation","path":"CrImage/Operation.html","kind":"module","full_name":"CrImage::Operation","name":"Operation","abstract":false,"locations":[{"filename":"src/cr-image/operation/bilinear_resize.cr","line_number":14,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/bilinear_resize.cr#L14"},{"filename":"src/cr-image/operation/operation.cr","line_number":2,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/operation.cr#L2"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"Crystal Image/CrImage","kind":"module","full_name":"CrImage","name":"CrImage"},"doc":"Module for containing individual operations for `Image` classes.","summary":"

        Module for containing individual operations for Image classes.

        ","types":[{"html_id":"Crystal Image/CrImage/Operation/BilinearResize","path":"CrImage/Operation/BilinearResize.html","kind":"module","full_name":"CrImage::Operation::BilinearResize","name":"BilinearResize","abstract":false,"locations":[{"filename":"src/cr-image/operation/bilinear_resize.cr","line_number":14,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/bilinear_resize.cr#L14"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"Crystal Image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"Crystal Image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"Crystal Image/CrImage/Operation","kind":"module","full_name":"CrImage::Operation","name":"Operation"},"doc":"Resize an image using a bilinear resizing algorithm.\n\nTaking sample `image`:\n\n\"Woman\n\n```\nputs image.width, image.height # => 159x199\nimage.bilinear_resize(40, 50).save(\"small_sample.jpg\")\nimage.bilinear_resize(200, 250).save(\"larger_sample.jpg\")\n```\n\"Sample\n\"Sample","summary":"

        Resize an image using a bilinear resizing algorithm.

        ","instance_methods":[{"html_id":"bilinear_resize(width:Int32,height:Int32):self-instance-method","name":"bilinear_resize","doc":"Resizes image to new dimensions","summary":"

        Resizes image to new dimensions

        ","abstract":false,"args":[{"name":"width","external_name":"width","restriction":"Int32"},{"name":"height","external_name":"height","restriction":"Int32"}],"args_string":"(width : Int32, height : Int32) : self","args_html":"(width : Int32, height : Int32) : self","location":{"filename":"src/cr-image/operation/bilinear_resize.cr","line_number":16,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/bilinear_resize.cr#L16"},"def":{"name":"bilinear_resize","args":[{"name":"width","external_name":"width","restriction":"Int32"},{"name":"height","external_name":"height","restriction":"Int32"}],"return_type":"self","visibility":"Public","body":"clone.bilinear_resize!(width, height)"}},{"html_id":"bilinear_resize!(width:Int32,height:Int32):self-instance-method","name":"bilinear_resize!","doc":"Resizes image to new dimensions. Modifies self.","summary":"

        Resizes image to new dimensions.

        ","abstract":false,"args":[{"name":"width","external_name":"width","restriction":"Int32"},{"name":"height","external_name":"height","restriction":"Int32"}],"args_string":"(width : Int32, height : Int32) : self","args_html":"(width : Int32, height : Int32) : self","location":{"filename":"src/cr-image/operation/bilinear_resize.cr","line_number":21,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/bilinear_resize.cr#L21"},"def":{"name":"bilinear_resize!","args":[{"name":"width","external_name":"width","restriction":"Int32"},{"name":"height","external_name":"height","restriction":"Int32"}],"return_type":"self","visibility":"Public","body":"x_ratio = width > 1 ? (@width - 1) / (width - 1) : 0\ny_ratio = height > 1 ? (@height - 1) / (height - 1) : 0\neach_channel do |channel, channel_type|\n resized_channel = Array.new(width * height) do\n 0_u8\n end\n height.times do |h|\n width.times do |w|\n x = w * x_ratio\n y = h * y_ratio\n x_ceil = Math.min(@width - 1, x.ceil.to_i)\n x_floor = x.floor.to_i\n y_ceil = Math.min(@height - 1, y.ceil.to_i)\n y_floor = y.floor.to_i\n value = case\n when (x_ceil == x_floor) && (y_ceil == y_floor)\n x_index = x.to_i\n y_index = y.to_i\n channel.unsafe_fetch((@width * y_index) + x_index)\n when x_ceil == x_floor\n x_index = x.to_i\n q_1 = channel.unsafe_fetch((@width * y_ceil) + x_index)\n q_2 = channel.unsafe_fetch((@width * y_floor) + x_index)\n ((q_2 * (y_ceil - y)) + (q_1 * (y - y_floor))).to_u8\n when y_ceil == y_floor\n y_index = y.to_i\n q_1 = channel.unsafe_fetch((@width * y_index) + x_ceil)\n q_2 = channel.unsafe_fetch((@width * y_index) + x_floor)\n ((q_2 * (x_ceil - x)) + (q_1 * (x - x_floor))).to_u8\n else\n v_1 = channel.unsafe_fetch((@width * y_floor) + x_floor)\n v_2 = channel.unsafe_fetch((@width * y_floor) + x_ceil)\n v_3 = channel.unsafe_fetch((@width * y_ceil) + x_floor)\n v_4 = channel.unsafe_fetch((@width * y_ceil) + x_ceil)\n q_1 = (v_1 * (x_ceil - x)) + (v_2 * (x - x_floor))\n q_2 = (v_3 * (x_ceil - x)) + (v_4 * (x - x_floor))\n ((q_1 * (y_ceil - y)) + (q_2 * (y - y_floor))).to_u8\n end\n resized_channel.unsafe_put((width * h) + w, value)\n end\n end\n self[channel_type] = resized_channel\nend\n@width = width\n@height = height\nself\n"}}]},{"html_id":"Crystal Image/CrImage/Operation/BoxBlur","path":"CrImage/Operation/BoxBlur.html","kind":"module","full_name":"CrImage::Operation::BoxBlur","name":"BoxBlur","abstract":false,"locations":[{"filename":"src/cr-image/operation/box_blur.cr","line_number":13,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/box_blur.cr#L13"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"Crystal Image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"Crystal Image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"Crystal Image/CrImage/Operation","kind":"module","full_name":"CrImage::Operation","name":"Operation"},"doc":"Blurs the image\n\nTaking sample `image`:\n\n\"Woman\n\n```\nimage.box_blur(1).save(\"blurred_1_sample.jpg\")\nimage.box_blur(5).save(\"blurred_5_sample.jpg\")\n```\n\"Blurred\n\"Blurred","summary":"

        Blurs the image

        ","instance_methods":[{"html_id":"box_blur(value:Int32):self-instance-method","name":"box_blur","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Int32"}],"args_string":"(value : Int32) : self","args_html":"(value : Int32) : self","location":{"filename":"src/cr-image/operation/box_blur.cr","line_number":14,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/box_blur.cr#L14"},"def":{"name":"box_blur","args":[{"name":"value","external_name":"value","restriction":"Int32"}],"return_type":"self","visibility":"Public","body":"clone.box_blur!(value)"}},{"html_id":"box_blur!(value:Int32):self-instance-method","name":"box_blur!","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Int32"}],"args_string":"(value : Int32) : self","args_html":"(value : Int32) : self","location":{"filename":"src/cr-image/operation/box_blur.cr","line_number":18,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/box_blur.cr#L18"},"def":{"name":"box_blur!","args":[{"name":"value","external_name":"value","restriction":"Int32"}],"return_type":"self","visibility":"Public","body":"horizontal_blur!(value)\nvertical_blur!(value)\n"}}]},{"html_id":"Crystal Image/CrImage/Operation/Brightness","path":"CrImage/Operation/Brightness.html","kind":"module","full_name":"CrImage::Operation::Brightness","name":"Brightness","abstract":false,"locations":[{"filename":"src/cr-image/operation/brightness.cr","line_number":11,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/brightness.cr#L11"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"Crystal Image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"Crystal Image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"Crystal Image/CrImage/Operation","kind":"module","full_name":"CrImage::Operation","name":"Operation"},"doc":"Brightens an image (increases white value)\n\nTaking sample `image`:\n\n\"Woman\n\n```\nimage.brightness(2.0)\n```\n\"Brightened","summary":"

        Brightens an image (increases white value)

        ","instance_methods":[{"html_id":"brightness(value:Float64):self-instance-method","name":"brightness","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Float64"}],"args_string":"(value : Float64) : self","args_html":"(value : Float64) : self","location":{"filename":"src/cr-image/operation/brightness.cr","line_number":12,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/brightness.cr#L12"},"def":{"name":"brightness","args":[{"name":"value","external_name":"value","restriction":"Float64"}],"return_type":"self","visibility":"Public","body":"clone.brightness!(value)"}},{"html_id":"brightness!(value:Float64):self-instance-method","name":"brightness!","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Float64"}],"args_string":"(value : Float64) : self","args_html":"(value : Float64) : self","location":{"filename":"src/cr-image/operation/brightness.cr","line_number":16,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/brightness.cr#L16"},"def":{"name":"brightness!","args":[{"name":"value","external_name":"value","restriction":"Float64"}],"return_type":"self","visibility":"Public","body":"each_channel do |channel|\n size.times do |index|\n channel.unsafe_put(index, (Math.min(255, ( (channel.unsafe_fetch(index)) * value))).to_u8)\n end\nend\nself\n"}}]},{"html_id":"Crystal Image/CrImage/Operation/ChannelSwap","path":"CrImage/Operation/ChannelSwap.html","kind":"module","full_name":"CrImage::Operation::ChannelSwap","name":"ChannelSwap","abstract":false,"locations":[{"filename":"src/cr-image/operation/channel_swap.cr","line_number":11,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/channel_swap.cr#L11"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"Crystal Image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"Crystal Image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"Crystal Image/CrImage/Operation","kind":"module","full_name":"CrImage::Operation","name":"Operation"},"doc":"Swaps channels of `ChannelType` supported by an image\n\nTaking sample `image`:\n\n\"Woman\n\n```\nimage.channel_swap(:green, :red) # Crystal autocasting of symbols to Pluto::ChannelType enum is magic\n```\n\"Channel","summary":"

        Swaps channels of ChannelType supported by an image

        ","instance_methods":[{"html_id":"channel_swap(a:ChannelType,b:ChannelType):self-instance-method","name":"channel_swap","abstract":false,"args":[{"name":"a","external_name":"a","restriction":"ChannelType"},{"name":"b","external_name":"b","restriction":"ChannelType"}],"args_string":"(a : ChannelType, b : ChannelType) : self","args_html":"(a : ChannelType, b : ChannelType) : self","location":{"filename":"src/cr-image/operation/channel_swap.cr","line_number":12,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/channel_swap.cr#L12"},"def":{"name":"channel_swap","args":[{"name":"a","external_name":"a","restriction":"ChannelType"},{"name":"b","external_name":"b","restriction":"ChannelType"}],"return_type":"self","visibility":"Public","body":"clone.channel_swap!(a, b)"}},{"html_id":"channel_swap!(a:ChannelType,b:ChannelType):self-instance-method","name":"channel_swap!","abstract":false,"args":[{"name":"a","external_name":"a","restriction":"ChannelType"},{"name":"b","external_name":"b","restriction":"ChannelType"}],"args_string":"(a : ChannelType, b : ChannelType) : self","args_html":"(a : ChannelType, b : ChannelType) : self","location":{"filename":"src/cr-image/operation/channel_swap.cr","line_number":16,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/channel_swap.cr#L16"},"def":{"name":"channel_swap!","args":[{"name":"a","external_name":"a","restriction":"ChannelType"},{"name":"b","external_name":"b","restriction":"ChannelType"}],"return_type":"self","visibility":"Public","body":"ch_a, ch_b = self[a], self[b]\nself[a] = ch_b\nself[b] = ch_a\nself\n"}}]},{"html_id":"Crystal Image/CrImage/Operation/Contrast","path":"CrImage/Operation/Contrast.html","kind":"module","full_name":"CrImage::Operation::Contrast","name":"Contrast","abstract":false,"locations":[{"filename":"src/cr-image/operation/contrast.cr","line_number":11,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/contrast.cr#L11"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"Crystal Image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"Crystal Image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"Crystal Image/CrImage/Operation","kind":"module","full_name":"CrImage::Operation","name":"Operation"},"doc":"Increases contrast of an image\n\nTaking sample `image`:\n\n\"Woman\n\n```\nimage.contrast(20)\n```\n\"Contrasted","summary":"

        Increases contrast of an image

        ","instance_methods":[{"html_id":"contrast(value:Float64):self-instance-method","name":"contrast","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Float64"}],"args_string":"(value : Float64) : self","args_html":"(value : Float64) : self","location":{"filename":"src/cr-image/operation/contrast.cr","line_number":12,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/contrast.cr#L12"},"def":{"name":"contrast","args":[{"name":"value","external_name":"value","restriction":"Float64"}],"return_type":"self","visibility":"Public","body":"clone.contrast!(value)"}},{"html_id":"contrast!(value:Float64):self-instance-method","name":"contrast!","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Float64"}],"args_string":"(value : Float64) : self","args_html":"(value : Float64) : self","location":{"filename":"src/cr-image/operation/contrast.cr","line_number":16,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/contrast.cr#L16"},"def":{"name":"contrast!","args":[{"name":"value","external_name":"value","restriction":"Float64"}],"return_type":"self","visibility":"Public","body":"factor = (259 * (value + 255)) / (255 * (259 - value))\neach_channel do |channel|\n size.times do |index|\n channel.unsafe_put(index, (Math.min(255, Math.max(0, (factor * ((channel.unsafe_fetch(index)).to_i - 128)) + 128))).to_u8)\n end\nend\nself\n"}}]},{"html_id":"Crystal Image/CrImage/Operation/Crop","path":"CrImage/Operation/Crop.html","kind":"module","full_name":"CrImage::Operation::Crop","name":"Crop","abstract":false,"locations":[{"filename":"src/cr-image/operation/crop.cr","line_number":13,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/crop.cr#L13"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"Crystal Image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"Crystal Image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"Crystal Image/CrImage/Operation","kind":"module","full_name":"CrImage::Operation","name":"Operation"},"doc":"Crops an image\n\nTaking sample `image`:\n\n\"Woman\n\n```\n# These calls are equivalent\nimage.crop(40, 30, 80, 80)\nimage[40...120, 30...110]\n```\n\"Cropped","summary":"

        Crops an image

        ","instance_methods":[{"html_id":"[](xrange:Range(Int32,Int32)|Range(Int32,Nil)|Range(Nil,Int32),yrange:Range(Int32,Int32)|Range(Int32,Nil)|Range(Nil,Int32)):self-instance-method","name":"[]","abstract":false,"args":[{"name":"xrange","external_name":"xrange","restriction":"Range(Int32, Int32) | Range(Int32, Nil) | Range(Nil, Int32)"},{"name":"yrange","external_name":"yrange","restriction":"Range(Int32, Int32) | Range(Int32, Nil) | Range(Nil, Int32)"}],"args_string":"(xrange : Range(Int32, Int32) | Range(Int32, Nil) | Range(Nil, Int32), yrange : Range(Int32, Int32) | Range(Int32, Nil) | Range(Nil, Int32)) : self","args_html":"(xrange : Range(Int32, Int32) | Range(Int32, Nil) | Range(Nil, Int32), yrange : Range(Int32, Int32) | Range(Int32, Nil) | Range(Nil, Int32)) : self","location":{"filename":"src/cr-image/operation/crop.cr","line_number":22,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/crop.cr#L22"},"def":{"name":"[]","args":[{"name":"xrange","external_name":"xrange","restriction":"Range(Int32, Int32) | Range(Int32, Nil) | Range(Nil, Int32)"},{"name":"yrange","external_name":"yrange","restriction":"Range(Int32, Int32) | Range(Int32, Nil) | Range(Nil, Int32)"}],"return_type":"self","visibility":"Public","body":"xstart, xcount = resolve_to_start_and_count(xrange, width)\nystart, ycount = resolve_to_start_and_count(yrange, height)\ncrop(xstart, ystart, xcount, ycount)\n"}},{"html_id":"crop(x:Int32,y:Int32,new_width:Int32,new_height:Int32):self-instance-method","name":"crop","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"y","external_name":"y","restriction":"Int32"},{"name":"new_width","external_name":"new_width","restriction":"Int32"},{"name":"new_height","external_name":"new_height","restriction":"Int32"}],"args_string":"(x : Int32, y : Int32, new_width : Int32, new_height : Int32) : self","args_html":"(x : Int32, y : Int32, new_width : Int32, new_height : Int32) : self","location":{"filename":"src/cr-image/operation/crop.cr","line_number":18,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/crop.cr#L18"},"def":{"name":"crop","args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"y","external_name":"y","restriction":"Int32"},{"name":"new_width","external_name":"new_width","restriction":"Int32"},{"name":"new_height","external_name":"new_height","restriction":"Int32"}],"return_type":"self","visibility":"Public","body":"clone.crop!(x, y, new_width, new_height)"}},{"html_id":"crop(region:Region):self-instance-method","name":"crop","abstract":false,"args":[{"name":"region","external_name":"region","restriction":"Region"}],"args_string":"(region : Region) : self","args_html":"(region : Region) : self","location":{"filename":"src/cr-image/operation/crop.cr","line_number":14,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/crop.cr#L14"},"def":{"name":"crop","args":[{"name":"region","external_name":"region","restriction":"Region"}],"return_type":"self","visibility":"Public","body":"crop(*region.to_tuple)"}},{"html_id":"crop!(x:Int32,y:Int32,new_width:Int32,new_height:Int32):self-instance-method","name":"crop!","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"y","external_name":"y","restriction":"Int32"},{"name":"new_width","external_name":"new_width","restriction":"Int32"},{"name":"new_height","external_name":"new_height","restriction":"Int32"}],"args_string":"(x : Int32, y : Int32, new_width : Int32, new_height : Int32) : self","args_html":"(x : Int32, y : Int32, new_width : Int32, new_height : Int32) : self","location":{"filename":"src/cr-image/operation/crop.cr","line_number":32,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/crop.cr#L32"},"def":{"name":"crop!","args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"y","external_name":"y","restriction":"Int32"},{"name":"new_width","external_name":"new_width","restriction":"Int32"},{"name":"new_height","external_name":"new_height","restriction":"Int32"}],"return_type":"self","visibility":"Public","body":"if (x + new_width) > width\n raise(\"Crop dimensions extend #{(x + new_width) - width} pixels beyond width of the image (#{width})\")\nend\nif (y + new_height) > height\n raise(\"Crop dimensions extend #{(y + new_height) - height} pixels beyond height of the image (#{height})\")\nend\nnew_size = new_width * new_height\nheight_offset = y * width\neach_channel do |channel, channel_type|\n resized_channel = Array.new(new_size) do\n 0_u8\n end\n new_height.times do |new_y|\n orig_index = (height_offset + (new_y * width)) + x\n resized_channel[new_y * new_width, new_width] = channel[orig_index, new_width]\n end\n self[channel_type] = resized_channel\nend\n@width = new_width\n@height = new_height\nself\n"}},{"html_id":"crop!(region:Region):self-instance-method","name":"crop!","abstract":false,"args":[{"name":"region","external_name":"region","restriction":"Region"}],"args_string":"(region : Region) : self","args_html":"(region : Region) : self","location":{"filename":"src/cr-image/operation/crop.cr","line_number":28,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/crop.cr#L28"},"def":{"name":"crop!","args":[{"name":"region","external_name":"region","restriction":"Region"}],"return_type":"self","visibility":"Public","body":"crop!(*region.to_tuple)"}}]},{"html_id":"Crystal Image/CrImage/Operation/Draw","path":"CrImage/Operation/Draw.html","kind":"module","full_name":"CrImage::Operation::Draw","name":"Draw","abstract":false,"locations":[{"filename":"src/cr-image/operation/draw.cr","line_number":15,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/draw.cr#L15"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"Crystal Image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"Crystal Image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"Crystal Image/CrImage/Operation","kind":"module","full_name":"CrImage::Operation","name":"Operation"},"doc":"Draws shapes in the image\n\nTaking sample `image`:\n\n\"Woman\n\n```\nimage.draw_square(40, 30, 80, 80, CrImage::Color.of(\"#00f\"))\nimage.draw_circle(80, 70, 40, CrImage::Color.of(\"#00f\"))\n```\n\"Woman\n\"Woman\n\nCan also use the `fill: true` parameter to fill in the drawn shapes","summary":"

        Draws shapes in the image

        ","instance_methods":[{"html_id":"draw_circle(x:Int,y:Int,radius:Int,color:Color,*,fill:Bool=false):self-instance-method","name":"draw_circle","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int"},{"name":"y","external_name":"y","restriction":"Int"},{"name":"radius","external_name":"radius","restriction":"Int"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"}],"args_string":"(x : Int, y : Int, radius : Int, color : Color, *, fill : Bool = false) : self","args_html":"(x : Int, y : Int, radius : Int, color : Color, *, fill : Bool = false) : self","location":{"filename":"src/cr-image/operation/draw.cr","line_number":56,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/draw.cr#L56"},"def":{"name":"draw_circle","args":[{"name":"x","external_name":"x","restriction":"Int"},{"name":"y","external_name":"y","restriction":"Int"},{"name":"radius","external_name":"radius","restriction":"Int"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"}],"splat_index":4,"return_type":"self","visibility":"Public","body":"clone.draw_circle!(x, y, radius, color, fill: fill)"}},{"html_id":"draw_circle(region:Region,radius:Int,color:Color,*,fill:Bool=false):self-instance-method","name":"draw_circle","doc":"Draw a circle around the region's center (see `Region#center`)","summary":"

        Draw a circle around the region's center (see Region#center)

        ","abstract":false,"args":[{"name":"region","external_name":"region","restriction":"Region"},{"name":"radius","external_name":"radius","restriction":"Int"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"}],"args_string":"(region : Region, radius : Int, color : Color, *, fill : Bool = false) : self","args_html":"(region : Region, radius : Int, color : Color, *, fill : Bool = false) : self","location":{"filename":"src/cr-image/operation/draw.cr","line_number":52,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/draw.cr#L52"},"def":{"name":"draw_circle","args":[{"name":"region","external_name":"region","restriction":"Region"},{"name":"radius","external_name":"radius","restriction":"Int"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"}],"splat_index":3,"return_type":"self","visibility":"Public","body":"clone.draw_circle!(*region.center, radius, color, fill: fill)"}},{"html_id":"draw_circle!(region:Region,color:Color,*,fill:Bool=false,radius:Int32|Nil=nil):self-instance-method","name":"draw_circle!","doc":"Draw a circle around the region's center (see `Region#center`)","summary":"

        Draw a circle around the region's center (see Region#center)

        ","abstract":false,"args":[{"name":"region","external_name":"region","restriction":"Region"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"},{"name":"radius","default_value":"nil","external_name":"radius","restriction":"Int32 | ::Nil"}],"args_string":"(region : Region, color : Color, *, fill : Bool = false, radius : Int32 | Nil = nil) : self","args_html":"(region : Region, color : Color, *, fill : Bool = false, radius : Int32 | Nil = nil) : self","location":{"filename":"src/cr-image/operation/draw.cr","line_number":61,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/draw.cr#L61"},"def":{"name":"draw_circle!","args":[{"name":"region","external_name":"region","restriction":"Region"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"},{"name":"radius","default_value":"nil","external_name":"radius","restriction":"Int32 | ::Nil"}],"splat_index":2,"return_type":"self","visibility":"Public","body":"draw_circle!(*region.center, radius, color, fill: fill)"}},{"html_id":"draw_square(x:Int,y:Int,box_width:Int,box_height:Int,color:Color,*,fill:Bool=false):self-instance-method","name":"draw_square","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int"},{"name":"y","external_name":"y","restriction":"Int"},{"name":"box_width","external_name":"box_width","restriction":"Int"},{"name":"box_height","external_name":"box_height","restriction":"Int"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"}],"args_string":"(x : Int, y : Int, box_width : Int, box_height : Int, color : Color, *, fill : Bool = false) : self","args_html":"(x : Int, y : Int, box_width : Int, box_height : Int, color : Color, *, fill : Bool = false) : self","location":{"filename":"src/cr-image/operation/draw.cr","line_number":20,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/draw.cr#L20"},"def":{"name":"draw_square","args":[{"name":"x","external_name":"x","restriction":"Int"},{"name":"y","external_name":"y","restriction":"Int"},{"name":"box_width","external_name":"box_width","restriction":"Int"},{"name":"box_height","external_name":"box_height","restriction":"Int"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"}],"splat_index":5,"return_type":"self","visibility":"Public","body":"clone.draw_square!(x, y, box_width, box_height, color, fill: fill)"}},{"html_id":"draw_square(region:Region,color:Color,*,fill:Bool=false):self-instance-method","name":"draw_square","abstract":false,"args":[{"name":"region","external_name":"region","restriction":"Region"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"}],"args_string":"(region : Region, color : Color, *, fill : Bool = false) : self","args_html":"(region : Region, color : Color, *, fill : Bool = false) : self","location":{"filename":"src/cr-image/operation/draw.cr","line_number":16,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/draw.cr#L16"},"def":{"name":"draw_square","args":[{"name":"region","external_name":"region","restriction":"Region"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"}],"splat_index":2,"return_type":"self","visibility":"Public","body":"clone.draw_square!(region, color, fill: fill)"}},{"html_id":"draw_square!(x:Int,y:Int,box_width:Int,box_height:Int,color:Color,*,fill:Bool=false):self-instance-method","name":"draw_square!","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int"},{"name":"y","external_name":"y","restriction":"Int"},{"name":"box_width","external_name":"box_width","restriction":"Int"},{"name":"box_height","external_name":"box_height","restriction":"Int"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"}],"args_string":"(x : Int, y : Int, box_width : Int, box_height : Int, color : Color, *, fill : Bool = false) : self","args_html":"(x : Int, y : Int, box_width : Int, box_height : Int, color : Color, *, fill : Bool = false) : self","location":{"filename":"src/cr-image/operation/draw.cr","line_number":28,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/draw.cr#L28"},"def":{"name":"draw_square!","args":[{"name":"x","external_name":"x","restriction":"Int"},{"name":"y","external_name":"y","restriction":"Int"},{"name":"box_width","external_name":"box_width","restriction":"Int"},{"name":"box_height","external_name":"box_height","restriction":"Int"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"}],"splat_index":5,"return_type":"self","visibility":"Public","body":"if (x + box_width) > width\n raise(\"Box dimensions extend #{(x + box_width) - width} pixels beyond width of the image (#{width})\")\nend\nif (y + box_height) > height\n raise(\"Box dimensions extend #{(y + box_height) - height} pixels beyond height of the image (#{height})\")\nend\nx_i = x.to_i\ny_i = y.to_i\neach_channel do |channel, channel_type|\n channel[( (y_i * width) + x_i), box_width] = Array(UInt8).new(box_width) do\n color[channel_type]\n end\n channel[((y_i + box_height) * width) + x_i, box_width] = Array(UInt8).new(box_width) do\n color[channel_type]\n end\n box_height.times do |i|\n if i == 0\n next\n end\n if fill\n channel[( ((y_i + i) * width) + x_i), box_width] = Array(UInt8).new(box_width) do\n color[channel_type]\n end\n else\n channel.unsafe_put(((y_i + i) * width) + x_i, color[channel_type])\n channel.unsafe_put((((y_i + i) * width) + x_i) + box_width, color[channel_type])\n end\n end\nend\nself\n"}},{"html_id":"draw_square!(region:Region,color:Color,*,fill:Bool=false):self-instance-method","name":"draw_square!","abstract":false,"args":[{"name":"region","external_name":"region","restriction":"Region"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"}],"args_string":"(region : Region, color : Color, *, fill : Bool = false) : self","args_html":"(region : Region, color : Color, *, fill : Bool = false) : self","location":{"filename":"src/cr-image/operation/draw.cr","line_number":24,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/draw.cr#L24"},"def":{"name":"draw_square!","args":[{"name":"region","external_name":"region","restriction":"Region"},{"name":"color","external_name":"color","restriction":"Color"},{"name":"","external_name":"","restriction":""},{"name":"fill","default_value":"false","external_name":"fill","restriction":"Bool"}],"splat_index":2,"return_type":"self","visibility":"Public","body":"draw_square!(*region.to_tuple, color, fill: fill)"}}]},{"html_id":"Crystal Image/CrImage/Operation/GaussianBlur","path":"CrImage/Operation/GaussianBlur.html","kind":"module","full_name":"CrImage::Operation::GaussianBlur","name":"GaussianBlur","abstract":false,"locations":[{"filename":"src/cr-image/operation/gaussian_blur.cr","line_number":13,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/gaussian_blur.cr#L13"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"Crystal Image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"Crystal Image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"Crystal Image/CrImage/Operation","kind":"module","full_name":"CrImage::Operation","name":"Operation"},"doc":"Applies a 3x3 Gaussian blur. Implementation derived from [here](https://blog.ivank.net/fastest-gaussian-blur.html)\n\nTaking sample `image`:\n\n\"Woman\n\n```\nimage.gaussian_blur(1).save(\"gaussian_1_sample.jpg\")\nimage.gaussian_blur(5).save(\"gaussian_5_sample.jpg\")\n```\n\"Blurred\n\"Blurred","summary":"

        Applies a 3x3 Gaussian blur.

        ","instance_methods":[{"html_id":"gaussian_blur(sigma:Int32):self-instance-method","name":"gaussian_blur","abstract":false,"args":[{"name":"sigma","external_name":"sigma","restriction":"Int32"}],"args_string":"(sigma : Int32) : self","args_html":"(sigma : Int32) : self","location":{"filename":"src/cr-image/operation/gaussian_blur.cr","line_number":14,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/gaussian_blur.cr#L14"},"def":{"name":"gaussian_blur","args":[{"name":"sigma","external_name":"sigma","restriction":"Int32"}],"return_type":"self","visibility":"Public","body":"clone.gaussian_blur!(sigma)"}},{"html_id":"gaussian_blur!(sigma:Int32):self-instance-method","name":"gaussian_blur!","abstract":false,"args":[{"name":"sigma","external_name":"sigma","restriction":"Int32"}],"args_string":"(sigma : Int32) : self","args_html":"(sigma : Int32) : self","location":{"filename":"src/cr-image/operation/gaussian_blur.cr","line_number":18,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/gaussian_blur.cr#L18"},"def":{"name":"gaussian_blur!","args":[{"name":"sigma","external_name":"sigma","restriction":"Int32"}],"return_type":"self","visibility":"Public","body":"n = 3\nw_ideal = Math.sqrt((((12 * sigma) * sigma) / n) + 1)\nw_l = w_ideal.floor.to_i\nif (w_l % 2) == 0\n w_l = w_l - 1\nend\nm_ideal = (((((12 * sigma) * sigma) - ((n * w_l) * w_l)) - ((4 * n) * w_l)) - (3 * n)) / ((-4 * w_l) - 4)\nm = m_ideal.round\nsizes = [] of Int32\nn.times do |i|\n sizes << (if i < m\n w_l\n else\n w_l + 2\n end)\nend\nbox_blur!(((sizes.unsafe_fetch(0)) - 1) // 2)\nbox_blur!(((sizes.unsafe_fetch(1)) - 1) // 2)\nbox_blur!(((sizes.unsafe_fetch(2)) - 1) // 2)\nself\n"}}]},{"html_id":"Crystal Image/CrImage/Operation/HistogramEqualize","path":"CrImage/Operation/HistogramEqualize.html","kind":"module","full_name":"CrImage::Operation::HistogramEqualize","name":"HistogramEqualize","abstract":false,"locations":[{"filename":"src/cr-image/operation/histogram.cr","line_number":19,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/histogram.cr#L19"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"Crystal Image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"Crystal Image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"Crystal Image/CrImage/Operation","kind":"module","full_name":"CrImage::Operation","name":"Operation"},"doc":"Provides methods for histogram and histogram equalization. Follows method outlined [here](https://www.sci.utah.edu/~acoste/uou/Image/project1/Arthur_COSTE_Project_1_report.html)\n\nIf an image is particularly dark or particularly bright with low contrast, the `Operation::Contrast#contrast` method will only\nmake the image darker or lighter. For images like these, equalizing the image along its histogram will produce better results.\n\n\"A\n\n```\nimage.contrast(10).save(\"contrast.jpg\")\nimage.histogram_equalize.save(\"equalized.jpg\")\n```\n\"Darker\n\"A\n\nThis method does not work well when a given method has a bimodal distribution of color pixels. For example:\n\n\"Woman\n\"Highly","summary":"

        Provides methods for histogram and histogram equalization.

        ","instance_methods":[{"html_id":"histogram(channel_type:ChannelType):Histogram-instance-method","name":"histogram","abstract":false,"args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"}],"args_string":"(channel_type : ChannelType) : Histogram","args_html":"(channel_type : ChannelType) : Histogram","location":{"filename":"src/cr-image/operation/histogram.cr","line_number":93,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/histogram.cr#L93"},"def":{"name":"histogram","args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"}],"return_type":"Histogram","visibility":"Public","body":"Histogram.new(self, channel_type)"}},{"html_id":"histogram_equalize:self-instance-method","name":"histogram_equalize","abstract":false,"location":{"filename":"src/cr-image/operation/histogram.cr","line_number":97,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/histogram.cr#L97"},"def":{"name":"histogram_equalize","return_type":"self","visibility":"Public","body":"clone.histogram_equalize!"}},{"html_id":"histogram_equalize!:self-instance-method","name":"histogram_equalize!","abstract":false,"location":{"filename":"src/cr-image/operation/histogram.cr","line_number":101,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/histogram.cr#L101"},"def":{"name":"histogram_equalize!","return_type":"self","visibility":"Public","body":"each_channel do |channel, channel_type|\n if channel_type.alpha?\n next\n end\n remap = (histogram(channel_type)).equalize\n size.times do |i|\n channel.unsafe_put(i, remap[channel.unsafe_fetch(i)])\n end\nend\nself\n"}}],"types":[{"html_id":"Crystal Image/CrImage/Operation/HistogramEqualize/Histogram","path":"CrImage/Operation/HistogramEqualize/Histogram.html","kind":"class","full_name":"CrImage::Operation::HistogramEqualize::Histogram","name":"Histogram","abstract":false,"superclass":{"html_id":"Crystal Image/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"Crystal Image/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"Crystal Image/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cr-image/operation/histogram.cr","line_number":21,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/histogram.cr#L21"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"Crystal Image/CrImage/Operation/HistogramEqualize","kind":"module","full_name":"CrImage::Operation::HistogramEqualize","name":"HistogramEqualize"},"doc":"A histogram of an `Image` for a specific `ChannelType`","summary":"

        A histogram of an Image for a specific ChannelType

        ","constructors":[{"html_id":"new(image:Image,channel_type:ChannelType)-class-method","name":"new","abstract":false,"args":[{"name":"image","external_name":"image","restriction":"Image"},{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"}],"args_string":"(image : Image, channel_type : ChannelType)","args_html":"(image : Image, channel_type : ChannelType)","location":{"filename":"src/cr-image/operation/histogram.cr","line_number":22,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/histogram.cr#L22"},"def":{"name":"new","args":[{"name":"image","external_name":"image","restriction":"Image"},{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"}],"visibility":"Public","body":"_ = allocate\n_.initialize(image, channel_type)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"cdf:Hash(UInt8,Float64)-instance-method","name":"cdf","doc":"Get the cumulative distribution for the image's histogram","summary":"

        Get the cumulative distribution for the image's histogram

        ","abstract":false,"location":{"filename":"src/cr-image/operation/histogram.cr","line_number":54,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/histogram.cr#L54"},"def":{"name":"cdf","return_type":"Hash(UInt8, Float64)","visibility":"Public","body":"total = 0_f64\n@cumulative_distribution_histogram || (@cumulative_distribution_histogram = normalize.map do |pixel, probability|\n original = total\n total = total + probability\n {pixel, original}\nend.to_h)\n"}},{"html_id":"counts:Hash(UInt8,Int32)-instance-method","name":"counts","doc":"Get the raw counts for a given pixel value (0-255) in the image","summary":"

        Get the raw counts for a given pixel value (0-255) in the image

        ","abstract":false,"location":{"filename":"src/cr-image/operation/histogram.cr","line_number":28,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/histogram.cr#L28"},"def":{"name":"counts","return_type":"Hash(UInt8, Int32)","visibility":"Public","body":"@internal_hist || (@internal_hist = calculate_counts)"}},{"html_id":"equalize:Hash(UInt8,UInt8)-instance-method","name":"equalize","doc":"Remap the cumalitive distribution of pixels to get a new, more spread out pixel value","summary":"

        Remap the cumalitive distribution of pixels to get a new, more spread out pixel value

        ","abstract":false,"location":{"filename":"src/cr-image/operation/histogram.cr","line_number":64,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/histogram.cr#L64"},"def":{"name":"equalize","return_type":"Hash(UInt8, UInt8)","visibility":"Public","body":"cdf.map do |pixel, cumalative|\n {pixel, ((cumalative * 255).clamp(0, 255)).to_u8}\nend.to_h"}},{"html_id":"normalize:Hash(UInt8,Float64)-instance-method","name":"normalize","doc":"Get pixel counts normalized - all values between 0.0 and 1.0","summary":"

        Get pixel counts normalized - all values between 0.0 and 1.0

        ","abstract":false,"location":{"filename":"src/cr-image/operation/histogram.cr","line_number":45,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/histogram.cr#L45"},"def":{"name":"normalize","return_type":"Hash(UInt8, Float64)","visibility":"Public","body":"counts.map do |pixel, count|\n {pixel, count.to_f / @image.size}\nend.to_h"}}]}]},{"html_id":"Crystal Image/CrImage/Operation/HorizontalBlur","path":"CrImage/Operation/HorizontalBlur.html","kind":"module","full_name":"CrImage::Operation::HorizontalBlur","name":"HorizontalBlur","abstract":false,"locations":[{"filename":"src/cr-image/operation/horizontal_blur.cr","line_number":13,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/horizontal_blur.cr#L13"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"Crystal Image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"Crystal Image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"Crystal Image/CrImage/Operation","kind":"module","full_name":"CrImage::Operation","name":"Operation"},"doc":"Blur an image along the horizontal axis\n\nTaking sample `image`:\n\n\"Woman\n\n```\nimage.horizontal_blur(1).save(\"horizontal_1_sample.jpg\")\nimage.horizontal_blur(5).save(\"horizontal_5_sample.jpg\")\n```\n\"Blurred\n\"Blurred","summary":"

        Blur an image along the horizontal axis

        ","instance_methods":[{"html_id":"horizontal_blur(value:Int32):self-instance-method","name":"horizontal_blur","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Int32"}],"args_string":"(value : Int32) : self","args_html":"(value : Int32) : self","location":{"filename":"src/cr-image/operation/horizontal_blur.cr","line_number":14,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/horizontal_blur.cr#L14"},"def":{"name":"horizontal_blur","args":[{"name":"value","external_name":"value","restriction":"Int32"}],"return_type":"self","visibility":"Public","body":"clone.horizontal_blur!(value)"}},{"html_id":"horizontal_blur!(value:Int32):self-instance-method","name":"horizontal_blur!","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Int32"}],"args_string":"(value : Int32) : self","args_html":"(value : Int32) : self","location":{"filename":"src/cr-image/operation/horizontal_blur.cr","line_number":18,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/horizontal_blur.cr#L18"},"def":{"name":"horizontal_blur!","args":[{"name":"value","external_name":"value","restriction":"Int32"}],"return_type":"self","visibility":"Public","body":"buffer = Bytes.new(size, 0)\nmultiplier = 1 / ((value + value) + 1)\neach_channel do |channel|\n @height.times do |y|\n c_index : Int32 = y * @width\n l_index : Int32 = c_index\n r_index : Int32 = c_index + value\n f_value : Int32 = (channel.unsafe_fetch(c_index)).to_i\n l_value : Int32 = (channel.unsafe_fetch((c_index + @width) - 1)).to_i\n c_value : Int32 = (value + 1) * f_value\n (0..(value - 1)).each do\n c_value = c_value + (channel.unsafe_fetch(c_index))\n end\n (0..value).each do\n c_value = c_value + ((channel.unsafe_fetch(r_index)).to_i - f_value)\n buffer.unsafe_put(c_index, ((c_value * multiplier).clamp(0, 255)).to_u8)\n r_index = r_index + 1\n c_index = c_index + 1\n end\n ((value + 1)..((@width - value) - 1)).each do\n c_value = c_value + ((channel.unsafe_fetch(r_index)).to_i - (channel.unsafe_fetch(l_index)).to_i)\n buffer.unsafe_put(c_index, ((c_value * multiplier).clamp(0, 255)).to_u8)\n r_index = r_index + 1\n l_index = l_index + 1\n c_index = c_index + 1\n end\n ((@width - value)..(@width - 1)).each do\n c_value = c_value + (l_value - (channel.unsafe_fetch(l_index)).to_i)\n buffer.unsafe_put(c_index, ((c_value * multiplier).clamp(0, 255)).to_u8)\n l_index = l_index + 1\n c_index = c_index + 1\n end\n end\n (channel.@buffer).copy_from(buffer.to_unsafe, buffer.size)\nend\nself\n"}}]},{"html_id":"Crystal Image/CrImage/Operation/MaskApply","path":"CrImage/Operation/MaskApply.html","kind":"module","full_name":"CrImage::Operation::MaskApply","name":"MaskApply","abstract":false,"locations":[{"filename":"src/cr-image/operation/mask_apply.cr","line_number":27,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/mask_apply.cr#L27"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"Crystal Image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"Crystal Image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"Crystal Image/CrImage/Operation","kind":"module","full_name":"CrImage::Operation","name":"Operation"},"doc":"Apply a mask to an image\n\nTaking sample `image`:\n\n\"Woman\n\nAnd mask\n\n\"Black\n\n```\nmask = CrImage::Mask.new(image, false)\nmask[50..90, 65..75] = true\nmask.to_gray.save(\"apply_mask_mask.jpg\")\n\nimage.apply(mask).save(\"apply_mask.jpg\")\n\nimage.apply_color(mask, CrImage::Color.of(\"#00f\")).save(\"apply_mask_color.jpg\")\n\nimage.apply(mask) do |x, y, pixel, channel_type|\n Math.min(255, pixel + 50).to_u8 if channel_type.blue?\nend.save(\"apply_mask_block.jpg\")\n```\n\"Image\n\"Thin\n\"Thin","summary":"

        Apply a mask to an image

        ","instance_methods":[{"html_id":"apply(mask:Mask):self-instance-method","name":"apply","doc":"Black out all pixels but those found in the mask","summary":"

        Black out all pixels but those found in the mask

        ","abstract":false,"args":[{"name":"mask","external_name":"mask","restriction":"Mask"}],"args_string":"(mask : Mask) : self","args_html":"(mask : Mask) : self","location":{"filename":"src/cr-image/operation/mask_apply.cr","line_number":29,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/mask_apply.cr#L29"},"def":{"name":"apply","args":[{"name":"mask","external_name":"mask","restriction":"Mask"}],"return_type":"self","visibility":"Public","body":"clone.apply!(mask)"}},{"html_id":"apply(mask:Mask,&block:Int32,Int32,UInt8,ChannelType->UInt8|Nil):self-instance-method","name":"apply","doc":"Apply block to all pixels that match mask, replacing pixel value if block returns non-nil value.\n\nDoes not change values not matched by the mask","summary":"

        Apply block to all pixels that match mask, replacing pixel value if block returns non-nil value.

        ","abstract":false,"args":[{"name":"mask","external_name":"mask","restriction":"Mask"}],"args_string":"(mask : Mask, &block : Int32, Int32, UInt8, ChannelType -> UInt8 | Nil) : self","args_html":"(mask : Mask, &block : Int32, Int32, UInt8, ChannelType -> UInt8 | Nil) : self","location":{"filename":"src/cr-image/operation/mask_apply.cr","line_number":36,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/mask_apply.cr#L36"},"def":{"name":"apply","args":[{"name":"mask","external_name":"mask","restriction":"Mask"}],"yields":4,"block_arity":4,"block_arg":{"name":"block","external_name":"block","restriction":"(Int32, Int32, UInt8, ChannelType -> UInt8 | ::Nil)"},"return_type":"self","visibility":"Public","body":"clone.apply!(mask, &block)"}},{"html_id":"apply!(mask:Mask):self-instance-method","name":"apply!","doc":"TODO: add apply version that accepts 1+ ChannelType that the mask should apply to (i.e. make a background completely transparent, not just transparent black)","summary":"

        TODO add apply version that accepts 1+ ChannelType that the mask should apply to (i.e.

        ","abstract":false,"args":[{"name":"mask","external_name":"mask","restriction":"Mask"}],"args_string":"(mask : Mask) : self","args_html":"(mask : Mask) : self","location":{"filename":"src/cr-image/operation/mask_apply.cr","line_number":46,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/mask_apply.cr#L46"},"def":{"name":"apply!","args":[{"name":"mask","external_name":"mask","restriction":"Mask"}],"return_type":"self","visibility":"Public","body":"if (mask.width == width) && (mask.height == height)\nelse\n raise(\"Mask of #{mask.width}x#{mask.height} doesn't match image dimensions #{width}x#{height}\")\nend\neach_channel do |channel|\n channel.map_with_index! do |pixel, i|\n mask.at(i) ? pixel : 0_u8\n end\nend\nself\n"}},{"html_id":"apply!(mask:Mask,&block:Int32,Int32,UInt8,ChannelType->UInt8|Nil):self-instance-method","name":"apply!","abstract":false,"args":[{"name":"mask","external_name":"mask","restriction":"Mask"}],"args_string":"(mask : Mask, &block : Int32, Int32, UInt8, ChannelType -> UInt8 | Nil) : self","args_html":"(mask : Mask, &block : Int32, Int32, UInt8, ChannelType -> UInt8 | Nil) : self","location":{"filename":"src/cr-image/operation/mask_apply.cr","line_number":55,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/mask_apply.cr#L55"},"def":{"name":"apply!","args":[{"name":"mask","external_name":"mask","restriction":"Mask"}],"yields":4,"block_arity":4,"block_arg":{"name":"block","external_name":"block","restriction":"(Int32, Int32, UInt8, ChannelType -> UInt8 | ::Nil)"},"return_type":"self","visibility":"Public","body":"if (mask.width == width) && (mask.height == height)\nelse\n raise(\"Mask of #{mask.width}x#{mask.height} doesn't match image dimensions #{width}x#{height}\")\nend\neach_channel do |channel, channel_type|\n channel.map_with_index! do |pixel, i|\n mask.at(i) ? (block.call(i % width, i // width, pixel, channel_type)) || pixel : pixel\n end\nend\nself\n"}},{"html_id":"apply_color(mask:Mask,color:Color):self-instance-method","name":"apply_color","doc":"Change the color of all pixels that match the mask","summary":"

        Change the color of all pixels that match the mask

        ","abstract":false,"args":[{"name":"mask","external_name":"mask","restriction":"Mask"},{"name":"color","external_name":"color","restriction":"Color"}],"args_string":"(mask : Mask, color : Color) : self","args_html":"(mask : Mask, color : Color) : self","location":{"filename":"src/cr-image/operation/mask_apply.cr","line_number":41,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/mask_apply.cr#L41"},"def":{"name":"apply_color","args":[{"name":"mask","external_name":"mask","restriction":"Mask"},{"name":"color","external_name":"color","restriction":"Color"}],"return_type":"self","visibility":"Public","body":"clone.apply_color!(mask, color)"}},{"html_id":"apply_color!(mask:Mask,color:Color):self-instance-method","name":"apply_color!","abstract":false,"args":[{"name":"mask","external_name":"mask","restriction":"Mask"},{"name":"color","external_name":"color","restriction":"Color"}],"args_string":"(mask : Mask, color : Color) : self","args_html":"(mask : Mask, color : Color) : self","location":{"filename":"src/cr-image/operation/mask_apply.cr","line_number":66,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/mask_apply.cr#L66"},"def":{"name":"apply_color!","args":[{"name":"mask","external_name":"mask","restriction":"Mask"},{"name":"color","external_name":"color","restriction":"Color"}],"return_type":"self","visibility":"Public","body":"apply!(mask) do |_, _, _, channel_type|\n color[channel_type]\nend"}}]},{"html_id":"Crystal Image/CrImage/Operation/VerticalBlur","path":"CrImage/Operation/VerticalBlur.html","kind":"module","full_name":"CrImage::Operation::VerticalBlur","name":"VerticalBlur","abstract":false,"locations":[{"filename":"src/cr-image/operation/vertical_blur.cr","line_number":13,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/vertical_blur.cr#L13"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"Crystal Image/CrImage/GrayscaleImage","kind":"class","full_name":"CrImage::GrayscaleImage","name":"GrayscaleImage"},{"html_id":"Crystal Image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"}],"namespace":{"html_id":"Crystal Image/CrImage/Operation","kind":"module","full_name":"CrImage::Operation","name":"Operation"},"doc":"Blur an image along the vertical axis\n\nTaking sample `image`:\n\n\"Woman\n\n```\nimage.vertical_blur(1).save(\"vertical_1_sample.jpg\")\nimage.vertical_blur(5).save(\"vertical_5_sample.jpg\")\n```\n\"Blurred\n\"Blurred","summary":"

        Blur an image along the vertical axis

        ","instance_methods":[{"html_id":"vertical_blur(value:Int32):self-instance-method","name":"vertical_blur","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Int32"}],"args_string":"(value : Int32) : self","args_html":"(value : Int32) : self","location":{"filename":"src/cr-image/operation/vertical_blur.cr","line_number":14,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/vertical_blur.cr#L14"},"def":{"name":"vertical_blur","args":[{"name":"value","external_name":"value","restriction":"Int32"}],"return_type":"self","visibility":"Public","body":"clone.vertical_blur!(value)"}},{"html_id":"vertical_blur!(value:Int32):self-instance-method","name":"vertical_blur!","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Int32"}],"args_string":"(value : Int32) : self","args_html":"(value : Int32) : self","location":{"filename":"src/cr-image/operation/vertical_blur.cr","line_number":18,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/operation/vertical_blur.cr#L18"},"def":{"name":"vertical_blur!","args":[{"name":"value","external_name":"value","restriction":"Int32"}],"return_type":"self","visibility":"Public","body":"buffer = Bytes.new(size, 0)\nmultiplier = 1 / ((value + value) + 1)\neach_channel do |channel|\n @width.times do |x|\n c_index : Int32 = x\n l_index : Int32 = c_index\n r_index : Int32 = c_index + (value * @width)\n f_value : Int32 = (channel.unsafe_fetch(c_index)).to_i\n l_value : Int32 = (channel.unsafe_fetch(c_index + (@width * (@height - 1)))).to_i\n c_value : Int32 = (value + 1) * f_value\n (0..(value - 1)).each do\n c_value = c_value + (channel.unsafe_fetch(c_index))\n end\n (0..value).each do\n c_value = c_value + ((channel.unsafe_fetch(r_index)).to_i - f_value)\n buffer.unsafe_put(c_index, ((c_value * multiplier).clamp(0, 255)).to_u8)\n r_index = r_index + @width\n c_index = c_index + @width\n end\n ((value + 1)..((@height - value) - 1)).each do\n c_value = c_value + ((channel.unsafe_fetch(r_index)).to_i - (channel.unsafe_fetch(l_index)).to_i)\n buffer.unsafe_put(c_index, ((c_value * multiplier).clamp(0, 255)).to_u8)\n l_index = l_index + @width\n r_index = r_index + @width\n c_index = c_index + @width\n end\n ((@height - value)..(@height - 1)).each do\n c_value = c_value + (l_value - (channel.unsafe_fetch(l_index)).to_i)\n buffer.unsafe_put(c_index, ((c_value * multiplier).clamp(0, 255)).to_u8)\n l_index = l_index + @width\n c_index = c_index + @width\n end\n end\n (channel.@buffer).copy_from(buffer.to_unsafe, buffer.size)\nend\nself\n"}}]}]},{"html_id":"Crystal Image/CrImage/Region","path":"CrImage/Region.html","kind":"struct","full_name":"CrImage::Region","name":"Region","abstract":false,"superclass":{"html_id":"Crystal Image/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"Crystal Image/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"Crystal Image/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"Crystal Image/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cr-image/region.cr","line_number":5,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/region.cr#L5"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"Crystal Image/CrImage","kind":"module","full_name":"CrImage","name":"CrImage"},"doc":"Represents a rectangular area on an `Image` from its upper left corner `x` and `y` coordinates, and a `width` and `height`.\n\nSee `Operation::Crop#crop` and `Operation::Draw#draw_square` for examples using it.","summary":"

        Represents a rectangular area on an Image from its upper left corner #x and #y coordinates, and a #width and #height.

        ","constructors":[{"html_id":"center(x:UInt16,y:UInt16,width:UInt16,height:UInt16):Region-class-method","name":"center","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"UInt16"},{"name":"y","external_name":"y","restriction":"UInt16"},{"name":"width","external_name":"width","restriction":"UInt16"},{"name":"height","external_name":"height","restriction":"UInt16"}],"args_string":"(x : UInt16, y : UInt16, width : UInt16, height : UInt16) : Region","args_html":"(x : UInt16, y : UInt16, width : UInt16, height : UInt16) : Region","location":{"filename":"src/cr-image/region.cr","line_number":11,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/region.cr#L11"},"def":{"name":"center","args":[{"name":"x","external_name":"x","restriction":"UInt16"},{"name":"y","external_name":"y","restriction":"UInt16"},{"name":"width","external_name":"width","restriction":"UInt16"},{"name":"height","external_name":"height","restriction":"UInt16"}],"return_type":"Region","visibility":"Public","body":"new(x - (width // 2), y - (height // 2), width, height)"}},{"html_id":"new(x:UInt16,y:UInt16,width:UInt16,height:UInt16)-class-method","name":"new","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"UInt16"},{"name":"y","external_name":"y","restriction":"UInt16"},{"name":"width","external_name":"width","restriction":"UInt16"},{"name":"height","external_name":"height","restriction":"UInt16"}],"args_string":"(x : UInt16, y : UInt16, width : UInt16, height : UInt16)","args_html":"(x : UInt16, y : UInt16, width : UInt16, height : UInt16)","location":{"filename":"src/cr-image/region.cr","line_number":5,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/region.cr#L5"},"def":{"name":"new","args":[{"name":"x","external_name":"x","restriction":"UInt16"},{"name":"y","external_name":"y","restriction":"UInt16"},{"name":"width","external_name":"width","restriction":"UInt16"},{"name":"height","external_name":"height","restriction":"UInt16"}],"visibility":"Public","body":"_ = allocate\n_.initialize(x, y, width, height)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"center:Tuple(Int32,Int32)-instance-method","name":"center","doc":"Return the `{x, y}` tuple of the center coordinates of this `Region`","summary":"

        Return the {x, y} tuple of the center coordinates of this Region

        ","abstract":false,"location":{"filename":"src/cr-image/region.cr","line_number":21,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/region.cr#L21"},"def":{"name":"center","return_type":"Tuple(Int32, Int32)","visibility":"Public","body":"{(width.to_i // 2) + x.to_i, (height.to_i // 2) + y.to_i}"}},{"html_id":"clone-instance-method","name":"clone","abstract":false,"location":{"filename":"src/cr-image/region.cr","line_number":5,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/region.cr#L5"},"def":{"name":"clone","visibility":"Public","body":"self.class.new(@x.clone, @y.clone, @width.clone, @height.clone)"}},{"html_id":"copy_with(x_x=@x,y_y=@y,width_width=@width,height_height=@height)-instance-method","name":"copy_with","abstract":false,"args":[{"name":"_x","default_value":"@x","external_name":"x","restriction":""},{"name":"_y","default_value":"@y","external_name":"y","restriction":""},{"name":"_width","default_value":"@width","external_name":"width","restriction":""},{"name":"_height","default_value":"@height","external_name":"height","restriction":""}],"args_string":"(x _x = @x, y _y = @y, width _width = @width, height _height = @height)","args_html":"(x _x = @x, y _y = @y, width _width = @width, height _height = @height)","location":{"filename":"src/cr-image/region.cr","line_number":5,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/region.cr#L5"},"def":{"name":"copy_with","args":[{"name":"_x","default_value":"@x","external_name":"x","restriction":""},{"name":"_y","default_value":"@y","external_name":"y","restriction":""},{"name":"_width","default_value":"@width","external_name":"width","restriction":""},{"name":"_height","default_value":"@height","external_name":"height","restriction":""}],"visibility":"Public","body":"self.class.new(_x, _y, _width, _height)"}},{"html_id":"crop(image:Image):Image-instance-method","name":"crop","doc":"Crop a provided `Image` with this region, using `Operation::Crop#crop`","summary":"

        Crop a provided Image with this region, using Operation::Crop#crop

        ","abstract":false,"args":[{"name":"image","external_name":"image","restriction":"Image"}],"args_string":"(image : Image) : Image","args_html":"(image : Image) : Image","location":{"filename":"src/cr-image/region.cr","line_number":16,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/region.cr#L16"},"def":{"name":"crop","args":[{"name":"image","external_name":"image","restriction":"Image"}],"return_type":"Image","visibility":"Public","body":"image.crop(self)"}},{"html_id":"height:UInt16-instance-method","name":"height","abstract":false,"def":{"name":"height","return_type":"UInt16","visibility":"Public","body":"@height"}},{"html_id":"to_tuple:Tuple(Int32,Int32,Int32,Int32)-instance-method","name":"to_tuple","doc":"Return this `Region` as a `x`, `y`, `width`, and `height` tuple","summary":"

        Return this Region as a #x, #y, #width, and #height tuple

        ","abstract":false,"location":{"filename":"src/cr-image/region.cr","line_number":26,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/region.cr#L26"},"def":{"name":"to_tuple","return_type":"Tuple(Int32, Int32, Int32, Int32)","visibility":"Public","body":"{x.to_i, y.to_i, width.to_i, height.to_i}"}},{"html_id":"width:UInt16-instance-method","name":"width","abstract":false,"def":{"name":"width","return_type":"UInt16","visibility":"Public","body":"@width"}},{"html_id":"x:UInt16-instance-method","name":"x","abstract":false,"def":{"name":"x","return_type":"UInt16","visibility":"Public","body":"@x"}},{"html_id":"y:UInt16-instance-method","name":"y","abstract":false,"def":{"name":"y","return_type":"UInt16","visibility":"Public","body":"@y"}}]},{"html_id":"Crystal Image/CrImage/RGBAImage","path":"CrImage/RGBAImage.html","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage","abstract":false,"superclass":{"html_id":"Crystal Image/CrImage/Image","kind":"class","full_name":"CrImage::Image","name":"Image"},"ancestors":[{"html_id":"Crystal Image/CrImage/Format/WebP","kind":"module","full_name":"CrImage::Format::WebP","name":"WebP"},{"html_id":"Crystal Image/CrImage/Format/PNG","kind":"module","full_name":"CrImage::Format::PNG","name":"PNG"},{"html_id":"Crystal Image/CrImage/Format/JPEG","kind":"module","full_name":"CrImage::Format::JPEG","name":"JPEG"},{"html_id":"Crystal Image/CrImage/Operation/MaskApply","kind":"module","full_name":"CrImage::Operation::MaskApply","name":"MaskApply"},{"html_id":"Crystal Image/CrImage/Format/Save","kind":"module","full_name":"CrImage::Format::Save","name":"Save"},{"html_id":"Crystal Image/CrImage/Operation/HistogramEqualize","kind":"module","full_name":"CrImage::Operation::HistogramEqualize","name":"HistogramEqualize"},{"html_id":"Crystal Image/CrImage/Operation/Draw","kind":"module","full_name":"CrImage::Operation::Draw","name":"Draw"},{"html_id":"Crystal Image/CrImage/Operation/Crop","kind":"module","full_name":"CrImage::Operation::Crop","name":"Crop"},{"html_id":"Crystal Image/CrImage/Operation/VerticalBlur","kind":"module","full_name":"CrImage::Operation::VerticalBlur","name":"VerticalBlur"},{"html_id":"Crystal Image/CrImage/Operation/HorizontalBlur","kind":"module","full_name":"CrImage::Operation::HorizontalBlur","name":"HorizontalBlur"},{"html_id":"Crystal Image/CrImage/Operation/GaussianBlur","kind":"module","full_name":"CrImage::Operation::GaussianBlur","name":"GaussianBlur"},{"html_id":"Crystal Image/CrImage/Operation/Contrast","kind":"module","full_name":"CrImage::Operation::Contrast","name":"Contrast"},{"html_id":"Crystal Image/CrImage/Operation/ChannelSwap","kind":"module","full_name":"CrImage::Operation::ChannelSwap","name":"ChannelSwap"},{"html_id":"Crystal Image/CrImage/Operation/Brightness","kind":"module","full_name":"CrImage::Operation::Brightness","name":"Brightness"},{"html_id":"Crystal Image/CrImage/Operation/BoxBlur","kind":"module","full_name":"CrImage::Operation::BoxBlur","name":"BoxBlur"},{"html_id":"Crystal Image/CrImage/Operation/BilinearResize","kind":"module","full_name":"CrImage::Operation::BilinearResize","name":"BilinearResize"},{"html_id":"Crystal Image/CrImage/Format/PPM","kind":"module","full_name":"CrImage::Format::PPM","name":"PPM"},{"html_id":"Crystal Image/CrImage/Image","kind":"class","full_name":"CrImage::Image","name":"Image"},{"html_id":"Crystal Image/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"Crystal Image/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cr-image/rgba_image.cr","line_number":2,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L2"},{"filename":"src/jpeg.cr","line_number":4,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/jpeg.cr#L4"},{"filename":"src/png.cr","line_number":4,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/png.cr#L4"},{"filename":"src/stumpy.cr","line_number":29,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/stumpy.cr#L29"},{"filename":"src/webp.cr","line_number":4,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/webp.cr#L4"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"Crystal Image/CrImage/Format/JPEG","kind":"module","full_name":"CrImage::Format::JPEG","name":"JPEG"},{"html_id":"Crystal Image/CrImage/Format/PNG","kind":"module","full_name":"CrImage::Format::PNG","name":"PNG"},{"html_id":"Crystal Image/CrImage/Format/PPM","kind":"module","full_name":"CrImage::Format::PPM","name":"PPM"},{"html_id":"Crystal Image/CrImage/Format/Save","kind":"module","full_name":"CrImage::Format::Save","name":"Save"},{"html_id":"Crystal Image/CrImage/Format/WebP","kind":"module","full_name":"CrImage::Format::WebP","name":"WebP"},{"html_id":"Crystal Image/CrImage/Operation/BilinearResize","kind":"module","full_name":"CrImage::Operation::BilinearResize","name":"BilinearResize"},{"html_id":"Crystal Image/CrImage/Operation/BoxBlur","kind":"module","full_name":"CrImage::Operation::BoxBlur","name":"BoxBlur"},{"html_id":"Crystal Image/CrImage/Operation/Brightness","kind":"module","full_name":"CrImage::Operation::Brightness","name":"Brightness"},{"html_id":"Crystal Image/CrImage/Operation/ChannelSwap","kind":"module","full_name":"CrImage::Operation::ChannelSwap","name":"ChannelSwap"},{"html_id":"Crystal Image/CrImage/Operation/Contrast","kind":"module","full_name":"CrImage::Operation::Contrast","name":"Contrast"},{"html_id":"Crystal Image/CrImage/Operation/Crop","kind":"module","full_name":"CrImage::Operation::Crop","name":"Crop"},{"html_id":"Crystal Image/CrImage/Operation/Draw","kind":"module","full_name":"CrImage::Operation::Draw","name":"Draw"},{"html_id":"Crystal Image/CrImage/Operation/GaussianBlur","kind":"module","full_name":"CrImage::Operation::GaussianBlur","name":"GaussianBlur"},{"html_id":"Crystal Image/CrImage/Operation/HistogramEqualize","kind":"module","full_name":"CrImage::Operation::HistogramEqualize","name":"HistogramEqualize"},{"html_id":"Crystal Image/CrImage/Operation/HorizontalBlur","kind":"module","full_name":"CrImage::Operation::HorizontalBlur","name":"HorizontalBlur"},{"html_id":"Crystal Image/CrImage/Operation/MaskApply","kind":"module","full_name":"CrImage::Operation::MaskApply","name":"MaskApply"},{"html_id":"Crystal Image/CrImage/Operation/VerticalBlur","kind":"module","full_name":"CrImage::Operation::VerticalBlur","name":"VerticalBlur"}],"extended_modules":[{"html_id":"Crystal Image/CrImage/Format/Open","kind":"module","full_name":"CrImage::Format::Open","name":"Open"}],"namespace":{"html_id":"Crystal Image/CrImage","kind":"module","full_name":"CrImage","name":"CrImage"},"doc":"An image with red, green, blue, and alpha color channels (i.e. a color image). This image type is likely the one read from and written to file (or `IO`).","summary":"

        An image with red, green, blue, and alpha color channels (i.e.

        ","constructors":[{"html_id":"from_jpeg(image_data:Bytes):self-class-method","name":"from_jpeg","doc":"Read `image_data` as JPEG encoded bytes","summary":"

        Read image_data as JPEG encoded bytes

        ","abstract":false,"args":[{"name":"image_data","external_name":"image_data","restriction":"Bytes"}],"args_string":"(image_data : Bytes) : self","args_html":"(image_data : Bytes) : self","def":{"name":"from_jpeg","args":[{"name":"image_data","external_name":"image_data","restriction":"Bytes"}],"return_type":"self","visibility":"Public","body":"handle = LibJPEGTurbo.init_decompress\ncheck_jpeg(handle, LibJPEGTurbo.decompress_header3(handle, image_data, image_data.size, out width, out height, out _subsampling, out _colorspace))\nbuffer = Bytes.new((width * height) * 3, 0)\ncheck_jpeg(handle, LibJPEGTurbo.decompress2(handle, image_data, LibC::ULong.new(image_data.size), buffer, width, 0, height, LibJPEGTurbo::PixelFormat::RGB, 0))\ncheck_jpeg(handle, LibJPEGTurbo.destroy(handle))\nred = Array.new(width * height) do\n 0_u8\nend\ngreen = Array.new(width * height) do\n 0_u8\nend\nblue = Array.new(width * height) do\n 0_u8\nend\nalpha = Array.new(width * height) do\n 255_u8\nend\n(width * height).times do |index|\n red.unsafe_put(index, buffer[index * 3])\n green.unsafe_put(index, buffer[(index * 3) + 1])\n blue.unsafe_put(index, buffer[(index * 3) + 2])\nend\nnew(red, green, blue, alpha, width, height)\n"}},{"html_id":"from_jpeg(io:IO):self-class-method","name":"from_jpeg","doc":"Construct an Image from reading in bytes from `io`","summary":"

        Construct an Image from reading in bytes from io

        ","abstract":false,"args":[{"name":"io","external_name":"io","restriction":"IO"}],"args_string":"(io : IO) : self","args_html":"(io : IO) : self","def":{"name":"from_jpeg","args":[{"name":"io","external_name":"io","restriction":"IO"}],"return_type":"self","visibility":"Public","body":"from_jpeg(io.getb_to_end)"}},{"html_id":"from_png(image_data:Bytes):self-class-method","name":"from_png","doc":"Read `image_data` and PNG encoded bytes","summary":"

        Read image_data and PNG encoded bytes

        ","abstract":false,"args":[{"name":"image_data","external_name":"image_data","restriction":"Bytes"}],"args_string":"(image_data : Bytes) : self","args_html":"(image_data : Bytes) : self","def":{"name":"from_png","args":[{"name":"image_data","external_name":"image_data","restriction":"Bytes"}],"return_type":"self","visibility":"Public","body":"ctx = LibSPNG.ctx_new(LibSPNG::CtxFlags::None)\nif ctx\nelse\n raise(::CrImage::Exception.new(\"Failed to create a context\"))\nend\nLibSPNG.set_png_buffer(ctx, image_data, image_data.size)\ncheck_png(LibSPNG.get_ihdr(ctx, out ihdr))\ncheck_png(LibSPNG.decoded_image_size(ctx, LibSPNG::Format::RGBA8, out image_size))\nimage = Bytes.new(image_size.to_i, 0_u8)\ncheck_png(LibSPNG.decode_image(ctx, image, image_size, LibSPNG::Format::RGBA8, LibSPNG::DecodeFlags::None))\nLibSPNG.ctx_free(ctx)\nsize = image_size // 4\nwidth = size // ihdr.height\nheight = ihdr.height\nred = Array.new(size) do\n 0_u8\nend\ngreen = Array.new(size) do\n 0_u8\nend\nblue = Array.new(size) do\n 0_u8\nend\nalpha = Array.new(size) do\n 0_u8\nend\nsize.times do |index|\n position = index * 4\n red.unsafe_put(index, image[position + 0])\n green.unsafe_put(index, image[position + 1])\n blue.unsafe_put(index, image[position + 2])\n alpha.unsafe_put(index, image[position + 3])\nend\nnew(red, green, blue, alpha, width.to_i, height.to_i)\n"}},{"html_id":"from_png(io:IO):self-class-method","name":"from_png","doc":"Construct an Image by reading bytes from `io`","summary":"

        Construct an Image by reading bytes from io

        ","abstract":false,"args":[{"name":"io","external_name":"io","restriction":"IO"}],"args_string":"(io : IO) : self","args_html":"(io : IO) : self","def":{"name":"from_png","args":[{"name":"io","external_name":"io","restriction":"IO"}],"return_type":"self","visibility":"Public","body":"from_png(io.getb_to_end)"}},{"html_id":"from_ppm(image_data:Bytes):self-class-method","name":"from_ppm","doc":"Read `image_data` as PPM encoded bytes","summary":"

        Read image_data as PPM encoded bytes

        ","abstract":false,"args":[{"name":"image_data","external_name":"image_data","restriction":"Bytes"}],"args_string":"(image_data : Bytes) : self","args_html":"(image_data : Bytes) : self","def":{"name":"from_ppm","args":[{"name":"image_data","external_name":"image_data","restriction":"Bytes"}],"return_type":"self","visibility":"Public","body":"from_ppm(IO::Memory.new(image_data))"}},{"html_id":"from_ppm(io:IO):self-class-method","name":"from_ppm","doc":"Read bytes from `io` as PPM encoded","summary":"

        Read bytes from io as PPM encoded

        ","abstract":false,"args":[{"name":"io","external_name":"io","restriction":"IO"}],"args_string":"(io : IO) : self","args_html":"(io : IO) : self","def":{"name":"from_ppm","args":[{"name":"io","external_name":"io","restriction":"IO"}],"return_type":"self","visibility":"Public","body":"_magic_number = io.gets(\"\\n\", chomp: true)\nwidth = (io.gets(\" \", chomp: true)).try(&.to_i)\nheight = (io.gets(\"\\n\", chomp: true)).try(&.to_i)\n_maximum_color_value = io.gets(\"\\n\", chomp: true)\nif width && height\n red = Array.new(width * height) do\n 0_u8\n end\n green = Array.new(width * height) do\n 0_u8\n end\n blue = Array.new(width * height) do\n 0_u8\n end\n alpha = Array.new(width * height) do\n 255_u8\n end\n (width * height).times do |index|\n red_byte = io.read_byte\n green_byte = io.read_byte\n blue_byte = io.read_byte\n if (red_byte && green_byte) && blue_byte\n red.unsafe_put(index, red_byte)\n green.unsafe_put(index, green_byte)\n blue.unsafe_put(index, blue_byte)\n else\n raise(\"The image ends prematurely\")\n end\n end\n new(red, green, blue, alpha, width, height)\nelse\n raise(\"The image doesn't have width or height\")\nend\n"}},{"html_id":"from_webp(image_data:Bytes):self-class-method","name":"from_webp","doc":"Read `image_data` as WebP encoded bytes","summary":"

        Read image_data as WebP encoded bytes

        ","abstract":false,"args":[{"name":"image_data","external_name":"image_data","restriction":"Bytes"}],"args_string":"(image_data : Bytes) : self","args_html":"(image_data : Bytes) : self","def":{"name":"from_webp","args":[{"name":"image_data","external_name":"image_data","restriction":"Bytes"}],"return_type":"self","visibility":"Public","body":"check_webp(LibWebP.get_info(image_data, image_data.size, out width, out height))\nbuffer = LibWebP.decode_rgba(image_data, image_data.size, pointerof(width), pointerof(height))\nred = Array.new(width * height) do\n 0_u8\nend\ngreen = Array.new(width * height) do\n 0_u8\nend\nblue = Array.new(width * height) do\n 0_u8\nend\nalpha = Array.new(width * height) do\n 0_u8\nend\n(width * height).times do |index|\n red.unsafe_put(index, buffer[index * 4])\n green.unsafe_put(index, buffer[(index * 4) + 1])\n blue.unsafe_put(index, buffer[(index * 4) + 2])\n alpha.unsafe_put(index, buffer[(index * 4) + 3])\nend\nLibWebP.free(buffer)\nnew(red, green, blue, alpha, width, height)\n"}},{"html_id":"from_webp(io:IO):self-class-method","name":"from_webp","doc":"Read bytes from `io` as WebP encoded","summary":"

        Read bytes from io as WebP encoded

        ","abstract":false,"args":[{"name":"io","external_name":"io","restriction":"IO"}],"args_string":"(io : IO) : self","args_html":"(io : IO) : self","def":{"name":"from_webp","args":[{"name":"io","external_name":"io","restriction":"IO"}],"return_type":"self","visibility":"Public","body":"from_webp(io.getb_to_end)"}},{"html_id":"new(red:Array(UInt8),green:Array(UInt8),blue:Array(UInt8),alpha:Array(UInt8),width:Int32,height:Int32)-class-method","name":"new","abstract":false,"args":[{"name":"red","external_name":"red","restriction":"::Array(::UInt8)"},{"name":"green","external_name":"green","restriction":"::Array(::UInt8)"},{"name":"blue","external_name":"blue","restriction":"::Array(::UInt8)"},{"name":"alpha","external_name":"alpha","restriction":"::Array(::UInt8)"},{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"height","external_name":"height","restriction":"::Int32"}],"args_string":"(red : Array(UInt8), green : Array(UInt8), blue : Array(UInt8), alpha : Array(UInt8), width : Int32, height : Int32)","args_html":"(red : Array(UInt8), green : Array(UInt8), blue : Array(UInt8), alpha : Array(UInt8), width : Int32, height : Int32)","location":{"filename":"src/cr-image/rgba_image.cr","line_number":10,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L10"},"def":{"name":"new","args":[{"name":"red","external_name":"red","restriction":"::Array(::UInt8)"},{"name":"green","external_name":"green","restriction":"::Array(::UInt8)"},{"name":"blue","external_name":"blue","restriction":"::Array(::UInt8)"},{"name":"alpha","external_name":"alpha","restriction":"::Array(::UInt8)"},{"name":"width","external_name":"width","restriction":"::Int32"},{"name":"height","external_name":"height","restriction":"::Int32"}],"visibility":"Public","body":"_ = allocate\n_.initialize(red, green, blue, alpha, width, height)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"[](x:Int32,y:Int32):Pixel-instance-method","name":"[]","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"y","external_name":"y","restriction":"Int32"}],"args_string":"(x : Int32, y : Int32) : Pixel","args_html":"(x : Int32, y : Int32) : Pixel","location":{"filename":"src/cr-image/rgba_image.cr","line_number":40,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L40"},"def":{"name":"[]","args":[{"name":"x","external_name":"x","restriction":"Int32"},{"name":"y","external_name":"y","restriction":"Int32"}],"return_type":"Pixel","visibility":"Public","body":"index = (y * width) + x\nPixel.new(red[index], green[index], blue[index], alpha[index])\n"}},{"html_id":"[](channel_type:ChannelType):Array(UInt8)-instance-method","name":"[]","doc":"Return the channel corresponding to `channel_type`","summary":"

        Return the channel corresponding to channel_type

        ","abstract":false,"args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"}],"args_string":"(channel_type : ChannelType) : Array(UInt8)","args_html":"(channel_type : ChannelType) : Array(UInt8)","location":{"filename":"src/cr-image/rgba_image.cr","line_number":46,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L46"},"def":{"name":"[]","args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"}],"return_type":"Array(UInt8)","visibility":"Public","body":"case channel_type\nwhen ChannelType::Red\n @red\nwhen ChannelType::Green\n @green\nwhen ChannelType::Blue\n @blue\nwhen ChannelType::Alpha\n @alpha\nelse\n raise(\"Unknown channel type #{channel_type} for RGBAImage\")\nend"}},{"html_id":"[]=(channel_type:ChannelType,channel:Array(UInt8)):Array(UInt8)-instance-method","name":"[]=","doc":"Set the corresponding `channel_type` with `channel`","summary":"

        Set the corresponding channel_type with channel

        ","abstract":false,"args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"},{"name":"channel","external_name":"channel","restriction":"Array(UInt8)"}],"args_string":"(channel_type : ChannelType, channel : Array(UInt8)) : Array(UInt8)","args_html":"(channel_type : ChannelType, channel : Array(UInt8)) : Array(UInt8)","location":{"filename":"src/cr-image/rgba_image.cr","line_number":57,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L57"},"def":{"name":"[]=","args":[{"name":"channel_type","external_name":"channel_type","restriction":"ChannelType"},{"name":"channel","external_name":"channel","restriction":"Array(UInt8)"}],"return_type":"Array(UInt8)","visibility":"Public","body":"case channel_type\nwhen ChannelType::Red\n @red = channel\nwhen ChannelType::Green\n @green = channel\nwhen ChannelType::Blue\n @blue = channel\nwhen ChannelType::Alpha\n @alpha = channel\nelse\n raise(\"Unknown channel type #{channel_type} for RGBAImage\")\nend"}},{"html_id":"alpha:Array(UInt8)-instance-method","name":"alpha","doc":"Return the alpha channel","summary":"

        Return the alpha channel

        ","abstract":false,"location":{"filename":"src/cr-image/rgba_image.cr","line_number":6,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L6"},"def":{"name":"alpha","return_type":"Array(UInt8)","visibility":"Public","body":"@alpha"}},{"html_id":"alpha=(alpha:Array(UInt8))-instance-method","name":"alpha=","abstract":false,"args":[{"name":"alpha","external_name":"alpha","restriction":"Array(UInt8)"}],"args_string":"(alpha : Array(UInt8))","args_html":"(alpha : Array(UInt8))","location":{"filename":"src/cr-image/rgba_image.cr","line_number":6,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L6"},"def":{"name":"alpha=","args":[{"name":"alpha","external_name":"alpha","restriction":"Array(UInt8)"}],"visibility":"Public","body":"@alpha = alpha"}},{"html_id":"blue:Array(UInt8)-instance-method","name":"blue","doc":"Return the blue channel","summary":"

        Return the blue channel

        ","abstract":false,"location":{"filename":"src/cr-image/rgba_image.cr","line_number":5,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L5"},"def":{"name":"blue","return_type":"Array(UInt8)","visibility":"Public","body":"@blue"}},{"html_id":"blue=(blue:Array(UInt8))-instance-method","name":"blue=","abstract":false,"args":[{"name":"blue","external_name":"blue","restriction":"Array(UInt8)"}],"args_string":"(blue : Array(UInt8))","args_html":"(blue : Array(UInt8))","location":{"filename":"src/cr-image/rgba_image.cr","line_number":5,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L5"},"def":{"name":"blue=","args":[{"name":"blue","external_name":"blue","restriction":"Array(UInt8)"}],"visibility":"Public","body":"@blue = blue"}},{"html_id":"clone:RGBAImage-instance-method","name":"clone","doc":"Create a copy of this image","summary":"

        Create a copy of this image

        ","abstract":false,"location":{"filename":"src/cr-image/rgba_image.cr","line_number":14,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L14"},"def":{"name":"clone","return_type":"RGBAImage","visibility":"Public","body":"self.class.new(@red.clone, @green.clone, @blue.clone, @alpha.clone, @width, @height)"}},{"html_id":"each_channel(&:Array(UInt8),ChannelType->Nil):Nil-instance-method","name":"each_channel","doc":"Run provided block with the `ChannelType::Red`, `ChannelType::Green`, `ChannelType::Blue`, and `ChannelType::Alpha` channels.","summary":"

        Run provided block with the ChannelType::Red, ChannelType::Green, ChannelType::Blue, and ChannelType::Alpha channels.

        ","abstract":false,"location":{"filename":"src/cr-image/rgba_image.cr","line_number":26,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L26"},"def":{"name":"each_channel","yields":2,"block_arity":2,"block_arg":{"name":"","external_name":"","restriction":"(Array(UInt8), ChannelType -> Nil)"},"return_type":"Nil","visibility":"Public","body":"yield @red, ChannelType::Red\nyield @green, ChannelType::Green\nyield @blue, ChannelType::Blue\nyield @alpha, ChannelType::Alpha\nnil\n"}},{"html_id":"green:Array(UInt8)-instance-method","name":"green","doc":"Return the green channel","summary":"

        Return the green channel

        ","abstract":false,"location":{"filename":"src/cr-image/rgba_image.cr","line_number":4,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L4"},"def":{"name":"green","return_type":"Array(UInt8)","visibility":"Public","body":"@green"}},{"html_id":"green=(green:Array(UInt8))-instance-method","name":"green=","abstract":false,"args":[{"name":"green","external_name":"green","restriction":"Array(UInt8)"}],"args_string":"(green : Array(UInt8))","args_html":"(green : Array(UInt8))","location":{"filename":"src/cr-image/rgba_image.cr","line_number":4,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L4"},"def":{"name":"green=","args":[{"name":"green","external_name":"green","restriction":"Array(UInt8)"}],"visibility":"Public","body":"@green = green"}},{"html_id":"height:Int32-instance-method","name":"height","doc":"Height of image","summary":"

        Height of image

        ","abstract":false,"location":{"filename":"src/cr-image/rgba_image.cr","line_number":8,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L8"},"def":{"name":"height","return_type":"Int32","visibility":"Public","body":"@height"}},{"html_id":"height=(height:Int32)-instance-method","name":"height=","abstract":false,"args":[{"name":"height","external_name":"height","restriction":"Int32"}],"args_string":"(height : Int32)","args_html":"(height : Int32)","location":{"filename":"src/cr-image/rgba_image.cr","line_number":8,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L8"},"def":{"name":"height=","args":[{"name":"height","external_name":"height","restriction":"Int32"}],"visibility":"Public","body":"@height = height"}},{"html_id":"red:Array(UInt8)-instance-method","name":"red","doc":"Return the red channel","summary":"

        Return the red channel

        ","abstract":false,"location":{"filename":"src/cr-image/rgba_image.cr","line_number":3,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L3"},"def":{"name":"red","return_type":"Array(UInt8)","visibility":"Public","body":"@red"}},{"html_id":"red=(red:Array(UInt8))-instance-method","name":"red=","abstract":false,"args":[{"name":"red","external_name":"red","restriction":"Array(UInt8)"}],"args_string":"(red : Array(UInt8))","args_html":"(red : Array(UInt8))","location":{"filename":"src/cr-image/rgba_image.cr","line_number":3,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L3"},"def":{"name":"red=","args":[{"name":"red","external_name":"red","restriction":"Array(UInt8)"}],"visibility":"Public","body":"@red = red"}},{"html_id":"size:Int32-instance-method","name":"size","doc":"Return the number of pixels in this image","summary":"

        Return the number of pixels in this image

        ","abstract":false,"location":{"filename":"src/cr-image/rgba_image.cr","line_number":85,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L85"},"def":{"name":"size","return_type":"Int32","visibility":"Public","body":"@width * @height"}},{"html_id":"to_gray(red_multiplier:Float=0.299,green_multiplier:Float=0.587,blue_multiplier:Float=0.114):GrayscaleImage-instance-method","name":"to_gray","doc":"Convert color image to `GrayscaleImage`, using the NTSC formula as default values.\n\n\"Woman\n\nBecomes\n\n\"Woman","summary":"

        Convert color image to GrayscaleImage, using the NTSC formula as default values.

        ","abstract":false,"args":[{"name":"red_multiplier","default_value":"0.299","external_name":"red_multiplier","restriction":"Float"},{"name":"green_multiplier","default_value":"0.587","external_name":"green_multiplier","restriction":"Float"},{"name":"blue_multiplier","default_value":"0.114","external_name":"blue_multiplier","restriction":"Float"}],"args_string":"(red_multiplier : Float = 0.299, green_multiplier : Float = 0.587, blue_multiplier : Float = 0.114) : GrayscaleImage","args_html":"(red_multiplier : Float = 0.299, green_multiplier : Float = 0.587, blue_multiplier : Float = 0.114) : GrayscaleImage","location":{"filename":"src/cr-image/rgba_image.cr","line_number":74,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L74"},"def":{"name":"to_gray","args":[{"name":"red_multiplier","default_value":"0.299","external_name":"red_multiplier","restriction":"Float"},{"name":"green_multiplier","default_value":"0.587","external_name":"green_multiplier","restriction":"Float"},{"name":"blue_multiplier","default_value":"0.114","external_name":"blue_multiplier","restriction":"Float"}],"return_type":"GrayscaleImage","visibility":"Public","body":"GrayscaleImage.new(red.map_with_index do |red_pix, i|\n (Math.min(255, ((red_pix * red_multiplier) + (@green[i] * green_multiplier)) + (@blue[i] * blue_multiplier))).to_u8\nend, width, height)"}},{"html_id":"to_stumpy:StumpyCore::Canvas-instance-method","name":"to_stumpy","abstract":false,"location":{"filename":"src/stumpy.cr","line_number":30,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/stumpy.cr#L30"},"def":{"name":"to_stumpy","return_type":"StumpyCore::Canvas","visibility":"Public","body":"StumpyCore::Canvas.new(width, height) do |x, y|\n color = self[x, y]\n StumpyCore::RGBA.new(color.red.to_u16 << 8, color.green.to_u16 << 8, color.blue.to_u16 << 8, color.alpha.to_u16 << 8)\nend"}},{"html_id":"width:Int32-instance-method","name":"width","doc":"Width of image","summary":"

        Width of image

        ","abstract":false,"location":{"filename":"src/cr-image/rgba_image.cr","line_number":7,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L7"},"def":{"name":"width","return_type":"Int32","visibility":"Public","body":"@width"}},{"html_id":"width=(width:Int32)-instance-method","name":"width=","abstract":false,"args":[{"name":"width","external_name":"width","restriction":"Int32"}],"args_string":"(width : Int32)","args_html":"(width : Int32)","location":{"filename":"src/cr-image/rgba_image.cr","line_number":7,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L7"},"def":{"name":"width=","args":[{"name":"width","external_name":"width","restriction":"Int32"}],"visibility":"Public","body":"@width = width"}}],"types":[{"html_id":"Crystal Image/CrImage/RGBAImage/Pixel","path":"CrImage/RGBAImage/Pixel.html","kind":"struct","full_name":"CrImage::RGBAImage::Pixel","name":"Pixel","abstract":false,"superclass":{"html_id":"Crystal Image/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"Crystal Image/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"Crystal Image/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"Crystal Image/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cr-image/rgba_image.cr","line_number":34,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L34"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"Crystal Image/CrImage/RGBAImage","kind":"class","full_name":"CrImage::RGBAImage","name":"RGBAImage"},"constructors":[{"html_id":"new(red:UInt8,green:UInt8,blue:UInt8,alpha:UInt8)-class-method","name":"new","abstract":false,"args":[{"name":"red","external_name":"red","restriction":"UInt8"},{"name":"green","external_name":"green","restriction":"UInt8"},{"name":"blue","external_name":"blue","restriction":"UInt8"},{"name":"alpha","external_name":"alpha","restriction":"UInt8"}],"args_string":"(red : UInt8, green : UInt8, blue : UInt8, alpha : UInt8)","args_html":"(red : UInt8, green : UInt8, blue : UInt8, alpha : UInt8)","location":{"filename":"src/cr-image/rgba_image.cr","line_number":34,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L34"},"def":{"name":"new","args":[{"name":"red","external_name":"red","restriction":"UInt8"},{"name":"green","external_name":"green","restriction":"UInt8"},{"name":"blue","external_name":"blue","restriction":"UInt8"},{"name":"alpha","external_name":"alpha","restriction":"UInt8"}],"visibility":"Public","body":"_ = allocate\n_.initialize(red, green, blue, alpha)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"alpha:UInt8-instance-method","name":"alpha","abstract":false,"def":{"name":"alpha","return_type":"UInt8","visibility":"Public","body":"@alpha"}},{"html_id":"blue:UInt8-instance-method","name":"blue","abstract":false,"def":{"name":"blue","return_type":"UInt8","visibility":"Public","body":"@blue"}},{"html_id":"clone-instance-method","name":"clone","abstract":false,"location":{"filename":"src/cr-image/rgba_image.cr","line_number":34,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L34"},"def":{"name":"clone","visibility":"Public","body":"self.class.new(@red.clone, @green.clone, @blue.clone, @alpha.clone)"}},{"html_id":"copy_with(red_red=@red,green_green=@green,blue_blue=@blue,alpha_alpha=@alpha)-instance-method","name":"copy_with","abstract":false,"args":[{"name":"_red","default_value":"@red","external_name":"red","restriction":""},{"name":"_green","default_value":"@green","external_name":"green","restriction":""},{"name":"_blue","default_value":"@blue","external_name":"blue","restriction":""},{"name":"_alpha","default_value":"@alpha","external_name":"alpha","restriction":""}],"args_string":"(red _red = @red, green _green = @green, blue _blue = @blue, alpha _alpha = @alpha)","args_html":"(red _red = @red, green _green = @green, blue _blue = @blue, alpha _alpha = @alpha)","location":{"filename":"src/cr-image/rgba_image.cr","line_number":34,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/cr-image/rgba_image.cr#L34"},"def":{"name":"copy_with","args":[{"name":"_red","default_value":"@red","external_name":"red","restriction":""},{"name":"_green","default_value":"@green","external_name":"green","restriction":""},{"name":"_blue","default_value":"@blue","external_name":"blue","restriction":""},{"name":"_alpha","default_value":"@alpha","external_name":"alpha","restriction":""}],"visibility":"Public","body":"self.class.new(_red, _green, _blue, _alpha)"}},{"html_id":"green:UInt8-instance-method","name":"green","abstract":false,"def":{"name":"green","return_type":"UInt8","visibility":"Public","body":"@green"}},{"html_id":"red:UInt8-instance-method","name":"red","abstract":false,"def":{"name":"red","return_type":"UInt8","visibility":"Public","body":"@red"}}]}]}]},{"html_id":"Crystal Image/StumpyCore","path":"StumpyCore.html","kind":"module","full_name":"StumpyCore","name":"StumpyCore","abstract":false,"locations":[{"filename":"lib/stumpy_core/src/stumpy_core/canvas.cr","line_number":3,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/lib/stumpy_core/src/stumpy_core/canvas.cr#L3"},{"filename":"lib/stumpy_core/src/stumpy_core/rgba.cr","line_number":4,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/lib/stumpy_core/src/stumpy_core/rgba.cr#L4"},{"filename":"lib/stumpy_core/src/stumpy_core/rgba/css_constants.cr","line_number":1,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/lib/stumpy_core/src/stumpy_core/rgba/css_constants.cr#L1"},{"filename":"lib/stumpy_core/src/stumpy_core/rgba/from_grayscale.cr","line_number":1,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/lib/stumpy_core/src/stumpy_core/rgba/from_grayscale.cr#L1"},{"filename":"lib/stumpy_core/src/stumpy_core/rgba/from_hex.cr","line_number":1,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/lib/stumpy_core/src/stumpy_core/rgba/from_hex.cr#L1"},{"filename":"lib/stumpy_core/src/stumpy_core/rgba/from_hsl_hsv.cr","line_number":1,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/lib/stumpy_core/src/stumpy_core/rgba/from_hsl_hsv.cr#L1"},{"filename":"lib/stumpy_core/src/stumpy_core/rgba/from_relative.cr","line_number":1,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/lib/stumpy_core/src/stumpy_core/rgba/from_relative.cr#L1"},{"filename":"lib/stumpy_core/src/stumpy_core/rgba/from_rgba.cr","line_number":1,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/lib/stumpy_core/src/stumpy_core/rgba/from_rgba.cr#L1"},{"filename":"lib/stumpy_core/src/stumpy_core/rgba/mixing.cr","line_number":1,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/lib/stumpy_core/src/stumpy_core/rgba/mixing.cr#L1"},{"filename":"lib/stumpy_core/src/stumpy_core/utils.cr","line_number":1,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/lib/stumpy_core/src/stumpy_core/utils.cr#L1"},{"filename":"src/stumpy.cr","line_number":5,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/stumpy.cr#L5"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"doc":"A module owned by [StumpyCr](https://github.com/stumpycr/stumpy_core)","summary":"

        A module owned by StumpyCr

        ","types":[{"html_id":"Crystal Image/StumpyCore/Canvas","path":"StumpyCore/Canvas.html","kind":"class","full_name":"StumpyCore::Canvas","name":"Canvas","abstract":false,"superclass":{"html_id":"Crystal Image/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"Crystal Image/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"Crystal Image/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"lib/stumpy_core/src/stumpy_core/canvas.cr","line_number":31,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/lib/stumpy_core/src/stumpy_core/canvas.cr#L31"},{"filename":"src/stumpy.cr","line_number":6,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/stumpy.cr#L6"}],"repository_name":"Crystal Image","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"Crystal Image/StumpyCore","kind":"module","full_name":"StumpyCore","name":"StumpyCore"},"doc":"A canvas is 2D array of `RGBA` pixels\n\nTo create a canvas of size `400` x `200`\n\n```\ncanvas = StumpyCore::Canvas.new(400, 200)\n```\n\nThe default background color is transparent,\nbut it can be passed in as a parameter or as a block\nthat returns the color value for each `{x, y}` pair.\n\n```\ncanvas2 = StumpyCore::Canvas.new(400, 200, RGBA::WHITE)\n```\n\n```\ncanvas3 = StumpyCore::Canvas.new(256, 256) do |x, y|\n RGBA.from_rgb_n(x, y, 255, 8)\nend\n```\n![image](https://github.com/stumpycr/stumpy_core/blob/feature/images/rainbow.png?raw=true)\n\nBecause of the way pixels are stored in a `Slice`,\n`Canvas`es are limited to `Int32::MAX = 2147483647` pixels in total,\ne.g. a maximal size of 46340x46340 for a square image.","summary":"

        A canvas is 2D array of RGBA pixels

        ","instance_methods":[{"html_id":"to_crimage:CrImage::RGBAImage-instance-method","name":"to_crimage","abstract":false,"location":{"filename":"src/stumpy.cr","line_number":7,"url":"https://github.com/Vici37/cr-image/blob/770447b9fd994f49a86dc000ad2a141b1b91629b/src/stumpy.cr#L7"},"def":{"name":"to_crimage","return_type":"CrImage::RGBAImage","visibility":"Public","body":"size = width * height\nred = Array(UInt8).new(size)\ngreen = Array(UInt8).new(size)\nblue = Array(UInt8).new(size)\nalpha = Array(UInt8).new(size)\neach_row do |row|\n row.each do |rgba|\n red << (rgba.r >> 8).to_u8\n green << (rgba.g >> 8).to_u8\n blue << (rgba.b >> 8).to_u8\n alpha << (rgba.a >> 8).to_u8\n end\nend\nCrImage::RGBAImage.new(red, green, blue, alpha, width, height)\n"}}]}]}]}}) \ No newline at end of file diff --git a/sample.ppm b/sample.ppm new file mode 100644 index 0000000..5fd4351 --- /dev/null +++ b/sample.ppm @@ -0,0 +1,79 @@ +P6 +159 199 +255 +«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ­·¶­·¶­·¶­·¶­·¶­·¶¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ­·¶­·¶­·¶¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ­·¶­·¶«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ­·¶­·¶­·¶­·¶¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ­·¶­·¶­·¶«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ­·¶­·¶­·¶­·¶­·¶­·¶­·¶«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ®¸·®¸·®¸·­·¶­·¶­·¶­·¶¬¶µ¬¶µ­·¶­·¶­·¶­·¶®¸·®¸·®¸·®¸·®¸·®¸·­·¶­·¶­·¶­·¶¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ®¸·®¸·®¸·­·¶­·¶­·¶­·¶«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¯¹¸¯¹¸®¸·®¸·­·¶­·¶­·¶¬¶µ¬¶µ¬¶µ­·¶­·¶®¸·®¸·¯¹¸¯¹¸¯¹¸¯¹¸®¸·®¸·­·¶­·¶­·¶¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¯¹¸¯¹¸®¸·®¸·­·¶­·¶­·¶«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ°º¹°º¹¯¹¸®¸·®¸·­·¶¬¶µ¬¶µ¬¶µ¬¶µ­·¶®¸·®¸·¯¹¸°º¹°º¹°º¹°º¹¯¹¸®¸·®¸·­·¶¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ°º¹°º¹¯¹¸®¸·®¸·­·¶¬¶µ«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ±»º°º¹°º¹¯¹¸®¸·­·¶¬¶µ¬¶µ¬¶µ¬¶µ­·¶®¸·¯¹¸°º¹°º¹°º¹±»º°º¹°º¹¯¹¸®¸·­·¶¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ±»º°º¹°º¹¯¹¸®¸·­·¶¬¶µ«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ±»º°º¹°º¹¯¹¸®¸·­·¶¬¶µ¬¶µ¬¶µ¬¶µ­·¶®¸·¯¹¸°º¹±»º±»º±»º°º¹°º¹¯¹¸®¸·­·¶¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ±»º°º¹°º¹¯¹¸®¸·­·¶¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ¬¶µ¬·³«·³«·³«·³«·³«·³«·³«·³«·³«·³«·³«·³«·³«·³«·³«·³«·³«·³«·³«·³«·³«·³«·³«·³«·³«·³«·³«·³«·³«·³«·³«·³¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ­·¶­·¶­·¶¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ¬·³«·³«·³«·³«·³«·³«·³«·³«·³«·³«·³«·³«·³«·³«·³«·³«·³«·³«·³«·³«·³«·³«·³«·³«·³«·³«·³«·³«·³«·³«·³«·³¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ­·¶­·¶­·¶­·¶¬¶µ¬¶µ¬¶µ¬¶µ¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬·³¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ­·¶­·¶­·¶­·¶®¸·®¸·®¸·¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬·³¬·³¬·±¬·±¬·±¬·±¬·±¬·±¬·±¬·±¬·±¬·±¬·±¬·±¬·±¬·±¬·³¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ­·¶­·¶®¸·®¸·¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬·³¬·³¬·±¬·±¬·±¬·±¬·±¬·±¬·±¬·±¬·±¬·±¬·±¬·±¬·±¬·±¬·±¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ­·¶®¸·®¸·¯¹¸°º¹°º¹¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶³­¶³­¶±­¶±­¶±­¶±­¶±­¶±­¶±­¶±­¶±­¶±­¶±­¶±­¶±­¶±­¶±¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ­·¶®¸·¯¹¸°º¹°º¹°º¹¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶µ­¶³­¶±­¶±­¶±­¶±­¶±­¶±­¶±­¶±­¶±­¶±­¶±­¶±­¶±­¶±­¶±­¶±¬·³¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ­·¶®¸·¯¹¸°º¹±»º±»º¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ­¶µ­¶µ­¶µ­¶µ­¶µ®·¶®·¶®·¶®·¶®·¶¯¸·°¹¸°¹¸®·¶¬µ´¬µ´¬µ²°¹¶®·´¨±®¨±®®·´®·´¨±®±º·°¹¶°¹¶°¹¶«´±¥®«¤­ª©²¯¢«¦¨²ª²¼´·Á¹±»³¨²ª©³«°º²µ¿·¯¹±¬¶®®¸°±»³¯¹±ª´¬¨±¬±¼¸®¸·®¸·¯¹¸¯¹¸­·¶­·¶®¸·¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­¶µ­¶µ­¶µ­¶µ®·¶®·¶®·¶®·¶³¼»¬µ´«´³°¹¸¯¸·©²±©²±°¹¸©²¯¤­¨ª³®¶¿º·À»®·²®·²¶¿º£¬§•ž™†Š|…€s|whql`id^gbiskakccmeyƒ{– ˜ª´¬³½µ¶À¸§Ÿ§±©±»³¯¹±ª´¬«µ­³½µ»Ä¿°»·®¸·¬¶µ­·¶¯¹¸¯¹¸®¸·®¸·¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶®·¶®·¶®·¶®·¶®·¶®·¶®·¶®·¶¥®­²»º´½¼¨±°¨±°µ¾½·À¿«´±´º¶°·°®µ®®µ®«²«¦­¦¦­¦ª±ª™ ™€‡€dkdT[TIPI=D=181*1* ")!.5-3:26=5CJBah`~…}Ÿ¦ž §Ÿ¤œ›¢š¤«£®µ­®µ­£­¥°»·®¸·¬¶µ¬¶µ¯¹¸±»º°º¹­·¶¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶¯¸·¯¸·¯¸·®·¶®·¶®·¶®·¶­¶µ¨±°­¶µ¯¸·¬µ´­¶µ±º¹°¹¸«´±£ª£ºÂ·¿Æ¾¯·¬­´¬³»° §Ÿ~†{ZaYFNC180)1&'.&#+ &#)0(%"&%,$+2*ryq‡Ž†˜Ÿ—›¢š §Ÿ¬³«³º²²¹²°¹¶¯¹¸­·¶¬¶µ¯¹¸³½¼±»º¬¶µ¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·°¹¸°¹¸¯¸·¯¸·®·¶®·¶®·¶­¶µ¾ÇÆ£¬«Ÿ¨§µ¾½¸ÁÀ¤­¬£¬«·À½´»³²¸¬•›‘msgci_nthag]BH<# ""((.$+0)&+$%*#*/(.3,+0)(-&',% +"' DIBingŒ‘ŠŸ¤—œ•…Œ…¨±®¬¶µ¯¹¸­·¶®¸·²¼»°º¹«µ´¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·±º¹±º¹°¹¸¯¸·¯¸·®·¶­¶µ­¶µ±º¹°¹¸ª³²¨±°°¹¸ºÃ´½¼¦¯ªŠ†fl^:@4!' # & !"( +!-2+16/&+$ !&.3,FKD05.-2+af_—œ•¹À¹— ¤®­­·¶¬¶µ«µ´°º¹°º¹«µ´¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·²»º±º¹±º¹°¹¸¯¸·®·¶­¶µ­¶µ£¬«¶¿¾¶¿¾¥®­¨±°°¹¸Ž—–Yb]$ !-4$4:,)0 %%   )/%" %*/().' %-2+>C<5:3@E>u|uŠ‡– Ÿ¨²±¨²±§±°¬¶µ¯¹¸¬¶µ¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·´º¸³¹·³¹·°¹¶¯¸·®·¶­¶µ¬¶µµ¿¾¢¬«§°¯¾ÇƱº·pyv-31 + +!%)--1"(,%)$(! + "$% ('-# %!&$' #& $' 03,&)""36/8;4*-&"%$)#qzuŒ—“£¬©¥°¬¤­ªªµ±¯º¶®¹µ¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸°¹¶ª¯©¸»´²·±±·³¸Á¾¬µ´¢¬«²¾¾±½½¢®¬°º¹ ©¦QZU% %&)$%,*:8+> ((52#QK=^XLMI=73()'""!"!"!  $!'$"(&)+&*+&)*%()$'&!%$#""!'&!&% "" '$41*<<4(-&;B:*1*‚‰‚—ž—¬³¬©²­®·²ªµ¯«¶°¬·³®¹µ¯»·¯»·®º¸­¹·¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸°¹¶±¶°²·°°µ¯±·³²»¸ªµ±¥±¯®º¸°¼º˜”=FA  31$E?1ibRe]PB<.0*$ &&#"($&,()+&),%+,&*+%()#&'!#$!" !""!!$$,,$23+9<5/4-"5<4›¢›’™’±»³¯¹±©´®«¶°®¹µ°»·°¼¸¯»·®º¶­¹µ¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸°¹¶¨®ªÁÈÁµ»·¥®©¶Á½´¿»§±°´¿»’™3<7  #&#%2."=7)VO?rk[YPA*"''! ! "#("&+%'*#(+$+,&+,&*+%()#&'!$% %&)*"''!",/(5:33:2*1)PWPž¥ž˜¢š­·¯¬µ°¬·±¯º¶¯º¶®º¶­¹µ®º¶®º¶¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¶¿¼©²­¯¸µ«¶²¢­©¸Ã¿¶Á½…Ž‹,2.##!A:*D=-i`O…|kk_O90!3*-% "!" !!!""##$#&$'%(&) &) %($'#&14+$'  $%&) "+0)BG@).' 'zy˜Ÿ˜¥¯§®·²°¹´¯º´­¸²ªµ±ªµ±­¸´°»·¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸°º¹¬·³­¸´²½¹³¾º£¬©ktq,2. $%+%6/?6%[O?maQŽ‚r‰}meYIOC5;2#+!+#("&"&"&"%"&#'$&&"$ # #"!!!!#&&) %(  !'"' #-2+#(!.5-7>6¡¨¡¢©¢«´¯®·²¯¸³¬·±©´°¨³¯«¶²¯º¶¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸§±°·ÃÁ°¼º±»º¬·³bkh (%)!JA2L@0H;*`SBaTCyl[†yh}p_pcSfZJ_SEZQBF<0@8+91&2, .'-&,(,*')$( #  !&,"'-###),# 9?5 05.fmeœ£›£ª£§±©®·²°¹´¬·±ªµ¯«¶°­¸´¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸µÁÁžªª®º¸³¾ºiro"%& 7/"F=.m`O~q`‰|l–‰yšŒƒuym_lcTZPDF>19/#0(-%*&12$+/!&(# $#+1'"'  16/ƒŠ‚š¡š¤«¤­¶±²»¶±ºµ¬·±«¶°¬·±¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸ª¶¶­¹¹±½»’™'-)!"  0(D8*J=-M=.TC3_N;3&"  ,2(+1'fkd®³¬­´¬˜Ÿ—ºÁº¯¸³¯¸µ®¸·®¸·®¸·¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸°¹¶½Â»KNC &$5._VE€oœz¤“§”…¨•‡©•Š­›‘²Ÿ˜¯ž–¦—¬Ÿ—ª —ª —©Ÿ–©Ÿ–ª –ª –«¡—­ —¬Ÿ–©œ“§š‘¦šŽ¨œ«Ÿ“® “¥˜ˆ¨›Š±¤”¬ –Š||sd\TG93'(!""%36-:?8—œ•·¼µ ¥ž¬³«©³«°¹¶¯¹¸¯¹¸¯¹¸®¸·®¸·®¸·®¸·¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸°¹´ª­¤')%#!SL<ˆ|l“†v¦–†§–†­›¯¬šŽª˜Ž¬›“¬–ª•©Ÿ–©Ÿ–ª —ª —«¡˜¬¢™¬¢˜­£™©Ÿ•«¡—®¡˜­£™®¡˜«¡•­ —­¡•®¡‘¥˜ˆ¤—‡¦šŠ¤˜Š ”††}nbZM2**# -0'05.y~w¹¾·º¿¸’‹®µ®°¹¶¯¹¸¯¹¸¯¹¸®¸·®¸·®¸·®¸·¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹±º¹±º¹±º¹±º¹±º¹±º¹±º¹±º¹¯¸·¸ÁÀ®·¶ª³²¶¿¾±º¹ª³²»Á½‘†!#>8,~viˆ|p¦˜¤“‰ª™ª™«šªœ‘ªœ“ª”«ž•©Ÿ•ª —ª¡˜ª¡˜ª¡˜«¢™«¢™«¢™¬£š¬£š«¢™¬¢™ª¡˜ª —¨ •¨ž•¨ž”¨Ÿªžªžªž«Ÿ§›‹–|…~nZRE4."# " #(!25.ORK©¬¥¶¹²­°©ž£¥®«©³²¯¹¸±»º¯¹¸­·¶­·¶®¸·¯¹¸¯¹¸¯¹¸¯¹¸°º¹°º¹±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹±º¹±º¹±º¹±º¹±º¹±º¹±º¹±º¹®·¶·À¿¯¸·«´³µ¾½±º¹­¶µ¼Â¾„„z& PJ>Š€v“‰©›’ªœ“ª™‘«š’©›’ªœ“ª”ª”©Ÿ•©Ÿ•© —ª¡˜ª¡˜ª¡˜«¢™«¢™«¢™¬£š¬£š¬£š«¢™ª¡˜© —© —¨Ÿ–¨ •¨ž’¨Ÿ¨Ÿ¨Ÿ­¡‘«Ÿ”ƒ†ue]P@:..*((14-BE>Š†¹¼µ¬­§«­¨¥®«¨²±®¸·°º¹¯¹¸®¸·®¸·¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸°º¹°º¹±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹±º¹±º¹±º¹±º¹±º¹±º¹±º¹±º¹­¶µ¶¿¾±º¹­¶µ²»º±º¹±º¹½Ã¿vvl ,&keY˜Ž„Ÿ•‹§™¬ž•ª™‘«š’©›’ªœ“ª”«ž•©Ÿ•ª –© —ª¡˜ª¡˜ª¡˜«¢™«¢™«¢™¬£š­¤›­¤›¬£š«¢™«¢™ª¡˜ª¡˜©¡–©Ÿ“© ‘¨Ÿ¨Ÿ®¢’¯£“§›‹š‘€yqdPJ>84)22(#$# ,/&47.abZµ¶®®¯§µ¸±¥®«¨²±¬¶µ®¸·¯¹¸®¸·¯¹¸°º¹¯¹¸¯¹¸¯¹¸¯¹¸°º¹°º¹±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹±º¹±º¹±º¹±º¹±º¹±º¹±º¹±º¹­¶µ³¼»³¼»¯¸·¯¸·±º¹³¼»¹¿»ff\71%ƒ}q¡—¤š ’‰¦˜«š’«š’ªœ“«”ª”«ž•ª –ª –© —ª¡˜ª¡˜ª¡˜«¢™«¢™«¢™¬£š­¤›­¤›­¤›¬£š¬£š«¢™«¢™«£˜ª ”ª¡’© ‘§ž­¡‘¯£“ªžŽ¢–†Ž…v`ZL<8,41(*+#" #/2)AB:Ÿ ˜·¸°¶¹²§°­¨²±ª´³¬¶µ®¸·¯¹¸°º¹±»º¯¹¸¯¹¸¯¹¸¯¹¸°º¹°º¹±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹±º¹±º¹±º¹±º¹±º¹±º¹±º¹±º¹®·¶±º¹³¼»°¹¸­¶µ²»º³¼»¯µ±SSIGA5’Œ€¦œ’¤šž‡£•Œ«š’¬›“ªœ“«”«ž•¬Ÿ–ª –ª –© —ª¡˜ª¡˜ª¡˜«¢™«¢™«¢™¬£š­¤›¬£š¬£š¬£š¬£š«¢™«¢™«£˜ª¢•ª¢•© ‘¦ŽªžŽ­¡‘ªžŽ£—‡”…qi\B<0.+"--%%&  "12*23+~w¾¿·®±ªª³°©³²©³²ª´³­·¶¯¹¸°º¹±»º¯¹¸¯¹¸¯¹¸¯¹¸°º¹°º¹±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹±º¹±º¹±º¹±º¹±º¹±º¹±º¹±º¹°¹¸®·¶³¼»²»º­¶µ³¼»±º¹ ¦¢DD: \VJ—‘…©Ÿ• –Œ¥—Ž§™¬›“¬›“«”«”«ž•¬Ÿ–ª –«¡—© —ª¡˜ª¡˜ª¡˜«¢™«¢™«¢™¬£š«¢™«¢™«¢™«¢™«¢™«¢™«¢™«£˜ª¢•«£–ª¡’¦Ž©¬ ©£—‡£š‹ƒ|lOI=.*-*!**"!"!$ &)  ,-%/0(abZ¸¹±©¬¥®·´ª´³¨²±©³²¬¶µ®¸·°º¹°º¹¯¹¸¯¹¸¯¹¸¯¹¸°º¹°º¹±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹±º¹±º¹±º¹±º¹±º¹±º¹±º¹±º¹³¼»¬µ´²»º³¼»­¶µ´½¼®·¶’˜”BB8,*uoc™“‡ª –œ’ˆ­Ÿ–ªœ“¬›“¬›“«”¬ž•«ž•¬Ÿ–«¡—«¡—ª –«¡—«¡—«¡—¬¢˜¬¢˜¬¢˜­£™«¡—«¡—«¡—«¡—«¡—«¡—«¡—«¡—¨ “ª¢•«¢“¨Ÿ«Ÿ­¡‘« Ž¦›‰¤›Š˜‘e_Q40$*''' !#&   ! "--#SSI¦¦œ¬¯¨±º·¬¶µ¨²±¨²±«µ´®¸·¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸°º¹°º¹±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹±º¹±º¹±º¹±º¹±º¹±º¹±º¹±º¹µ¾½«´³±º¹³¼»­¶µ´½¼«´³‰‹HH>86)‰ƒwš”ˆ«¡——ƒ°¢™©›’¬›“¬›“«”¬ž•¬Ÿ–¬Ÿ–«¡—«¡—ª –«¡—«¡—«¡—¬¢˜¬¢˜¬¢˜­£™ª –ª –ª –ª –ª –ª –«¡—«¡—¦ž‘©¡”«¢“© ‘¬ ¯£“­¢©žŒ¤˜ˆ§žyrb=7))%%"$%$  +      "$ ++!OOE••‹²³«µ»¹­·¶¨²±§±°ª´³­·¶®¸·®¸·¯¹¸¯¹¸¯¹¸¯¹¸°º¹°º¹±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹±º¹±º¹±º¹±º¹±º¹±º¹±º¹±º¹²»º°¹¸°¹¸²»º¬µ´²»ºª³²{}[[Q>! ''"%$ #%  +((;;1uri¥¦ž©¯«¬¶µ¯¹¸ª´³¨²±ª´³®¸·®¸·¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹±º¹±º¹±º¹±º¹±º¹±º¹±º¹±º¹²»º®·¶²»º°¹¸®·¶²»º¢«ª„Š†yyoHF9”Ž‚¥Ÿ“¦œ’©Ÿ•¥—Ž¨š‘¬›“°Ÿ—® —«”ª”®¡˜«¡—¨ž”¬ ”©‘§›ªž’¯£—±¥™­¡•©‘®¢–­¡•«Ÿ“ªž’©‘¨œ§›¥›¯§œ®¨š­¦–¨Ÿ£—‡¢–†¨›Š®¡«ž’€¨œŒ­¤•ylE?3'! " $#!  + + !!0."\ZNš›“®´°«µ´­·¶®¸·ª´³§±°«µ´²¼»¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹±º¹±º¹±º¹±º¹±º¹±º¹±º¹±º¹²»º­¶µ´½¼¯¸·¯¸·²»º›¤£‹‘yyo@>1‰}¢œž”Š¡—Ÿ‘ˆ ’‰®•¯ž–ªœ“¦˜¦™­ —°¦œ¯¥›¦šŽ«Ÿ“°¤˜°¤˜­¡•¬ ”¯£—³§›²¦š±¥™¯£—¯£—¯£—¯£—­¡•ª ”£›¤ž’§Ÿ’¥žŽ¦šŠ¥™‰¨›ŠªŒ¨›Š¥˜‡©œŒ¨œŒœ“„…}pSK@""&#'    ''//# *(EC7‹Œ„°¶²©³²«µ´°º¹­·¶¥¯®¨²±³½¼¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹±º¹±º¹±º¹±º¹±º¹±º¹±º¹±º¹²»º«´³µ¾½­¶µ±º¹±º¹”œ“™•€€vCA4–„«¥™Ÿ•‹¢˜Ž¨š‘¨š‘«š’®•¬ž•©›’¨›’¬Ÿ–«¡—¨ž”­¡•¬ž‘ªœ¨š©›Ž­Ÿ’³¥˜·©œ°¢•¦˜‹–ˆ{‰{nsf}obzl_wk_sk`{uiŒ„w–†¬ ¯£“ªŒ¦—„¦—„¨›ˆ¨›Šž’‚¡˜‰¨¡‘}uh3/#!"$&(!#%% +  +0.":6+uum®´°§±°ª´³±»º­·¶¥¯®§±°±»º®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹±º¹±º¹±º¹±º¹±º¹±º¹±º¹±º¹²»º©²±·À¿¬µ´²»º±º¹–•š œƒEC6”Ž‚¦ ”’ˆ~”Š€††œ‹ƒ¥”Œªœ“­Ÿ–®¡˜®¡˜§“Ÿ•‰¬ž“¦˜‹¢”‡¦˜‹¨š ’…‹}pyk^qcVdVITF9L>1N@3XJ=bTGfZLog\nh\tl_€yi“‡yŸ”‚¨˜ˆ©š‡£”¦—„©œ‹¥˜‡¢–†¤›Œ†zgaS%&" "%'#%""))%#" (&-)iia¦¬¨¥¯®«µ´¯¹¸¬¶µ§±°¨²±­·¶®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹±º¹±º¹±º¹±º¹±º¹±º¹±º¹±º¹²»º¨±°¸ÁÀ«´³³¼»±º¹ˆ‘Ÿ¥¡†53&tnb{ui\RHZPFbTK[MDn]Uyh`„vmx™Œƒ£–¤š¡—‹¢”‰¤–‰¦˜‹£•ˆ•‡z{m`]OBI;.=/"=/"B4'RD7l^Q‡yl›€¤˜Š’Šˆ‚v~viyrb€tfŒo}¦—„£”¥–ƒªŒ©œ‹¡•… —†–~{ug/0"#% #%"$"#%#*(b`SdbU`\PEA5/+XXN£Ÿ¤®­¬¶µ­·¶«µ´«µ´ª´³§±°®¸·®¸·®¸·®¸·®¸·®¸·®¸·®¸·°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹±º¹±º¹±º¹±º¹±º¹±º¹±º¹±º¹²»º¨±°¹ÂÁª³²´½¼±º¹…Ž¢¨¤¤¤š;7+icWf^S>4*:-$:,#/9(C2(P?5^PEug\v ”ˆ§›¡“†©œŒ©œŒ–†wtdU^L@\J>cQEgUIjXLrbUqdt™‹~™–Š|œ’†œ’†š‘‚–Š|„t‚q•…u™Šw¥–ƒ«›‹«ž¢•„¡”„­¡‘‘ƒqjZ:6*'( !#!#!02%;<.–”‡±­¡Å¿±…xF<0C<2šœ—¥®«®·´¬µ²©´°­·¶«µ´¤®­­·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹³½¼¬¶µ¯¹¸·ÁÀ²¼»Ÿ©¨•Ÿžš œ¹¹­=:+OI;yl{qe„xlŠyovdXR@4R@4`NBSA5XF8ƒsd™‰z¡‘‚Ÿ’ “‚¡‘š‰yyk†nbˆmbrgdYui‰shhVJ`REmaSlbVriZ}p`†vgp–†wŸ¤”„¡€˜‡w¡‘©™Š¬œ¨˜‰ªš‹ªž‘Š~pD<1)"##"!"!'&*USF`ZLui[¢„¬–‰B1'}zq¶»´©®¨¤«¤¸Á¼©´°£­¬¤°®¬¸¸¬¸¸­¹·¯¹¸¯º¶°¹¶°¹¶°¹¶¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹²¼»®¸·®¸·²¼»°º¹¥¯®›¥¤›¡¸¸®EB3_YK ˜‹–Œ€’†z‘€v‚pd–‚w~k]ƒpb|j\saS~m]‹zj €š{ž“¢“€ž‹z•~psfqfrhš|r{`UX@6n\PugZaXIkcVibRnaQraQyhX…td”ƒs¡€¨—‡©™Š¤”…«›Œ¬œ¨˜‰ªš‹¬œ¢’ƒtNA8+"##!$"" )-pnb‹ƒvƒsf†pc¤ˆ|mWLqj`°³ª­°©¤«£¸¾º¬·±¨²±§³±«··¬¸¸­¹·®º¸°¹¶°¹¶²¸´¯¸³°¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹±»º±»º¯¹¸¬¶µ­·¶¬¶µ¢¬«˜žš£¥š:6*SOC šŽŠ€vrfZudZxg]fTJWE9p^R~l^|j\€paƒsd‘„sœ‘}¢—ƒ¨˜ˆ£’‚š„vykqfŒpe}`XkSI|f[L0#Jœ’†g[O>2&NB6znb—‹ž’†ž’†¬Ÿ–¬ ”«Ÿ“§›§›§›¤˜Œ ”ˆymaA7+  ! $*<:-‡r¬ž‘•ƒu±›‡ui:6+…ˆ¶¹²¨¯§ª°¬³¾¸«µ´¦²°ª¶¶«··¬¸¶­¹·¯¸µ¯¸µ±·³®·²°¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹ª´³²¼»²¼»¬¶µ®¸·°º¹£­¬™–„‡€:<155+’†YUL.'QF@˜‹ƒzZLCRD;[NE`SJh\Psg[Ž…v›”‚¦ŸŒ®£‘©œ‹¦–‡¤’„ž‹}”sYE:‘s¬ž“µ©{qeJD6YVGA=1kcX\TI]SJwmc—ƒ©Ÿ•¯¥›±§ª –¬Ÿ–«ž•©‘§›¦šŽ¤˜Œ£—‹‡{oTH<+#  "%'53&sm_¢–ˆšˆz¶ ’xh[40%vyp³¶¯«²ª¨®ª±¼¶§±°¥±¯ª¶¶«··¬¸¶¬¸¶¯¸µ¯¸µ°¶²®·²°¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹­·¶±»º±»º®¸·®¸·¯¹¸¨²± ©¦{€zCD<;<4œœ”e`ZA:2nc]½²¬ylfC6.C6._RIre\zpf€vl—‚›”„¦Ÿ­¡‘§šŠ§—ˆªš‹§•‰‹ƒqg_NDpbWuiwodYSG:6*RNB]VL{tj —²© ¯¦¤›’Ÿ– —Ž¨Ÿ–¨ž”¨ž”¨ž”¦œ’£™¡—¤˜Œ•‡zgYL;1%# "$##" b\N§›¦–‡²Ÿ[K>1-"hkb®±ª¬³«¨®ª°»µ¤®­§³±ª¶¶ª¶¶«·µ¬¸¶¯¸µ®·´°¶²®·²°¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹®¸·®¸·®¸·®¸·®·´‚‡581  ˜†ha[RIB`UO‹~x^QKTG?YLDlbX‰uŽ†{•€Ÿ˜ˆª¡®¢’¦šŠ¤—‡«›Œ¨˜‹Ÿ‚“‚x“…zymacYM^VK^XLjfZtpe‰€—ˆ–ŽŸ˜¥œ•­¤›±¨Ÿ¯¦§ž•¦ž“¨ž”©Ÿ•§“¢˜Ž¡—¤˜ŒžŽueVG;-'!'' &&%#c]O¡—‹˜Š}žŒ~A3&0,!_bY©¬¥­´¬¨®ª°»µ£­¬ª¶´ª¶¶ª¶¶«·µ¬¸¶®·´®·´°¶²®·²°¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹¯¹¸¯¹¸¯¹¸®¸·®¸·®¸·®·´˜—@C<"#šš’›˜‘‡€ze\UI>8E82QD>aTLtg_‰u“‰ ˜™‘„£š‹©©¤˜Š£•ˆ§™Œ©›©›Ÿ‘†œŽƒ–‰€‘‡}’Š•ƒ™•Š™ŽŸ›’¡œ–£ž˜¦¢™©¢šª£›«¢™«¢™«¡—©Ÿ•©œ“¨œ¨œ¦šŽ£—‹¡“†›‹|Ž~o_RB/#! ("'%&' !)%SM?“‰}¢–ˆ‘„t*/-!GJA–™’®µ­ª°¬¬·±¢¬«®º¸«··«··«·µ«·µ­¶³­¶³¯µ±­¶±®·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶¬¶µ¬¶µ­·¶­·¶­·¶®¸·®¸·®¸·¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸°º¹°º¹°º¹°º¹°º¹°º¹°º¹±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹¯¹¸¯¹¸¯¹¸®¸·®¸·®¸·®·´™ž˜CD<““‹Ÿš”›”Œ’‡ƒxrylfrj†yq€wš„¢˜Ž¢˜Žš„¦šŒªžŽ«¥—Š¤–‰§™Œ©›©›§™Ž¥—Œ “Šœ’ˆœ”‰ž˜Œ£œ’¦Ÿ•¡œ–£ž˜¥ š§£š«¤œ«¤š¬£š«£˜«¡—©Ÿ“©‘¨œ¨œ§™Œ£•ˆ¢’ƒŸŽ~—†vrbR@3#$  '#20#*( *&IC5– —ˆmaQ&/,#KNE’‹­´¬«±­§²¬¥¯®«·µ«··«··«·µ«·µ­¶³­¶³¯µ±­¶±®·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶¬¶µ¬¶µ­·¶­·¶­·¶®¸·®¸·®¸·¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸°º¹°º¹°º¹°º¹°º¹°º¹°º¹±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹¯¹¸¯¹¸¯¹¸®¸·®¸·®¸·®·´£¦ŸPRG‘Ž…žš‘ž—¤™“¡”Œ ‘Š¡“Š ’‰ž‘ˆ¡”‹¤˜Œ ”ˆ™¨š«­§—Š¦•‹ª™«’ªœ‘® —­Ÿ–ª•§”§”¨Ÿ–© —«¢™§ š¦¡›ª£›¬¥®¥ž®¥œ®¤›­£™­ —«Ÿ“ªœ‘©›Ž¨š¨˜‰£“„¡€œ‰x’nyhVWG76*&& ,)51%,(B<.š“ƒ“Š{@7&*#.+"NQH„}«²ª¬²® «¥«µ´§³±«··«··«·µ«·µ­¶³­¶³¯µ±­¶±®·¶­·¶­·¶­·¶­·¶­·¶­·¶­·¶¬¶µ¬¶µ¬¶µ­·¶­·¶­·¶®¸·®¸·¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸°º¹°º¹°º¹°º¹°º¹°º¹°º¹±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹¯¹¸¯¹¸¯¹¸®¸·®¸·®¸·®·²§ª¡aaW*'˜”‰¤•š‘ˆ “‹œŽ…¡“Š¡“Š£’Š¡“ˆ£•Š£—‰Ÿ“‡›€¨˜‹­›¬šŽ¦–‰¥”Šª™¯ž”­Ÿ”® —® —­ ˜­ ˜­ ˜«¡˜¬Ÿ—ªŸ™ª£›©¥œ¬¥®§¯¦®¦›®¤š¯£—¬ ”«ªœªš‹ª˜Š§–†¢‘ŸŒ{—‚o†q^yfUp_M[N>H<.6.!*$4."+'+(A>/•ngW% 3-** LOFrun¦­¥­³¯¨¢²¼»¨´²«··«··«·µ«·µ­¶³­¶³¯µ±­¶±­¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ«µ´¬¶µ¬¶µ¬¶µ­·¶­·¶­·¶­·¶¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸°º¹°º¹°º¹°º¹°º¹°º¹°º¹±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹¯¹¸¯¹¸¯¹¸®¸·®¸·®¸·°¶²¤¥lj^,*œ˜Œ®¥œ –Œªœ“¥”Š …¡†¥“‰©™Œ«›Ž¦™‰¢”‡¢’…§•‰«—Œ«—Ž¥“‰¥“‰ª™°Ÿ—± ˜­Ÿ–® —¯ ™°¡š°¡œ­ š­ž™«ž˜¬£œ¬¥®¥ž¯¦°¦®¤š¯¢™®¢–««›Œ«šŠª™‡©–…¥’ŸŒ{œ‡t’}jƒnY„r^‡vdwgXi[N\RFKC6("82&'$DA2|k=7'85$** EH?gjcž¥«±­ž©£´¾½ª¶´«··«··«·µ«·µ­¶³­¶³¯µ±­¶±­¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ«µ´«µ´«µ´¬¶µ¬¶µ­·¶­·¶­·¶¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸°º¹°º¹°º¹°º¹°º¹°º¹°º¹±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹¯¹¸¯¹¸¯¹¸®¸·®¸·®¸·°¶²¦¨tpd&"”Ž‚¬¢˜¡•‰± –­œ’§•‹¦”ˆ©—‹®œŽ­›¦–‡¡‘‚ ©•Š­—Œ¬•¤‡¤‡©—®›”¯ž–°Ÿ—¯¡˜±¢›²£œ²£ž±¢±Ÿ›­ š¬£œ¬¥›®¥œ®¦›®¤š®¢–¬ ”¬ž‘ªš‹ª™‰ª—†©—ƒ©”¤|ˆu™ƒnwb‡q\“~k‘~mxgWtgWsevl`'60$%">;,]ZI" +63"--#;>5be^•œ”§­©£®¨¯¹¸¬¸¶«··«··«·µ«·µ­¶³­¶³¯µ±­¶±­¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ«µ´«µ´«µ´«µ´¬¶µ¬¶µ­·¶­·¶¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸°º¹°º¹°º¹°º¹°º¹°º¹°º¹±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹¯¹¸¯¹¸¯¹¸®¸·®¸·®¸·°¶²ªª zwh! Œ„w§‘œ„°Ÿ•¬šŽ®š«˜Š¬™‹®œŽ«™‹¤“ƒ¡€£‘ƒ®˜°™‘­–Ž£†¡„¤’ˆ©–©˜°Ÿ˜± ™³¢›´£œµ£Ÿµ£Ÿµ¢ž±¢¬¢™¬£š­£š­£™­ —«Ÿ“ªœªš‹¨˜‰¨—‡¨•„©”§~¢Œwš„o•hybŠt_™„q’nyhXtd”ˆz…{o:2'+%,)30!?<+ +&#/.55+47.cf_Ž•¢¨¤¨³­¦°¯¬¸¶«··«··«·µ«·µ­¶³­¶³¯µ±­¶±¬µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´ª´³«µ´«µ´«µ´¬¶µ¬¶µ¬¶µ¬¶µ¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸°º¹°º¹°º¹°º¹°º¹°º¹°º¹±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹¯¹¸¯¹¸¯¹¸®¸·®¸·®¸·°¶²¥§œywh ‹…w¬¢˜¡•‰µ¤š°ž’±’­šŒ¬˜¯œŽ®›§–†¨–ˆ¯œŽ³›‘¶›”¯–¦† ‰¤…§Š¦’‹±œ—±ž˜³ š´¡›µ¢žµ¢ž¶¡ž´£œ®¡™¬¢˜¬¢˜«¡•¬ ”ªœ¨š¨˜‰§•‡¦•…¦“‚¥“¥}ŸŠw˜‚m’|g›…pzeš…r–…s‡wg˜‹{¢–ˆ€vjPH=!51%+(/,-**',+::.13(fi`ŠˆŸ¦Ÿ«´¯Ÿª¦«µ´¬¶·¬¶·«·µ¬¶µ¬¶µ­¶³­¶³­¶³«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´ª´³ª´³«µ´«µ´«µ´¬¶µ¬¶µ¬¶µ¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸°º¹°º¹°º¹°º¹°º¹°º¹°º¹±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹±»º°º¹°º¹°º¹¯¹¸¯¹¸¯¹¸°¹´¢¨œƒ‡x €~q›”Š –Œ¨š‘³¡—¯›’°œ‘±š’¬˜©•Š¨•‡ª–‹®˜»ž–¸š’²•®‘‰¬‡«‡«‰©‰­”±˜“´—¶Ÿ™¶žš³ž™µ™³ š³¥œ±¥™¯£—­¡•«’©›Ž§™Œ¦™‰¥•†¦–‡¦•… š‡x•‚q“€o”p›‰u’€l–…s‘quhX¨Ÿ¢š†€tMI=+)53&(&31"  /.23#35'acV‚w§ª¡¥ª¤¶¼¸­³³©±³ª²´ª´µ«µ¶«µ¶«µ´«µ´ª´³«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´¬¶µ¬¶µ¬¶µ­·¶­·¶­·¶¬¶µ­·¶­·¶­·¶®¸·®¸·®¸·®¸·°º¹°º¹°º¹°º¹°º¹°º¹°º¹±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹¯¹¸¯¹¸¯¹¸®¹³£« ‡y"JJ>ª¦›™‡«”ª™‘¨–Œ«—Ž±š’³œ”²ž“¯›«—Œª”‰®‘‰°“‹°“‹ª…£†~ …|¦‹„ª‘Š©‹¬•±š”²ž—³ž™³ž™´Ÿš´¡š±£š¯£—­¡•«Ÿ“ªœ§™Œ¥—Š¤–‰¥•†¦–‡¤”…Ÿ€™ˆx•„t”ƒs•„r”p‘€l“ƒsŠ}l…ykÁºª£‘b^R20$!34&()0.  /..//0Y[My{nž¡–¤§ ³¸´«¯®«°³ª²´«³µ«µ¶ª¶¶ª¶¶ª¶´©µ³«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´¬¶µ¬¶µ­·¶­·¶­·¶¬¶µ­·¶­·¶­·¶®¸·®¸·®¸·®¸·°º¹°º¹°º¹°º¹°º¹°º¹°º¹±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹¯¹¸¯¹¸¯¹¸®¸·®¹³£« ‡&*š–‹ž•Œ¨›’¤“‹«™­™±š’³œ”®š£„”€uŠti˜€t”|pˆpdu_RkUJwaV“v«™£‘‡¦•‹«š’¬ž•® —°¢™²£œ²¥œ¯¢™®¢–¬ ”ªž’©›Ž¦˜‹¥—Š¤–‰¦–‡¥•†£“„žŽš‰y˜‡w˜‡w™ˆvš‰w‘€lo€sbthZ•Ž~lfZ.*9:,/0"/-! +**+,-QSEsuh—š¤§ ²·³ª®­«°³ª²´«³µ«µ¶ª¶¶ª¶¶ª¶´©µ³«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´¬¶µ¬¶µ¬¶µ­·¶­·¶¬¶µ­·¶­·¶­·¶®¸·®¸·®¸·®¸·°º¹°º¹°º¹°º¹°º¹°º¹°º¹±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹¯¹¸¯¹¸¯¹¸®¸·®¸·®¹³¢ªŸŽ”†!^ZO¤›’¤—Ž¤–®œ’®š‘®š‘°™‘ª–‹œˆ}‡shwcX}j\‰vh’€r“sŽ|p}p–…{ž…¡•‰¥™§“ª –«¡—¬¤™®¥œ°¨­£—®¢–¬ ”ªž’©›Ž§™Œ¦˜‹¥—Š§—ˆ¥•†¢’ƒžŽœ‹{›Šz›Šzœ‹{ŸŽ|~k}mqdTD;,6.!" + ""?@289+0.)' &%(),-LN@suh”—Œª­¦´¹µ«¯®«°³ª²´«³µ«µ¶ª¶¶ª¶¶ª¶´©µ³«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´ª´³ª´³«µ´«µ´¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ­·¶­·¶­·¶®¸·®¸·®¸·®¸·°º¹°º¹°º¹°º¹°º¹°º¹°º¹±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹¯¹¸¯¹¸¯¹¸¯¹¸®¸·®¸·­·¶­¸²£« ˆŽ€!""'%‹„z¥›‘§™ª™ª˜Ž¬˜¯›’°œ‘©•Š›‡|}q‘qœŒ}¬œµ¥–³¥˜­¡“¨œŽ¤›Œ¥§Ÿ’©£•ª¤–¨¤˜¨¤˜ª¦š¬¨œ®¤˜¯£—®¢–¬ ”«©›Ž¨š§™Œ¨˜‰¥•†¢’ƒ ŸŽ~ž}ž}Œ|‘‚o‹|iŒn\P@# + $"%%;;/;<.31"1/  #"'(,-EG9preŽ‘†­°©³¸´©­¬«°³ª²´«³µ«µ¶ª¶¶ª¶¶ª¶´©µ³«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´ª´³ª´³ª´³«µ´«µ´¬¶µ¬¶µ¬¶µ¬¶µ­·¶­·¶­·¶®¸·®¸·®¸·®¸·°º¹°º¹°º¹°º¹°º¹°º¹°º¹±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹¯¹¸¯¹¸¯¹¸®¸·®¸·­·¶­·¶®·²¤¬¡~„v)- " YRH£™¥˜¨š©˜Žª˜Ž­™°œ‘¯›©•Š¤…­Ž«›Œ©™Š¦™‰¨šªžª¡’ª£“©¡”ª¤–«¥—©¦—§£—¦¤—¨¦™«§›®¤˜¯£—®¢–¬ ”¬ž‘ªœ©›Ž¨š¨˜‰¦–‡¤”…¢’ƒ£’‚¢‘ŸŽ~Œ|…vcŒlˆ}k<3"  00$<<042%64% &%('*+;=/fh[„y«®§¯´°§«ª«°³ª²´«³µ«µ¶ª¶¶ª¶¶ª¶´©µ³«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´ª´³ª´³ª´³ª´³«µ´«µ´«µ´¬¶µ¬¶µ­·¶­·¶­·¶®¸·®¸·®¸·®¸·°º¹°º¹°º¹°º¹°º¹°º¹°º¹±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹¯¹¸¯¹¸®¸·®¸·­·¶­·¶­·¶®·²Ÿ§œ„Š|*. "$$"/+ …z¢˜Ž¨œ¨šª˜Ž©—ª–‹¨”‰©“ˆ¦’‡ª—‰­œŒ³¢’¸¨˜¹©š²¥•©›Ž¢–ˆª¡’«¤”«¥—¨¥–¦£”¥£”§¥˜ª¦š¬¢–®¢–­¡•«Ÿ“«©›Ž¨š§™Œ¨˜‰¦–‡¥•†¥•†§–†¤“ƒŸŽ~›ŠzŠzj‡zivjZ$ +  ,, CC775(64% +*(.-,-13%[]Psvk§ª£¯´°ª®­«°³ª²´«³µ«µ¶ª¶¶ª¶¶ª¶´©µ³«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´©³²©³²ª´³ª´³ª´³«µ´«µ´«µ´¬¶µ­·¶­·¶­·¶®¸·®¸·®¸·®¸·°º¹°º¹°º¹°º¹°º¹°º¹°º¹±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹¯¹¸®¸·®¸·®¸·­·¶­·¶­·¶­¶±—Ÿ””šŒ $+- )) pj^¡™Ž¢˜Œ¥™©˜Ž©—©•Š©•Š¬–‹®˜‹µž²›®˜Š«•‡¨•‡¬šŒ² ”¶¦™«¬ ’«¡•©¡”¨ “§¡“ª¤˜¬¦š«¡•¬ ”«Ÿ“ªž’©›Ž¨š§™Œ¦˜‹¨˜‰§—ˆ¦–‡§—ˆ©˜ˆ¥”„ŸŽ~˜ˆx‘„syn\_VE00&LL@:8,42%.+43!01-/!TVIjmb¦©¢°µ±¯³²«°³ª²´«³µ«µ¶ª¶¶ª¶¶ª¶´©µ³«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´©³²©³²ª´³ª´³ª´³«µ´«µ´«µ´¬¶µ­·¶­·¶­·¶®¸·®¸·®¸·®¸·°º¹°º¹°º¹°º¹°º¹°º¹°º¹±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸®¸·°º¹¯¹¸­·¶®¸·°º¹­·¶¨±¬™Ÿ•“—‰'+11%&$;7+ƒ}q¢˜Œªž’¬ž“š‰¯‘Ÿ‹€§‘†²šŽ®…±‘„®…¬Žƒ®’†µ›Žµ‘±›Ž²ž“­›©™Œ©›Ž­¡•¯¥™¯¥™­£—¬ ”¬ ”«Ÿ“ªž’«ªœ©›Ž©›Ž©™Š¤”…£“„ªš‹¯žŽ¨—‡œ‹{“ƒsƒxfxp]92 $"')))DD8@>264' ,)32 78&(*MOB`cX—š“¯´°©­¬­²µ«³µ«³µª´µ©µµ©µµ©µ³©µ³ª´³ª´³ª´³ª´³ª´³ª´³ª´³ª´³©³²©³²©³²ª´³ª´³«µ´«µ´«µ´«µ´«µ´¬¶µ¬¶µ¬¶µ­·¶­·¶­·¶­·¶®¸·®¸·®¸·¯¹¸¯¹¸¯¹¸±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸®¸·°º¹¯¹¸­·¶®¸·°º¹­·¶¨±¬ ¦œ’–ˆ+/!"&-/".,a]Q¤œŸ•‰¥™¤“‰«™¦’‡¤Žƒ™~sœzp¢|q£}t¢}t¦„z¬Œ¬Ž„§‹€³˜²œ‘´ž“±Ÿ“°ž”¬›‘©›¨š¬ ”¬ ”«Ÿ“ªž’ªœªœ©›Ž©›Ž§—ˆ§—ˆ§—ˆ§—ˆ¨—‡¥”„œ‹{’‚rzo]kdR0* + !!$%''CC9><051&!)&0.56$%'EG:Z]R”—±¶²§«ª­²µ«³µ«³µª´µ©µµ©µµ©µ³©µ³ª´³ª´³ª´³ª´³ª´³ª´³ª´³ª´³©³²©³²©³²ª´³ª´³«µ´«µ´«µ´«µ´«µ´¬¶µ¬¶µ¬¶µ­·¶­·¶­·¶­·¶®¸·®¸·®¸·¯¹¸¯¹¸¯¹¸±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸®¸·°º¹¯¹¸­·¶®¸·°º¹­·¶¨±¬§­£‘ƒ.2$,0",.! &'>73*40%(!"&$+,#%%'?B7uxq¬±­¨¬«­²µ«³µ«³µª´µ©µµ©µµ©µ³©µ³ª´³ª´³ª´³ª´³ª´³ª´³ª´³ª´³©³²©³²©³²ª´³ª´³«µ´«µ´«µ´«µ´«µ´¬¶µ¬¶µ¬¶µ­·¶­·¶­·¶­·¶®¸·®¸·®¸·¯¹¸¯¹¸¯¹¸±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸®¸·°º¹¯¹¸­·¶®¸·°º¹­·¶¨±¬¦© „†y-1#*. !%%)02$&(:;+“©Ÿ“ž…¤’†–‚w}e[˜zp£{q©}r¬€w«€w­…{¯‹«‰£…z¨Œ€£Œ~¢Œ¦“…®œ³£–³£–® “ªž’ªž’ªž’©‘©›Ž¨š¨š§™Œ¬œ¨˜‰¥•†¥•†¢‘“‚r{jZeXGd]K98& #%(*!$+.' ''HH@40'3/&*#$"&'$&!#9<1`c\¢§£¨¬«­²µ«³µ«³µª´µ©µµ©µµ©µ³©µ³ª´³ª´³ª´³ª´³ª´³ª´³ª´³ª´³©³²©³²©³²ª´³ª´³«µ´«µ´«µ´«µ´«µ´¬¶µ¬¶µ¬¶µ­·¶­·¶­·¶­·¶®¸·®¸·®¸·¯¹¸¯¹¸¯¹¸±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸®¸·°º¹¯¹¸­·¶®¸·°º¹­·¶¨±¬¢¥œŒŽ37)(,%"(-1"+-*+qn_¨ “¦šŽ§•‰¢Žƒ¥ƒ£‡|«…z³‰}³‹³€µ‘…¶”ˆ±‘„¨Œ~ªƒ§‘ƒ¦“…¦–‡¦™‰¦šŠ¦šŒ¤˜Šªž’ªž’©‘©‘©›Ž¨š§™Œ§™Œ¬œ¤”…¢’ƒ¢’ƒ–…u|k[jYIcVE`[H32  #%(*(+"-0)&&HH@1-$2.%+$ ! "$!25*LOH”™•§«ª­²µ«³µ«³µª´µ©µµ©µµ©µ³©µ³ª´³ª´³ª´³ª´³ª´³ª´³ª´³ª´³©³²©³²©³²ª´³ª´³«µ´«µ´«µ´«µ´«µ´¬¶µ¬¶µ¬¶µ­·¶­·¶­·¶­·¶®¸·®¸·®¸·¯¹¸¯¹¸¯¹¸±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸®¸·°º¹¯¹¸­·¶®¸·°º¹­·¶¨±¬ž¡˜’”‰8;0*. &)(,04&46(#!LI:Ÿ—Œ¦šŽœ‹Ÿ·£š“{o¦†{§†w¤‚v €s¡„v§‹}¨Ž£Œ|œ†x¡Ž§•‡ªš‹¨›‹§›‹ªžŽ­¡“ªž’ªž’©‘©›©›Ž¨š§™Œ©™Œªš‹¡‘‚  Ž€‹zjkZJ`O?eXH]WI-.  "$(* ./'./'$$IF=.*!0,!*#   "# /1&>A8Š¥ª¦®²³­³³«´³«´³ª´³ª´³ª´³ª´³ª´³ª´³ª´³ª´³ª´³ª´³ª´³ª´³©³²©³²©³²ª´³ª´³«µ´«µ´«µ´«µ´«µ´¬¶µ¬¶µ¬¶µ­·¶­·¶­·¶­·¶®¸·®¸·®¸·¯¹¸¯¹¸¯¹¸±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹¯¹¸¯¹¸¯¹¸¯¹¸°º¹°º¹°º¹°º¹­·¶®¸·¬¶µ«µ´­·¶¯¹¸ª´³¢«¨©®§x{r;>5*-"$'(*::01/#3/$+%„{r –Œ§š‘„†œŒ”s–p–€r–€r”r•‚s–ƒt•„t£’‚¤“ƒ¥•…¨˜ˆ©™‰©œ‹©œ‹ªŸ‘„¦˜­Ÿ”®“§—Š£“†¦–‰«™œŠ|¢‚ Ž€’qs`QTA2^K<ƒuhA=2%&  !#$&,,"))75)DB5,('#%! ! +,*--!:<1fg_™œ•®°­±³°°´³­±°®²±±µ¶®´´©¯¯ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²©³²©³²ª´³«µ´¬¶µ¬¶µ­·¶­·¶¬¶µ­·¶­·¶­·¶®¸·®¸·®¸·±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸°º¹°º¹®¸·¯¹¸®¸·¬¶µ®¸·°º¹«µ´£¬©¥ª¤wzs;>5),##$$&63*)&'#RI@®¥œ‘‡}™Œƒ¦™“‡{˜ˆy›‹{ €¤”„¨˜ˆ©™‰©™‰¨˜ˆ¢’‚£“ƒ¤”„¥•…¦–†¦–†¦–†¦–‡«›Ž¤–‹ …ŸŽ„¢’…¦–‰©—‹©—‹§•‡”‚t˜†x}k]L:,aP@~l^[M@+( #$&'((--#'% ;9,A?2*'(%%"   '%''66,\]U™š’¬­¨°±¬°²¯®°­¯±°²´³¯³´©¯¯¬²²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²©³²©³²ª´³«µ´¬¶µ¬¶µ­·¶­·¶¬¶µ­·¶­·¶­·¶®¸·®¸·®¸·±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸°º¹®¸·­·¶¯¹¸±»º¬¶µ¤­ª§®¦{wBE<.1(%'&(85,*( +#…z˜Ž„•‹ž”ˆ‘…y™‰z Ž€¨–ˆ¯´¢”´¢”² ’°ž«™‹«™‹«™‹¬šŒ¬šŒ«™‹ª˜Š¨˜‰§—Š¥•ˆ¤”‡¦–‰©™Œ©™Œ¥•ˆ¡‘„˜ˆ{˜ˆ{‚reaQD[K>jZKZJ=-#  &''( '')) @>1=;.%#)'&#   ##** DE=Š‹ƒ¦¨£«­¨®°­­¯¬¬°¯¯³²¯³´ª°°¬²²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²©³²©³²ª´³«µ´¬¶µ¬¶µ­·¶­·¶¬¶µ­·¶­·¶­·¶®¸·®¸·®¸·±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸®¸·®¸·®¸·®¸·¯¹¸­·¶¬¶µ®¸·°º¹«µ´£¬©ª±©€†|GJA03(%'')99-., !<8,)#=5*¤œ‘œ’ˆ‘‡{šŽ‚žŽ£‘ƒ©—‰¯±Ÿ‘°ž®œŽ«™‹°ž°ž±Ÿ‘±Ÿ‘±Ÿ‘°ž¯®œŽ¥•†©™Š¬œªš¤”‡ ƒŸ‚žƒt€rg]ODPD8\PDJ>2%   + $%#$!! %%DB675(#!+)%!   +((** 780}~x¡£ž¨ª¥­¯¬­¯¬«¯®®²±®²³ª°°¬²²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²©³²©³²ª´³«µ´¬¶µ¬¶µ­·¶­·¶¬¶µ­·¶­·¶­·¶®¸·®¸·®¸·±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹¯¹¸¯¹¸¯¹¸®¸·®¸·­·¶­·¶¬¶µ­·¶«µ´ª´³¬¶µ®¸·©³²¡ª§©°¨‚ˆ|HK@,/$!#%99-.."'%D@4.* yse§Ÿ’“‹~¢˜Œ©™Œ«™®œ°ž’±Ÿ“±Ÿ“±Ÿ“°ž’®œ®œ¯‘°ž’°ž’°ž’°ž’¯°žª™‰£“„žŽœŒ}œŒ}˜Š}•‰{‚vjA7-7-#A7-$ +'!" **AA511%$",*"  ((!"-.&23-opjž ›¦¨£«°¬«°¬«¯®®²±®²³«±±¬²²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²©³²©³²ª´³«µ´¬¶µ¬¶µ­·¶­·¶¬¶µ­·¶­·¶­·¶®¸·®¸·®¸·±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹¯¹¸¯¹¸®¸·®¸·­·¶¬¶µ¬¶µ«µ´¬¶µª´³©³²«µ´­·¶¨²± ©¤­´¬‰ƒQTI25*!#&(<<0//#+)+)$!(%‘‹}š”†§‘©›Ž¬šŽ­›®œ°ž’² ”µ£—¶¤˜°ž’±Ÿ“±Ÿ“² ”² ”² ”² ”±Ÿ“®£“ƒ}¢’‚¨˜‰œ€tfe[O<2(&""    !! ,,"==3.."(&-+ $$!! !"#"#NQJœž™¦¨£¬±­¬±­«¯®­±°®²³«±±ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²©³²©³²ª´³«µ´¬¶µ¬¶µ­·¶­·¶¬¶µ­·¶­·¶­·¶®¸·®¸·®¸·±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹¯¹¸®¸·­·¶¬¶µ¬¶µ«µ´¬¶µ­·¶«µ´ª´³¬¶µ®¸·©³²¡ª¥±¸°’˜Œ[aU;A5(,)-;=0+- () + IF7~o¦ ’¦˜¨—¨—©˜Ž«š®“°Ÿ•²¡—²¡—²¡—²¡—²¡—± –°Ÿ•¯ž”®ž‘¢’‚Ÿ}}š|‘„tuiYLC4.& " !!  !!" ! !$%+-"88.,,"++!,,"##&' '(""#')$JLGœž™¥ª¤­²®­²®«±¯¬²°¬²°«±¯ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²©³²©³²ª´³«µ´¬¶µ¬¶µ­·¶­·¶¬¶µ­·¶­·¶­·¶®¸·®¸·®¸·±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹¯¹¸®¸·­·¶¬¶µ«µ´«µ´­·¶®¸·­·¶«µ´­·¶¯¹¸ª´³£¬©¯¶®“™_eY>D8),!&*46)!#&(&'  [YJ¥¢“¥™§™Ž©˜Ž¨š«šªœ‘¬›‘ªœ‘¯ž”­Ÿ”®“«’«š§™Ž§–Œ¤–‰ž‘€ž‘€”‡vxl\SG70',( "# +!###!!()!*+#44,,,"//',," 34.'(";<67:3JLGkmhšŸ™¦«¥¯´°¯´°«±¯¬²°¬²°«±¯ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²©³²©³²ª´³«µ´¬¶µ¬¶µ­·¶­·¶¬¶µ­·¶­·¶­·¶®¸·®¸·®¸·±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ­·¶¬¶µ¬¶µ«µ´«µ´ª´³ª´³«´±¶½µŸ¥›]cY:@6"$*!.2$&*!##% )*zxk¦œ’§š‘—‰€°£š§™«ž•¡“Š¡”‹¬ž•¦™¤–£–¦˜¤—ŽŸ‘ˆ˜Œ€•‰yxl\NB2)  ! "%(.$TWN"$%&'!89356."">=8FE@./)JKEbd_gidmoj‚„›š¥ª¦­²®­²®¬²®¬²®¬²°¬²°ª³°ª³°ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²¨²±¨²±©³²ª´³ª´³«µ´¬¶µ¬¶µ¬¶µ­·¶­·¶­·¶®¸·®¸·®¸·±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ«µ´«µ´ª´³ª´³«´±ª±ª¢›ing=B;"' #)#&03(/2'#&"&'+/0"‹‚y“‰™†£™“‰€£™£™¢˜Ž—„™…ž”‹£™£™˜Ž„‡}tzpfB;+5.%  !!tzp”—ŽmpgEF@[\V{|v}~xkjevupŒ‡Œˆ“”¢£ž©«¦£¥ ¡£žª¬§°µ±°µ±­²®¬²®¬²®¬²®¬²°¬²°ª³°ª³°ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²¨²±¨²±©³²ª´³ª´³«µ´¬¶µ¬¶µ¬¶µ­·¶­·¶­·¶®¸·®¸·®¸·±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ«µ´«µ´«µ´ª´³«´±¯µ±¥¬¥|ƒ|A=440'$        "&,"…‹¨­¦­²«´·°³¶¯´µ°±²­¯°«³³±²²°©©§©«¨«­ª©«¨§©¦ª¯«°µ±¯´°¨­©¬²®¬²®ª³®ª³®ª³°ª³°ª³°ª³°ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²¨²±¨²±©³²ª´³ª´³«µ´¬¶µ¬¶µ¬¶µ­·¶­·¶­·¶®¸·®¸·®¸·±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ«µ´«µ´«µ´«µ´«µ´«µ´«µ´«µ´®´´°¶¶Ÿ¥¥eki`fd^db‡…•›—¤ª¦¡ª¥µ»·ºÄ¼¬³¬©³«³º³ª¯¨@A9 +        +    "!  )1&ˆ†»À¹ž£¦«¥°²¯´¶³°°®¤¤¤¥¥¥±±±­¯®¯±°­±°¬°¯­±°°´³¯µ³­³±¬²°¬²°ª³°ª³°ª³®ª³®©´®©´°ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²¨²±¨²±©³²ª´³ª´³«µ´¬¶µ¬¶µ¬¶µ­·¶­·¶­·¶®¸·®¸·®¸·±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µª´³ª´³«µ´«µ´«µ´¬¶µ¬¶µ¬¶µ©®±·¼¿¹¾Á§­­¨­°¡§§©¯¯´º¸µ¾»ª³°ª³°­¶±§°«¥®©ª³®®µ®–™’()!  + ! bg`£¨¡¼Á»µº´§©¦¦¨¥³³³±±±«««±±±­¯®®°¯­±°«¯®©­¬¨¬«¨®¬¨®¬¬²°¬²°ª³°ª³°ª³®ª³®©´®©´®ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²¨²±¨²±©³²ª´³ª´³«µ´¬¶µ¬¶µ¬¶µ­·¶­·¶­·¶®¸·®¸·®¸·±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µª´³ª´³ª´³«µ´«µ´¬¶µ¬¶µ¬¶µ¢§ª«°´¨­±³¸»³¸¼¯´·¡©««´³©²±ª³²£¬« ©¦§²®¨³¯¦±­«´¯ž£œ%(      $"  ,3+V]U«°ª¸½·«­ªœž›®°¯¹»º¯¯±¨¨ª°±³­±²¬°±­±²®²³­±²¬²°¬²°ª³°ª³°ª³°ª³°©´®©´®©´®©´®ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²¨²±¨²±©³²ª´³ª´³«µ´¬¶µ¬¶µ¬¶µ­·¶­·¶­·¶®¸·®¸·®¸·±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¯¹¸¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µ¬¶µª´³ª´³ª´³«µ´«µ´¬¶µ¬¶µ­·¶·¿Á´¹¼ž£¦¯´·«°³°µ¸Ÿ§©±º¹¦¥´½¼±º¹¥®­¬µ²«¶²¥®««´¯‘–  #+  @E?•š”¿Ä¾­²®ª¬©¯±®¬®­­¯®¯³´ª®¯§«¬©­®­±²¬°±¨®¬¥«©ª³°ª³°ª³°ª³°ª³®©´®ª³®ª³°ª³°ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²ª³²©²±¨²±©³²ª´³ª´³«µ´¬¶µ¬¶µ¬¶µ­·¶­·¶­·¶®¸·®¸·®¸·±»º±»º±»º±»º±»º±»º±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹±º¹±º¹±º¹±º¹±º¹±º¹±º¹±º¹¯¸·¯¸·¯¸·¯¸·®·¶®·¶®·¶¬¶µ­¸´¬¸´­¹µ­¹µ­¹µ­¹µ­¹µ­¹µ¨´°¨´°ª¶²«·³¬¸´¬¸´«·³¬·³¨±°ª°°«±±ª°°«±±­³³°¶¶³¹·ª°®©¯­©¯­©¯­«±¯ª³°¬²°«±­š¡™+3( "*  +"  + !  ;y‚¯¸·®·¶ ©¨¥®­¬µ´§°¯¬µ´¬µ´¬µ´­¶µ­¶µ®·¶®·¶±»º±»º±»º±»º±»º±»º±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°¹¸°¹¸°¹¸°¹¸°¹¸°¹¸°¹¸°¹¸¯¸·¢«ª®·¶ºÃŠ“’4=< $!  ! %  % ""#!&%%%%# '!( !(/(!-65ajiœ¥¤·À¿¯¸·¨±°­¶µ¬µ´¬µ´¬µ´¬µ´­¶µ­¶µ®·¶±»º±»º±»º±»º±»º±»º±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°¹¸°¹¸°¹¸°¹¸°¹¸°¹¸°¹¸°¹¸¬µ´ÁÊɳ¼»pyx.76! &#/4.""$  %"  "!!$"##'0-  aji£¬«±º¹«´³¬µ´«´³¬µ´¬µ´¬µ´­¶µ­¶µ­¶µ±»º±»º±»º±»º±»º±»º±»º±»º°º¹°º¹°º¹°º¹°º¹°º¹°º¹°º¹°¹¸°¹¶°¹¸°¹¶°¹¸°¹¶°¹¸°¹¶´½¼œ¥¢bkj!*' '$#,+ + +"' " ! %"!"! "#!( & )$#"R[V¢«¨ºÃÀ ©¦«´±«´±¬µ´¬µ´¬µ´­¶µ­¶µ²»º²»º²»º²»º²»º²»º²»º²»º±º¹±º¹±º¹±º¹±º¹±º¹±º¹±º¹´º¸°¶²¬²°°¶²´º¸¯µ±®´²µ»· ¦¤PVR"(.,"    !"##        & +$ \c[¬³«¬³¬Ÿ¦Ÿ¹¿»±·µ¦¬ª´ºº¯µµ¥ª­²»º²»º²»º²»º²»º²»º²»º²»º±º¹±º¹±º¹±º¹±º¹±º¹±º¹±º·¦¬ª³¹µ¶¼¸®´°®´°±·³­³¯¨®ªEKG(.*"!(!   !!""          "*#+&emb±¹®²¹²¤«¤¬²°®´²¡§§±··»Àò»º²»º²»º²»º²»º²»º²»º²»º±º¹±º¹±º¹±º¹±º¹±º¹±º¹±º·´º¸¬²®µ»·±·³©¯«¹¿»š œFLH $   !!    !""         ' "%- "*x€uÂÉ § ¥«©¶¼ºª°°ª°°µ»»²»º²»º²»º²»º²»º²»º²»º²»º±º¹±º¹±º¹±º¹±º¹±º¹±º¹±º·°¶²½Ã¿¥«§©¯«ÈÎÊ‘—“395$ !'#$  &"#    !!         ) +3&' *1)Ž•Ž³º³´º¶¨®¬±··­³³¦¬¬²»º²»º²»º²»º²»º²»º²»º²»º±º¹±º¹±º¹±º¹±º¹±º¹±º¹±º·¸¾º£ª£µ¼µÂÉÂ…Œ…181")" ' ! $"      #'!! 292š¡šÂÈÄ£©¥£©§´º¸®´²²»º²»º²»º²»º²»º²»º²»º²»º±º¹±º¹±º¹±º¹±º¹±º¹±º¹±º·¹¿»²¹²ºÁº„‹„")".5.###  & $!) !( $CJC—™ÀƬ²°©¯­´º¸²»º²»º²»º²»º²»º²»º²»º²»º±º¹±º¹±º¹±º¹±º¹±º¹±º¹±º·¥«§ÈÏÈnun&-&,3,  &"%#  "* "! '!$+$LRNª°¬»Á½§­©«±¯²»º²»º²»º²»º²»º²»º²»º²»º±º¹±º¹±º¹±º¹±º¹±º¹±º¹±º·ÀÆÂNUN")0) '   '  !!(!&     '"*##*#% &"\b^®´°¼Â¾¦¬¨²»º²»º²»º²»º²»º²»º²»º²»º­¶µ°¹¸²»º­¶µ«´³µ¾½µ¾½¥®«E>  #iok©¯­®´²§­«¤ª¨¯µµ³¹¹¨®®§­­­²µ§¬¯¤­¬¤­¬¤­¬¤­¬¤­¬¤­¬¤­¬¤­¬¢«ª£¬«¤­¬£¬«¢«ª¢«ª¤­¬¥®«W^V#+     #!(  +‚‰®µ®š¡š£©¥£©¥£©¥£©¥£©§£©§£©§£©§£©©£¨«£©©£©©£©©£©©£©§£©§˜žœ­³¯š œ¦¬¨«²«”›”181  6=6ŠŒ¬²®£©§¨®¬¯µ³©¯­¨®®§­­¦¬¬®´´®³¶Ÿ¤§¤­¬¤­¬¤­¬¤­¬¤­¬¤­¬¤­¬¤­¬£¬«£¬«£¬«£¬«£¬«£¬«£¬«£¬©JQI%-""" !(  !‰ˆ¥¬¥›¢›£©¥£©¥£©¥£©¥£©§£©§£©§£©§£¨«£¨«£©©£©©£©©£©©£©§£©§£©§•›™¯µ±¦¬¨˜Ÿ˜²¹²’™’,3,DJF¤ª¦­³¯¬²®¶¼ºž¤¢«±¯¦¬ª ¦¦¡§§¨­°«°³©®±¦«®¤­¬¤­¬¤­¬¤­¬¤­¬¤­¬¤­¬¤­¬£¬«£¬«£¬«¤­¬¤­¬¤­¬£¬«¢«¨> 8).to_u8 + green << (rgba.g >> 8).to_u8 + blue << (rgba.b >> 8).to_u8 + alpha << (rgba.a >> 8).to_u8 + end + end + + CrImage::RGBAImage.new(red, green, blue, alpha, width, height) + end + end +end + +module CrImage + class RGBAImage + def to_stumpy : StumpyCore::Canvas + StumpyCore::Canvas.new(width, height) do |x, y| + color = self[x, y] + StumpyCore::RGBA.new(color.red.to_u16 << 8, color.green.to_u16 << 8, color.blue.to_u16 << 8, color.alpha.to_u16 << 8) + end + end + end + + class GrayscaleImage + def to_stumpy : StumpyCore::Canvas + StumpyCore::Canvas.new(width, height) do |x, y| + color = self[x, y] + StumpyCore::RGBA.new(color.gray.to_u16 << 8, color.gray.to_u16 << 8, color.gray.to_u16 << 8, color.alpha.to_u16 << 8) + end + end + end +end