void DocumentApi::cropSprite(Sprite* sprite, const gfx::Rect& bounds, int bgcolor) { setSpriteSize(sprite, bounds.w, bounds.h); displaceLayers(sprite->getFolder(), -bounds.x, -bounds.y); Layer *background_layer = sprite->getBackgroundLayer(); if (background_layer) cropLayer(background_layer, 0, 0, sprite->getWidth(), sprite->getHeight(), bgcolor); if (!m_document->getMask()->isEmpty()) setMaskPosition(m_document->getMask()->getBounds().x-bounds.x, m_document->getMask()->getBounds().y-bounds.y); }
void SetMaskPosition::onUndo() { setMaskPosition(m_oldPosition); }
void SetMaskPosition::onExecute() { setMaskPosition(m_newPosition); }