void MouseDialogNavigationTool::display(GLContextData& contextData) const { if(showScreenCenter) { /* Save and set up OpenGL state: */ glPushAttrib(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_ENABLE_BIT|GL_LINE_BIT|GL_TEXTURE_BIT); glDisable(GL_LIGHTING); glDepthFunc(GL_LEQUAL); /* Go to screen coordinates: */ glPushMatrix(); Scalar viewport[4]; glMultMatrix(getMouseScreenTransform(mouseAdapter,viewport)); /* Determine the crosshair colors: */ Color bgColor=getBackgroundColor(); Color fgColor; for(int i=0;i<3;++i) fgColor[i]=1.0f-bgColor[i]; fgColor[3]=bgColor[3]; /* Calculate the window's or screen's center: */ Scalar centerPos[2]; for(int i=0;i<2;++i) centerPos[i]=Math::mid(viewport[2*i+0],viewport[2*i+1]); /* Calculate the endpoints of the screen's crosshair lines in screen coordinates: */ Point l=Point(viewport[0],centerPos[1],Scalar(0)); Point r=Point(viewport[1],centerPos[1],Scalar(0)); Point b=Point(centerPos[0],viewport[2],Scalar(0)); Point t=Point(centerPos[0],viewport[3],Scalar(0)); /* Draw the screen crosshairs: */ glLineWidth(3.0f); glColor(bgColor); glBegin(GL_LINES); glVertex(l); glVertex(r); glVertex(b); glVertex(t); glEnd(); glLineWidth(1.0f); glColor(fgColor); glBegin(GL_LINES); glVertex(l); glVertex(r); glVertex(b); glVertex(t); glEnd(); /* Go back to physical coordinates: */ glPopMatrix(); /* Restore OpenGL state: */ glPopAttrib(); } }
void ScaleBar::draw(GLContextData& contextData) const { /* Save and set OpenGL state: */ glPushAttrib(GL_COLOR_BUFFER_BIT|GL_ENABLE_BIT|GL_LINE_BIT); glDisable(GL_LIGHTING); /* Calculate the scale bar layout: */ GLfloat x0=getInterior().origin[0]+(getInterior().size[0]-GLfloat(currentPhysLength))*0.5f; GLfloat x1=x0+GLfloat(currentPhysLength); const GLLabel::Box::Vector& labelSize=lengthLabel->getLabelSize(); GLfloat y0=getInterior().origin[1]+(getInterior().size[1]-labelSize[1]*2.0f)*0.5f; GLfloat y1=y0+labelSize[1]; GLfloat y2=y1+labelSize[1]; /* Draw the scale bar: */ glLineWidth(5.0f); glBegin(GL_LINES); glColor(getBackgroundColor()); glVertex2f(x0,y1); glVertex2f(x1,y1); glEnd(); glLineWidth(3.0f); glBegin(GL_LINES); glVertex2f(x0,y0); glVertex2f(x0,y2); glVertex2f(x1,y0); glVertex2f(x1,y2); glColor(getForegroundColor()); glVertex2f(x0,y1); glVertex2f(x1,y1); glEnd(); glLineWidth(1.0f); glBegin(GL_LINES); glVertex2f(x0,y0); glVertex2f(x0,y2); glVertex2f(x1,y0); glVertex2f(x1,y2); glEnd(); /* Install a temporary deferred renderer: */ { GLLabel::DeferredRenderer dr(contextData); /* Draw the length and scale labels: */ // glEnable(GL_ALPHA_TEST); // glAlphaFunc(GL_GREATER,0.0f); lengthLabel->draw(contextData); scaleLabel->draw(contextData); } /* Restore OpenGL state: */ glPopAttrib(); }
void gcn::Panel::draw(Graphics* graphics) { if(IsCovered()) return; // draw self, background if(getBackgroundColor().a) // draw background only if not completely transparent { graphics->setColor(getBackgroundColor()); graphics->fillRectangle(getChildrenArea()); } if(getForegroundColor().a) // draw foreground only if not completely transparent { graphics->setColor(getForegroundColor()); graphics->drawRectangle(getChildrenArea()); } drawChildren(graphics); }
void DkCompressDialog::saveSettings() { QSettings& settings = DkSettingsManager::instance().qSettings(); settings.beginGroup(objectName()); settings.setValue("Compression" + QString::number(mDialogMode), getCompression()); if (mDialogMode != webp_dialog) settings.setValue("bgCompressionColor" + QString::number(mDialogMode), getBackgroundColor().rgba()); settings.endGroup(); }
void DropDown::draw(Graphics* graphics) { int h; if (mDroppedDown) { h = mOldH; } else { h = getHeight(); } int alpha = getBaseColor().a; Color faceColor = getBaseColor(); faceColor.a = alpha; Color highlightColor = faceColor + 0x303030; highlightColor.a = alpha; Color shadowColor = faceColor - 0x303030; shadowColor.a = alpha; graphics->setColor(getBackgroundColor()); graphics->fillRectangle(Rectangle(0, 0, getWidth(), h)); graphics->setColor(getForegroundColor()); graphics->setFont(getFont()); if (isFocused()) { graphics->setColor(getSelectionColor()); graphics->fillRectangle(Rectangle(0, 0, getWidth() - h, h)); graphics->setColor(getForegroundColor()); } if (mListBox->getListModel() && mListBox->getSelected() >= 0) { graphics->drawText(mListBox->getListModel()->getElementAt(mListBox->getSelected()), 1, 0); } drawButton(graphics); if (mDroppedDown) { drawChildren(graphics); // Draw two lines separating the ListBox with se selected // element view. graphics->setColor(highlightColor); graphics->drawLine(0, h, getWidth(), h); graphics->setColor(shadowColor); graphics->drawLine(0, h + 1,getWidth(),h + 1); } }
void EnergyGauge::draw(gcn::Graphics* graphics) { int highlightThickness = (getOrientation() == Orientation::VERTICAL ? getWidth() : getHeight() ) / 4; // width of the highlight stripe, typically 2 pixels const float percentageFilled = value / maximumValue; // Draw the background of the gague graphics->setColor(getBackgroundColor()); graphics->fillRectangle(0, 0, getWidth(), getHeight()); if(getOrientation() == Orientation::VERTICAL) { // Draw the highlight stripe graphics->setColor(getForegroundColor()); const int highlightStartX = (getWidth() / 2) - (highlightThickness / 2); graphics->fillRectangle(highlightStartX, 0, highlightThickness, getHeight()); graphics->setColor(getBaseColor()); // Draw horizontal ticks for(unsigned int row = 0, height = getHeight(); row < height; ++row) { if(row % 2 == 1) { graphics->drawLine(0, row, getWidth(), row); } } // Draw overlay rectangle int fillHeight = getHeight() - static_cast<int>(percentageFilled * static_cast<float>(getHeight())); graphics->fillRectangle(0, 0, getWidth(), fillHeight); // Draw border graphics->drawLine(0, 0, 0, getHeight()); graphics->drawLine(getWidth() - 1, 0, getWidth() - 1, getHeight()); } else { // Draw horizontal orientation graphics->setColor(getForegroundColor()); const int highlightStartY = (getHeight() / 2) - (highlightThickness / 2); graphics->fillRectangle(0, highlightStartY, getWidth(), highlightThickness); graphics->setColor(getBaseColor()); // Draw horizontal ticks for(unsigned int column = 0, width = getWidth(); column < width; ++column) { if(column % 2 == 1) { graphics->drawLine(column, 0, column, getHeight()); } } // Draw overlay rectangle int fillWidth = getWidth() - static_cast<int>(percentageFilled * static_cast<float>(getWidth())); graphics->fillRectangle(0, 0, fillWidth, getHeight()); // Draw border graphics->drawLine(0, 0, getWidth(), 0); graphics->drawLine(0, getHeight() - 1, getWidth(), getHeight() - 1); } }
void Label::draw() { const Size& size = getSize(); const int width = size.getWidth(); const int height = size.getHeight(); gltext::FontPtr font = getFont(); // draw the label background glColor(getBackgroundColor()); glBegin(GL_TRIANGLE_FAN); { glVertex2i(0, 0 ); glVertex2i(width, 0 ); glVertex2i(width, height); glVertex2i(0, height); } glEnd(); // draw text glColor(getForegroundColor()); gltext::FontRendererPtr renderer = gltext::CreateRenderer(gltext::PIXMAP, font); double labelWidth = double(renderer->getWidth(mText.c_str())); double fontHeight = double(font->getAscent() + font->getDescent()); //Lets store the Matrix so we don't piss anyone off glPushMatrix(); //These checks see if the button Label fits inside the //button. If not start in the lower left-hand corner of //the button and render the text. double yLoc = (height - fontHeight)/2.0; if (yLoc < 0) { yLoc = 0; } double xLoc = (width - labelWidth)/2.0; if (xLoc < 0) { xLoc = 0; } glTranslatef(GLfloat(xLoc), GLfloat(height - yLoc), 0.0f); renderer->render(mText.c_str()); //Lets restore the Matrix glPopMatrix(); }
/** * Perform steps associated with an update. Driven by nested presenters. */ void CompositePeaksPresenter::performUpdate() { for (auto presenterIterator = m_subjects.begin(); presenterIterator != m_subjects.end(); ++presenterIterator) { auto presenter = (*presenterIterator); const int pos = static_cast<int>(std::distance(m_subjects.begin(), presenterIterator)); m_palette.setBackgroundColour(pos, presenter->getBackgroundColor()); m_palette.setForegroundColour(pos, presenter->getForegroundColor()); if (m_owner) { m_owner->performUpdate(); } } }
int TartiniSettingsDialog::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QDialog::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: { QString _r = getPath((*reinterpret_cast< const QString(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r; } break; case 1: changeTempFolder(); break; case 2: fileNameChanged(); break; case 3: getBackgroundColor(); break; case 4: getShading1Color(); break; case 5: getShading2Color(); break; case 6: saveSetting((*reinterpret_cast< QObject*(*)>(_a[1])),(*reinterpret_cast< const QString(*)>(_a[2]))); break; case 7: saveSettings(); break; case 8: checkAnalysisEnabled(); break; case 9: onNoteRangeChoice((*reinterpret_cast< int(*)>(_a[1]))); break; case 10: setUnknownsToDefault((*reinterpret_cast< QSettings*(*)>(_a[1]))); break; case 11: resetDefaults(); break; } _id -= 12; } return _id; }
void TextField::draw(Graphics* graphics) { Color faceColor = getBackgroundColor(); graphics->setColor(faceColor); graphics->fillRectangle(Rectangle(0, 0, getWidth(), getHeight())); if (isFocused()) { drawCaret(graphics, getFont()->getWidth(mText.substr(0, mCaretPosition)) - mXScroll); } graphics->setColor(getForegroundColor()); graphics->setFont(getFont()); graphics->drawText(mText, 1 - mXScroll, 1); }
void TextBox::drawBorder(Graphics* graphics) { int width = getWidth() + getBorderSize() * 2 - 1; int height = getHeight() + getBorderSize() * 2 - 1; graphics->setColor(getBackgroundColor()); unsigned int i; for (i = 0; i < getBorderSize(); ++i) { graphics->drawLine(i,i, width - i, i); graphics->drawLine(i,i + 1, i, height - i - 1); graphics->drawLine(width - i,i + 1, width - i, height - i); graphics->drawLine(i,height - i, width - i - 1, height - i); } }
/*! * Fermeture du module * */ void CDataGraph::close(void) { // Mémorise en EEPROM l'état de la fenêtre m_application->m_eeprom->write(getName(), "geometry", QVariant(m_ihm.geometry())); m_application->m_eeprom->write(getName(), "visible", QVariant(m_ihm.isVisible())); m_application->m_eeprom->write(getName(), "background_color", QVariant(getBackgroundColor())); m_application->m_eeprom->write(getName(), "niveau_trace", QVariant((unsigned int)getNiveauTrace())); // mémorise en EEPROM la liste des variables sous surveillance QStringList liste_variables_observees; for (int i=0; i<m_ihm.ui.liste_variables->count(); i++) { if (m_ihm.ui.liste_variables->item(i)->checkState() == Qt::Checked) { liste_variables_observees.append(m_ihm.ui.liste_variables->item(i)->text()); } } // for toutes les variables sous surveillances m_application->m_eeprom->write(getName(), "liste_variables_observees", QVariant(liste_variables_observees)); }
void TextEntityItem::appendSubclassData(OctreePacketData* packetData, EncodeBitstreamParams& params, EntityTreeElementExtraEncodeData* modelTreeElementExtraEncodeData, EntityPropertyFlags& requestedProperties, EntityPropertyFlags& propertyFlags, EntityPropertyFlags& propertiesDidntFit, int& propertyCount, OctreeElement::AppendState& appendState) const { bool successPropertyFits = true; APPEND_ENTITY_PROPERTY(PROP_TEXT, getText()); APPEND_ENTITY_PROPERTY(PROP_LINE_HEIGHT, getLineHeight()); APPEND_ENTITY_PROPERTY(PROP_TEXT_COLOR, getTextColor()); APPEND_ENTITY_PROPERTY(PROP_BACKGROUND_COLOR, getBackgroundColor()); APPEND_ENTITY_PROPERTY(PROP_FACE_CAMERA, getFaceCamera()); }
void TextField::draw(Graphics* graphics) { Color faceColor = getBaseColor(); Color highlightColor, shadowColor; int alpha = getBaseColor().a; highlightColor = faceColor + 0x303030; highlightColor.a = alpha; shadowColor = faceColor - 0x303030; shadowColor.a = alpha; // Draw a border. graphics->setColor(shadowColor); graphics->drawLine(0, 0, getWidth() - 1, 0); graphics->drawLine(0, 1, 0, getHeight() - 2); graphics->setColor(highlightColor); graphics->drawLine(getWidth() - 1, 1, getWidth() - 1, getHeight() - 1); graphics->drawLine(0, getHeight() - 1, getWidth() - 1, getHeight() - 1); // Push a clip area so the other drawings don't need to worry // about the border. graphics->pushClipArea(Rectangle(1, 1, getWidth() - 2, getHeight() - 2)); graphics->setColor(getBackgroundColor()); graphics->fillRectangle(Rectangle(0, 0, getWidth(), getHeight())); if (isFocused()) { graphics->setColor(getSelectionColor()); graphics->drawRectangle(Rectangle(0, 0, getWidth() - 2, getHeight() - 2)); graphics->drawRectangle(Rectangle(1, 1, getWidth() - 4, getHeight() - 4)); } if (isFocused() && isEditable()) { drawCaret(graphics, mText->getCaretX(getFont()) - mXScroll); } graphics->setColor(getForegroundColor()); graphics->setFont(getFont()); const Rectangle& dim = mText->getCaretDimension(getFont()); if (mText->getNumberOfRows() != 0) graphics->drawText(mText->getRow(0), 1 - mXScroll, 1); graphics->popClipArea(); }
void SixAxisNavigationTool::display(GLContextData& contextData) const { if(config.showNavigationCenter&&isActive()) { /* Set up OpenGL state: */ glPushAttrib(GL_DEPTH_BUFFER_BIT|GL_ENABLE_BIT|GL_LINE_BIT); glDisable(GL_LIGHTING); glDepthFunc(GL_LEQUAL); /* Calculate colors to draw the crosshairs: */ Color bgColor=getBackgroundColor(); Color fgColor; for(int i=0;i<3;++i) fgColor[i]=1.0f-bgColor[i]; fgColor[3]=bgColor[3]; /* Go to crosshair space: */ glPushMatrix(); ONTransform trans=calcHUDTransform(config.followDisplayCenter?getDisplayCenter():config.navigationCenter); glMultMatrix(trans); glLineWidth(3.0f); glBegin(GL_LINES); glColor(bgColor); glVertex2d(-getDisplaySize(),0.0); glVertex2d(getDisplaySize(),0.0); glVertex2d(0.0,-getDisplaySize()); glVertex2d(0.0,getDisplaySize()); glEnd(); glLineWidth(1.0f); glBegin(GL_LINES); glColor(fgColor); glVertex2d(-getDisplaySize(),0.0); glVertex2d(getDisplaySize(),0.0); glVertex2d(0.0,-getDisplaySize()); glVertex2d(0.0,getDisplaySize()); glEnd(); glPopMatrix(); /* Restore OpenGL state: */ glPopAttrib(); } }
void Text3DOverlay::render(RenderArgs* args) { if (!_visible || !getParentVisible()) { return; // do nothing if we're not visible } Q_ASSERT(args->_batch); auto& batch = *args->_batch; applyTransformTo(_transform, true); batch.setModelTransform(_transform); const float MAX_COLOR = 255.0f; xColor backgroundColor = getBackgroundColor(); glm::vec4 quadColor(backgroundColor.red / MAX_COLOR, backgroundColor.green / MAX_COLOR, backgroundColor.blue / MAX_COLOR, getBackgroundAlpha()); glm::vec2 dimensions = getDimensions(); glm::vec2 halfDimensions = dimensions * 0.5f; const float SLIGHTLY_BEHIND = -0.001f; glm::vec3 topLeft(-halfDimensions.x, -halfDimensions.y, SLIGHTLY_BEHIND); glm::vec3 bottomRight(halfDimensions.x, halfDimensions.y, SLIGHTLY_BEHIND); DependencyManager::get<DeferredLightingEffect>()->bindSimpleProgram(batch, false, true, false, true); DependencyManager::get<GeometryCache>()->renderQuad(batch, topLeft, bottomRight, quadColor); // Same font properties as textSize() float maxHeight = (float)_textRenderer->computeExtent("Xy").y * LINE_SCALE_RATIO; float scaleFactor = (maxHeight / FIXED_FONT_SCALING_RATIO) * _lineHeight; glm::vec2 clipMinimum(0.0f, 0.0f); glm::vec2 clipDimensions((dimensions.x - (_leftMargin + _rightMargin)) / scaleFactor, (dimensions.y - (_topMargin + _bottomMargin)) / scaleFactor); Transform transform = _transform; transform.postTranslate(glm::vec3(-(halfDimensions.x - _leftMargin), halfDimensions.y - _topMargin, 0.001f)); transform.setScale(scaleFactor); batch.setModelTransform(transform); glm::vec4 textColor = { _color.red / MAX_COLOR, _color.green / MAX_COLOR, _color.blue / MAX_COLOR, getAlpha() }; _textRenderer->draw(batch, 0, 0, _text, textColor); }
void BubbleButton::onPaint(wxPaintEvent& event) { // //##20110321: // if (parent == NULL) // return; //##Ver si esto no tiene que integrarse con el sistema estándar de visibilidad del wxWindow del que hereda: if (IsShown()) { if (imageCurrent) { // wxClientDC parentDC(parent); //##20110321 wxPaintDC dc(this); //This must be created here, inside the onPaint event, and on the stack. //dc.SetBackgroundMode(wxTRANSPARENT);//##No parece hacer gran cosa... //dc.Clear(); wxSize size = GetClientSize(); #if defined (linux) SetBackgroundColour( getBackgroundColor() ); #endif // //##20110321: // wxPoint pos = GetPosition(); // dc.Blit(0, // 0, // size.GetWidth(), // size.GetHeight(), // &parentDC, // pos.x, // pos.y //// int logicalFunc = wxCOPY, //// bool useMask = false, //// wxCoord xsrcMask = -1, //// wxCoord ysrcMask = -1 // ); wxBitmap bmp(imageCurrent->Scale(size.GetWidth(), size.GetHeight())); dc.DrawBitmap(bmp, 0, 0, true); } } //This is necessary in order to avoid event problems: //event.Skip(); }
void TextField::draw() { const Size& size = getSize(); const int width = size.getWidth(); const int height = size.getHeight(); // draw the button background glColor(getBackgroundColor()); glBegin(GL_TRIANGLE_FAN); { glVertex2i(0, 0 ); glVertex2i(width, 0 ); glVertex2i(width, height); glVertex2i(0, height); } glEnd(); // draw text glColor(getForegroundColor()); /* FontRenderer* renderer = FontRendererCache::getFontRenderer(getFont()); const Insets& i = getInsets(); // int w = width - i.getLeft() - i.getRight(); // int h = height - i.getTop() - i.getBottom(); unsigned int fontHeight = renderer->getHeight(); // unsigned int fontWidth = renderer.getWidth(mText); unsigned int fontAscent = fontHeight - renderer->getDescent(); int textRectX = i.getLeft(); int textRectY = i.getTop(); // int textRectW = width - (i.getRight() + textRectX); // int textRectH = height - (i.getBottom() + textRectY); int fontX = textRectX; int fontY = textRectY + fontAscent; if(hasFocus()) { std::string cursor = "|"; renderer->draw(cursor, fontX+mCursorScreenPosition, fontY); } renderer->draw(mText, fontX, fontY);*/ }
void TextField::draw(Graphics* graphics) { Color faceColor = getBaseColor(); Color highlightColor, shadowColor; int alpha = getBaseColor().a; highlightColor = faceColor + 0x303030; highlightColor.a = alpha; shadowColor = faceColor - 0x303030; shadowColor.a = alpha; // Draw a border. graphics->setColor(shadowColor); graphics->drawLine(0, 0, getWidth() - 1, 0); graphics->drawLine(0, 1, 0, getHeight() - 2); graphics->setColor(highlightColor); graphics->drawLine(getWidth() - 1, 1, getWidth() - 1, getHeight() - 1); graphics->drawLine(0, getHeight() - 1, getWidth() - 1, getHeight() - 1); // Push a clip area so the other drawings don't need to worry // about the border. graphics->pushClipArea(Rectangle(1, 1, getWidth() - 2, getHeight() - 2)); graphics->setColor(getBackgroundColor()); graphics->fillRectangle(Rectangle(0, 0, getWidth(), getHeight())); if (isFocused()) { graphics->setColor(getSelectionColor()); graphics->drawRectangle(Rectangle(0, 0, getWidth() - 2, getHeight() - 2)); graphics->drawRectangle(Rectangle(1, 1, getWidth() - 4, getHeight() - 4)); } if (isFocused()) { drawCaret(graphics, getFont()->getWidth(mText.substr(0, mCaretPosition)) - mXScroll); } graphics->setColor(getForegroundColor()); graphics->setFont(getFont()); graphics->drawText(mText.c_str(), 3 - mXScroll, 1); graphics->popClipArea(); }
void Text3DOverlay::render(RenderArgs* args) { if (!_renderVisible || !getParentVisible()) { return; // do nothing if we're not visible } Q_ASSERT(args->_batch); auto& batch = *args->_batch; auto transform = getRenderTransform(); batch.setModelTransform(transform); glm::u8vec3 backgroundColor = getBackgroundColor(); glm::vec4 quadColor(toGlm(backgroundColor), getBackgroundAlpha()); glm::vec2 dimensions = getDimensions(); glm::vec2 halfDimensions = dimensions * 0.5f; const float SLIGHTLY_BEHIND = -0.001f; glm::vec3 topLeft(-halfDimensions.x, -halfDimensions.y, SLIGHTLY_BEHIND); glm::vec3 bottomRight(halfDimensions.x, halfDimensions.y, SLIGHTLY_BEHIND); DependencyManager::get<GeometryCache>()->bindSimpleProgram(batch, false, quadColor.a < 1.0f, false, false, false); DependencyManager::get<GeometryCache>()->renderQuad(batch, topLeft, bottomRight, quadColor, _geometryId); // Same font properties as textSize() float maxHeight = (float)_textRenderer->computeExtent("Xy").y * LINE_SCALE_RATIO; float scaleFactor = (maxHeight / FIXED_FONT_SCALING_RATIO) * _lineHeight; glm::vec2 clipDimensions((dimensions.x - (_leftMargin + _rightMargin)) / scaleFactor, (dimensions.y - (_topMargin + _bottomMargin)) / scaleFactor); transform.postTranslate(glm::vec3(-(halfDimensions.x - _leftMargin), halfDimensions.y - _topMargin, 0.001f)); transform.setScale(scaleFactor); batch.setModelTransform(transform); glm::vec4 textColor = { toGlm(_color), getTextAlpha() }; // FIXME: Factor out textRenderer so that Text3DOverlay overlay parts can be grouped by pipeline for a gpu performance increase. _textRenderer->draw(batch, 0, 0, getText(), textColor, glm::vec2(-1.0f), true); }
void TextOverlay::render(RenderArgs* args) { if (!_visible) { return; // do nothing if we're not visible } const float MAX_COLOR = 255.0f; xColor backgroundColor = getBackgroundColor(); glColor4f(backgroundColor.red / MAX_COLOR, backgroundColor.green / MAX_COLOR, backgroundColor.blue / MAX_COLOR, getBackgroundAlpha()); int left = _bounds.left(); int right = _bounds.right() + 1; int top = _bounds.top(); int bottom = _bounds.bottom() + 1; glm::vec2 topLeft(left, top); glm::vec2 bottomRight(right, bottom); DependencyManager::get<GeometryCache>()->renderQuad(topLeft, bottomRight); // Same font properties as textSize() TextRenderer* textRenderer = TextRenderer::getInstance(SANS_FONT_FAMILY, _fontSize, DEFAULT_FONT_WEIGHT); const int leftAdjust = -1; // required to make text render relative to left edge of bounds const int topAdjust = -2; // required to make text render relative to top edge of bounds int x = _bounds.left() + _leftMargin + leftAdjust; int y = _bounds.top() + _topMargin + topAdjust; glColor3f(_color.red / MAX_COLOR, _color.green / MAX_COLOR, _color.blue / MAX_COLOR); float alpha = getAlpha(); QStringList lines = _text.split("\n"); int lineOffset = 0; foreach(QString thisLine, lines) { if (lineOffset == 0) { lineOffset = textRenderer->calculateHeight(qPrintable(thisLine)); } lineOffset += textRenderer->draw(x, y + lineOffset, qPrintable(thisLine), alpha); const int lineGap = 2; lineOffset += lineGap; } }
void ClickLabel::draw(Graphics* graphics) { if (mGuiFont != static_cast<FIFE::GuiFont*> (getFont())) { mGuiFont = static_cast<FIFE::GuiFont*> (getFont()); wrapText(); adjustSize(); } int32_t textX = 0; int32_t textY = 0; graphics->setColor(getBackgroundColor()); graphics->fillRectangle(Rectangle(1, 1, getDimension().width-1, getHeight() - 1)); if (mGuiFont) { if( isTextWrapping() ) { mGuiFont->drawMultiLineString(graphics, mWrappedText, textX, textY); } else { mGuiFont->drawMultiLineString(graphics, mCaption, textX, textY); } } }
/*! * Fermeture du module * */ void CSensorView::close(void) { // Mémorise en EEPROM l'état de la fenêtre m_application->m_eeprom->write(getName(), "geometry", QVariant(m_ihm.geometry())); m_application->m_eeprom->write(getName(), "visible", QVariant(m_ihm.isVisible())); m_application->m_eeprom->write(getName(), "niveau_trace", QVariant((unsigned int)getNiveauTrace())); m_application->m_eeprom->write(getName(), "background_color", QVariant(getBackgroundColor())); QStringList ListXY; QStringList ListName; QString unStringPoint, xString, yString; for(int ind=0;ind<listeAddedSignals.size();ind++) { unStringPoint="("+xString.setNum(listeAddedSignals.at(ind)->addedSignalPosition.x())+"x"; unStringPoint=unStringPoint+yString.setNum(listeAddedSignals.at(ind)->addedSignalPosition.y())+")"; ListXY << unStringPoint; ListName << listeAddedSignals.at(ind)->addedSignalName; } m_application->m_eeprom->write(getName(), "signalsPlacement", QVariant(ListXY)); m_application->m_eeprom->write(getName(), "signalsAdded", QVariant(ListName)); }
bool Label::getProperty(std::string property, std::string& value) const { property = toLower(property); if (property == "configfile") value = getLoadedConfigFile(); else if (property == "text") encodeString(getText(), value); else if (property == "textcolor") value = "(" + to_string(int(getTextColor().r)) + "," + to_string(int(getTextColor().g)) + "," + to_string(int(getTextColor().b)) + "," + to_string(int(getTextColor().a)) + ")"; else if (property == "textsize") value = to_string(getTextSize()); else if (property == "backgroundcolor") value = "(" + to_string(int(getBackgroundColor().r)) + "," + to_string(int(getBackgroundColor().g)) + "," + to_string(int(getBackgroundColor().b)) + "," + to_string(int(getBackgroundColor().a)) + ")"; else if (property == "autosize") value = m_AutoSize ? "true" : "false"; else // The property didn't match return ClickableWidget::getProperty(property, value); // You pass here when one of the properties matched return true; }
void CheckBox::drawBox(Graphics *graphics) { int h = getHeight() - 2; int alpha = getBaseColor().a; Color faceColor = getBaseColor(); faceColor.a = alpha; Color highlightColor = faceColor + 0x303030; highlightColor.a = alpha; Color shadowColor = faceColor - 0x303030; shadowColor.a = alpha; graphics->setColor(shadowColor); graphics->drawLine(1, 1, h, 1); graphics->drawLine(1, 1, 1, h); graphics->setColor(highlightColor); graphics->drawLine(h, 1, h, h); graphics->drawLine(1, h, h - 1, h); graphics->setColor(getBackgroundColor()); graphics->fillRectangle(Rectangle(2, 2, h - 2, h - 2)); graphics->setColor(getForegroundColor()); if (isFocused()) { graphics->drawRectangle(Rectangle(0, 0, h + 2, h + 2)); } if (mMarked) { graphics->drawLine(3, 5, 3, h - 2); graphics->drawLine(4, 5, 4, h - 2); graphics->drawLine(5, h - 3, h - 2, 4); graphics->drawLine(5, h - 4, h - 4, 5); } }
void tmx::Tilemap::tell() { std::cout << "==MAP==" << "\n\n" << "Version: " << getVersion() << "\n" << "Orientation: " << getOrientation() << "\n" << "Width: " << getWidth() << "\n" << "Height: " << getHeight() << "\n" << "Tile width: " << getTileWidth() << "\n" << "Tile height: " << getTileHeight() << "\n" << "Background color: " << getBackgroundColor() << "\n" << "# of tilesets: " << mTileset.size() << "\n" << "# of layers: " << mLayer.size() << "\n" << "# of objectgroups: " << mObjectGroup.size() << "\n" << "# of imagelayers: " << mImageLayer.size() << "\n\n" << "==TILESETS==" << "\n" << std::endl; for(std::vector<Tileset>::size_type i = 0; i != mTileset.size(); ++i) { mTileset[i].tell(); } std::cout << "\n==LAYERS==\n" << std::endl; for(std::vector<Layer>::size_type i = 0; i != mLayer.size(); ++i) { mLayer[i].tell(); } std::cout << "\n==OBJECT GROUPS==\n" << std::endl; for(std::vector<Objectgroup>::size_type i = 0; i != mObjectGroup.size(); ++i) { mObjectGroup[i].tell(); } std::cout << "\n==IMAGE LAYERS==\n" << std::endl; for(std::vector<Imagelayer>::size_type i = 0; i != mImageLayer.size(); ++i) { mImageLayer[i].tell(); } }
void TextBox::draw(Graphics* graphics) { unsigned int i; if (mOpaque) { graphics->setColor(getBackgroundColor()); graphics->fillRectangle(Rectangle(0, 0, getWidth(), getHeight())); } if (hasFocus() && isEditable()) { drawCaret(graphics, getFont()->getWidth(mTextRows[mCaretRow].substr(0, mCaretColumn)), mCaretRow * getFont()->getHeight()); } graphics->setColor(getForegroundColor()); graphics->setFont(getFont()); for (i = 0; i < mTextRows.size(); i++) { // Move the text one pixel so we can have a caret before a letter. graphics->drawText(mTextRows[i], 1, i * getFont()->getHeight()); } }
void eTextInputField::drawCursor() { // eDebug("length = %d", isotext.length()); if ( !cursorRect.isEmpty() ) eWidget::invalidate(cursorRect); cursorRect.setTop((deco_selected?crect_selected.bottom():deco?crect.bottom():clientrect.bottom())-4); cursorRect.setHeight( 3 ); if ( isotext.length() ) // text exist? { if ( (int)isotext.length() > curPos) // before or on the last char? { const eRect &bbox = editLabel->getPara()->getGlyphBBox(curPos); if ( !bbox.width() ) // Space { if (curPos) // char before space? { const eRect &bbBefore = editLabel->getPara()->getGlyphBBox(curPos-1); cursorRect.setLeft( bbBefore.right()+2 ); } if ( (int)isotext.length() > curPos+1) // char after space ? { const eRect &bbAfter = editLabel->getPara()->getGlyphBBox(curPos+1); cursorRect.setRight( bbAfter.left()-2 ); } else // no char behind Space cursorRect.setWidth( 10 ); } else { cursorRect.setLeft( bbox.left() ); cursorRect.setWidth( bbox.width() ); } } else // we are behind the last character { const eRect &bbox = editLabel->getPara()->getGlyphBBox(isotext.length()-1); cursorRect.setLeft( bbox.right() + ( ( curPos-isotext.length() ) * 10 ) + 2 ); cursorRect.setWidth( 10 ); } } else // no one character in text { cursorRect.setLeft( 0 ); cursorRect.setWidth( 10 ); } eRect tmp = deco_selected?crect_selected:deco?crect:clientrect; if ( cursorRect.right() > scroll.top().second ) { int newpos = scroll.top().first + cursorRect.left(); scroll.push( std::pair<int,int>( newpos, newpos+tmp.width() ) ); editLabel->move( ePoint( (-newpos)+tmp.left(), editLabel->getPosition().y() ) ); } else if ( scroll.size() > 1 && cursorRect.left() < scroll.top().first ) { scroll.pop(); editLabel->move( ePoint( (-scroll.top().first)+tmp.left() , editLabel->getPosition().y() ) ); } cursorRect.moveBy( (deco_selected?crect_selected.left():deco?crect.left():clientrect.left())-scroll.top().first+1, 0 ); gPainter *painter = getPainter( eRect( ePoint(0,0), size ) ); painter->setForegroundColor( getForegroundColor() ); painter->setBackgroundColor( getBackgroundColor() ); painter->fill( cursorRect ); if(capslock) { if ( !capsRect.isEmpty() ) eWidget::invalidate( capsRect ); capsRect=cursorRect; capsRect.setTop(deco_selected?crect_selected.top():deco?crect.top():clientrect.top()); capsRect.setHeight( 3 ); painter->fill( capsRect ); } if (deco_selected && have_focus) deco_selected.drawDecoration(painter, ePoint(width(), height())); else if (deco) deco.drawDecoration(painter, ePoint(width(), height())); delete painter; }
void Text3DOverlay::render(RenderArgs* args) { if (!_visible) { return; // do nothing if we're not visible } glPushMatrix(); { glTranslatef(_position.x, _position.y, _position.z); glm::quat rotation; if (_isFacingAvatar) { // rotate about vertical to face the camera rotation = Application::getInstance()->getCamera()->getRotation(); } else { rotation = getRotation(); } glm::vec3 axis = glm::axis(rotation); glRotatef(glm::degrees(glm::angle(rotation)), axis.x, axis.y, axis.z); const float MAX_COLOR = 255.0f; xColor backgroundColor = getBackgroundColor(); glm::vec4 quadColor(backgroundColor.red / MAX_COLOR, backgroundColor.green / MAX_COLOR, backgroundColor.blue / MAX_COLOR, getBackgroundAlpha()); glm::vec2 dimensions = getDimensions(); glm::vec2 halfDimensions = dimensions * 0.5f; const float SLIGHTLY_BEHIND = -0.005f; glm::vec3 topLeft(-halfDimensions.x, -halfDimensions.y, SLIGHTLY_BEHIND); glm::vec3 bottomRight(halfDimensions.x, halfDimensions.y, SLIGHTLY_BEHIND); DependencyManager::get<GeometryCache>()->renderQuad(topLeft, bottomRight, quadColor); // Same font properties as textSize() TextRenderer* textRenderer = TextRenderer::getInstance(SANS_FONT_FAMILY, FIXED_FONT_POINT_SIZE); float maxHeight = (float)textRenderer->computeExtent("Xy").y * LINE_SCALE_RATIO; float scaleFactor = (maxHeight / FIXED_FONT_SCALING_RATIO) * _lineHeight; glTranslatef(-(halfDimensions.x - _leftMargin), halfDimensions.y - _topMargin, 0.0f); glm::vec2 clipMinimum(0.0f, 0.0f); glm::vec2 clipDimensions((dimensions.x - (_leftMargin + _rightMargin)) / scaleFactor, (dimensions.y - (_topMargin + _bottomMargin)) / scaleFactor); glScalef(scaleFactor, -scaleFactor, scaleFactor); enableClipPlane(GL_CLIP_PLANE0, -1.0f, 0.0f, 0.0f, clipMinimum.x + clipDimensions.x); enableClipPlane(GL_CLIP_PLANE1, 1.0f, 0.0f, 0.0f, -clipMinimum.x); enableClipPlane(GL_CLIP_PLANE2, 0.0f, -1.0f, 0.0f, clipMinimum.y + clipDimensions.y); enableClipPlane(GL_CLIP_PLANE3, 0.0f, 1.0f, 0.0f, -clipMinimum.y); glm::vec4 textColor = { _color.red / MAX_COLOR, _color.green / MAX_COLOR, _color.blue / MAX_COLOR, getAlpha() }; textRenderer->draw(0, 0, _text, textColor); glDisable(GL_CLIP_PLANE0); glDisable(GL_CLIP_PLANE1); glDisable(GL_CLIP_PLANE2); glDisable(GL_CLIP_PLANE3); } glPopMatrix(); }
ossimRefPtr<ossimProperty> ossimNitfFileHeaderV2_1::getProperty(const ossimString& name)const { ossimProperty* property = 0; ossimStringProperty* stringProperty = 0; ossimColorProperty* colorProperty = 0; if(name == CLEVEL_KW) { property = new ossimStringProperty(name, getComplexityLevel().trim()); } else if(name == FSCLASY_KW) { property = new ossimStringProperty(name, getSecurityClassificationSys().trim()); } else if(name == FSDCTP_KW) { property = new ossimStringProperty(name, getDeclassificationType().trim()); } else if(name == FSDCDT_KW) { property = new ossimStringProperty(name, getDeclassificationDate().trim()); } else if(name == FSDCXM_KW) { property = new ossimStringProperty(name, getDeclassificationExemption().trim()); } else if(name == FSDG_KW) { stringProperty = new ossimStringProperty(name, getDowngrade().trim(), false); stringProperty->addConstraint(""); stringProperty->addConstraint("S"); stringProperty->addConstraint("C"); stringProperty->addConstraint("R"); property = stringProperty; } else if(name == FSDGDT_KW) { property = new ossimStringProperty(name, getDowngradingDate().trim()); } else if(name == FSCLTX_KW) { property = new ossimStringProperty(name, getClassificationText().trim()); } else if(name == FSCATP_KW) { stringProperty = new ossimStringProperty(name, getClassificationAuthorityType().trim(), false); stringProperty->addConstraint(""); stringProperty->addConstraint("O"); stringProperty->addConstraint("D"); stringProperty->addConstraint("M"); property = stringProperty; } else if(name == FSCRSN_KW) { stringProperty = new ossimStringProperty(name, getClassificationReason().trim(), false); stringProperty->addConstraint(""); stringProperty->addConstraint("A"); stringProperty->addConstraint("B"); stringProperty->addConstraint("C"); stringProperty->addConstraint("D"); stringProperty->addConstraint("E"); stringProperty->addConstraint("F"); stringProperty->addConstraint("G"); property = stringProperty; } else if(name == FSSRDT_KW) { property = new ossimStringProperty(name, getSecuritySourceDate().trim()); } else if(name == FBKGC_KW) { ossim_uint8 r, g, b; getBackgroundColor(r, g, b); colorProperty = new ossimColorProperty(name, ossimRgbVector(r, g, b)); property = colorProperty; } else if(name == ONAME_KW) { property = new ossimStringProperty(name, ossimString(theOriginatorsName).trim()); } else if(name == OPHONE_KW) { property = new ossimStringProperty(name, ossimString(theOriginatorsPhone).trim()); } else { return ossimNitfFileHeaderV2_X::getProperty(name); } return property; }