示例#1
0
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);
}
示例#2
0
void SetMaskPosition::onUndo()
{
  setMaskPosition(m_oldPosition);
}
示例#3
0
void SetMaskPosition::onExecute()
{
  setMaskPosition(m_newPosition);
}