/** * Draw the image onto the renderer. * @param renderer */ void ImageView::draw(SDL_Renderer* renderer) { RectangleView::draw(renderer); auto x = static_cast<uint16_t>(getX() + getHorizontalOffset()); auto y = static_cast<uint16_t>(getY() + getVerticalOffset()); animation->move(x, y); animation->draw(renderer); }
void ListBox::paintComponent( const agui::PaintEvent &paintEvent ) { int itemsSkipped = getVisibleItemStart(); int hScrollHeight = 0; if(m_hScroll->isVisible()) { hScrollHeight = m_hScroll->getHeight(); } int maxitems = getVisibleItemCount(); int h = getItemHeight() * itemsSkipped; int rcount = 0; int diff = getItemHeight() - getFont()->getLineHeight(); agui::Color inverseFont = agui::Color(255,255,255); agui::Color* color; agui::Point absPos = getAbsolutePosition(); agui::Rectangle parentRect = m_visbilityWidget ? m_visbilityWidget->getAbsoluteRectangle() : getParent()->getAbsoluteRectangle(); int posX = absPos.getX() + (getInnerWidth() / 2); for(agui::ListItem::const_iterator it = getItemsBegin() + itemsSkipped ; it != getItemsEnd(); ++it) { if(rcount == maxitems) { break; } //if the item cannot be seen in the parent do not render it if(parentRect.pointInside(agui::Point(posX, absPos.getY() + h + getVerticalOffset())) || getSizeRectangle().pointInside(agui::Point(posX ,absPos.getY() + getItemHeight() + h + getVerticalOffset()) )) { if(it->second) { int vOffset = m_vScroll->isVisible() ? m_vScroll->getWidth() + 1 : 0; paintEvent.graphics()->drawNinePatchImage(m_selImage, agui::Point(0,h + getVerticalOffset()), agui::Dimension(getInnerSize().getWidth() - vOffset,getItemHeight())); color = &inverseFont; } else if(itemsSkipped + rcount == getHoverIndex()) { agui::Color highlight = agui::Color( getFontColor().getR() + 0.12f, getFontColor().getG() + 0.12f, getFontColor().getB() + 0.12f); color = (agui::Color*)&highlight; } else { color = (agui::Color*)&getFontColor(); } paintEvent.graphics()->drawText(agui::Point(getHorizontalOffset() + 4 , h + getVerticalOffset() + (diff / 2)),it->first.text.c_str(),*color, getFont()); } h += getItemHeight(); rcount++; } }