void SetCelOpacity::onFireNotifications() { Cel* cel = this->cel(); DocumentEvent ev(cel->document()); ev.sprite(cel->sprite()); ev.cel(cel); cel->document()->notifyObservers<DocumentEvent&>(&DocumentObserver::onCelOpacityChanged, ev); }
void ClearMask::clear() { Cel* cel = this->cel(); Image* image = m_dstImage->image(); app::Document* doc = static_cast<app::Document*>(cel->document()); Mask* mask = doc->mask(); ASSERT(mask->bitmap()); if (!mask->bitmap()) return; const LockImageBits<BitmapTraits> maskBits(mask->bitmap()); LockImageBits<BitmapTraits>::const_iterator it = maskBits.begin(); // Clear the masked zones int u, v; for (v=0; v<mask->bounds().h; ++v) { for (u=0; u<mask->bounds().w; ++u, ++it) { ASSERT(it != maskBits.end()); if (*it) { put_pixel(image, u + m_offsetX, v + m_offsetY, m_bgcolor); } } } ASSERT(it == maskBits.end()); }
void ClearMask::clear() { Cel* cel = this->cel(); Image* image = m_dstImage->image(); Doc* doc = static_cast<Doc*>(cel->document()); Mask* mask = doc->mask(); doc::algorithm::fill_selection(image, m_offset, mask, m_bgcolor); }
void SetCelPosition::onFireNotifications() { Cel* cel = this->cel(); Doc* doc = static_cast<Doc*>(cel->document()); DocEvent ev(doc); ev.sprite(cel->sprite()); ev.cel(cel); doc->notify_observers<DocEvent&>(&DocObserver::onCelPositionChanged, ev); }
void ShiftMaskedCel::shift(int dx, int dy) { Cel* cel = this->cel(); Image* image = cel->image(); Mask* mask = static_cast<app::Document*>(cel->document())->mask(); ASSERT(mask->bitmap()); if (!mask->bitmap()) return; int x = cel->x(); int y = cel->y(); mask->offsetOrigin(-x, -y); doc::algorithm::shift_image_with_mask(image, mask, dx, dy); mask->offsetOrigin(x, y); image->incrementVersion(); }