static void draw_hilight_box (HWND hWnd, HDC hdc, COOLBARITEMDATA* item)
{
    int  l,r,t,b; 
    WINDOWINFO *info = (WINDOWINFO*)GetWindowInfo (hWnd);
    DWORD color;
    DWORD mainc = GetWindowElementAttr (hWnd, WE_MAINC_THREED_BODY);

    l = item->RcTitle.left;
    t = item->RcTitle.top;
    r = item->RcTitle.right - 1;
    b = item->RcTitle.bottom - 1;

    color = info->we_rdr->calc_3dbox_color (mainc, LFRDR_3DBOX_COLOR_DARKER);
    SetPenColor (hdc,
            RGBA2Pixel (hdc, GetRValue (color), GetGValue (color), 
                GetBValue (color), GetAValue (color)));
    MoveTo (hdc, l, t);
    LineTo (hdc, l, b);
    MoveTo (hdc, r - 1, t);
    LineTo (hdc, r - 1, b);

    color = info->we_rdr->calc_3dbox_color (mainc, LFRDR_3DBOX_COLOR_LIGHTER);
    SetPenColor (hdc,
            RGBA2Pixel (hdc, GetRValue (color), GetGValue (color), 
                GetBValue (color), GetAValue (color)));
    MoveTo (hdc, l + 1, t);
    LineTo (hdc, l + 1, b);
    MoveTo (hdc, r, t);
    LineTo (hdc, r, b);
}
Пример #2
0
static int DrawYSpace ( HDC hdc, int x, int y, int w, int h, PSCOLORDIA scld)
{
    int i;
    Uint8 r, g, b;
    HDC mdc;
    
    mdc = CreateCompatibleDCEx (hdc, scld->ysp_w, 256);
    for (i = 0; i < 256; i ++) {
        HSV2RGB (scld->clrh, scld->clrs, i, &r, &g, &b );
        SetPenColor (mdc, RGB2Pixel(mdc, r, g, b));
        MoveTo (mdc, 0, i);
        LineTo (mdc, 20 * scld->SCALE_W, i);
    }
    SetBrushColor (mdc, PIXEL_lightgray);
    FillBox (mdc, 21 * scld->SCALE_W, 0, scld->ysp_w * scld->SCALE_W, 256);
    scld->pz = scld->clrv ;
    SetPenColor (mdc, RGB2Pixel(mdc, 0, 0, 0));
    MoveTo ( mdc, 21 * scld->SCALE_W, scld->pz);
    LineTo ( mdc, 28 * scld->SCALE_W, scld->pz-3);
    MoveTo ( mdc, 21 * scld->SCALE_W, scld->pz);
    LineTo ( mdc, 28 * scld->SCALE_W, scld->pz+3);
    StretchBlt (mdc, 0, 0, scld->ysp_w, 256, hdc, x, y, w, h, 0);
    DeleteMemDC (mdc);
    return 0;
}
Пример #3
0
void confirmComplete(double x1, double y1, double x2, double y2)//确认完成按钮函数
{
    MovePen(x1,y1);
    DrawLine(x2-x1,0);
    DrawLine(0,y2-y1);
    DrawLine(x1-x2,0);
    DrawLine(0,y1-y2);
    double distance1;
    double distance2;
    double X,Y;
    SetPenColor(RED);
    distance1=(x2-x1-GetStringWidth("输入完成"))/2;
    distance2=(y1-y2-GetStringWidth("输"))/2;
    MovePen(x1+distance1,y1-distance2);
    DrawString("输入完成");
    SetPenColor(BLACK);
    while(1)
    {
        while(!(WaitForEvent()==KEYDOWN)){}
        if(GetStruckKey() == VK_LBUTTON)
        {
            X = GetMouseX();
            Y = GetMouseY();
            if((X >= x1 && X <= x2) && (Y >= y2 && Y <= y1))//鼠标点击在所规定的范围内
            {
                EatEgg();//吃掉完成键和信息输入框的蛋
                break;
            }
        }
    }

}
Пример #4
0
void GUIAPI Draw3DBorder (HDC hdc, int l, int t, int r, int b)
{
    SetPenColor(hdc, GetWindowElementColor (WEC_3DFRAME_LEFT));
    Rectangle (hdc, l + 1, t + 1, r - 1, b - 1);

    SetPenColor(hdc, GetWindowElementColor (WEC_3DFRAME_RIGHT));
    Rectangle (hdc, l, t, r - 2, b - 2);
}
Пример #5
0
static void DrawCenteredText(string text, double cx, double cy, string color) {
	double x = cx - TextStringWidth(text)/2;
	double y = cy - GetFontAscent()/2;
	MovePen(x, y);
	string oldColor = GetPenColor();
	SetPenColor(color);
	DrawTextString(text);
	SetPenColor(oldColor);
}
Пример #6
0
static void DrawCenteredCircle(double radius, double cx, double cy, string color = "Black", bool isSolid = true) {
	string oldColor = GetPenColor();
	SetPenColor(color);
	MovePen(cx + radius, cy);
	if (isSolid) StartFilledRegion(1.0);
	DrawArc(radius, 0, 360);
	if (isSolid) EndFilledRegion();
	SetPenColor(oldColor);
}
Пример #7
0
/*
	列表框消息回调函数
*/
static int CobProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
{
	int temp;
	int id;
	int index;
	RECT rc;
	HDC hdc= (HDC)NULL;
	
	GetWindowRect(hWnd, &rc);	
	switch(message){
		case MSG_SETFOCUS:{
			hdc = GetClientDC(GetParent(hWnd));
			if(hdc != (HDC)NULL){
				SetPenColor(hdc, SETFOCUS_COLOR);
				Rectangle(hdc, rc.left-1, rc.top-1, rc.right+1, rc.bottom+1);
				Rectangle(hdc, rc.left-2, rc.top-2, rc.right+2, rc.bottom+2);
				ReleaseDC(hdc);
			}
		}break;
		case MSG_KILLFOCUS:{
			hdc = GetClientDC(GetParent(hWnd));
			if(hdc !=(HDC)NULL){
				SetPenColor(hdc, KILLFOCUS_COLOR);
				Rectangle(hdc, rc.left-1, rc.top-1, rc.right+1, rc.bottom+1);
				Rectangle(hdc, rc.left-2, rc.top-2, rc.right+2, rc.bottom+2);
				ReleaseDC(hdc);
			}
		}break;
	case MSG_COMMAND:{
		case MSG_KEYUP:{
			if(wParam==SCANCODE_ENTER||CBN_EDITCHANGE==HIWORD(wParam)){
					id = GetDlgCtrlID(hWnd);
					index = SendMessage(hWnd, CB_GETCURSEL, 0, 0);
						
					switch(id){
						case DID_CO2SET_ALMCLASS:{
							gCfgCO2.bAlmControl = index;
							SetIntValueToResFile(gFileSetup, "CO2Setup", "alarm_control",  gCfgCO2.bAlmControl, 1);
							SetFocus(btnSetAlmClass);
							//改变参数的报警级别
							ChangeAlarmClass();
						}break;
						case DID_CO2SET_ALMPRINT:{
							gCfgCO2.bPrnControl = index;
							SetIntValueToResFile(gFileSetup, "CO2Setup", "alarm_print",  gCfgCO2.bPrnControl, 1);
							SetFocus(btnSetAlmPrint);
						}break;
					}	
					gbKeyType = KEY_TAB;
				}break;
			}
			return 0;
		}break;	
	}	
	temp = (*OldCobProc)(hWnd, message, wParam, lParam);
	return(temp);
}
Пример #8
0
void DrawPathfinderMap(string mapFile) {
	SetPenColor("White");
	FillBox(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT);
	SetPenColor("Black");
	if (mapFile != "") {
		MovePen(0, 0);
		DrawNamedPicture(mapFile);
	}
}
Пример #9
0
void DrawHighlightedButton(buttonT & button) {
    SetPenColor("ACTIVATED_BACKGROUND");
    DrawBackground(button);
    SetPenColor("ACTIVATED_INNERSHADE");
    DrawInnerShade(button);
    SetPenColor("ACTIVATED_BORDER");
    DrawOutline(button);
    SetPenColor("ACTIVATED_TEXT");
    DrawButtonText(button);
}
Пример #10
0
void Maze::drawWallsForCell(pointT p)
{
	MovePen(originX + p.col*cellSize, originY + p.row*cellSize);
	SetPenColor(cells(p.row, p.col).walls[South] ? "Black" : "White");
	DrawLine(cellSize, 0);
	SetPenColor(cells(p.row, p.col).walls[East] ? "Black" : "White");
	DrawLine(0, cellSize);
	SetPenColor(cells(p.row, p.col).walls[North] ? "Black" : "White");
	DrawLine(-cellSize, 0);
	SetPenColor(cells(p.row, p.col).walls[West] ? "Black" : "White");
	DrawLine(0, -cellSize);
}
Пример #11
0
void MarkHit(coord location,string color,double density)
{
	SetPenColor(color);
	MovePen( (location.col+1.5)*LG,GetWindowHeight()-(location.row+1.3)*LG );
	StartFilledRegion(density);
	DrawLine(-LG/2,-LG/2);
	DrawLine(LG/2,-LG/2);
	DrawLine(LG/2,LG/2);
	DrawLine(-LG/2,LG/2);
	EndFilledRegion();
	SetPenColor("Black");
}
Пример #12
0
/*
 *                       
 *         
 *                                  ¨x¨x¨x¨x¨x¨x¨xtop_line(dark)
 *                                   ---------top_line(light)
 *                                ¨† ¨‡        ¨‡¨†
 *        left_line(dark+light)   ¨† ¨‡        ¨‡¨†right_line(light+dark)
 *                                ¨† ¨‡        ¨‡¨†
 *    base_line_left ¨{¨{¨{¨{¨{¨{¨{                ¨{¨{¨{¨{¨{¨{¨{ base_line_right
 */
static void draw_hilight_box (HWND hWnd, HDC hdc, COOL_INDICATOR_ITEMDATA* item)
{
    int  l,r,t,b; 
    WINDOWINFO *info = (WINDOWINFO*)GetWindowInfo (hWnd);
    DWORD color;
    DWORD mainc = GetWindowElementAttr (hWnd, WE_FGC_THREED_BODY);	//UI@hilight_box_color
    
	if(item == NULL)
		return;

    l = item->RcTitle.left;
    t = item->RcTitle.top + 2;
    r = item->RcTitle.right + 1;
    b = item->RcTitle.bottom + 1;

    color = info->we_rdr->calc_3dbox_color (mainc, LFRDR_3DBOX_COLOR_DARKER);
    SetPenColor (hdc, RGBA2Pixel (hdc, GetRValue (color), GetGValue (color), GetBValue (color), GetAValue (color)));
    MoveTo (hdc, l, t);
    LineTo (hdc, l, b);	//left_line_dark
    MoveTo (hdc, r, t);
    LineTo (hdc, r, b);	//right_line_dark

	MoveTo (hdc, l, t);
	LineTo (hdc, r, t);	//top_line_dark

    color = info->we_rdr->calc_3dbox_color (mainc, LFRDR_3DBOX_COLOR_LIGHTER);
    SetPenColor (hdc, RGBA2Pixel (hdc, GetRValue (color), GetGValue (color), GetBValue (color), GetAValue (color)));
    MoveTo (hdc, l + 1, t);
    LineTo (hdc, l + 1, b);	//left_line_light
    MoveTo (hdc, r - 1, t);
    LineTo (hdc, r - 1, b);	//right_line_light

	MoveTo (hdc, l, t+1);
	LineTo (hdc, r, t+1);	//top_line_light

	mainc = GetWindowElementPixelEx(hWnd, hdc, WE_FGC_THREED_BODY);	//to avoid hdc use the color as ARGB
	SetBrushColor(hdc, mainc);	//base line color

	RECT rP;
	GetWindowRect(GetParent(hWnd), &rP);
	int x, y, w, h;
	x = 0;
	y = item->RcTitle.bottom + 2;
	w = item->RcTitle.left + 2;
	h = 4;
	FillBox(hdc, x, y, w, h);	//base_line_left
	x = item->RcTitle.right + 1;
	y = item->RcTitle.bottom + 2;
	w = RECTW(rP) - x;
	h = 4;
	FillBox(hdc, x, y, w, h);	//base_line_right
}
Пример #13
0
void DrawNormalButton(buttonT & button) {
    SetPenColor("STANDARD_BACKGROUND");
    DrawBackground(button);
    SetPenColor("STANDARD_OUTERSHADE");
    DrawOuterShade(button);
    SetPenColor("STANDARD_INNERSHADE");
    DrawInnerShade(button);
    SetPenColor("STANDARD_HIGHLIGHT");
    DrawHighlight(button);
    SetPenColor("Black");
    DrawOutline(button);
    DrawButtonText(button);
}
Пример #14
0
void DrawPrintfMessage(string message)
{
	MovePen( LG , GetWindowHeight()-11.5*LG );
	SetPenColor("White");
	StartFilledRegion(1);
	DrawLine(0,-2*LG);
	DrawLine(23*LG,0);
	DrawLine(0,2*LG);
	DrawLine(-23*LG,0);
	EndFilledRegion();
	SetPenColor("Black");
	MovePen( 2*LG , GetWindowHeight()-12.3*LG );
	DrawTextString(message);
}
Пример #15
0
/*
Function: DrawCircle
Usage: DrawCircle(pt)
-----------------------------------
Given a pointT point (pt), this function draws a circle of radius FILL_RADIUS
and color FILL_COLOR around that point.
 */
void DrawCircle(pointT pt) {
    SetPenColor(FILL_COLOR);
    StartFilledRegion(PT_DENSITY);
    MovePen(pt.xp + FILL_RADIUS, pt.yp);
    DrawArc(FILL_RADIUS, 0, 360);
    EndFilledRegion();
}
Пример #16
0
/* 
 * Function: DrawCube
 * ------------------
 * Draws one cube in its position, including the letter centered in the middle of
 * the cube.  If invert flag is true, reverse background and letter colors.
 */
static void DrawCube(int row, int col, char ch, bool invert)
{
    DrawAndFillRoundedRect(CubeX(col), CubeY(row), gState.cubeSize, gState.cubeSize, 
			   gState.cubeSize/5.0, 1.0, (invert ? "Letter Color" : "Die Color"));
    SetPenColor((invert ? "Die Color" : "Letter Color"));						
    DrawCenteredChar(CubeX(col) + gState.cubeSize/2.0, CubeY(row) + gState.cubeSize/2.0, ch);
}
Пример #17
0
static void draw_border (HWND hwnd, HDC hdc)
{
    SetPenColor (hdc, COLOR_darkgray);

    LineEx (hdc, 1, 0, 1, CONT_WIN_HEIGHT);
    LineEx (hdc, CONT_WIN_WIDTH-1, 0, CONT_WIN_WIDTH-1, CONT_WIN_HEIGHT);
}
Пример #18
0
static void DrawAndFillRoundedRect (double x, double y, double width, double height,
                                    double radius, double fill, string color)
{
    FillRoundedRect(x, y,width, height, radius, fill, color);
    SetPenColor("Black");
    DrawRoundedRect(x, y, width, height, radius);
}
Пример #19
0
void GUIAPI Draw3DDownThinFrame (HDC hDC, int l, int t, int r, int b, gal_pixel fillc)
{
    SetPenColor(hDC, GetWindowElementColor (WEC_3DFRAME_LEFT));
    MoveTo(hDC, l, b);
    LineTo(hDC, r, b);
    LineTo(hDC, r, t);
    SetPenColor(hDC, GetWindowElementColor (WEC_3DFRAME_RIGHT));
    MoveTo(hDC, l, b);
    LineTo(hDC, l, t);
    LineTo(hDC, r, t);

    if (fillc != 0) {
         SetBrushColor(hDC, fillc);
         FillBox(hDC, l + 1, t + 1, r - l - 2, b - t - 2);
    }
}
Пример #20
0
static void DrawWallUsingColor(wall w, string color)
{
	double startx = GetMazeLowerLeftX() + w.one.col * gWallLength;
	double starty = GetMazeLowerLeftY() + w.one.row * gWallLength;

	double wallLength = gWallLength;
	if (color == kMazeInvisibleColor) {
		wallLength *= 0.6;
	}

	SetPenColor(color);
	if (w.one.row == w.two.row) {
		startx += gWallLength;
		if (color == kMazeInvisibleColor)
			starty += gWallLength / 5;
		MovePen(startx, starty);
		DrawLine(0, wallLength);
	} else {
		starty += gWallLength;
		if (color == kMazeInvisibleColor)
			startx += gWallLength / 5;
		MovePen(startx, starty);
		DrawLine(wallLength, 0);
	}
}
Пример #21
0
static void FillBox(double x, double y, double width, double height,
                    double fill, string color)
{
    SetPenColor(color);
    StartFilledRegion(fill);
    DrawBox(x, y, width, height);
    EndFilledRegion();
}
Пример #22
0
static void FillRoundedRect (double x, double y, double width, double height,
                             double radius, double fill, string color)
{
    SetPenColor(color);
    StartFilledRegion(fill);
    DrawRoundedRect(x,y,width, height, radius);
    EndFilledRegion();
}
Пример #23
0
void InitPuzzleGraphics() {
	SetCoordinateSystem("screen");
	SetWindowSize(WINDOW_WIDTH, WINDOW_HEIGHT + CONTROL_STRIP_HEIGHT);
	InitGraphics();
	DefineColor("CONTROL_STRIP", 0.90, 0.90, 0.90);
	DefineColor("STANDARD_BACKGROUND", 0.80, 0.80, 0.80);
	DefineColor("STANDARD_HIGHLIGHT", 1.00, 1.00, 1.00);
	DefineColor("STANDARD_INNERSHADE", 0.72, 0.72, 0.72);
	DefineColor("STANDARD_OUTERSHADE", 0.43, 0.43, 0.43);
	DefineColor("ACTIVATED_BACKGROUND", 0.00, 0.00, 1.00);
	DefineColor("ACTIVATED_BORDER", 0.00, 0.00, 0.90);
	DefineColor("ACTIVATED_INNERSHADE", 0.00, 0.00, 0.80);
	DefineColor("ACTIVATED_TEXT", 1.00, 1.00, 1.00);
	SetPenColor("CONTROL_STRIP");
	FillBox(0, WINDOW_HEIGHT, WINDOW_WIDTH, CONTROL_STRIP_HEIGHT);
	SetPenColor("Black");
	SetWindowTitle("Triangle Puzzle Solver");
}
Пример #24
0
/* 
 * Function: DrawOneScore
 * ----------------------
 * Draws the specified score for the player according to player enum.
 */
static void DrawOneScore(playerT playerNum, int value)
{   
    SetFont(SCORE_FONT);
    SetPointSize(SCORE_FONT_SIZE);
    SetPenColor("Label Color");
    string str = IntegerToString(value);
    MovePen(gState.scoreBox[playerNum].x + gState.scoreBox[playerNum].w - TextStringWidth(str), 
	    gState.scoreBox[playerNum].y + GetFontDescent() + 0.03); // the 0.03 hack added Sept-2011
    // Using SetEraseMode() to delete old score interfered with the line underneath
    DrawTextString(str);
}
Пример #25
0
/* 
 * Function: DrawPlayerLabel
 * -------------------------
 * Labels player word list with specified name and draws a line underneath the label.
 * It also resets the player's score and word list count back to zero.
 */
static void DrawPlayerLabel(playerT player, string name)
{
    SetPenColor("Label Color");
    MovePen(gState.scoreBox[player].x, gState.scoreBox[player].y);
    DrawLine(gState.scoreBox[player].w , 0);
    SetFont(SCORE_FONT);
    SetPointSize(SCORE_FONT_SIZE);
    MovePen(gState.scoreBox[player].x, gState.scoreBox[player].y + GetFontDescent());
    DrawTextString(name);
    gState.scores[player] = gState.numWords[player] = 0;
}
Пример #26
0
Gpu::Gpu()
{
	for (int i = 0; i < 9; i++)
	{
		this->SurfacePool[i] = NULL;
	}
	for (int i = 0; i < 10; i++)
	{
		this->DrawRenderer[i] = NULL;
	}
	SetPenColor(-1, 0xFFFFFF);
}
Пример #27
0
//-----------------------------------------------------
void CTestRectGc::ConstructL(TPoint aPt, TSize aSize, TRgb aPenColor, TRgb aBrushColor, CGraphicsContext::TBrushStyle aBrushStyle)
    {    
    SetPenColor(aPenColor);
    SetBrushColor(aBrushColor);
    
    SetBrushStyle(aBrushStyle);
    SetDrawType(EDrawRect);
    SetExtent(aPt, aSize);
   
   	iFrameNo = g_FrameStart+=5; //Offset frame start for next control
   	g_FrameStart %= KNumAnimFrames;			
   }
Пример #28
0
/* Function: DrawFilledCircleWithLabel
 * Usage:  DrawFilledCircleWithLabel(center, .25, "Green", "You are here");
 * -----------------------------------------------------------------------
 * Uses facilities from extgraph to draw a circle filled with
 * color specified. The circle is centered at the given coord has the
 * specified radius.  A label is drawn to the right of the circle.
 * If you don't want a label, pass the empty string.
 */
void DrawFilledCircleWithLabel(coordT center, double radius, string color, string label)
{
    MovePen(center.x + radius, center.y);
    SetPenColor(color);
    StartFilledRegion(1.0);
    DrawArc(radius, 0, 360);
    EndFilledRegion();
    MovePen(center.x + radius, center.y);
    SetFont("Helvetica");
    SetPointSize(FONT_SIZE);
    DrawTextString(label);
}
Пример #29
0
void RemoveButton(string name) {
	for (int i = 0; i < buttons.size(); i++) {
		if (buttons[i].name == name) {
			SetPenColor("CONTROL_STRIP");
			FillBox(buttons[i].x - BUTTON_SEP, buttons[i].y - BUTTON_SEP, 
				buttons[i].width + 2*BUTTON_SEP, buttons[i].height + 2*BUTTON_SEP);
			buttons.removeAt(i);
			UpdateDisplay();
			return;
		}
	}
}
Пример #30
0
void UI_Out_640_480_Set_From_Title(HWND hWnd, char* sTitle)
{
	HDC hdc;
	RECT recttitle;
	RECT rectParent; 
	GetClientRect(hWnd, &rectParent);
	hdc = BeginPaint (hWnd); 
	recttitle.left=rectParent.left + 1;
	recttitle.top=rectParent.top + 2;
	recttitle.right=rectParent.right - 3;
	recttitle.bottom=rectParent.top + 21;
	SetBrushColor (hdc, SUBTITLECOLOR); 
	FillBox (hdc, recttitle.left, recttitle.top, recttitle.right-recttitle.left, recttitle.bottom-recttitle.top);   
	SetBkColor(hdc,SUBTITLECOLOR);  
	SetTextColor(hdc,TITLE_TEXT_COLOR); 
	DrawText (hdc, sTitle, -1, &recttitle,
		DT_SINGLELINE | DT_CENTER | DT_VCENTER);   
	SetPenColor (hdc, SEPLINECOLOR2 );	//里层SEPLINECOLOR2
	MoveTo (hdc,rectParent.left + 1, rectParent.top +1);    
	LineTo (hdc, rectParent.right -1,rectParent.top + 1);   
	MoveTo (hdc, rectParent.left +1,rectParent.top +1); 
	LineTo (hdc, rectParent.left +1, rectParent.bottom -1); 
	SetPenColor (hdc, LTFRAMECOLOR );	//外层LTFRAMECOLOR
	MoveTo (hdc, rectParent.left , rectParent.top); 
	LineTo (hdc, rectParent.right, rectParent.top); 
	MoveTo (hdc, rectParent.left , rectParent.top); 
	LineTo (hdc, rectParent.left , rectParent.bottom);  
	//画窗体右下两对边框线
	SetPenColor (hdc, SEPLINECOLOR1 );	//里层SEPLINECOLOR1
	MoveTo (hdc, rectParent.right-2, rectParent.top+1); 
	LineTo (hdc, rectParent.right-2, rectParent.bottom-2);  
	MoveTo (hdc, rectParent.left+1 ,rectParent.bottom -2);  
	LineTo (hdc, rectParent.right-2 , rectParent.bottom -2);    
	SetPenColor (hdc, RBFRAMECOLOR );	//外层RBFRAMECOLOR
	MoveTo (hdc, rectParent.right-1, rectParent.top);   
	LineTo (hdc, rectParent.right-1, rectParent.bottom-1);  
	MoveTo (hdc, rectParent.left, rectParent.bottom-1); 
	LineTo (hdc, rectParent.right-1, rectParent.bottom-1);  
	EndPaint (hWnd, hdc);   
}