• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ VGDevice类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中VGDevice的典型用法代码示例。如果您正苦于以下问题:C++ VGDevice类的具体用法?C++ VGDevice怎么用?C++ VGDevice使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了VGDevice类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: DrawWithLines

// --------------------------------------------------------------------------
void GRBar::DrawWithLines( VGDevice & hdc ) const
{
	if ((getTagType() != GRTag::SYSTEMTAG) && isSystemSlice())
		return;			// don't draw staff bars on system slices

    const float staffSize = mGrStaff->getSizeRatio();

    if (staffSize < kMinNoteSize) // Too small, don't draw
        return;

    // - Vertical adjustement according to staff's line number
    float offsety1 = (fmod(- 0.5f * fLineNumber - 2, 3) + 1.5f) * LSPACE;
    float offsety2 = 0;

    if (fLineNumber != 0 && fLineNumber != 1)
        offsety2 = ((fLineNumber - 5) % 6) * LSPACE;

    const float offsetX = 3 + (staffSize - 1) * 2;

    const float x = mPosition.x + offsetX;
	const float y1 = mPosition.y + mBoundingBox.top + offsety1 * staffSize;
	const float y2 = y1 + mBoundingBox.bottom + offsety2 * staffSize;

    hdc.PushPenWidth( mGrStaff ? mGrStaff->currentLineThikness() * staffSize : kLineThick * staffSize );
    hdc.Line(x, y1, x, y2);
    hdc.PopPenWidth();
}
开发者ID:iloveican,项目名称:AscoGraph,代码行数:28,代码来源:GRBar.cpp


示例2: float

void GRClef::OnDraw(VGDevice & hdc) const
{
// DrawBoundingBox( hdc, GColor( 255, 200, 0, 150)); // DEBUG
	if (error) return;

	GRTagARNotationElement::OnDraw(hdc);
	if( mDoubleTreble )
	{
		const float xOffset = ((mRightSpace + mLeftSpace) * float(0.5)) - LSPACE * float(0.2);
		OnDrawSymbol( hdc, mSymbol, xOffset, 0 );
	}
	else if( mOctaveStr ) // Draws the octava
	{
		const int fontSize = (int)(float(1.5) * LSPACE);
		NVstring textFont ( FontManager::kDefaultTextFont );
		const VGFont* fontRef = FontManager::FindOrCreateFont( fontSize, &textFont );

		const float octX = mPosition.x + mOctaveOffset.x;
		const float octY = mPosition.y +  mOctaveOffset.y;

//		hdc.SelectFont( fontRef );		
		hdc.SetTextFont( fontRef );		
//		hdc.SetMusicFont( fontRef );		
		hdc.SetFontAlign( VGDevice::kAlignBottom | VGDevice::kAlignCenter ); 
		hdc.DrawString( octX, octY, mOctaveStr, (int)strlen(mOctaveStr) );
	}
}
开发者ID:hanshoglund,项目名称:guido-engine,代码行数:27,代码来源:GRClef.cpp


示例3: OnDraw

void GRSimpleBeam::OnDraw( VGDevice & hdc ) const
{
	const unsigned char * colref = getColRef();

	if (colref) {
		VGColor color ( colref ); 	// custom or black
		hdc.PushFillColor( color );
		hdc.PushPen( color, 1 );
	}
	float ax [4] = { fPoints[0].x, fPoints[1].x, fPoints[3].x, fPoints[2].x };
	float ay [4] = { fPoints[0].y, fPoints[1].y, fPoints[3].y, fPoints[2].y };


// DF added to check for incorrect coordinates
// makes sure that the right point is not to the left of the left point :-)
// actually this should be checked at coordinates computation time
// todo: check the object that computes the beam coordinates
	if (ax[0] > ax[2]) { ax[2] = ax[0]; }
	if (ax[1] > ax[3]) { ax[3] = ax[1]; }
	
	// This does the drawing!
	hdc.Polygon( ax, ay, 4 );

	// - Cleanup
	if (colref) {
		hdc.PopPen();
		hdc.PopFillColor();
	}
}
开发者ID:EQ4,项目名称:guido-engine,代码行数:29,代码来源:GRSimpleBeam.cpp


示例4: getColRef

/** \brief Draws a musical symbol glyph at given position into input graphic device context.
	It possible to scale the symbol, by specifying a font height and a x-scale.
*/
void 
GRNotationElement::OnDrawSymbol( VGDevice & hdc, unsigned int inSymbol,
								   float inOffsetX, float inOffsetY,
								   float inFontSize ) const //, float inScaleX ) const
{
	// - Setup colors
	if(!mDraw)
		return;
	const unsigned char * colref = getColRef();
	const VGColor prevFontColor = hdc.GetFontColor();
  	if (colref)
		hdc.SetFontColor( VGColor( colref ));

		// 	int nBackmode = hdc.GetBackgroundMode();
		// 	hdc.SetBackgroundMode( VGDevice::kModeTransparent );

	// - Setup text align 
	hdc.SetFontAlign(getTextAlign());

	// - Draw
	DrawSymbol( hdc, inSymbol, inOffsetX, inOffsetY, inFontSize );

//	DrawBoundingBox( hdc, VGColor(0,0,200)); // debug 


	// - Restore context
	if (colref)
		hdc.SetFontColor( prevFontColor );  //(TODO: in a parent method)
}
开发者ID:iloveican,项目名称:AscoGraph,代码行数:32,代码来源:GRNotationElement.cpp


示例5: DrawWithLines

// --------------------------------------------------------------------------
void GRDoubleBar::DrawWithLines( VGDevice & hdc ) const
{
	if ((getTagType() != GRTag::SYSTEMTAG) && isSystemSlice())
		return;			// don't draw staff bars on system slices
    
    if (fSize < kMinNoteSize) // Too small, don't draw
        return;

    // - Vertical adjustement according to staff's line number
    float offsety1 = (fmod(- 0.5f * fLineNumber - 2, 3) + 1.5f) * LSPACE;
    float offsety2 = 0;

    if (fLineNumber != 0 && fLineNumber != 1)
        offsety2 = ((fLineNumber - 5) % 6) * LSPACE;

    // - Horizontal adjustement according to staff's lines size and staff's size
    const float offsetX = (fStaffThickness - 4) * 0.5f - 24;

    const float spacing = LSPACE * 0.7f * fSize;
	const float x1 = mPosition.x + offsetX;
	const float x2 = x1 + spacing;
	const float y1 = mPosition.y + mBoundingBox.top + offsety1 * fSize;
	const float y2 = y1 + mBoundingBox.bottom + offsety2 * fSize;

    float lineThickness = kLineThick * 1.5f * fSize;

    hdc.PushPenWidth(lineThickness);
    hdc.Line(x1, y1 + lineThickness / 2, x1, y2 - lineThickness / 2);
    hdc.Line(x2, y1 + lineThickness / 2, x2, y2 - lineThickness / 2);
    hdc.PopPenWidth();
}
开发者ID:iloveican,项目名称:AscoGraph,代码行数:32,代码来源:GRDoubleBar.cpp


示例6: getSize

/** \brief Low-level symbol drawing.
*/
void 
GRNotationElement::DrawSymbol( VGDevice & hdc, unsigned int inSymbol,
								   float inOffsetX, float inOffsetY,
								   float inFontSize ) const
{
	if(!mDraw)
		return;
	// - Setup font

	const VGFont* myfont = FontManager::gFontScriab;
	const float theSize = (inFontSize != 0) ? inFontSize : getSize();
	if (theSize < kMinNoteSize) return;		// element is too small, don't draw it

	if (theSize != float(1.0))
	{
		const int newFontSize = (int)(theSize * 4 * LSPACE + 0.5f ); // +0.5 to round from float to int.
		myfont = FontManager::FindOrCreateFont( newFontSize );
	}
//	hdc.SelectFont( myfont );
	hdc.SetMusicFont( myfont );

	// - Setup position
	const NVPoint & offset = getOffset();
  	const NVPoint & refpos = getReferencePosition();
	const float xPos = mPosition.x + offset.x + (refpos.x * theSize) + inOffsetX;
	const float yPos = mPosition.y + offset.y + (refpos.y * theSize) + inOffsetY;

	// - Draw
	hdc.DrawMusicSymbol( xPos, yPos, inSymbol );

#ifdef SHOWRODS
	// draw the rods ....
	const float leftspc = getLeftSpace();
	const float rightspc = getRightSpace();

   	if (leftspc)
	{
		const float myposy = 350;		
		hdc.PushPen(VGColor( 0, 0, 200 ), 5 );	// Always blue		
		hdc.Line( mPosition.x-leftspc,myposy-30, mPosition.x-leftspc,myposy+30 );
		hdc.Line( mPosition.x-leftspc, myposy, mPosition.x, myposy );
		hdc.PopPen();
	}
  	if (rightspc)
	{
		const float myposy = 350;
		hdc.PushPen(VGColor( 0, 0, 200 ), 5 );	// Always blue		
		hdc.Line( mPosition.x+rightspc, myposy-30, mPosition.x+rightspc, myposy+30 );
		hdc.LineTo( mPosition.x+rightspc, myposy, mPosition.x, myposy );
		hdc.PopPen();
	}
#endif // #ifdef SHOWRODS
}
开发者ID:iloveican,项目名称:AscoGraph,代码行数:55,代码来源:GRNotationElement.cpp


示例7: OnDraw

/** \brief Draws the score page.
*/
void GRPage::OnDraw( VGDevice & hdc ) const
{	
// TODO: test if the element intersect with the clipping box
	GuidoPos pagepos = First();

	while (pagepos)
		GetNext(pagepos)->OnDraw(hdc);

	// - Convert from centimeter to logical.
	const float tstx = mLeftMargin;	// (JB) sign change
	const float tsty = mTopMargin;		// (JB) sign change

	// this resets the window-origin, so that left and top margins are correct ...
	// dont forget to set the clipping-rectangle!
	gClipRect.left -= tstx;
	gClipRect.top -= tsty;
	gClipRect.right -= tstx;
	gClipRect.bottom -= tsty;

	// The following sets the WindowOrigin so that
	// 0,0 is at the top left (including margins)
	//
	//  ---------------
	//  |    mt       |
	//  |  x-------   |
	//  |  |      | mr|
	//  |ml|      |   |
	//  |  --------   |
	//  |    mb       |
	//  |-------------|

	hdc.OffsetOrigin( tstx, tsty ); 

	GRSystem * theSystem;
	SystemPointerList::const_iterator ptr;
	for( ptr = mSystems.begin(); ptr != mSystems.end(); ++ ptr )
	{
		theSystem = *ptr;
		const NVPoint & pos = theSystem->getPosition();
		NVRect br (theSystem->getBoundingBox());
		br += pos;
			
		if( br.Collides( gClipRect ) == false )
			continue;

		gCurSystem = theSystem;
	    theSystem->OnDraw(hdc);
	}

	if (gBoundingBoxesMap & kPageBB)
		DrawBoundingBox( hdc, kPageBBColor);
	hdc.OffsetOrigin( -tstx, -tsty ); 
}
开发者ID:anttirt,项目名称:guidolib,代码行数:55,代码来源:GRPage.cpp


示例8: DPtoLPRect

/** \brief Converts a Rectangle from device coordinades to logical (virtual) coordinates.
*/
bool GRPage::DPtoLPRect( VGDevice & hdc, float left, float top, 
						float right, float bottom, NVRect * outRect ) const
{
	hdc.DeviceToLogical( &left, &top );
	hdc.DeviceToLogical( &right, &bottom );

	outRect->left = left;
	outRect->top = top;
	outRect->right = right;
	outRect->bottom = bottom;

	return true;
}
开发者ID:anttirt,项目名称:guidolib,代码行数:15,代码来源:GRPage.cpp


示例9: drawSlur

/** \brief Rudis Slur-routine (currently unused)
*/
void GRBowing::drawSlur( VGDevice & hdc, NVPoint pstart, NVPoint pmid, NVPoint pend) const
{
	NVRect rectangle ; // rectangle in which the arc is to be drawn.

	rectangle.left = pstart.x;

	if (pstart.y<pmid.y)	rectangle.top=pmid.y;
	else					rectangle.top= (pstart.y-pmid.y)*2 + pmid.y;

	rectangle.right =  (pmid.x-pstart.x)*2 + pstart.x;

	if(pstart.y<pmid.y) rectangle.bottom= pmid.y - (pmid.y-pstart.y)*2;
	else				rectangle.bottom= pmid.y;

	hdc.Arc( rectangle.left, rectangle.top, rectangle.right, rectangle.bottom,
				pstart.x,pstart.y,pmid.x,pmid.y);

	//second arc
	/// pmid.y-=10;

	rectangle.left =  pmid.x - (pend.x - pmid.x);
	if (pmid.y < pend.y)
		rectangle.top =  (pend.y-pmid.y)*2 - pmid.y;
	else
		rectangle.top= pmid.y;

	rectangle.right=pend.x;

	if(pmid.y < pend.y)	rectangle.bottom= pmid.y;
	else				rectangle.bottom= pmid.y - (pmid.y-pend.y)*2;

	hdc.Arc( rectangle.left, rectangle.top, rectangle.right, rectangle.bottom,
				pmid.x,pmid.y,pend.x,pend.y);

	// - DEBUG ->
/*	hdc.PushPen( GColor( 0, 0, 200 ), 5 );

	hdc.Line( pstart.x - 20, pstart.y - 20, pstart.x + 20, pstart.y + 20);
	hdc.Line( pstart.x - 10, pstart.y + 20, pstart.x + 20, pstart.y - 20);

	hdc.Line( pmid.x - 20, pmid.y - 20, pmid.x + 20, pmid.y + 20);
	hdc.Line( pmid.x - 10, pmid.y + 20, pmid.x + 20, pmid.y - 20);

	hdc.Line( pend.x - 20, pend.y - 20, pend.x + 20, pend.y + 20);
	hdc.Line( pend.x - 20, pend.y + 20, pend.x + 20, pend.y - 20);

	hdc.PopPen();*/
	// <-
}
开发者ID:iloveican,项目名称:AscoGraph,代码行数:51,代码来源:GRBowing.cpp


示例10: if

//____________________________________________________________________________________
void GRSingleNote::OnDraw( VGDevice & hdc ) const
{
	float incy = 1;
	float posy = 0;
	int sum = mNumHelpLines;
	if (mNumHelpLines > 0)
	{ 	// ledger lines up
	  	incy = -mCurLSPACE;
	  	posy = -mCurLSPACE;
		hdc.SetFontAlign( VGDevice::kAlignLeft | VGDevice::kAlignBase );
	}
	else if( mNumHelpLines < 0 )
	{
		incy = mCurLSPACE;
		posy = mGrStaff->getNumlines() * mCurLSPACE;
		sum = - sum;
		hdc.SetFontAlign( VGDevice::kAlignLeft | VGDevice::kAlignBase );
	}

	// draw ledger lines
	const float ledXPos = -60 * 0.85f * mSize;
	for (int i = 0; i < sum; ++i, posy += incy)
		 GRNote::DrawSymbol( hdc, kLedgerLineSymbol, ledXPos, ( posy - mPosition.y ));

	const VGColor oldcolor = hdc.GetFontColor();
	if (mColRef) hdc.SetFontColor( VGColor( mColRef ));

	// - Draw elements (stems, dots...)
	DrawSubElements( hdc );

	// - draw articulations & ornament
	const GRNEList * articulations = getArticulations();
	if( articulations )
	{
		for( GRNEList::const_iterator ptr = articulations->begin(); ptr != articulations->end(); ++ptr )
		{
			GRNotationElement * el = *ptr;
			el->OnDraw(hdc);
		}
	}
	if (mOrnament )
		mOrnament->OnDraw(hdc);

	// - Restore
	if (mColRef) hdc.SetFontColor( oldcolor );
	if (gBoundingBoxesMap & kEventsBB)
		DrawBoundingBox( hdc, kEventBBColor);
}
开发者ID:EQ4,项目名称:guido-engine,代码行数:49,代码来源:GRSingleNote.cpp


示例11: setScaling

/** \brief Sets the scaling of input graphic device context, according to 
		input sizes.
	(was setMapping)
*/
void GRPage::setScaling( VGDevice & hdc, float vsizex, float vsizey ) const
{
	float newScaleX = vsizex;
	float newScaleY = vsizey;
	
	getScaling (newScaleX, newScaleY);
	hdc.SetScale( newScaleX, newScaleY ); // ok
	
//	const float sizex = getPageWidth();	// Get the logical (virtual) size
//	const float sizey = getPageHeight(); //	used internaly by Guido.
//
//	if( sizex <= 0 ) return;
//	if( sizey <= 0 ) return;
//
//	// - Calculate the new device context scaling factors.
//	float newScaleX = vsizex / sizex;
//	float newScaleY = vsizey / sizey;
//	
//	// - Force the page to be proportional. 
//	// (This could be a setting for GuidoSetSetting(): proportionnal or non-proportionnal)
//	if( newScaleX > newScaleY )		newScaleX = newScaleY;
//	if( newScaleY > newScaleX )		newScaleY = newScaleX;
//
//	// - Scale the device context to match desired size & zoom.
//	hdc.SetScale( newScaleX, newScaleY ); // ok
}
开发者ID:anttirt,项目名称:guidolib,代码行数:30,代码来源:GRPage.cpp


示例12: getLeftSpace

/** \brief For debugging purpose only
*/
void		
GRNotationElement::DrawExtents( VGDevice & hdc, const VGColor & inColor ) const
{
	if(!mDraw)
		return;
	
#if (0)
	hdc.PushPen( inColor, LSPACE * 0.15f );
	const float x1 = mPosition.x - getLeftSpace();
	const float x2 = mPosition.x + getRightSpace();
	const float y = mPosition.y;
	hdc.Line( x1, y, x2, y );
	hdc.Line( x1, y - LSPACE, x1, y + LSPACE );
	hdc.Line( x2, y - LSPACE, x2, y + LSPACE );
	hdc.PopPen();
#endif
}
开发者ID:iloveican,项目名称:AscoGraph,代码行数:19,代码来源:GRNotationElement.cpp


示例13: OnDraw

//----------------------------------------------------------------------------------
void GRJump::OnDraw( VGDevice & hdc ) const
{
//	DrawBoundingBox (hdc, VGColor(255,0,0));
	if(!mDraw)
		return;

	const ARJump * ar = getARJump();
	if (!ar) return;

    NVRect r = getBoundingBox();
	NVPoint pos = getPosition();
	pos.x += r.left;

	FormatStringParserResult::const_iterator assoc;
	for (assoc = ar->getMark().begin(); assoc != ar->getMark().end(); assoc++) {
		if (assoc->second == FormatStringParser::kSpecial) {
			unsigned int symbol = mSymbols[assoc->first];
			if (symbol) {
				OnDrawSymbol( hdc, symbol, pos.x - getPosition().x, 0, getSymbolSize() );
				pos.x += GetSymbolExtent( symbol ) * getSymbolSize();
			}
		}
        else {
            const VGColor prevTextColor = hdc.GetFontColor();
            if (mColRef)
                hdc.SetFontColor(VGColor(mColRef));

            const VGFont* font = SelectTextFont (hdc);
            const char * text = assoc->first.c_str();
            int size = int(assoc->first.size());
            float w, h, texty = pos.y + r.bottom + getOffset().y;
            font->GetExtent ( 'a', &w, &h, &hdc );
            texty += (r.bottom - r.top - h) / 2;
            hdc.DrawString( pos.x + getOffset().x, texty, text, size);
            font->GetExtent ( text, size, &w, &h, &hdc );
            pos.x += w;

            if (mColRef)
                hdc.SetFontColor(prevTextColor);
		}
	}
}
开发者ID:anttirt,项目名称:guidolib,代码行数:43,代码来源:GRJump.cpp


示例14: DrawText

// ----------------------------------------------------------------------------
void GRTempo::DrawText( VGDevice & hdc, const char * cp, float xOffset, float yOffset, float * outWidth ) const
{
//	hdc.SelectFont( mFont );
	hdc.SetTextFont( mFont );
    hdc.SetFontAlign (getTextAlign());
	hdc.DrawString ( xOffset + mPosition.x, yOffset + mPosition.y, cp, (int)strlen(cp) );
	if( outWidth ) {
		float fooHeight;
//		hdc.GetTextExtent(cp, (int)strlen(cp), outWidth, &fooHeight);
                const VGFont *font = hdc.GetTextFont();
                if (!font) {
                        font = FontManager::gFontText;
                }
                if (!font) {
                        std::cerr << "Cannot find text font" << std::endl;
                        *outWidth = 0;
                } else {
		        font->GetExtent(cp, (int)strlen(cp), outWidth, &fooHeight, &hdc);
                }
	}
}
开发者ID:anttirt,项目名称:guidolib,代码行数:22,代码来源:GRTempo.cpp


示例15: OnDraw

void GRDiminuendo::OnDraw( VGDevice & hdc) const
{
	if (!mDraw)
		return;

    if (fDimInfos->points[0].x == fDimInfos->points[1].x)
        return;

    assert(gCurSystem);

	GRSystemStartEndStruct * sse = getSystemStartEndStruct(gCurSystem);
	if (sse == 0)
		return;

    if (mColRef)
    {
        hdc.PushPenColor(VGColor(mColRef));
        hdc.PushFillColor(VGColor(mColRef));
        hdc.SetFontColor(VGColor(mColRef));
    }

    hdc.PushPenWidth(fDimInfos->thickness);

    hdc.Line(fDimInfos->points[0].x , fDimInfos->points[0].y, fDimInfos->points[1].x , fDimInfos->points[1].y);
	hdc.Line(fDimInfos->points[2].x , fDimInfos->points[2].y, fDimInfos->points[1].x , fDimInfos->points[1].y);

    const float xMarkingOffset = fDimInfos->points[1].x + 30;
    const float yMarkingOffset = fDimInfos->points[1].y - 277 + (mTagSize - 1) * 25;

    OnDrawSymbol(hdc, fDimInfos->fMarkingSymbol, xMarkingOffset, yMarkingOffset, mTagSize);
    
    hdc.PopPenWidth();

    if (mColRef)
    {
        hdc.PopPenColor();
        hdc.PopFillColor();
        hdc.SetFontColor(VGColor());
    }
}
开发者ID:iloveican,项目名称:AscoGraph,代码行数:40,代码来源:GRDiminuendo.cpp


示例16: OnDraw

// ----------------------------------------------------------------------------
void GRTempo::OnDraw( VGDevice & hdc ) const
{
	if(!mDraw)
		return; 
	
    ARTempo *ar = static_cast<ARTempo *>(mAbstractRepresentation);
	
    if (!ar)
        return;

    VGColor prevFontColor = hdc.GetFontColor();

    if (mColRef)
        hdc.SetFontColor(VGColor(mColRef));

	const float noteOffsetY = 0; // LSPACE * 1.85f;
	float currX = getOffset().x;

	float dy = 0;
	if (ar->getDY())
		dy = - ar->getDY()->getValue(LSPACE);

	FormatStringParserResult::const_iterator assoc;

	for (assoc = ar->getTempoMark().begin(); assoc != ar->getTempoMark().end(); assoc++) {
		if ((*assoc).second == FormatStringParser::kSpecial) {
			TYPE_DURATION duration = getDuration((*assoc).first.c_str());
			currX += DrawNote( hdc, duration, currX + LSPACE, noteOffsetY + dy ) + LSPACE;
		}
		else {
			float textwidth;
			DrawText( hdc, (*assoc).first.c_str(), currX, dy, &textwidth );
			currX += textwidth;
		}
	}

    if (mColRef)
        hdc.SetFontColor(prevFontColor);
}
开发者ID:anttirt,项目名称:guidolib,代码行数:40,代码来源:GRTempo.cpp


示例17: OnDraw

void GRBeam::OnDraw( VGDevice & hdc) const
{
	if (error) return;

	GRSystemStartEndStruct * sse = getSystemStartEndStruct( gCurSystem );
	if (sse == 0) return;

	GRBeamSaveStruct * st = (GRBeamSaveStruct *)sse->p;
	assert(st);

	if (mColRef) {
		VGColor color ( mColRef ); 	// custom or black
		hdc.PushFillColor( color );
		hdc.PushPen( color, 1);
	}
		
	float ax [4] = { st->p[0].x, st->p[1].x, st->p[3].x, st->p[2].x };
	float ay [4] = { st->p[0].y, st->p[1].y, st->p[3].y, st->p[2].y };
	
	// This does the drawing!
	hdc.Polygon( ax, ay, 4 );
	
	if (st->simpleBeams)
	{
		GuidoPos smplpos = st->simpleBeams->GetHeadPosition();
		while (smplpos)
		{
			GRSimpleBeam * smplbeam = st->simpleBeams->GetNext(smplpos);
			smplbeam->OnDraw(hdc);
		}
	}

	if (mColRef) {
		hdc.PopPen();
		hdc.PopFillColor();
	}
}
开发者ID:EQ4,项目名称:guido-engine,代码行数:37,代码来源:GRBeam.cpp


示例18: OnDraw

/** \brief This tries to draw the spring.
*/
void GRSpring::OnDraw( VGDevice & hdc ) const
{
	const VGColor springColor ( 0, 0, 255, 50 ); 		//  semi-transparent blue
	const float springThickness = 5;

	hdc.PushPen( springColor, springThickness );

	const float offsety = -100;

	float x = posx, y = offsety;
	const int numturns = (int)((x-60.0f) / 40.0f + 0.5f );
	if (numturns < 1)
	{
		hdc.Line( x, y, (posx + x), offsety );
	}
	else
	{
		const float offset = ((x - numturns * 40) * 0.5f);
		hdc.Line( x, y, posx + offset, offsety );
		x = posx + offset;

		for( float i = 0; i < numturns; i++ )
		{
			hdc.Line( x, y, posx + offset + 40 * i + 10, -20 + offsety );
			x = posx + offset + 40 * i + 10;
			y = -20 + offsety;
			
			hdc.Line( x, y, posx + offset + 40 * i + 30, 20 + offsety );
			x = posx + offset + 40 * i + 30;
			y = 20 + offsety;

			hdc.Line( x, y, posx + offset + 40 * i + 40, offsety );
			x = posx + offset + 40 * i + 40;
			y = offsety;
		}
		hdc.Line( x, y, (posx + x), 0 + offsety );
	}
	hdc.PopPen();
}
开发者ID:anttirt,项目名称:guidolib,代码行数:41,代码来源:GRSpring.cpp


示例19: OnDrawText

// -------------------------------------------------------------------------
void GRNotationElement::OnDrawText( VGDevice & hdc,  const char * cp, int inCharCount ) const
{
	// first we have to get a font ....
	if(!mDraw)
		return;
	
	const VGFont* hmyfont = FontManager::gFontText;
	
	const int size = getFontSize();
	const NVstring * font = getFont();
	const unsigned char * colref = getColRef();
	
	if (font && font->length() > 0)
	{
		// handle font-attributes ...
		hmyfont = FontManager::FindOrCreateFont( size, font, getFontAttrib());
	}
	
	hdc.SetTextFont( hmyfont );
	const VGColor prevTextColor = hdc.GetFontColor();
	if (colref) hdc.SetFontColor( VGColor( colref ));
	
//	const unsigned int ta = hdc.GetTextAlign();

//	GColor backColor = hdc.GetTextBackgroundColor();
//	hdc.SetTextBackgroundColor( 255, 255, 255, 255 );

	const NVPoint & refpos = getReferencePosition();
	const NVPoint & offset = getOffset();

	hdc.SetFontAlign(getTextAlign());
	hdc.DrawString(	(float)(mPosition.x + offset.x + (refpos.x * size)), 
					(float)(mPosition.y + offset.y + (refpos.y * size)), 
					cp, inCharCount );

//	hdc.SetTextAlign( ta );
//	hdc.SetTextBackgroundColor( backColor );
	if (colref) hdc.SetFontColor( prevTextColor );
}
开发者ID:iloveican,项目名称:AscoGraph,代码行数:40,代码来源:GRNotationElement.cpp


示例20: DrawNote

/** Draws the note corresponding to a given symbolic musical duration.
*/
float GRTempo::DrawNote( VGDevice & hdc, const TYPE_DURATION & noteDur, float xOffset, float yOffset ) const
{
	float offsetX = 0;

	// - Choose notehead
	unsigned int theSymbol = kNoneSymbol;
	if (noteDur>=DURATION_1) {
		theSymbol = kWholeNoteHeadSymbol;
	}
	else if (noteDur == DURATION_2 || noteDur == DURATION_3_4 || noteDur == DURATION_7_8) {
   		theSymbol = kHalfNoteHeadSymbol;
	}
	else {
		theSymbol = kFullHeadSymbol;
	}

	// - Choose flag
	unsigned int theFlagSymbol = kNoneSymbol;
	if (noteDur==DURATION_8 ||  noteDur == DURATION_3_16 || noteDur == DURATION_7_32) {
		theFlagSymbol = GRFlag::H8U;
	}
	else if(noteDur==DURATION_16 || noteDur == DURATION_3_32 || noteDur == DURATION_7_64) {
		theFlagSymbol = GRFlag::H16U;
	}
	else if(noteDur == DURATION_32) {
		theFlagSymbol =  GRFlag::H32U;
	}
	else if (noteDur == DURATION_64) {
		theFlagSymbol = GRFlag::H64U;
	}

	// - Choose dot
	unsigned int theDotSymbol = kNoneSymbol;
//	if (noteDur == DURATION_3_4 || noteDur == DURATION_3_8 || noteDur == DURATION_3_16 || noteDur == DURATION_3_32) {
	if (noteDur.getNumerator() == 3) {
		theDotSymbol = kNoteDotSymbol;
	}

	// - Setup zoom
    hdc.selectfont(1); // Not very beautiful but avoid a bug during SVG export
	const float cueScale = 0.70f;
	hdc.SetScale(cueScale, cueScale);

	// - Calculate the position of the head
	float w, h;

	hdc.GetMusicFont()->GetExtent(theSymbol, &w, &h, &hdc);
	float xPos = (xOffset + mPosition.x) / cueScale;
	float yPos = (yOffset + mPosition.y - w / 2.5f) / cueScale;

	// - Draw Head
	hdc.DrawMusicSymbol(xPos, yPos, theSymbol);
	offsetX = w * cueScale;

	// - Draw Stem
	if (theSymbol != kWholeNoteHeadSymbol)
    {
		float		stemLen = 3 * LSPACE;
		float		stemTagSize = 1;

		const float stemCharSize = LSPACE * stemTagSize;
		const float halfStemCharSize = 0.5f * stemCharSize;

		hdc.DrawMusicSymbol( xPos, yPos, kStemUp1Symbol );

		// - Draws until the length has been completed ...
		float offsy = -halfStemCharSize;

		while( -offsy < stemLen ) // * mSize)
		{
			if(( stemCharSize - offsy ) > stemLen ) // * mSize)
			{
				offsy =  (-(stemLen) // * mSize)
					+ stemCharSize );
				hdc.DrawMusicSymbol( xPos, yPos + offsy, kStemUp2Symbol );
				break;
			}
			hdc.DrawMusicSymbol( xPos, yPos + offsy, kStemUp2Symbol );
			offsy -= halfStemCharSize;
		}
	}

	// - Draw flag
	if (theFlagSymbol != kNoneSymbol) hdc.DrawMusicSymbol( xPos, yPos - 4 * LSPACE, theFlagSymbol );

	// - Draw Dot
	if (theDotSymbol != kNoneSymbol)
    {
		hdc.GetMusicFont()->GetExtent(theDotSymbol, &w, &h, &hdc);
		hdc.DrawMusicSymbol( xPos + 2 * LSPACE, yPos, theDotSymbol);
		offsetX += LSPACE;
	}

	// - Cleanup
	hdc.SetScale(1 / cueScale, 1 / cueScale);
	return offsetX;
}
开发者ID:anttirt,项目名称:guidolib,代码行数:99,代码来源:GRTempo.cpp



注:本文中的VGDevice类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ VI类代码示例发布时间:2022-05-31
下一篇:
C++ VG类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap