Пример #1
0
void RELabel::renderAtWithShadow(const REFloat32 x, const REFloat32 y)
{
	if (_font) 
	{
		RERenderDevice * device = RERenderDevice::defaultDevice();
		RESize ratio(_font->getCharsScaleRatio());
		if (_frame.height != 0.0f) 
		{
			ratio.height *= (_textInsets.adjustedRect(_frame).height / _frame.height);
		}
		REFloat32 penX = x;
		const REFloat32 bottomY = y + _font->getHeight() - _textInsets.bottom - _textInsets.top;
		for (REUInt32 i = 0; i < _chars.count(); i++) 
		{
			RETTFFontChar * fontChar = _chars[i];
			penX += ((ratio.width * fontChar->offsetX) * _charsSpaceRatio);
			const REFloat32 penY = bottomY - (ratio.height * fontChar->offsetY);
			const REFloat32 width = (ratio.width * fontChar->width);
			const REFloat32 height = (ratio.height * fontChar->height);
			device->renderRect(RERect(penX + _shadowOffset.x, penY + _shadowOffset.y, width, height),
							   _shadowColor, 
							   fontChar->textureFrame, 
							   fontChar->texture);
			device->renderRect(RERect(penX, penY, width, height),
							   _textColor, 
							   fontChar->textureFrame, 
							   fontChar->texture);
			penX += (ratio.width * fontChar->advanceX);
		}
	}
}
Пример #2
0
void RESymbolManipulator::CreateHandles(const REPoint& startPoint)
{
    float hsize = 6.0f;
    RERect handleBounds = RERect(-hsize/2, -hsize/2, hsize, hsize);
    
    RERect bounds = _psymbol->Bounds(_staff->UnitSpacing());
    bounds.origin.x -= 2.0;
    bounds.origin.y -= 2.0;
    bounds.size.w += 4.0;
    bounds.size.h += 4.0;
    
    SetPosition(startPoint);
    
    // Start anchor point
    REHandle* startAnchorHandle = new REHandle("start_anchor", this);
    _handles[startAnchorHandle->Identifier()] = startAnchorHandle;
    startAnchorHandle->SetPosition(REPoint(0,0));
    startAnchorHandle->SetBounds(handleBounds);
    
    // start point
    REHandle* startHandle = new REHandle("start", this);
    _handles[startHandle->Identifier()] = startHandle;
    startHandle->SetPosition(_psymbol->Offset());
    startHandle->SetBounds(bounds);
    
    RefreshBounds();
}
Пример #3
0
void RENoteToolHoverManipulator::Draw(REPainter& painter) const
{
    painter.SetStrokeColor(REColor::Green);
    painter.StrokeRect(RERect(-3.5, -3.5, 8.0, 8.0));
    
    painter.DrawMusicSymbol("quarter", 0, 0, 7.0);
    
}
Пример #4
0
RERect RENoteToolHoverManipulator::ManipulatedItemBounds()
{
    RERect bounds = RERect(-5, -5, 10, 10);
    bounds.origin.x -= 2.0;
    bounds.origin.y -= 2.0;
    bounds.size.w += 4.0;
    bounds.size.h += 4.0;
    
    return bounds;
}
Пример #5
0
RERect REPainter::BoundingBoxOfMusicSymbol(const char* symbol, float size)
{
    REMusicalFont* font = REMusicalFont::BuiltinFont();
    assert(font != NULL);

    REMusicalGlyph* glyph = font->GlyphNamed(symbol);
    if(glyph == NULL) return RERect(0,0,0,0);

    return glyph->BoundingBoxForSize(size);
}
Пример #6
0
/// Setting rectangular frame of view.
void RETextField::SetFrame(const RERect & newViewFrame)
{
	RELabel::setFrame(newViewFrame);
	
	if (_cursorView) 
	{
		const REFloat32 w2px = 2.0f * RERenderDevice::defaultDevice()->screenToRenderSizeRatio().width;
		_cursorView->setFrame(RERect(0.0f, 0.0f, w2px, newViewFrame.height));
	}
}
Пример #7
0
RERect REView::screenFrame() const
{
	REView * parent = dynamic_cast<REView *>(this->parentSubviewsContainer());
    if (parent)
	{
		RERect parentScreenFrame(parent->screenFrame());
		return RERect(_frame.x + parentScreenFrame.x,
					  _frame.y + parentScreenFrame.y,
					  _frame.width,
					  _frame.height);
	}
	return _frame;
}
Пример #8
0
void RESlurManipulator::CreateHandles(const REPoint& startPoint, const REPoint& endPoint)
{
    float hsize = 6.0f;
    RERect handleBounds = RERect(-hsize/2, -hsize/2, hsize, hsize);
    
    SetPosition(startPoint);
    REPoint deltaEnd = (endPoint - startPoint);
    
    // Start anchor point
    REHandle* startAnchorHandle = new REHandle("start_anchor", this);
    _handles[startAnchorHandle->Identifier()] = startAnchorHandle;
    startAnchorHandle->SetPosition(REPoint(0,0));
    startAnchorHandle->SetBounds(handleBounds);
    startAnchorHandle->SetDraggable(false);
    
    // End anchor point
    REHandle* endAnchorHandle = new REHandle("end_anchor", this);
    _handles[endAnchorHandle->Identifier()] = endAnchorHandle;
    endAnchorHandle->SetPosition(deltaEnd);
    endAnchorHandle->SetBounds(handleBounds);
    endAnchorHandle->SetDraggable(false);
    
    // start point
    REHandle* startHandle = new REHandle("start", this);
    _handles[startHandle->Identifier()] = startHandle;
    startHandle->SetPosition(_pslur->StartOffset());
    startHandle->SetBounds(handleBounds);
    
    // end point
    REHandle* endHandle = new REHandle("end", this);
    _handles[endHandle->Identifier()] = endHandle;
    endHandle->SetPosition(_pslur->EndOffset() + deltaEnd);
    endHandle->SetBounds(handleBounds);
    
    // start control point
    REHandle* scp = new REHandle("start_cp", this);
    scp->SetParent(startHandle);
    _handles[scp->Identifier()] = scp;
    scp->SetPosition(_pslur->StartControlPointOffset());
    scp->SetBounds(handleBounds);
    
    // end control point
    REHandle* ecp = new REHandle("end_cp", this);
    ecp->SetParent(endHandle);
    _handles[ecp->Identifier()] = ecp;
    ecp->SetPosition(_pslur->EndControlPointOffset());
    ecp->SetBounds(handleBounds);
    
    RefreshBounds();
}
Пример #9
0
void REManipulator::RefreshBounds()
{
    RERect rc = ManipulatedItemBounds();
    
    if(_handles.empty() && rc.Width() == 0 && rc.Height() == 0) return;

    bool first = true;
    
    float minLeft = 0;
    float maxRight = 0;
    float minTop = 0;
    float maxBottom = 0;
    
    {
        RERect rc = ManipulatedItemBounds();
        if(rc.Width() != 0 && rc.Height() != 0)
        {
            minLeft = rc.Left();
            minTop = rc.Top();
            maxRight = rc.Right();
            maxBottom = rc.Bottom();
            first = false;
        }
    }
    
    for(auto it : _handles)
    {
        REHandle* h = it.second;
        RERect rc = RectFromSceneToLocal(h->SceneFrame());
        if(!first) {
            minLeft = std::min<float>(rc.Left(), minLeft);
            minTop = std::min<float>(rc.Top(), minTop);
            maxRight = std::max<float>(rc.Right(), maxRight);
            maxBottom = std::max<float>(rc.Bottom(), maxBottom);
        }
        else {
            first = false;
            minLeft = rc.Left();
            minTop = rc.Top();
            maxRight = rc.Right();
            maxBottom = rc.Bottom();
        }
    }
    SetBounds(RERect(minLeft, minTop, maxRight-minLeft, maxBottom-minTop));
    if(ViewportItem()) {
        static_cast<REViewportManipulatorItem*>(ViewportItem())->UpdateFrame();
    }
}