Bugfix: Background color was always transparent with older imagemagick
the build was successful Details

versions
This commit is contained in:
tastytea 2019-01-02 06:00:51 +01:00
parent b0c0e0ef09
commit e568a64129
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
5 changed files with 9 additions and 7 deletions

View File

@ -1,6 +1,6 @@
cmake_minimum_required (VERSION 3.2)
project(identiconpp
VERSION 0.3.5
VERSION 0.3.6
LANGUAGES CXX
)

View File

@ -78,10 +78,12 @@ Magick::Image Identiconpp::generate(const string &digest, const uint16_t width)
}
}
img.backgroundColor(Magick::Color('#' + _background));
img.scale(Magick::Geometry(imgwidth, imgheight));
img.borderColor(Magick::Color('#' + _background));
img.border(Magick::Geometry(_padding[0], _padding[1]));
// The CompositeOperator prevents the background color to be affected by the
// frame color. See https://github.com/ImageMagick/ImageMagick/issues/647
img.compose(Magick::CompositeOperator::CopyCompositeOp);
img.matteColor(Magick::Color('#' + _background));
img.frame(Magick::Geometry(_padding[0], _padding[1]));
return img;
}

View File

@ -20,7 +20,7 @@
Magick::Image Identiconpp::generate_ltr_asymmetric(const string &digest)
{
Magick::Image img(Magick::Geometry(_columns, _rows),
Magick::Color("#00000000"));
Magick::Color('#' + _background));
Magick::Color dotcolor = get_color(_columns * _rows + 1, digest);
for (uint8_t row = 0; row < _rows; ++row)

View File

@ -20,7 +20,7 @@
Magick::Image Identiconpp::generate_ltr_symmetric(const string &digest)
{
Magick::Image img(Magick::Geometry(_columns, _rows),
Magick::Color("#00000000"));
Magick::Color('#' + _background));
uint8_t used_columns = _columns / 2 + _columns % 2;
Magick::Color dotcolor = get_color(used_columns * _rows + 1, digest);

View File

@ -20,7 +20,7 @@
Magick::Image Identiconpp::generate_sigil(const string &digest)
{
Magick::Image img(Magick::Geometry(_columns, _rows),
Magick::Color("#00000000"));
Magick::Color('#' + _background));
Magick::Color dotcolor = get_color(0, digest);
uint8_t used_columns = _columns / 2 + _columns % 2;