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


C++ draw_box函数代码示例

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


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

示例1: menubar_draw_drop

static void
menubar_draw_drop (WMenuBar * menubar)
{
    const Menu *menu = g_list_nth_data (menubar->menu, menubar->selected);
    const unsigned int count = g_list_length (menu->entries);
    int column = menu->start_x - 1;
    unsigned int i;

    if (column + menu->max_entry_len + 5 > (gsize) menubar->widget.cols)
        column = menubar->widget.cols - menu->max_entry_len - 5;

    tty_setcolor (MENU_ENTRY_COLOR);
    draw_box (menubar->widget.owner,
              menubar->widget.y + 1, menubar->widget.x + column,
              count + 2, menu->max_entry_len + 5, FALSE);

    for (i = 0; i < count; i++)
        menubar_paint_idx (menubar, i,
                           i == menu->selected ? MENU_SELECTED_COLOR : MENU_ENTRY_COLOR);
}
开发者ID:ryanlee,项目名称:mc,代码行数:20,代码来源:menu.c

示例2: draw_level

/* Returns the width of the thumbnail */
static int draw_level(SDL_Surface *surface, struct LevelThumbnail *level,
        int x,int y,int visibility,int selected)
{
    int thwidth;
    SDL_Rect rect;
    Uint8 alpha;
    rect.x = x;
    rect.y = y;
    if(level->thumbnail) {
        SDL_Rect src = {0,0,level->thumbnail->w,level->thumbnail->h};
        thwidth = level->thumbnail->w;
        if(rect.x<0) {
            src.x = -rect.x;
            src.w -= src.x;
            rect.x = 0;
        }
        if(visibility > level->thumbnail->w)
            alpha = SDL_ALPHA_OPAQUE;
        else
            alpha = visibility/(double)level->thumbnail->w*SDL_ALPHA_OPAQUE;
        SDL_SetAlpha(level->thumbnail,SDL_SRCALPHA,alpha);
        SDL_BlitSurface(level->thumbnail,&src,surface,&rect);
    } else {
        rect.w = THUMBNAIL_HEIGHT;
        rect.h = THUMBNAIL_HEIGHT;
        thwidth = rect.w;
        if(visibility > THUMBNAIL_HEIGHT)
            alpha = SDL_ALPHA_OPAQUE;
        else
            alpha = visibility/(double)THUMBNAIL_HEIGHT*SDL_ALPHA_OPAQUE;
        fill_box(surface,rect.x,rect.y,rect.w,rect.h,map_rgba(0,0,0,alpha));
    }
    if(selected) {
        draw_box(rect.x-3, rect.y-3, rect.w+6, rect.h+6, 3, col_cyan);
        rect.y += rect.h + 4;
        rect.x += rect.w/2 - level->name->w/2;
        SDL_BlitSurface(level->name,NULL,surface,&rect);
    }

    return thwidth;
}
开发者ID:callaa,项目名称:luola,代码行数:42,代码来源:selection.c

示例3: kmain

void kmain( void* mbd, unsigned int magic )
{
   if ( magic != 0x2BADB002 )
   {
      /* Something went not according to specs. Print an error */
      /* message and halt, but do *not* rely on the multiboot */
      /* data structure. */

     kputs("magic number failed, a-bloo a-bloo :(");
     return;
   }
 
   /* You could either use multiboot.h */
   /* (http://www.gnu.org/software/grub/manual/multiboot/multiboot.html#multiboot_002eh) */
   /* or do your offsets yourself. The following is merely an example. */ 
   char * boot_loader_name =(char*) ((long*)mbd)[16];

   clear();

   kputs("Welcome to BonzOS");
   kputs("~ My OS is a POS ~");
   kputs(boot_loader_name);

   kputs("");
   kputs("Testing memcpy, memset, and memcmp:");
   test_memcpy();
   test_memset();
   test_memcmp();

   if (bochs_vga_available()) {
     kputs("Bochs VGA is available.");
     bochs_vga_set_resolution(800, 600);

     clear_screen(0xFF);
     clear_screen(0xEE);
     clear_screen(0x77);
     clear_screen(0x0);

     draw_box(30, 30, 100, 100, 0x00FFFF00);
   }
}
开发者ID:bkerley,项目名称:bonzos,代码行数:41,代码来源:kernel.c

示例4: main

int main( int argc, char* argv[] ) {
box = cvRect(-1,-1,0,0);
IplImage* image = cvLoadImage(argv[1]);
//cvZero( image );
IplImage* temp = cvCloneImage( image );
cvNamedWindow( "Box Example" );
// Here is the crucial moment that we actually install
// the callback. Note that we set the value ‘param’ to
// be the image we are working with so that the callback
// will have the image to edit.
//
cvSetMouseCallback(
"Box Example",
my_mouse_callback,
(void*) image
);
// The main program loop. Here we copy the working image
// to the ‘temp’ image, and if the user is drawing, then
// put the currently contemplated box onto that temp image.
// display the temp image, and wait 15ms for a keystroke,
// then repeat...
//
while( 1 ) {
cvCopyImage( image, temp );
if( drawing_box ) draw_box( temp, box );
if(count==2)
    {
        cvSetImageROI(temp,box);
        cvShowImage("Cropped",temp);
        cvSaveImage(argv[1],temp);
        break;
    }
cvShowImage( "Box Example", temp );
if( cvWaitKey( 15 )==27 ) break;
}
// Be tidy
//
cvReleaseImage( &image );
cvReleaseImage( &temp );
cvDestroyWindow( "Box Example" );
}
开发者ID:adarshtadimari,项目名称:vision,代码行数:41,代码来源:crop2.cpp

示例5: panelize_callback

static cb_ret_t
panelize_callback (Dlg_head *h, dlg_msg_t msg, int parm)
{
    switch (msg) {
    case DLG_DRAW:
	common_dialog_repaint (h);
	attrset (COLOR_NORMAL);
	draw_box (h, UY, UX, h->lines - 10, h->cols - 10);
	return MSG_HANDLED;

    case DLG_POST_KEY:
	/* fall */
    case DLG_INIT:
	attrset (MENU_ENTRY_COLOR);
	update_command ();
	return MSG_HANDLED;

    default:
	return default_dlg_callback (h, msg, parm);
    }
}
开发者ID:ebichu,项目名称:dd-wrt,代码行数:21,代码来源:panelize.c

示例6: common_dialog_repaint

/** Clean the dialog area, draw the frame and the title */
void
common_dialog_repaint (Dlg_head * h)
{
    int space;

    if (h->state != DLG_ACTIVE)
        return;

    space = (h->flags & DLG_COMPACT) ? 0 : 1;

    tty_setcolor (h->color[DLG_COLOR_NORMAL]);
    dlg_erase (h);
    draw_box (h, space, space, h->lines - 2 * space, h->cols - 2 * space, FALSE);

    if (h->title != NULL)
    {
        tty_setcolor (h->color[DLG_COLOR_TITLE]);
        dlg_move (h, space, (h->cols - str_term_width1 (h->title)) / 2);
        tty_print_string (h->title);
    }
}
开发者ID:ryanlee,项目名称:mc,代码行数:22,代码来源:dialog.c

示例7: tclcmd_draw_box

/* void draw_box (ESContext *esContext, int16_t x, int16_t y, int16_t w, int16_t h, uint8_t r, uint8_t g, uint8_t b, uint8_t a) { */
int tclcmd_draw_box (ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) {
    if (objc != 9) {
        Tcl_WrongNumArgs (interp, 1, objv, "{ESContext *esContext} { int16_t x} { int16_t y} { int16_t w} { int16_t h} { uint8_t r} { uint8_t g} { uint8_t b} { uint8_t a}");
        return TCL_ERROR;
    }
    int16_t arg_x;
    if (Tcl_GetIntFromObj(interp, objv[1], (int *)&arg_x) != TCL_OK) {
        return TCL_ERROR;
    }
    int16_t arg_y;
    if (Tcl_GetIntFromObj(interp, objv[2], (int *)&arg_y) != TCL_OK) {
        return TCL_ERROR;
    }
    int16_t arg_w;
    if (Tcl_GetIntFromObj(interp, objv[3], (int *)&arg_w) != TCL_OK) {
        return TCL_ERROR;
    }
    int16_t arg_h;
    if (Tcl_GetIntFromObj(interp, objv[4], (int *)&arg_h) != TCL_OK) {
        return TCL_ERROR;
    }
    uint8_t arg_r;
    if (Tcl_GetIntFromObj(interp, objv[5], (int *)&arg_r) != TCL_OK) {
        return TCL_ERROR;
    }
    uint8_t arg_g;
    if (Tcl_GetIntFromObj(interp, objv[6], (int *)&arg_g) != TCL_OK) {
        return TCL_ERROR;
    }
    uint8_t arg_b;
    if (Tcl_GetIntFromObj(interp, objv[7], (int *)&arg_b) != TCL_OK) {
        return TCL_ERROR;
    }
    uint8_t arg_a;
    if (Tcl_GetIntFromObj(interp, objv[8], (int *)&arg_a) != TCL_OK) {
        return TCL_ERROR;
    }
    draw_box(GlobalesContext, arg_x, arg_y, arg_w, arg_h, arg_r, arg_g, arg_b, arg_a);
    return TCL_OK;
}
开发者ID:auuuux,项目名称:multigcs,代码行数:41,代码来源:tcl_draw.c

示例8: draw_numbers

/* Draw a column of numbers at the left of the current point */
static void draw_numbers(FILE *out, unsigned int maxnum, bool move_down)
{
    unsigned int i;

    /* Draw title */
    fprintf(out, "-%u 0 rmoveto\n", NORMAL_COLUMN_WIDTH);
    draw_box(out, NORMAL_COLUMN_WIDTH,
             TOP_BOX_HEIGHT,
             "Count", NUMBER_FONT_SIZE, ORIENT_VERTICAL, true);
    fprintf(out, "-%u -%u rmoveto\n",
            NORMAL_COLUMN_WIDTH, TOP_BOX_HEIGHT);

    /* Set font */
    fprintf(out, "/%s findfont ", COUNT_NUMBER_FONT);
    fprintf(out, "%u scalefont setfont ", NUMBER_FONT_SIZE);

    if (move_down) {
        fprintf(out, "0 -%u rmoveto\n",	NORMAL_COLUMN_HEIGHT/2);
        /* Draw lines to attach up */
        fprintf(out, "gsave"
                " 0 %u rlineto %u 0 rmoveto 0 -%u rlineto stroke"
                " grestore\n",
                NORMAL_COLUMN_HEIGHT/2,
                NORMAL_COLUMN_WIDTH,
                NORMAL_COLUMN_HEIGHT/2);
    }

    /* Draw every digit H. */
    for (i = 0; i < maxnum; i++) {
        char countstr[INT_CHARS+1];
        sprintf(countstr, "%u", i+1);
        /* Set width */
        fprintf(out, "%u\n", NORMAL_COLUMN_WIDTH);
        draw_pair(out, countstr, "", NUMBER_FONT_SIZE, true);
    }
    /* Move back up to the top. */
    fprintf(out, "0 %u rmoveto\n",
            NORMAL_COLUMN_HEIGHT*maxnum + TOP_BOX_HEIGHT
            + NORMAL_COLUMN_HEIGHT/2);
}
开发者ID:patcon,项目名称:eVACS,代码行数:41,代码来源:report.c

示例9: pager_draw_button

void
pager_draw_button (int x, int num)
{
	char label;
#ifdef XFT
	XftColor col;
#endif

	if (num == tb.my_desktop)
	{
		/* current desktop */
		draw_box (x, PAGER_BUTTON_WIDTH);
	} else
	{
		set_foreground (5);
		fill_rect (x, 1, PAGER_BUTTON_WIDTH+1, WINHEIGHT - 2);
	}

	label = '1' + num;

#ifdef XFT
	col.color.alpha = 0xffff;
	col.color.red = cols[5].red;
	col.color.green = cols[5].green;
	col.color.blue = cols[5].blue;
	XftDrawString8 (xftdraw, &col, xfs, x + ((PAGER_BUTTON_WIDTH - PAGER_DIGIT_WIDTH) / 2), text_y, &label, 1);
#else
    if (num == tb.my_desktop)
    {
        set_foreground (6);
    }
    else
    {
        set_foreground (4);
    }
	XDrawString (dd, tb.win, fore_gc,
	x + ((PAGER_BUTTON_WIDTH - PAGER_DIGIT_WIDTH) / 2) - 1, text_y, &label, 1);
#endif
}
开发者ID:hoverisk,项目名称:fspanel-black,代码行数:39,代码来源:fspanel.c

示例10: display_video_text

void RecordMonitorGUI::
display_video_text(int x, int y, const char *text, int font,
	int bg_color, int color, int alpha, double secs, double scale)
{
	lock_window("RecordMonitorGUI::display_text");
	set_font(font);
	int ch = get_text_height(font);
	int h = get_text_height(font,text) + ch/2;
	int w = get_text_width(font, text) + ch;
	BC_Pixmap pixmap(this, w, h);
	set_opaque();
	set_color(bg_color);
	draw_box(0, 0, w, h, &pixmap);
	set_color(color);
	draw_text(ch/2, ch, text, strlen(text), &pixmap);
	BC_Bitmap bitmap(this, w, h, BC_RGB888, 0);
	VFrame in(&bitmap, w, h, BC_RGB888, -1);
	Drawable drawable = pixmap.get_pixmap();
	bitmap.read_drawable(drawable, 0, 0, &in);
	unlock_window();
	record->display_vframe(&in, x, y, alpha, secs, scale);
}
开发者ID:TravisKraatz,项目名称:cinelerra,代码行数:22,代码来源:recordmonitor.C

示例11: report_transfer

void report_transfer(unsigned int count,
                     struct fraction value,
                     unsigned int votes_transferred)
{
    char valstring[INT_CHARS + sizeof(" / ") + INT_CHARS];

    /* If denominator == 1, skip it */
    if (value.denominator == 1)
        sprintf(valstring, "%lu", value.numerator);
    else
        sprintf(valstring, "%lu / %lu",
                value.numerator, value.denominator);

    fprintf(counting.out, "%u -%u moveto\n",
            counting.transfer_value,
            TOP_BOX_HEIGHT + (count-1)*NORMAL_COLUMN_HEIGHT);
    draw_box(counting.out, FRACTION_COLUMN_WIDTH, NORMAL_COLUMN_HEIGHT,
             valstring, NUMBER_FONT_SIZE, ORIENT_HORIZONTAL, true);

    draw_number_box(counting.out, count-1, counting.to_table2,
                    votes_transferred);
}
开发者ID:patcon,项目名称:eVACS,代码行数:22,代码来源:report.c

示例12: groupbox_callback

static cb_ret_t
groupbox_callback (Widget * w, widget_msg_t msg, int parm)
{
    WGroupbox *g = (WGroupbox *) w;

    switch (msg)
    {
    case WIDGET_INIT:
        return MSG_HANDLED;

    case WIDGET_FOCUS:
        return MSG_NOT_HANDLED;

    case WIDGET_DRAW:
        {
            gboolean disabled = (w->options & W_DISABLED) != 0;
            tty_setcolor (disabled ? DISABLED_COLOR : COLOR_NORMAL);
            draw_box (g->widget.owner, g->widget.y - g->widget.owner->y,
                      g->widget.x - g->widget.owner->x, g->widget.lines, g->widget.cols, TRUE);

            if (g->title != NULL)
            {
                tty_setcolor (disabled ? DISABLED_COLOR : COLOR_TITLE);
                dlg_move (g->widget.owner, g->widget.y - g->widget.owner->y,
                          g->widget.x - g->widget.owner->x + 1);
                tty_print_string (g->title);
            }
            return MSG_HANDLED;
        }

    case WIDGET_DESTROY:
        g_free (g->title);
        return MSG_HANDLED;

    default:
        return default_proc (msg, parm);
    }
}
开发者ID:artzub,项目名称:mc,代码行数:38,代码来源:groupbox.c

示例13: ff_drawshape

Var* ff_drawshape(vfuncptr func, Var* arg)
{
	Var *obj = NULL, *ovar = NULL;
	size_t x, y, z;
	char* out;
	float ignore = FLT_MAX;

	const char* options[] = {"cross", "box", "circle", NULL};
	const char* shape     = options[0];

	Alist alist[9];
	alist[0]      = make_alist("object", ID_VAL, NULL, &obj);
	alist[1]      = make_alist("shape", ID_ENUM, options, &shape);
	alist[2]      = make_alist("ignore", DV_FLOAT, NULL, &ignore);
	alist[3].name = NULL;

	if (parse_args(func, arg, alist) == 0) return (NULL);

	if (obj == NULL) {
		parse_error("%s: No object specified\n", func->name);
		return (NULL);
	}

	x    = GetX(obj);
	y    = GetY(obj);
	z    = GetZ(obj);
	out  = calloc(x * y, sizeof(char));
	ovar = newVal(BSQ, x, y, 1, DV_UINT8, out);

	if (!strcmp(shape, "cross")) {
		draw_cross(obj, x, y, ignore, out);
	} else if (!strcmp(shape, "box")) {
		draw_box(obj, x, y, ignore, out);
	} else if (!strcmp(shape, "circle")) {
		draw_circle(obj, x, y, ignore, out);
	}
	return (ovar);
}
开发者ID:robwink,项目名称:davinci,代码行数:38,代码来源:ff_radial.c

示例14: value

void TaskButton::draw(void) {
	Fl_Color col = value() ? selection_color() : color();
	draw_box(value() ? (down_box() ? down_box() : fl_down(box())) : box(), col);

	if(image()) {
		int X, Y, lw, lh;

		X = x() + 5;
		Y = (y() + h() / 2) - (image()->h() / 2);
		image()->draw(X, Y);

		X += image()->w() + 5;

		if(label()) {
			fl_font(labelfont(), labelsize());
			fl_color(labelcolor());

			lw = lh = 0;
			fl_measure(label(), lw, lh, 0);

			/* use clipping so long labels do not be drawn on the right border, which looks ugly */
			fl_push_clip(x() + Fl::box_dx(box()), 
						 y() + Fl::box_dy(box()), 
						 w() - Fl::box_dw(box()) - 5, 
						 h() - Fl::box_dh(box()));

			Y = (y() + h() / 2) - (lh / 2);
			fl_draw(label(), X, Y, lw, lh, align(), 0, 0);

			fl_pop_clip();
		}
	} else {
		draw_label();
	}

	if(Fl::focus() == this)
		draw_focus();
}
开发者ID:GustavoMOG,项目名称:ede,代码行数:38,代码来源:TaskButton.cpp

示例15: display_listbox

/* Displays a dialog box */
static widget_handler_status_T
display_listbox(struct dialog_data *dlg_data, struct widget_data *widget_data)
{
	struct terminal *term = dlg_data->win->term;
	struct listbox_data *box = get_listbox_widget_data(widget_data);
	struct listbox_context data;

	listbox_sel_move(widget_data, 0);

	draw_box(term, &widget_data->box, ' ', 0,
		 get_bfu_color(term, (const unsigned char *)"menu.normal"));

	memset(&data, 0, sizeof(data));
	data.term = term;
	data.widget_data = widget_data;
	data.box = box;
	data.dlg_data = dlg_data;

	traverse_listbox_items_list(box->top, box, widget_data->box.height,
				    1, display_listbox_item, &data);

	return EVENT_PROCESSED;
}
开发者ID:rkd77,项目名称:elinks-tv,代码行数:24,代码来源:listbox.c


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