mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-14 13:21:34 +00:00
Fix Un-replaceable transparent pixels created by resize
This commit is contained in:
parent
fc63532fef
commit
c25d6eb436
@ -38,7 +38,9 @@ doc::Image* resize_image(const doc::Image* image,
|
||||
std::unique_ptr<doc::Image> newImage(doc::Image::create(spec));
|
||||
newImage->setMaskColor(image->maskColor());
|
||||
|
||||
doc::algorithm::fixup_image_transparent_colors(newImage.get());
|
||||
doc::algorithm::fixup_image_transparent_colors(
|
||||
newImage.get(),
|
||||
method == doc::algorithm::RESIZE_METHOD_NEAREST_NEIGHBOR);
|
||||
doc::algorithm::resize_image(image, newImage.get(), method, pal, rgbmap, newImage->maskColor());
|
||||
|
||||
return newImage.release();
|
||||
@ -77,7 +79,9 @@ void resize_cel_image(Tx& tx,
|
||||
doc::Image::create(image->pixelFormat(), std::max(1, w), std::max(1, h)));
|
||||
newImage->setMaskColor(image->maskColor());
|
||||
|
||||
doc::algorithm::fixup_image_transparent_colors(image);
|
||||
doc::algorithm::fixup_image_transparent_colors(
|
||||
image,
|
||||
method == doc::algorithm::RESIZE_METHOD_NEAREST_NEIGHBOR);
|
||||
doc::algorithm::resize_image(
|
||||
image,
|
||||
newImage.get(),
|
||||
|
@ -184,8 +184,10 @@ void resize_image(const Image* src,
|
||||
}
|
||||
}
|
||||
|
||||
void fixup_image_transparent_colors(Image* image)
|
||||
void fixup_image_transparent_colors(Image* image, bool skip_for_nearest_neighbor)
|
||||
{
|
||||
if (skip_for_nearest_neighbor)
|
||||
return;
|
||||
int x, y;
|
||||
|
||||
switch (image->pixelFormat()) {
|
||||
|
@ -42,7 +42,8 @@ void resize_image(const Image* src,
|
||||
// (alpha = 0) with the average of its 4-neighbors. Useful if you
|
||||
// want to use resize_image() with images that contains
|
||||
// transparent pixels.
|
||||
void fixup_image_transparent_colors(Image* image);
|
||||
|
||||
void fixup_image_transparent_colors(Image* image, bool skip_for_nearest_neighbor);
|
||||
|
||||
} // namespace algorithm
|
||||
} // namespace doc
|
||||
|
Loading…
x
Reference in New Issue
Block a user