Пример #1
0
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));
        }
    }
}
Пример #2
0
void ofxUIEnvelopeEditor::drawEnvelope(){
    
    vector<ofVec3f> points = envelope->getPoints();
    int size = points.size();
    float rX = rect->getX();
    float rY = rect->getY();
    
    ofxUISetRectMode(OFX_UI_RECTMODE_CENTER);
    ofxUINoFill();
    for (int i = 0; i < size; i++)
    {
        float x = rX + points[i].x*rect->getWidth();
        float y = rY + points[i].y*rect->getHeight();
        
        ofxUICircle(x, y, pointNodeRadius);
        
        if(i < size-1)
        {
            float nx = rX + points[i+1].x*rect->getWidth();
            float hx = (x + nx)/2.0;
            ofxUIDrawRect(hx, rY + envelope->getY((hx-rX)/rect->getWidth())*rect->getHeight(), pointNodeRectWidth, pointNodeRectHeight);
        }
    }
    ofxUIFill();
    ofxUISetRectMode(OFX_UI_RECTMODE_CORNER);
    
    polyline.draw();
}
Пример #3
0
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);
    }
}
Пример #4
0
void ofxUIScrollableCanvas::draw()
{
    ofxUIPushStyle();
    
    glDisable(GL_DEPTH_TEST);
    glDisable(GL_LIGHTING);
    ofEnableBlendMode(OF_BLENDMODE_ALPHA);
    ofxUISetRectMode(OFX_UI_RECTMODE_CORNER);
    ofSetLineWidth(1.0);
    
    drawPadded();
    
    drawPaddedOutline();
    
    drawBack();
    
    drawFill();
    
    drawFillHighlight();
    
    drawOutline();
    
    drawOutlineHighlight();
    
    for(vector<ofxUIWidget *>::reverse_iterator it = widgets.rbegin(); it != widgets.rend(); ++it)
    {
        if((*it)->isVisible() && (*it)->getRect()->rInside(*sRect))
        {
            (*it)->draw();
        }
    }
    
    ofxUIPopStyle();
}
Пример #5
0
void ofxUIImageSampler::drawFill()
{
    if(draw_fill)
    {
        if(image != NULL)
        {
            ofxUIFill();
            ofxUISetColor(255);
            image->draw(rect->getX(), rect->getY(), rect->width, rect->height);
        }
        ofxUISetColor(color_fill);
        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);
        
    }
}
Пример #6
0
void ofxUIImageSlider::drawFill()
{
    if(draw_fill)
    {
        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);
            handle->draw(imageRect->getX()+value*imageRect->getWidth(), rect->getY()+rect->getHalfHeight(), ratio*handle->getWidth(), ratio*handle->getHeight());
            ofxUISetRectMode(OFX_UI_RECTMODE_CORNER);
        }
    }
}