Esempio n. 1
0
void
RectDrawRadioBox_Aoi(const PaintContext& pc_, RadioBox& rb)
{
	RectDrawSelector_Aoi([](const PaintContext& pc, const Size& s,
		const bool cst[], const Color ccs[], size_t c_idx){
		const auto& g(pc.Target);
		const SDst rad(min(s.Width / 2, s.Height / 2));
		const auto pt(pc.Location + Size(rad, rad));
		const Rect& bounds(pc.ClipArea);
		const Rect r(pc.Location, s);
		const bool is_enabled(cst[ControlState_Enabled]);

		DrawCircle(g, bounds, pt, rad, ccs[is_enabled ? c_idx : 0]);
		// XXX: Minimal size.
		if(YB_LIKELY(r.Width > 10 && r.Height > 10))
		{
			SDst radt(rad);

			FillCircle(g, bounds, pt, --radt, ccs[SelectorIndex_Aoi_C1
				+ (cst[ControlState_Locked] || cst[ControlState_Focused]
				? 2 : is_enabled ? c_idx : 0)]);
			if(is_enabled)
			{
				--c_idx;
				DrawCircle(g, bounds, pt, --radt,
					ccs[SelectorIndex_Aoi_C2 + c_idx]);
				DrawCircle(g, bounds, pt, --radt,
					ccs[SelectorIndex_Aoi_C3 + c_idx]);
			}
		}
		if(cst[ControlState_Ticked])
			FillCircle(g, bounds, pt, rad - 2, is_enabled ? Color(11, 130, 199)
				: MakeGray(190));
	}, pc_, rb, rb.IsSelected());
}
Esempio n. 2
0
static int PaletteWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
{
    HDC hdc;
    int x, y;
    static GAL_Color colorPal[256], myPal[256];
    switch (message) {
    case MSG_CREATE:
        GetPalette(HDC_SCREEN, 0, 256, colorPal);
#ifdef _DEBUG
	int i;
        for (i = 0; i < 256; i++) {
            printf ("i = %d\n, red = %d\n, green = %d\n, blue = %d\n\n", 
                    i, colorPal[i].r, colorPal[i].g, colorPal[i].b);
        }
#endif
        break;

    case MSG_PAINT:
        {
            if (g_bShowBall)
                SendMessage (hWnd, MSG_LBUTTONDOWN, 0, 0);
        }
        break;
    case MSG_LBUTTONDOWN:
        g_bShowBall = TRUE;
        hdc = GetClientDC(hWnd);
        InitMyPalette(myPal);
        SetPalette(hdc, 0, 256, myPal);
        SetBrushColor(hdc, COLOR_red);
        FillCircle(hdc, 10, 10, 8);
        for (y = 0; y < 240; y += 20) {
            for (x = 0; x < 320; x += 20) {
              BitBlt(hdc, 0, 0, 20, 20, hdc, x, y, 0);
              SetColorfulPalette(hdc);
            }
        }
        ReleaseDC(hdc);
        break;

    case MSG_RBUTTONDOWN:
        SetColorfulPalette(HDC_SCREEN);
        SetBrushColor(HDC_SCREEN, PIXEL_yellow);
        FillCircle(HDC_SCREEN, 50, 50, 15);
        break;

    case MSG_CLOSE:
        DestroyAllControls (hWnd);
        DestroyMainWindow (hWnd);
        PostQuitMessage (hWnd);
        return 0;
    }

    return DefaultMainWinProc(hWnd, message, wParam, lParam);
}
Esempio n. 3
0
/*****************************************************************************
 * void DisplayLightingScreen(void)
 *****************************************************************************/
void DisplayLightingScreen(void)
{
    static DWORD prevTick = 0;
    static BYTE blink = 0;

    if((TimerTick_GetTick() - prevTick) > 1000)
    {
	    prevTick = TimerTick_GetTick();
	    blink ^=1;
	    
        if(blink == 1)
	       { SetColor(GREEN);}
	    else
	        SetColor(WHITE);

	    FillCircle(LIGHTING_SCREEN_START + 65, 140, 5);           //Bed 3
	    FillCircle(LIGHTING_SCREEN_START+290, 160, 5);            //Terrace
	    FillCircle(LIGHTING_SCREEN_START+250, GetMaxY() - 80, 5);  //Living
	    FillCircle(LIGHTING_SCREEN_START + 65, GetMaxY() - 200, 5);  //Bed 4
        UpdateDisplayNow();
    }
    
}
static int PaletteWndProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
{
	
	switch ( message ) {
	case MSG_SETCURSOR:
        SetCursorEx(0, FALSE);
        return 0;
 case MSG_CREATE:
        /* fill our palette with a gradually altering sequence of colors */
        for (c=0; c<64; c++) {
            palette[c].r = c*4;
            palette[c].g = 0;
            palette[c].b = 0;
        }
        for (c=64; c<128; c++) {
            palette[c].r = (127-c)*4;
            palette[c].g = (c-64)*4;
            palette[c].b = 0;
        }
        for (c=128; c<192; c++) {
            palette[c].r = 0;
            palette[c].g = (191-c)*4;
            palette[c].b = (c-128)*4;
        }
        for (c=192; c<256; c++) {
            palette[c].r = 0;
            palette[c].g = 0;
            palette[c].b = (255-c)*4;
        }
        SetTimer(hWnd, IDT_PAL, 1); 
        mem_dc = CreateCompatibleDC (hdc);
	break;
	case MSG_TIMER:
		switch(wParam){
            case IDT_PAL:
		temp = palette[255];
		for (c =255; c>0; c--)
		palette[c] = palette [c-1];
		palette[0] = temp;
		SetPalette(mem_dc, 0, 255, palette);

                for (c=255; c>0; c--){
                    pix = RGB2Pixel (mem_dc, palette[c].r, palette[c].g, palette[c].b);
                    SetBrushColor (mem_dc, pix);
                    FillCircle (mem_dc, SCREEN_W/2, SCREEN_H/2, c);
                }
		InvalidateRect (hWnd , NULL , FALSE);
                break;
        }
        break;
	case MSG_PAINT:
		hdc = BeginPaint(hWnd);	
		BitBlt (mem_dc, 0, 0, SCREEN_W, SCREEN_H, hdc, 0, 0, 0);
                
		EndPaint(hWnd, hdc);
	break;
	case MSG_CLOSE:
		KillTimer(hWnd , IDT_PAL);
		DeleteCompatibleDC(mem_dc);
		DestroyMainWindow (hWnd);
		PostQuitMessage (hWnd);
		break;
	}
		

	return DefaultMainWinProc(hWnd, message, wParam, lParam);
}
Esempio n. 5
0
void Renderer::FillCircle(const Vector2D & center, double r) 
{ 
	FillCircle(center.x, center.y, r); 
}
Esempio n. 6
0
void Renderer::FillCircle(const Circle& cir) 
{ 
	FillCircle(cir.position.x, cir.position.y, cir.radius);
}
Esempio n. 7
0
ErrorType MyDrawEngine::FillCircle(const Vector2D& centre, int radius, unsigned int colour)
{
	return FillCircle(int(centre.XValue), int(centre.YValue), radius, colour);
}
Esempio n. 8
0
//8-way symmetry circle
void FrameBuffer::DrawCircleWithThickness(float cx, float cy, float r, float thickness, unsigned int color) {
    FillCircle(cx + r, cy, thickness, color);
    FillCircle(cx, cx + r, thickness, color);
    FillCircle(cx, cy - r, thickness, color);
    float x = 1.0f;
    float y = r;
    y = sqrt((r*r) - 1) + 0.5;
    while (x < y) {
        FillCircle(cx + y, cy - x, thickness, color);
        FillCircle(cx - y, cy + x, thickness, color);
        FillCircle(cx - y, cy - x, thickness, color);
        FillCircle(cx + x, cy + y, thickness, color);
        FillCircle(cx + x, cy - y, thickness, color);
        FillCircle(cx - x, cy + y, thickness, color);
        FillCircle(cx - x, cy - y, thickness, color);
        FillCircle(cx + y, cy + x, thickness, color);
        y = sqrt((r*r) - (x*x)) + 0.5;
        x++;
    }
    if (abs(x - y) < 0.01) {
        FillCircle(cx + x, cy + y, thickness, color);
        FillCircle(cx + x, cy - y, thickness, color);
        FillCircle(cx - x, cy + y, thickness, color);
        FillCircle(cx - x, cy - y, thickness, color);
    }
}
Esempio n. 9
0
	//-----------------------------------------------------------------------------------------------------------------------------------------
	void Bitmap::DrawPoint(Point p1)
	{
		FillCircle(p1, brush.size, true);
	}
/*********************************************************************
* Function: WORD AcDraw(ANALOGCLOCK *pAc)
*
*
* Notes: This is the state machine to draw the clock.
*
********************************************************************/
WORD AcDraw(void *pObj)
{
    typedef enum
    {
        REMOVE,
        BEVEL_DRAW,
        TICK
    } AC_DRAW_STATES;

    static AC_DRAW_STATES state = REMOVE;
    static SHORT width, height, radius;

    static GFX_COLOR faceClr, handClr;
  
    ANALOGCLOCK *pAc;
    
    pAc = (ANALOGCLOCK *)pObj;
 

   if(IsDeviceBusy())
        return (0);
	
    switch(state)
    {
        case REMOVE:
            if(IsDeviceBusy())
                return (0);

            if(GetState(pAc, AC_HIDE))     // Hide the button (remove from screen)
            {                      
                SetColor(pAc->hdr.pGolScheme->CommonBkColor);
                if(!Bar(pAc->hdr.left, pAc->hdr.top, pAc->hdr.right, pAc->hdr.bottom))
                {
                    return (0);
                }
            }
                      
            if(GetState(pAc, AC_TICK))
            {
                   state = TICK;
                   return(1); //buthave to do goto erase
                //goto erase_current_pos;
            }

            if(GetState(pAc, UPDATE_HOUR))
            {
                   AcHandsDraw(pAc, HOUR, THICKNESS_SECOND+4, handClr, pAc->pBitmap);
                   state = TICK;
                   return(1); //buthave to do goto erase
                //goto erase_current_pos;
            }

            if(GetState(pAc, UPDATE_MINUTE))
            {
                   AcHandsDraw(pAc, MINUTE, THICKNESS_SECOND+4, handClr, pAc->pBitmap);
                   state = TICK;
                   return(1); //buthave to do goto erase
                //goto erase_current_pos;
            }

            if(GetState(pAc, UPDATE_SECOND))
            {
                   AcHandsDraw(pAc, SECOND, THICKNESS_SECOND+4, handClr, pAc->pBitmap);
                   state = TICK;
                   return(1); //buthave to do goto erase
                //goto erase_current_pos;
            }



            radius = pAc->radius;    // get radius
            width = (pAc->hdr.right - pAc->hdr.left) - (radius * 2);  // get width
            height = (pAc->hdr.bottom - pAc->hdr.top) - (radius * 2); // get height
            state = BEVEL_DRAW;

        case BEVEL_DRAW:

            faceClr = pAc->hdr.pGolScheme->Color0;
            handClr = pAc->hdr.pGolScheme->Color1;

            SetLineThickness(NORMAL_LINE);
            SetLineType(SOLID_LINE);

            SetColor(faceClr);

            FillCircle(pAc->centerx,pAc->centery, radius);  //Draw Face of Analog Clock
           
            SetColor(handClr);
            FillCircle(pAc->centerx,pAc->centery, 8);  //Draw Middle of Analog Clock

			AcHandsDraw(pAc, SECOND, THICKNESS_SECOND, handClr, pAc->pBitmap);
			AcHandsDraw(pAc, HOUR, THICKNESS_SECOND+4, handClr, pAc->pBitmap);
			AcHandsDraw(pAc, MINUTE, THICKNESS_SECOND+4, handClr, pAc->pBitmap);

            state = REMOVE;
            break;

		case TICK:
			
			AcHandsDraw(pAc, SECOND, THICKNESS_SECOND, handClr, pAc->pBitmap);				
								
			if(pAc->valueS++ == 60) 
			{
				pAc->valueS = 1;
				if(pAc->valueM++ == 60)
				{
					pAc->valueM = 1;			
				}
				if(pAc->valueM%12 == 0)
				{
					pAc->valueH++;
					if(pAc->valueH == 60)
						pAc->valueH = 0;
					AcHandsDraw(pAc, HOUR, THICKNESS_SECOND+4, handClr, pAc->pBitmap);	
				}			
				AcHandsDraw(pAc, MINUTE, THICKNESS_SECOND+4, handClr, pAc->pBitmap);		
			}
			

			if( ((pAc->valueS - pAc->valueM)<4 && (pAc->valueS - pAc->valueM)>=0) || ((pAc->valueS - pAc->valueM)<-56 && (pAc->valueS - pAc->valueM)>-59) )
				AcHandsDraw(pAc, MINUTE, THICKNESS_SECOND+4, handClr, pAc->pBitmap);
				
			if( ((pAc->valueS - pAc->valueH)<4  && (pAc->valueS - pAc->valueH)>=0) || ((pAc->valueS - pAc->valueH)<-56 && (pAc->valueS - pAc->valueH)>-59) )
				AcHandsDraw(pAc, HOUR, THICKNESS_SECOND+4, handClr, pAc->pBitmap);
				
				
			if(pAc->valueS-1 == pAc->valueM)
				AcHandsDraw(pAc, MINUTE, THICKNESS_SECOND+4, handClr, pAc->pBitmap);
			if(pAc->valueS-1 == pAc->valueH)
				AcHandsDraw(pAc, HOUR, THICKNESS_SECOND+4, handClr, pAc->pBitmap);				
	
            state = REMOVE;
            return (1);
    }

    return (1);
}