Add DocumentApi::clearImage() member function

This commit is contained in:
David Capello 2014-09-10 00:59:14 -03:00
parent 03ac41e05d
commit 8acfa688cc
2 changed files with 12 additions and 6 deletions

View File

@ -1190,6 +1190,16 @@ void DocumentApi::replaceStockImage(Sprite* sprite, int imageIndex, Image* newIm
delete oldImage;
}
void DocumentApi::clearImage(Image* image, color_t bgcolor)
{
if (undoEnabled())
m_undoers->pushUndoer(new undoers::ImageArea(getObjects(),
image, 0, 0, image->width(), image->height()));
// clear all
clear_image(image, bgcolor);
}
// Clears the mask region in the current sprite with the specified background color.
void DocumentApi::clearMask(Layer* layer, Cel* cel, color_t bgcolor)
{
@ -1207,12 +1217,7 @@ void DocumentApi::clearMask(Layer* layer, Cel* cel, color_t bgcolor)
if (!m_document->isMaskVisible()) {
// If the layer is the background then we clear the image.
if (layer->isBackground()) {
if (undoEnabled())
m_undoers->pushUndoer(new undoers::ImageArea(getObjects(),
image, 0, 0, image->width(), image->height()));
// clear all
clear_image(image, bgcolor);
clearImage(image, bgcolor);
}
// If the layer is transparent we can remove the cel (and its
// associated image).

View File

@ -112,6 +112,7 @@ namespace app {
void replaceStockImage(Sprite* sprite, int imageIndex, Image* newImage);
// Image API
void clearImage(Image* image, color_t bgcolor);
void clearMask(Layer* layer, Cel* cel, color_t bgcolor);
void flipImage(Image* image, const gfx::Rect& bounds, raster::algorithm::FlipType flipType);
void flipImageWithMask(Image* image, const Mask* mask, raster::algorithm::FlipType flipType, color_t bgcolor);