void ofxUIImageSlider::drawFillHighlight() { if(draw_fill_highlight) { ofxUISetColor(255); if(kind == OFX_UI_WIDGET_IMAGESLIDER_H) { if(value > 0.00) progressleft->draw(rect->getX(), rect->getY(), tlaspect*rect->getHeight(), rect->getHeight()); progress->draw(rect->getX()+rect->getHeight()*tlaspect-1,rect->getY(),(rect->getWidth() - 2.0*rect->getHeight()*tlaspect)*value + 1, rect->getHeight()); if(value > .99) progressright->draw(rect->getX()+rect->getWidth() - tlaspect*rect->getHeight(), rect->getY(), tlaspect*rect->getHeight(), rect->getHeight()); ofxUISetRectMode(OFX_UI_RECTMODE_CENTER); ofxUISetColor(255); handleDown->draw(imageRect->getX()+value*imageRect->getWidth(), rect->getY()+rect->getHalfHeight(), ratio*handle->getWidth(), ratio*handle->getHeight()); ofxUISetRectMode(OFX_UI_RECTMODE_CORNER); } else { } if(kind == OFX_UI_WIDGET_IMAGESLIDER_V) { label->drawString(imageRect->getX()+imageRect->getWidth()+padding, label->getRect()->getHeight()/2.0+imageRect->getY()+imageRect->getHeight()-imageRect->getHeight()*value, ofxUIToString(getScaledValue(),labelPrecision)); } } }
void ofxUIValuePlotter::drawFill() { if(draw_fill) { ofNoFill(); if(draw_fill_highlight) { ofxUISetColor(color_fill_highlight); } else { ofxUISetColor(color_fill); } ofPushMatrix(); ofTranslate(rect->getX(), rect->getY()+scale, 0); ofSetLineWidth(2.0); ofBeginShape(); for (unsigned int i = 0; i < bufferSize; i++) { ofVertex(inc*(float)i, ofxUIMap(buffer[i], min, max, scale, -scale, true)); } ofEndShape(); ofSetLineWidth(1); ofPopMatrix(); } }
void ofxUISpectrum::drawFill() { if(draw_fill) { ofxUIFill(); if(draw_fill_highlight) { ofxUISetColor(color_fill_highlight); } else { ofxUISetColor(color_fill); } if(buffer != NULL) { ofPushMatrix(); ofTranslate(rect->getX(), rect->getY()+scale, 0); ofBeginShape(); ofVertex(0, 0); for (int i = 0; i < bufferSize; i++) { ofVertex(inc*(float)i, ofxUIMap(buffer[i], min, max, 0, -scale, true)); } ofVertex((bufferSize-1)*inc, 0); ofEndShape(true); ofPopMatrix(); } } }
void ofxUICircleSlider::drawFillHighlight() { if(draw_fill_highlight) { ofxUIFill(); ofxUISetColor(color_fill_highlight); ofxUICircle(rect->getX()+rect->getHalfWidth(), rect->getY()+rect->getHalfHeight(), value*rect->getHalfWidth()); ofxUISetColor(label->getColorFillHighlight()); label->drawString(rect->getX()+rect->getWidth()+padding, label->getRect()->getHeight()/2.0+rect->getY()+rect->getHeight()-rect->getHeight()*.5, ofxUIToString(getScaledValue(),labelPrecision)); } }
void ofxUIImageSampler::drawFillHighlight() { if(draw_fill_highlight) { ofxUISetColor(color_fill_highlight); ofxUIDrawLine(rect->getX()+value.x*rect->getWidth(), rect->getY(), rect->getX()+value.x*rect->getWidth(), rect->getY()+rect->getHeight()); ofxUIDrawLine(rect->getX(), rect->getY()+value.y*rect->getHeight(), rect->getX()+rect->getWidth(), rect->getY()+value.y*rect->getHeight()); ofxUIFill(); ofxUISetColor(sampledColor); ofxUISetRectMode(OFX_UI_RECTMODE_CENTER); ofxUIDrawRect(rect->getX()+value.x*rect->getWidth(), rect->getY()+value.y*rect->getHeight(), squareSize, squareSize); ofxUISetRectMode(OFX_UI_RECTMODE_CORNER); } }
void ofxUIWidget::drawPadded() { if(draw_padded_rect && !embedded) { ofxUIFill(); ofxUISetColor(color_padded_rect); drawComponent(skin_padded,paddedRect); } }
void ofxUIWidget::drawFillHighlight() { if(draw_fill_highlight) { ofxUIFill(); ofxUISetColor(color_fill_highlight); drawComponent(skin_fill_highlight,rect); } }
void ofxUIWidget::drawFill() { if(draw_fill) { ofxUIFill(); ofxUISetColor(color_fill); drawComponent(skin_fill,rect); } }
void ofxUIWidget::drawOutlineHighlight() { if(draw_outline_highlight) { ofxUINoFill(); ofxUISetColor(color_outline_highlight); drawComponent(skin_outline_highlight,rect); } }
void ofxUIWidget::drawPaddedOutline() { if(draw_padded_rect_outline && !embedded) { ofxUINoFill(); ofxUISetColor(color_padded_rect_outline); drawComponent(skin_padded_outline,paddedRect); } }
void ofxUILabel::drawFill() { if(draw_fill) { ofxUIFill(); ofxUISetColor(color_fill); // --! int px=0, py=0; ofxUIRectangle* parentRect = rect; // 循环到canvas的上一层 while(parentRect->getParent() != NULL) { px += parentRect->x; py += parentRect->y; parentRect = parentRect->getParent(); } font->drawString(label, floor(px)+xOffset, floor(py+rect->getHeight())+yOffset); //font->drawString(label, floor(rect->x)+xOffset, floor(rect->y+rect->getHeight())+yOffset); // getX()和getY()并非实际意义上的xy 而是加了parent之后的坐标 //cout << label << floor(rect->getX()) << ", " << floor(rect->getY()) << endl; //drawStringShadow(floor(rect->getX())+xOffset, floor(rect->getY()+rect->getHeight())+yOffset, label); } }
void ofxUIWidget::drawBack() { if(draw_back) { ofxUIFill(); ofxUISetColor(color_back); drawComponent(skin_back, rect); } }
void ofxUIWidget::drawOutline() { if(draw_outline) { ofxUINoFill(); ofxUISetColor(color_outline); drawComponent(skin_outline,rect); } }
void ofxUIMultiImageToggle::drawOutlineHighlight() //OVER { if(draw_outline_highlight) { ofxUISetColor(255); over->draw(rect->getX(), rect->getY(), rect->getWidth(), rect->getHeight()); } }
void ofxUIMultiImageToggle::drawBack() //NORMAL { if(draw_back && !draw_fill) { ofxUISetColor(255); back->draw(rect->getX(), rect->getY(), rect->getWidth(), rect->getHeight()); } }
void ofxUIMultiImageToggle::drawFill() { if(draw_fill) { ofxUISetColor(255); on->draw(rect->getX(), rect->getY(), rect->getWidth(), rect->getHeight()); } }
void ofxUIMultiImageToggle::drawFillHighlight() //DOWN/ON { if(draw_fill_highlight) { ofxUISetColor(255); down->draw(rect->getX(), rect->getY(), rect->getWidth(), rect->getHeight()); } }
void ofxUICircleSlider::drawBack() { if(draw_back) { ofxUIFill(); ofxUISetColor(color_back); ofxUICircle(rect->getX()+rect->getHalfWidth(), rect->getY()+rect->getHalfHeight(), rect->getHalfWidth()); } }
void ofxUIWidget::drawPaddedOutline() { if(draw_padded_rect_outline && !embedded) { ofxUINoFill(); ofxUISetColor(color_padded_rect_outline); paddedRect->draw(); } }
void ofxUIWidget::drawPadded() { if(draw_padded_rect && !embedded) { ofxUIFill(); ofxUISetColor(color_padded_rect); paddedRect->draw(); } }
void ofxUIWidget::drawFillHighlight() { if(draw_fill_highlight) { ofxUIFill(); ofxUISetColor(color_fill_highlight); rect->draw(); } }
void ofxUIWidget::drawFill() { if(draw_fill) { ofxUIFill(); ofxUISetColor(color_fill); rect->draw(); } }
void ofxUIWidget::drawOutlineHighlight() { if(draw_outline_highlight) { ofxUINoFill(); ofxUISetColor(color_outline_highlight); rect->draw(); } }
void ofxUIWidget::drawOutline() { if(draw_outline) { ofxUINoFill(); ofxUISetColor(color_outline); rect->draw(); } }
void ofxUIWidget::drawBack() { if(draw_back) { ofxUIFill(); ofxUISetColor(color_back); rect->draw(); } }
void ofxUICircleSlider::drawFill() { if(draw_fill) { ofxUIFill(); ofxUISetColor(color_fill); ofxUICircle(rect->getX()+rect->getHalfWidth(), rect->getY()+rect->getHalfHeight(), value*rect->getHalfWidth()); } }
void ofxUILabel::drawStringShadow(float x, float y, string _string) { ofxUIFill(); ofxUISetColor(color_back); // --!ofxUI只是ofTrueTypeFont的别称 // --!floor()返回小于或者等于指定表达式的最大整数 即向上取整 //if(bDrawString == true) font->drawString(_string, floor(x)+1, floor(y)+1); }
void ofxUIScrollableCanvas::drawPadded() { if(draw_padded_rect && !embedded) { ofxUIFill(); ofxUISetColor(color_padded_rect); paddedRect->draw(); } }
void ofxUIScrollableCanvas::drawPaddedOutline() { if(draw_padded_rect_outline && !embedded) { ofNoFill(); ofxUISetColor(color_padded_rect_outline); paddedRect->draw(); } }
void ofxUICircleSlider::drawOutline() { if(draw_outline) { ofNoFill(); ofxUISetColor(color_outline); ofxUICircle(rect->getX()+rect->getHalfWidth(), rect->getY()+rect->getHalfHeight(), rect->getHalfWidth()); } }