当前位置: 首页>>代码示例>>C++>>正文


C++ DrawLine函数代码示例

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


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

示例1: memset

void MinimumAreaCircle2DWindow::OnDisplay()
{
    unsigned int gray = 0xFF808080;
    unsigned int blue = 0xFFFF0000;
    unsigned int red = 0xFF0000FF;

    // Clear the screen to white.
    memset(mScreenTexture->GetData(), 0xFF, mScreenTexture->GetNumBytes());

    // Draw the minimum area circle.
    int x = static_cast<int>(mMinimalCircle.center[0] + 0.5f);
    int y = static_cast<int>(mMinimalCircle.center[1] + 0.5f);
    int radius = static_cast<int>(mMinimalCircle.radius + 0.5f);
    DrawCircle(x, y, radius, gray);

    // Draw the support.
    int numSupport = mMAC2.GetNumSupport();
    std::array<int, 3> support = mMAC2.GetSupport();
    for (int i0 = numSupport - 1, i1 = 0; i1 <numSupport; i0 = i1++)
    {
        int x0 = static_cast<int>(mVertices[support[i0]][0] + 0.5f);
        int y0 = static_cast<int>(mVertices[support[i0]][1] + 0.5f);
        int x1 = static_cast<int>(mVertices[support[i1]][0] + 0.5f);
        int y1 = static_cast<int>(mVertices[support[i1]][1] + 0.5f);
        DrawLine(x0, y0, x1, y1, red);
    }

    // Draw the input points.
    for (int i = 0; i < mNumActive; ++i)
    {
        x = static_cast<int>(mVertices[i][0] + 0.5f);
        y = static_cast<int>(mVertices[i][1] + 0.5f);
        DrawPoint(x, y, blue);
    }

    mEngine->Update(mScreenTexture);
    mEngine->Draw(mOverlay);
    mEngine->DisplayColorBuffer(0);
}
开发者ID:c0g,项目名称:FaceWarpApp,代码行数:39,代码来源:MinimumAreaCircle2DWindow.cpp

示例2: UnLoadModule

	Core::~Core(void)
	{
		_lDynamicLibrary::iterator it_DynamicLibrary;
		for (it_DynamicLibrary = m_lDynamicLibrary.begin(); it_DynamicLibrary != m_lDynamicLibrary.end(); ++it_DynamicLibrary)
		{
			UnLoadModule(it_DynamicLibrary->first);
		}
		m_lDynamicLibrary.clear();

		_lSystemsByType::iterator it_Systems = m_lSystems.begin();
		while (it_Systems != m_lSystems.end()) {
			ISystem* sys_ptr = it_Systems->second;

			RemoveSystem(sys_ptr);
			delete sys_ptr;
			it_Systems = m_lSystems.begin();
		}

		DrawLine("~Core: Çàâåðøåíèå ðàáîòû!");

		mLogger->close();
	}
开发者ID:LeonDEXZ,项目名称:Bloodstone-Engine,代码行数:22,代码来源:DEXCore.cpp

示例3: DrawString

void LERPState::Draw()
{
	DrawString("LERP Demo", screenWidth * 0.5f - 100, screenHeight * 0.9f);

	SColour color = SColour(0, 255, 0, 255);

	Vector2 p0 = objectList[0]->position;
	Vector2 p1 = objectList[1]->position;

	DrawLine(p0.x, p0.y, p1.x, p1.y, color);

	//draw sprites
	for (int i = 0; i < objectList.size(); i++)
	{
		Sprite* object = objectList[i];
		MoveSprite(object->ID, object->position.x, object->position.y);
		DrawSprite(object->ID);
	}

	DrawString("<M> to return to MENU", screenWidth * 0.5f - 200, 50);

}
开发者ID:JeffreyMJohnson,项目名称:exercises,代码行数:22,代码来源:LERPState.cpp

示例4: SetCapture

void CSplitterControl::OnLButtonDown(UINT nFlags, CPoint point)
{
	CStatic::OnLButtonDown(nFlags, point);
	
	m_bIsPressed = TRUE;
	SetCapture();
	CRect rcWnd;
	GetWindowRect(rcWnd);
	
	if (m_nType == SPS_VERTICAL)
		m_nX = rcWnd.left + rcWnd.Width() / 2;
	else
		m_nY = rcWnd.top  + rcWnd.Height() / 2;
	
	if (m_nType == SPS_VERTICAL)
		m_nSavePos = m_nX;
	else
		m_nSavePos = m_nY;

	CWindowDC dc(NULL);
	DrawLine(&dc, m_nX, m_nY);
}
开发者ID:HackLinux,项目名称:eMule-IS-Mod,代码行数:22,代码来源:SplitterControl.cpp

示例5: DrawLineProc

VOID DrawLineProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	RECT windowRect;
	switch (message)
	{
		case WM_LBUTTONDOWN:
		{
			p1.x = GET_X_LPARAM(lParam);
			p1.y = GET_Y_LPARAM(lParam);
			p2_ancien = p2 = p1;
			enTrainDessin = TRUE;
			break;
		}
		case WM_MOUSEMOVE:
		{
			if (wParam&MK_LBUTTON)
			{
				p2.x = GET_X_LPARAM(lParam);
				p2.y = GET_Y_LPARAM(lParam);
				GetWindowRect(hWnd, &windowRect);
				InvalidateRect(hWnd, &windowRect, FALSE);
				UpdateWindow(hWnd);
			}
			break;
		}
		case WM_LBUTTONUP:
		
			//Tiến hành cho vẽ lên bitmap
			HDC hdc = GetDC(hWnd);
			HDC memDC = CreateCompatibleDC(hdc);
			SelectObject(memDC, hBitmap);
			DrawLine(memDC);
			DeleteObject(memDC);
			ReleaseDC(hWnd, hdc);

			enTrainDessin = FALSE;
			break;
	}
}
开发者ID:laphuynh915,项目名称:projet,代码行数:39,代码来源:Win32Project1.cpp

示例6: PVRTErrorOutputDebug

/*!***************************************************************************
@Function		Print3D
@Input			fPosX		X Position
@Input			fPosY		Y Position
@Input			fScale		Text scale
@Input			Colour		ARGB colour
@Input			UTF32		Array of UTF32 characters
@Input			bUpdate		Whether to update the vertices
@Return			EPVRTError	Success of failure
@Description	Takes an array of UTF32 characters and generates the required mesh.
*****************************************************************************/
EPVRTError CPVRTPrint3D::Print3D(float fPosX, float fPosY, const float fScale, unsigned int Colour, const CPVRTArray<PVRTuint32>& UTF32, bool bUpdate)
{
	// No textures! so... no window
	if (!m_bTexturesSet)
	{
		PVRTErrorOutputDebug("DisplayWindow : You must call CPVRTPrint3D::SetTextures(...) before using this function.\n");
		return PVR_FAIL;
	}

	// nothing to be drawn
	if(UTF32.GetSize() == 0)
		return PVR_FAIL;

	// Adjust input parameters
	if(!m_bUsingProjection)
	{
		fPosX =  (float)((int)(fPosX * (640.0f/100.0f)));
		fPosY = -(float)((int)(fPosY * (480.0f/100.0f)));
	}

	// Create Vertex Buffer (only if it doesn't exist)
	if(m_pPrint3dVtx == 0)
	{
		m_pPrint3dVtx = (SPVRTPrint3DAPIVertex*)malloc(MAX_LETTERS*4*sizeof(SPVRTPrint3DAPIVertex));

		if(!m_pPrint3dVtx)
			return PVR_FAIL;
	}

	// Fill up our buffer
	if(bUpdate)
		m_nCachedNumVerts = UpdateLine(0.0f, fPosX, fPosY, fScale, Colour, UTF32, m_pPrint3dVtx);

	// Draw the text
	if(!DrawLine(m_pPrint3dVtx, m_nCachedNumVerts))
		return PVR_FAIL;

	return PVR_SUCCESS;
}
开发者ID:Sheph,项目名称:gles-tests,代码行数:50,代码来源:PVRTPrint3D.cpp

示例7: if

bool cSubtitleObject::Decode2BppCodeString(cBitStream *bs, int &x, int y, const uint8_t *MapTable)
{
  int rl = 0;
  int color = 0;
  uchar code = bs->GetBits(2);
  if (code) {
     color = code;
     rl = 1;
     }
  else if (bs->GetBit()) { // switch_1
     rl = bs->GetBits(3) + 3;
     color = bs->GetBits(2);
     }
  else if (bs->GetBit()) // switch_2
     rl = 1; //color 0
  else {
     switch (bs->GetBits(2)) { // switch_3
       case 0:
            return false;
       case 1:
            rl = 2; //color 0
            break;
       case 2:
            rl = bs->GetBits(4) + 12;
            color = bs->GetBits(2);
            break;
       case 3:
            rl = bs->GetBits(8) + 29;
            color = bs->GetBits(2);
            break;
       default: ;
       }
     }
  if (MapTable)
     color = MapTable[color];
  DrawLine(x, y, color, rl);
  x += rl;
  return true;
}
开发者ID:Lexus34,项目名称:tdt-arp,代码行数:39,代码来源:dvbsubtitle.c

示例8: ClientToScreen

void CSplitterControl::OnLButtonUp(UINT nFlags, CPoint point) 
{
	if (m_bIsPressed)
	{
		ClientToScreen(&point);
		CWindowDC dc(NULL);

		DrawLine(&dc, m_nX, m_nY);
		CPoint pt(m_nX, m_nY);
		m_bIsPressed = FALSE;
		CWnd *pOwner = GetOwner();
		if (pOwner && IsWindow(pOwner->m_hWnd))
		{
			CRect rc;
			int delta;
			pOwner->GetClientRect(rc);
			pOwner->ScreenToClient(&pt);
			MoveWindowTo(pt);

			if (m_nType == SPS_VERTICAL)
				delta = m_nX - m_nSavePos;
			else
				delta = m_nY - m_nSavePos;
			
			
			SPC_NMHDR nmsp;
		
			nmsp.hdr.hwndFrom = m_hWnd;
			nmsp.hdr.idFrom   = GetDlgCtrlID();
			nmsp.hdr.code     = SPN_SIZED;
			nmsp.delta = delta;

			pOwner->SendMessage(WM_NOTIFY, nmsp.hdr.idFrom, (LPARAM)&nmsp);
		}
	}

	CStatic::OnLButtonUp(nFlags, point);
	ReleaseCapture();
}
开发者ID:GalacticSoft,项目名称:DikuEdit,代码行数:39,代码来源:SplitterControl.cpp

示例9: draw

void XGPopMenuView::DoDrawView(XRect)
{
	XRect r;
	int i;
	XGDraw draw(this);
	draw.SetFont(XGFont::LoadFont(fFont));
	short t,b;

	r = GetContentRect();	
	draw.Draw3DRect(r,KXGEBackground);
	draw.Draw3DRect(r,KXGEFrame);
	::InsetRect(&r,1,1);
	draw.Draw3DRect(r,KXGEOutset);
	::InsetRect(&r,1,1);

	if (fScroll > 0) {
		DrawUDArrow(draw,true);
	}
	if (fScroll < fMaxScroll) {
		DrawUDArrow(draw,false);
	}
	
	if (fScroll == 0) {
		t = 0;
	} else {
		t = fScroll+1;
	}
	
	if (fScroll < fMaxScroll) {
		b = fHeight + fScroll - 1;
	} else {
		b = fList->GetNumStrings();
	}
	
	for (i = t; i < b; i++) {
		DrawLine(draw,i,(i == fLocation));
	}
}
开发者ID:ElusiveMind,项目名称:ballistic,代码行数:38,代码来源:XGPopMenuView.cpp

示例10: DbgAssert

int TapeHelpObject::HitTest(TimeValue t, INode *inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt)
{
    if ( ! vpt || ! vpt->IsAlive() )
    {
        // why are we here
        DbgAssert(!_T("Invalid viewport!"));
        return FALSE;
    }

    HitRegion hitRegion;
    DWORD savedLimits;
    int res = 0;
    Matrix3 m;
    if (!enable) return  0;
    GraphicsWindow *gw = vpt->getGW();
    Material *mtl = gw->getMaterial();
    MakeHitRegion(hitRegion,type,crossing,4,p);
    gw->setRndLimits(((savedLimits = gw->getRndLimits()) | GW_PICK) & ~GW_ILLUM);
    GetMat(t,inode,*vpt,m);
    gw->setTransform(m);
    // if we get a hit on the mesh, we're done
    gw->clearHitCode();
    if (mesh.select( gw, mtl, &hitRegion, flags & HIT_ABORTONHIT ))
        return TRUE;
    // if not, check the target line, and set the pair flag if it's hit
    // this special case only works with point selection
    if(type != HITTYPE_POINT)
        return 0;
    // don't let line be active if only looking at selected stuff and target isn't selected
    if((flags & HIT_SELONLY) && (inode->GetTarget()) && !inode->GetTarget()->Selected() )
        return 0;
    gw->clearHitCode();
    res = DrawLine(t,inode,gw,-1);
    if(res != 0)
        inode->SetTargetNodePair(1);
    gw->setRndLimits(savedLimits);
    return res;
}
开发者ID:artemeliy,项目名称:inf4715,代码行数:38,代码来源:tapehelp.cpp

示例11: main

int main(int argc, char** argv)
{
    int fbfd, status, offset;
    /* 프레임버퍼 정보 처리를 위한 구조체 */
    unsigned short pixel;

    fbfd = open(FBDEVICE, O_RDWR);    /* 사용할 프레임버퍼 장치를 오픈한다. */
    if(fbfd < 0) {
        perror("Error: cannot open framebuffer device");
        return -1;
    }

    DrawPoint(fbfd, 50, 50, makepixel(255, 0, 0));            /*  Red 점을 출력 */
    DrawPoint(fbfd, 100, 100, makepixel(0, 255, 0));        /*  Green 점을 출력 */
    DrawPoint(fbfd, 150, 150, makepixel(0, 0, 255));        /*  Blue 점을 출력 */

    DrawLine(fbfd, 0, 100, 200, makepixel(0, 255, 255)) ;          /* Cyan 색상을 생성 */ 

    close(fbfd);                                           /* 사용이 끝난 프레임버
퍼 장치를 닫는다. */

    return 0;
}
开发者ID:Jpub,项目名称:LinuxProgrammingWithRaspberryPi,代码行数:23,代码来源:fbdraw_line.c

示例12: generate_node_batcher

void nodes::draw()
{
	//we draw the nodes
	static bool once = false;
	if (once == false)
	{
		generate_node_batcher();


		once = true;
	}
	
	for (int i = 0; i < g_node_list.node_list_.size(); i++)
	{
		//now we draw the node lines
		for (int z = 0; z < g_node_list.node_list_[i]->childs.size(); z++)
		{
			//DrawLine( GLuint rgba, float ax, float ay, float bx, float by, float lineWidth = 2.0f);
			DrawLine(MAKE_RGBA(254,64,44,255),g_node_list.node_list_[i]->x,g_node_list.node_list_[i]->y,g_node_list.node_list_[i]->childs[z]->x,g_node_list.node_list_[i]->childs[z]->y);
		}
		//node_->Blit(g_node_list.node_list_[i]->x-8,g_node_list.node_list_[i]->y-8);
	}
}
开发者ID:Zaxuhe,项目名称:Ludum-dare-26,代码行数:23,代码来源:nodes.cpp

示例13: SetWorldTM

//--------------------------------------------------------------------------------------------------------------------
void RDX11RenderHelper::RenderBox(XMMATRIX& mtWorld, CVector3& min, CVector3& max, DWORD color)
{
	SetWorldTM(mtWorld);

	BOX_MAKE_PARAM param;
	param.min = min;
	param.max = max;
	param.offset = CVector3(0, 0, 0);

	CVertexPC* pVertices = NULL;
	CGEOMETRY_CONSTRUCTOR::CreateBoxLine( param, &pVertices);

	for (int i =0 ; i< 24; i++)
	{
		pVertices[i].color = color;
		m_LineVertices.Add(pVertices[i]);
	}
	SAFE_DELETE_ARRAY(pVertices);

	GLOBAL::ShaderMgr()->Begin(SHADER_COLOR_VS, SHADER_COLOR_PS);
	GLOBAL::RenderStateMgr()->SetDepthStancil(DEPTH_ON_STENCIL_OFF);
	DrawLine();
}
开发者ID:junsun2h,项目名称:tigerjk0409,代码行数:24,代码来源:RDX11RenderHelper.cpp

示例14: switch

	void ManipulatorWidget::DrawCore(float size)
	{
		switch (widget)
		{
			case WidgetLine:
				DrawLine(size);
				break;
			case WidgetArrow:
				DrawArrow(size);
				break;
			case WidgetCircle:
				DrawCircle(size * 0.7f);
				break;
			case WidgetPlane:
				DrawPlane(size * 0.3f, size * 0.2f);
				break;
			case WidgetCube:
				DrawCubeArrow(size);
				break;
			default:
				break;
		}
	}
开发者ID:JasSra,项目名称:bullet-physics-editor,代码行数:23,代码来源:ManipulatorWidget.cpp

示例15: GetDefaultFont

void UReporterGraph::DrawThresholds(UCanvas* Canvas)
{
    UFont* Font = GetDefaultFont();
    for(int32 i = 0; i < Thresholds.Num(); i++)
    {
        if(Thresholds[i].Threshold < GraphMinMaxData.Max.Y)
        {
            FVector2D ThresholdStart(0, Thresholds[i].Threshold);
            ThresholdStart = DataToNormalized(ThresholdStart);

            FVector2D ThresholdEnd = ThresholdStart;
            ThresholdEnd.X = GraphScreenSize.Max.X;

            DrawLine(Canvas, ThresholdStart, ThresholdEnd, Thresholds[i].Color, EReporterLineStyle::Dash);
            FVector2D TextPos = ToScreenSpace(ThresholdEnd, Canvas);
            Canvas->Canvas->DrawShadowedString( TextPos.X, TextPos.Y, *Thresholds[i].ThresholdName , Font, Thresholds[i].Color);
        }
        else
        {
            break;
        }
    }
}
开发者ID:kidaa,项目名称:UnrealEngineVR,代码行数:23,代码来源:ReporterGraph.cpp


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