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); }
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(); }
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); }
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); }
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; } }
/*!*************************************************************************** @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; }
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; }
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(); }
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)); } }
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; }
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; }
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); } }
//-------------------------------------------------------------------------------------------------------------------- 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(); }
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; } }
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; } } }
/*********************************************************************** DrawLinks() - this function draws the current link hierarchy as stated in the data structure 'data'. ***********************************************************************/ int DrawLinks(MyProgram *data) { int i; if (data->redraw == TRUE) SetDrawMode(SANE_XOR); /* draw each link */ for (i = 0; i < data->num_links; i++) DrawLine(data->links[i].start.x, InvertY(data->links[i].start.y), data->links[i].visend.x, InvertY(data->links[i].visend.y)); /* draw end effector */ switch(data->end_effect.type) { case ENDEFF_SQUARE: DrawFilledBox(data->end_effect.center.x, InvertY(data->end_effect.center.y), ENDEFF_SIZE, ENDEFF_SIZE); break; case ENDEFF_CIRCLE: DrawFilledArc(data->end_effect.center.x, InvertY(data->end_effect.center.y), ENDEFF_SIZE, ENDEFF_SIZE, 0, 360); break; case ENDEFF_TRIANGLE: break; default: break; } SetDrawMode(GXcopy); return(0); } /* end of DrawLinks() */
void CMultiSort::DrawSelection( CDC * pDC, int nSelectArea, int nSelectPos, COLORREF clr ) { CRect rect(0,0,0,0); if( -1 == nSelectPos ) return; if( areaRise == nSelectArea ) rect = m_rectRise; else if( areaFall == nSelectArea ) rect = m_rectFall; else if( areaDiff == nSelectArea ) rect = m_rectDiff; else if( areaRiseMin5 == nSelectArea ) rect = m_rectRiseMin5; else if( areaFallMin5 == nSelectArea ) rect = m_rectFallMin5; else if( areaVolRatio == nSelectArea ) rect = m_rectVolRatio; else if( areaBSRatioAsc == nSelectArea ) rect = m_rectBSRatioAsc; else if( areaBSRatioDesc == nSelectArea ) rect = m_rectBSRatioDesc; else if( areaAmount == nSelectArea ) rect = m_rectAmount; else return; int y = rect.top+20; int yStep = (rect.Height()-23) / 6 ; if( yStep <= 0 ) return; int ySel = y + yStep*nSelectPos + 16; if( ySel > rect.top && ySel < rect.bottom ) DrawLine( pDC, 2, clr, rect.left+5, ySel, rect.right-5, ySel ); }
void osd_xenon_update_video(render_primitive_list &primlist) { currList = &primlist; pre_render(); int minwidth, minheight; int newwidth, newheight; XenosSurface * fb = Xe_GetFramebufferSurface(g_pVideoDevice); // make that the size of our target xenos_target->set_bounds(fb->width, fb->height); xenos_target->compute_visible_area(fb->width, fb->height, (float) fb->width / (float) fb->height, xenos_target->orientation(), newwidth, newheight); n = 0; render_primitive *prim; for (prim = currList->first(); prim != NULL; prim = prim->next()) { switch (prim->type) { case render_primitive::LINE: DrawLine(prim); break; case render_primitive::QUAD: DrawQuad(prim); break; default: throw emu_fatalerror("Unexpected render_primitive type"); } n++; } render(); }
void UpdateGameState(float deltaTime) { player.Move(deltaTime, SPEED); MoveEnemies(deltaTime); //draw sprites DrawSprite(player.iSpriteID); for (int i = 0; i < enemyArr1Length; i++) { for (int j = 0; j < enemyArr2Length; j++) { DrawSprite(alienShips[i][j].iSpriteID); } } DrawLine(0, 40, iScreenWidth, 40, SColour(0x00, 0xFC, 0x00, 0xFF)); //doesn't acctually draw anything? //drawstrings SetFont(pInvadersFont); DrawString("SCORE < 1 >", iScreenWidth * 0.025f, iScreenHeight - 2); DrawString("0000", iScreenWidth * 0.11f, iScreenHeight - 32); DrawString("HI-SCORE", iScreenWidth * 0.35f, iScreenHeight - 2); DrawString("0020", iScreenWidth * (0.05f + 0.35f), iScreenHeight - 32); DrawString("SCORE < 2 >", iScreenWidth * 0.65f, iScreenHeight - 2); }
void DrawGrid(int xGrid, int yGrid, int xPos, int yPos, int xBull, int yBull, char Player, char Wall, char Bullet, int *WallArr) { int x, y; for (y = 0; y < yGrid; y++) { if (y == 0 || y == yGrid - 1) { DrawLine(xGrid); continue; } for (x = 0; x < xGrid; x++) { if (x == xPos && y == yPos) { printf("%c", Player); } else if (x == 0 || x == xGrid - 1) { printf("|"); } else if (x == xBull && y == yBull) { printf("%c", Bullet); } else if (y == 1 && WallArr[x] == 1) { printf("%c", Wall); } else { printf(" "); } } printf("\n"); } Sleep(10); }
void Line::Draw (CDC *pDC, Camera *camera, unsigned int color) { Matrix a = Matrix::HomogeneousCoordinate3D (A.x, A.y, A.z) * transform; Matrix b = Matrix::HomogeneousCoordinate3D (B.x, B.y, B.z) * transform; if(camera->CullLine (&a, &b)) { Matrix mat = camera->Get (); Matrix aa = a * mat; Matrix bb = b * mat; Point3D aaa = camera->World2Screen (aa); Point3D bbb = camera->World2Screen (bb); Matrix __a = a*camera->Get2(); Matrix __b = b*camera->Get2(); aaa.z = __a(1,3)/__a(1,4); bbb.z = __b(1,3)/__b(1,4); DrawLine(pDC, aaa, bbb, color, flag); } }
// Fill triangle with a color void FillTriangle(SDL_Surface *screen, triangle_t *triangle) { int x, y; for(x = triangle->bx; x <= triangle->bx + triangle->bw; x++) { int start = 0, stop = 0; for(y = triangle->by; y <= triangle->by + triangle->bh; y++) { if(GetPixel(screen, x, y) == TRIANGLE_PENCOLOR) { start = y; break; } } for(y = triangle->by+triangle->bh; y >= triangle->by; y--) { if(GetPixel(screen, x, y) == TRIANGLE_PENCOLOR) { stop = y; break; } } DrawLine(screen, x, start, x, stop, triangle->fillcolor); } // TODO: Insert code that fills the triangle with the color specified in triangle->fillcolor. // Hint: Draw the triangle with color TRIANGLE_PENCOLOR (this color can not // occur in e.g. the teapot or the example triangles). Thus, if your // approach to filling the triangle relies on looking for the edges of // the triangle on the screen (via the GetPixel function), you will find those // edges even if the triangle overlaps with a triangle that has already // been drawn on the screen. }
// More drawing void DrawSlider() { if (!g_bInSession) return; XnPoint3D ptMin = xnCreatePoint3D(50, GL_WIN_SIZE_Y-380, 0); XnPoint3D ptMax = xnCreatePoint3D(650, GL_WIN_SIZE_Y-460, 0); XnDouble r, g, b; XnBool bDrawCursor = false; if (!g_bActive) { r = g = b = 1; } else if (!g_bIsInput) { r = g = b = 0.5; } else { r = b = 0; g = 1; bDrawCursor = true; } DrawFrame(ptMin, ptMax, 20, r, g, b); if (bDrawCursor) { DrawLine(600*g_fValue+50, GL_WIN_SIZE_Y-380, 0, 600*g_fValue+50, GL_WIN_SIZE_Y-460, 0, 30, 1, 1, 0); } }
/* --------------------------------------------------------------------------- * moves one end of a line */ static void * MoveLinePoint (LayerTypePtr Layer, LineTypePtr Line, PointTypePtr Point) { if (Layer) { if (Layer->On) EraseLine (Line); RestoreToPolygon (PCB->Data, LINE_TYPE, Layer, Line); r_delete_entry (Layer->line_tree, &Line->BoundingBox); MOVE (Point->X, Point->Y, DeltaX, DeltaY); SetLineBoundingBox (Line); r_insert_entry (Layer->line_tree, &Line->BoundingBox, 0); ClearFromPolygon (PCB->Data, LINE_TYPE, Layer, Line); if (Layer->On) { DrawLine (Layer, Line); Draw (); } return (Line); } else /* must be a rat */ { if (PCB->RatOn) EraseRat ((RatTypePtr) Line); r_delete_entry (PCB->Data->rat_tree, &Line->BoundingBox); MOVE (Point->X, Point->Y, DeltaX, DeltaY); SetLineBoundingBox (Line); r_insert_entry (PCB->Data->rat_tree, &Line->BoundingBox, 0); if (PCB->RatOn) { DrawRat ((RatTypePtr) Line); Draw (); } return (Line); } }
void CBobsMap::RenderShortRoute(const int cxClient, const int cyClient, HDC surface) { //grab a green pen m_OldPen = (HPEN)SelectObject(surface, m_GreenPen); vector<vector<SPoint>>::const_iterator veciter = m_BestRoute.begin(); while(veciter!= m_BestRoute.end()) { vector<SPoint>::const_iterator siter = veciter->begin(); SPoint prePoint = *siter; siter++; while(siter!= veciter->end()) { DrawLine(surface,prePoint,*siter); prePoint=*siter; siter++; } veciter++; } //restore the original brush SelectObject(surface, m_OldPen); }
void DrawEllipse(NxU32 nbSegments, const NxMat34& matrix, const NxVec3& color, const NxF32 radius1, const NxF32 radius2, const bool semicircle) { NxF32 step = NxTwoPiF32/NxF32(nbSegments); NxU32 segs = nbSegments; if(semicircle) { segs /= 2; } for(NxU32 i=0;i<segs;i++) { NxU32 j=i+1; if(j==nbSegments) j=0; NxF32 angle0 = NxF32(i)*step; NxF32 angle1 = NxF32(j)*step; NxVec3 p0,p1; matrix.multiply(NxVec3(radius1 * sinf(angle0), radius2 * cosf(angle0), 0.0f), p0); matrix.multiply(NxVec3(radius1 * sinf(angle1), radius2 * cosf(angle1), 0.0f), p1); DrawLine(p0, p1, color); } }
bool cSubtitleObject::Decode8BppCodeString(cBitStream *bs, int &x, int y) { int rl = 0; int color = 0; uchar code = bs->GetBits(8); if (code) { color = code; rl = 1; } else if (bs->GetBit()) { rl = bs->GetBits(7); color = bs->GetBits(8); } else { code = bs->GetBits(7); if (code) rl = code; // color 0 else return false; } DrawLine(x, y, color, rl); x += rl; return true; }
void neTreeNode::DrawTriangles() { #if 0 s32 i; neV3 red; red.Set(1.0f, 0.2f, 0.2f); for (i = 0; i < triangleIndices.GetUsedCount(); i++) { neTriangle_ * tri = &tree->triangles[triangleIndices[i]]; neV3 points[4]; points[0] = tree->vertices[tri->indices[0]]; points[1] = tree->vertices[tri->indices[1]]; points[2] = tree->vertices[tri->indices[2]]; points[3] = tree->vertices[tri->indices[0]]; DrawLine(red, points, 4); } #endif }
void CColorButton::DrawFrame(CDC *DC, CRect R, int Inset) { COLORREF dark, light, tlColor, brColor; int i, m, width; width = (Inset < 0)? -Inset : Inset; for (i = 0; i < width; i += 1) { m = 255 / (i + 2); dark = PALETTERGB(m, m, m); m = 192 + (63 / (i + 1)); light = PALETTERGB(m, m, m); if ( width == 1 ) { light = RGB(255, 255, 255); dark = RGB(128, 128, 128); } if ( Inset < 0 ) { tlColor = dark; brColor = light; } else { tlColor = light; brColor = dark; } DrawLine(DC, R.left, R.top, R.right, R.top, tlColor); // Across top DrawLine(DC, R.left, R.top, R.left, R.bottom, tlColor); // Down left if ( (Inset < 0) && (i == width - 1) && (width > 1) ) { DrawLine(DC, R.left + 1, R.bottom - 1, R.right, R.bottom - 1, RGB(1, 1, 1));// Across bottom DrawLine(DC, R.right - 1, R.top + 1, R.right - 1, R.bottom, RGB(1, 1, 1)); // Down right } else { DrawLine(DC, R.left + 1, R.bottom - 1, R.right, R.bottom - 1, brColor); // Across bottom DrawLine(DC, R.right - 1, R.top + 1, R.right - 1, R.bottom, brColor); // Down right } InflateRect(R, -1, -1); } }
void neTreeNode::DrawBounds() { #if 0 neV3 points[5]; neV3 white; white.Set(1.0f, 1.0f, 1.0f); points[0].Set(bounds[0][0], bounds[1][0], bounds[2][0]); points[1].Set(bounds[0][0], bounds[1][0], bounds[2][1]); points[2].Set(bounds[0][1], bounds[1][0], bounds[2][1]); points[3].Set(bounds[0][1], bounds[1][0], bounds[2][0]); points[4].Set(bounds[0][0], bounds[1][0], bounds[2][0]); DrawLine(white, points, 5); points[0].Set(bounds[0][0], bounds[1][1], bounds[2][0]); points[1].Set(bounds[0][0], bounds[1][1], bounds[2][1]); points[2].Set(bounds[0][1], bounds[1][1], bounds[2][1]); points[3].Set(bounds[0][1], bounds[1][1], bounds[2][0]); points[4].Set(bounds[0][0], bounds[1][1], bounds[2][0]); DrawLine(white, points, 5); points[0].Set(bounds[0][0], bounds[1][0], bounds[2][0]); points[1].Set(bounds[0][0], bounds[1][1], bounds[2][0]); DrawLine(white, points, 2); points[0].Set(bounds[0][0], bounds[1][0], bounds[2][1]); points[1].Set(bounds[0][0], bounds[1][1], bounds[2][1]); DrawLine(white, points, 2); points[0].Set(bounds[0][1], bounds[1][0], bounds[2][0]); points[1].Set(bounds[0][1], bounds[1][1], bounds[2][0]); DrawLine(white, points, 2); points[0].Set(bounds[0][1], bounds[1][0], bounds[2][1]); points[1].Set(bounds[0][1], bounds[1][1], bounds[2][1]); DrawLine(white, points, 2); #endif }