void MIDIRelayComponent::paint (Graphics& g) { g.fillAll (Colours::transparentBlack); // clear the background Rectangle<float> b = getLocalBounds().toFloat(); Rectangle<float> cellBounds(hmargin, vmargin, b.getWidth() - (hmargin*2), b.getHeight() - (vmargin*2)); g.setColour (Colours::grey); g.drawRoundedRectangle(cellBounds, 5, 1); g.setColour(Colours::black.withAlpha(0.5f)); g.fillRoundedRectangle(cellBounds.reduced(1), 5); }
void GUIInventory::onRefresh() { _parent->fillRect(_bounds, _vm->_palette->BLACK); //_parent->frameRect(_bounds, _vm->_palette->LIGHT_GRAY); if (_visible) { //kernel_trigger_dispatch(kernel_trigger_create(TRIG_INV_CLICK)); _scrollable = false; // Get to the starting inventory position for display ItemsIterator i = _inventoryItems.begin(); int index = _scrollPosition; while (index-- > 0) ++i; // Loop through displaying entries for (index = 0; (i != _inventoryItems.end()) && (index < _cellCount.x * _cellCount.y); ++index, ++i) { GUIInventoryItem *item = (*i).get(); const Common::Point cellPos = getCellPosition(index); /* Common::Rect cellBounds(_bounds.left + cellPos.x + xOffset, _bounds.top + cellPos.y + yOffset, _bounds.left + cellPos.x + xOffset + _cellSize.x, _bounds.top + cellPos.y + _cellSize.y);*/ Common::Rect cellBounds(_bounds.left + cellPos.x, _bounds.top + cellPos.y, _bounds.left + cellPos.x + _cellSize.x, _bounds.top + cellPos.y + _cellSize.y); Common::Point iconPt( cellBounds.left + (cellBounds.width() - item->icon->width()) / 2, cellBounds.top + (cellBounds.height() - item->icon->height()) / 2); item->icon->copyTo(_parent, iconPt.x, iconPt.y, 0); if (_highlightedIndex == index) _parent->frameRect(Common::Rect(iconPt.x - 2, iconPt.y - 2, iconPt.x + item->icon->width() + 2, iconPt.y + item->icon->height() + 2), _vm->_palette->LIGHT_GRAY); } } }
Scalar StructuredGridBase::cellDiameter(Index elem) const { auto bounds = cellBounds(elem); return (bounds.second-bounds.first).norm(); }