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


C++ drawtext函数代码示例

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


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

示例1: edit_draw

void edit_draw(EDIT *edit, int x, int y, int width, int height)
{
    if((width - 4 * SCALE - SCROLL_WIDTH) < 0) {
        return;
    }

    if(utox_window_baseline && y > utox_window_baseline - font_small_lineheight - 4 * SCALE) {
        y = utox_window_baseline - font_small_lineheight - 4 * SCALE;
    }

    edit->width = width -4 * SCALE - (edit->multiline ? SCROLL_WIDTH : 0);
    edit->height = height - 4 * SCALE;

    if(!edit->noborder) {
        framerect(x, y, x + width, y + height, (edit == active_edit) ? BLUE : (edit->mouseover ? C_GRAY2 : C_GRAY));
    }
    drawrect(x + 1, y + 1, x + width - 1, y + height - 1, WHITE);

    setfont(FONT_TEXT);
    setcolor(COLOR_TEXT);

    int yy = y;

    if(edit->multiline) {
        pushclip(x + 1, y + 1, width - 2, height - 2);

        SCROLLABLE *scroll = edit->scroll;
        scroll->content_height = text_height(width - 4 * SCALE - SCROLL_WIDTH, font_small_lineheight, edit->data, edit->length) + 4 * SCALE;
        scroll_draw(scroll, x, y, width, height);
        yy -= scroll_gety(scroll, height);
    }


    if(!edit->length && maybe_i18nal_string_is_valid(&edit->empty_str)) {
        STRING* empty_str_text = maybe_i18nal_string_get(&edit->empty_str);
        setcolor(C_GRAY2);
        drawtext(x + 2 * SCALE, yy + 2 * SCALE, empty_str_text->str, empty_str_text->length);
    }

    _Bool a = (edit == active_edit);
    drawtextmultiline(x + 2 * SCALE, x + width - 2 * SCALE - (edit->multiline ? SCROLL_WIDTH : 0), yy + 2 * SCALE, y, y + height, font_small_lineheight, edit->data, edit->length,
                      a ? edit_sel.start : STRING_IDX_MAX, a ? edit_sel.length : STRING_IDX_MAX, edit->multiline);

    if(edit->multiline) {
        popclip();
    }
}
开发者ID:Antonius-git,项目名称:uTox,代码行数:47,代码来源:edit.c

示例2: usb_dnld_hook

int usb_dnld_hook(){
  /* These are global buffers to the packet data, its length, and the
     block address that it runs to.  The stock firmware has a bug
     in that it assumes the packet size is always 2048 bytes.
  */
  static char *packet=(char*) 0x200199f0;//2.032
  static int *packetlen=(int*) 0x2001d20c;//2.032
  static int *blockadr=(int*) 0x2001d208;//2.032
  static char *dfu_state=(char*) 0x2001d405;//2.032
  static char **dfu_target_adr=(char**) 0x2000112c; //2.032
  
  //Don't know what these do.
  //char *thingy=(char*) 0x2001d276;
  char *thingy2=(char*) 0x2001d041;
  
  /* DFU transfers begin at block 2, and special commands hook block
     0.  We'll use block 1, because it handily fits in the gap without
     breaking backward compatibility with the older code.
   */
  if(*blockadr==1){
    switch(packet[0]){
    case TDFU_DMESG:
      //The DMESG buffer might move, so this command
      //sets the target address to the DMESG buffer.
      *dfu_target_adr=dmesg_start;
      break;
    case TDFU_PRINT: // 0x80, u8 x, u8 y, u8 str[].
      drawtext((wchar_t *) (packet+3),
	       packet[1],packet[2]);
      break;
    }
    
    thingy2[0]=0;
    thingy2[1]=0;
    thingy2[2]=0;
    thingy2[3]=3;
    *dfu_state=3;
    
    *blockadr=0;
    *packetlen=0;
    return 0;
  }else{
    /* For all other blocks, we default to the internal handler.
     */
    return usb_dnld_handle();
  }
}
开发者ID:hewittc,项目名称:md380tools,代码行数:47,代码来源:usb.c

示例3: dropdown_drawactive

void dropdown_drawactive(void)
{
    DROPDOWN *b = active;
    if(!b) {
        return;
    }

    int x = active_x, y = active_y, w = active_width, h = active_height;

    setfont(FONT_TEXT);
    setcolor(COLOR_TEXT);

    int i, sign = 1;

    // Increase width if needed, so that all menu items fit.
    for(i = 0; i != b->dropcount; i++) {
        STRING* e = b->ondisplay(i, b);
        int needed_w = textwidth(e->str, e->length) + 4 * SCALE;
        if(w < needed_w) {
            w = needed_w;
        }
    }

    if(y + h * b->dropcount > height) {
        y -= h * (b->dropcount - 1);
        sign = -1;
    }

    drawrect(x, y, x + w, y + h * b->dropcount, WHITE);
    framerect(x, y, x + w, y + h * b->dropcount, BLUE);

    if(sign == -1) {
        y += h * (b->dropcount - 1);
    }

    for(i = 0; i != b->dropcount; i++) {
        int j = index(b, i);
        STRING* e = b->ondisplay(j, b);
        if(j == b->over) {
            drawrectw(x + 1, y + 1, w - 2, h - 2, C_GRAY);
        }
        drawtext(x + 2 * SCALE, y + 2 * SCALE, e->str, e->length);

        y += sign * h;
    }
}
开发者ID:aviau,项目名称:uTox,代码行数:46,代码来源:dropdown.c

示例4: luatpt_drawtext

int luatpt_drawtext(lua_State* l)
{
    char *string;
	int textx, texty, textred, textgreen, textblue, textalpha;
	textx = luaL_optint(l, 1, 0);
	texty = luaL_optint(l, 2, 0);
	string = luaL_optstring(l, 3, "");
	textred = luaL_optint(l, 4, 255);
	textgreen = luaL_optint(l, 5, 255);
	textblue = luaL_optint(l, 6, 255);
	textalpha = luaL_optint(l, 7, 255);
	if(vid_buf!=NULL){
		drawtext(vid_buf, textx, texty, string, textred, textgreen, textblue, textalpha);
		return 0;	
	}
	return -1;
}
开发者ID:321boom,项目名称:The-Powder-Toy,代码行数:17,代码来源:luaconsole.c

示例5: draw_rr_pin

static void draw_rr_pin (int inode, enum color_types color) {

/* Draws an IPIN or OPIN rr_node.  Note that the pin can appear on more    *
 * than one side of a clb.  Also note that this routine can change the     *
 * current color to BLACK.                                                 */

 int ipin, i, j, iside, iclass, iblk;
 float xcen, ycen;
 char str[BUFSIZE];

 i = rr_node[inode].xlow;
 j = rr_node[inode].ylow;
 ipin = rr_node[inode].ptc_num;
 setcolor (color);

 if (clb[i][j].type == CLB) {
    iclass = clb_pin_class[ipin];

    for (iside=0;iside<=3;iside++) {
       if (pinloc[iside][ipin] == 1) {   /* Pin exists on this side. */
          get_rr_pin_draw_coords (inode, iside, &xcen, &ycen);
          fillrect (xcen-pin_size, ycen-pin_size, xcen+pin_size, ycen+pin_size);
          sprintf (str, "%d", ipin);
          setcolor (BLACK);
          drawtext (xcen, ycen, str, 2*pin_size);
          setcolor (color);
       }
    }
 }

 else {               /* IO pad. */
    iblk = clb[i][j].u.io_blocks[ipin];

    if (i == 0) 
       iside = RIGHT;
    else if (j == 0)
       iside = TOP;
    else if (i == nx+1)
       iside = LEFT;
    else
       iside = BOTTOM;

    get_rr_pin_draw_coords (inode, iside, &xcen, &ycen);
    fillrect (xcen-pin_size, ycen-pin_size, xcen+pin_size, ycen+pin_size);
 }
}
开发者ID:BackupTheBerlios,项目名称:pvpr,代码行数:46,代码来源:draw.c

示例6: sprintf

void Transmitter::renderLevels(int width, int height) {
    char val[50];
    const int LEVEL_CORNER_X = 10;
    const int LEVEL_CORNER_Y = 400;
    
    // Draw the numeric degree/sec values from the gyros
    sprintf(val, "Pitch Rate %4.1f", _lastRotationRate.x);
    drawtext(LEVEL_CORNER_X, LEVEL_CORNER_Y, 0.10, 0, 1.0, 1, val, 0, 1, 0);
    sprintf(val, "Yaw Rate   %4.1f", _lastRotationRate.y);
    drawtext(LEVEL_CORNER_X, LEVEL_CORNER_Y + 15, 0.10, 0, 1.0, 1, val, 0, 1, 0);
    sprintf(val, "Roll Rate  %4.1f", _lastRotationRate.z);
    drawtext(LEVEL_CORNER_X, LEVEL_CORNER_Y + 30, 0.10, 0, 1.0, 1, val, 0, 1, 0);
    sprintf(val, "Pitch      %4.3f", _estimatedRotation.x);
    drawtext(LEVEL_CORNER_X, LEVEL_CORNER_Y + 45, 0.10, 0, 1.0, 1, val, 0, 1, 0);
    sprintf(val, "Yaw        %4.3f", _estimatedRotation.y);
    drawtext(LEVEL_CORNER_X, LEVEL_CORNER_Y + 60, 0.10, 0, 1.0, 1, val, 0, 1, 0);
    sprintf(val, "Roll       %4.3f", _estimatedRotation.z);
    drawtext(LEVEL_CORNER_X, LEVEL_CORNER_Y + 75, 0.10, 0, 1.0, 1, val, 0, 1, 0);
    
    //  Draw the levels as horizontal lines
    const int LEVEL_CENTER = 150;
    const float ACCEL_VIEW_SCALING = 1.f;
    glLineWidth(2.0);
    glColor4f(1, 1, 1, 1);
    glBegin(GL_LINES);
    // Gyro rates
    glVertex2f(LEVEL_CORNER_X + LEVEL_CENTER, LEVEL_CORNER_Y - 3);
    glVertex2f(LEVEL_CORNER_X + LEVEL_CENTER + _lastRotationRate.x, LEVEL_CORNER_Y - 3);
    glVertex2f(LEVEL_CORNER_X + LEVEL_CENTER, LEVEL_CORNER_Y + 12);
    glVertex2f(LEVEL_CORNER_X + LEVEL_CENTER + _lastRotationRate.y, LEVEL_CORNER_Y + 12);
    glVertex2f(LEVEL_CORNER_X + LEVEL_CENTER, LEVEL_CORNER_Y + 27);
    glVertex2f(LEVEL_CORNER_X + LEVEL_CENTER + _lastRotationRate.z, LEVEL_CORNER_Y + 27);
    // Acceleration
    glVertex2f(LEVEL_CORNER_X + LEVEL_CENTER, LEVEL_CORNER_Y + 42);
    glVertex2f(LEVEL_CORNER_X + LEVEL_CENTER + (int)(_estimatedRotation.x * ACCEL_VIEW_SCALING),
               LEVEL_CORNER_Y + 42);
    glVertex2f(LEVEL_CORNER_X + LEVEL_CENTER, LEVEL_CORNER_Y + 57);
    glVertex2f(LEVEL_CORNER_X + LEVEL_CENTER + (int)(_estimatedRotation.y * ACCEL_VIEW_SCALING),
               LEVEL_CORNER_Y + 57);
    glVertex2f(LEVEL_CORNER_X + LEVEL_CENTER, LEVEL_CORNER_Y + 72);
    glVertex2f(LEVEL_CORNER_X + LEVEL_CENTER + (int)(_estimatedRotation.z * ACCEL_VIEW_SCALING),
               LEVEL_CORNER_Y + 72);
    
    glEnd();
    //  Draw green vertical centerline
    glColor4f(0, 1, 0, 0.5);
    glBegin(GL_LINES);
    glVertex2f(LEVEL_CORNER_X + LEVEL_CENTER, LEVEL_CORNER_Y - 6);
    glVertex2f(LEVEL_CORNER_X + LEVEL_CENTER, LEVEL_CORNER_Y + 30);
    glEnd();

    
}
开发者ID:Issacchaos,项目名称:hifi,代码行数:53,代码来源:Transmitter.cpp

示例7: drawsettings_content

/* Text content for settings page */
static void drawsettings_content(int UNUSED(x), int y, int UNUSED(w), int UNUSED(height))
{
    setcolor(C_TITLE);
    setfont(FONT_TEXT);
    drawstr(LIST_RIGHT + SCALE * 5, y + SCALE * 5, NAME);

    drawstr(LIST_RIGHT + SCALE * 5, y + SCALE * 29, STATUSMESSAGE);

    drawstr(LIST_RIGHT + SCALE * 5, y + SCALE * 123, AUDIOINPUTDEVICE);
    drawstr(LIST_RIGHT + SCALE * 190, y + SCALE * 123, AUDIOFILTERING);
    drawstr(LIST_RIGHT + SCALE * 5, y + SCALE * 147, AUDIOOUTPUTDEVICE);
    drawstr(LIST_RIGHT + SCALE * 5, y + SCALE * 171, VIDEOINPUTDEVICE);

    drawstr(LIST_RIGHT + SCALE * 5, y + SCALE * 206, DPI);
    drawstr(LIST_RIGHT + SCALE * 5, y + SCALE * 230, LANGUAGE);
    drawstr(LIST_RIGHT + SCALE * 5, y + SCALE * 254, NETWORK);

    drawstr(LIST_RIGHT + SCALE * 5, y + SCALE * 266, IPV6);
    drawstr(LIST_RIGHT + SCALE * 5 + 50 * SCALE, y + SCALE * 266, UDP);

    drawstr(LIST_RIGHT + SCALE * 5, y + SCALE * 278, PROXY);

    drawstr(LIST_RIGHT + SCALE * 5, y + SCALE * 310, LOGGING);

    drawtext(LIST_RIGHT + SCALE * 132, y + SCALE * 290, (uint8_t*)":", 1);

    setfont(FONT_SELF_NAME);

    drawstr(LIST_RIGHT + SCALE * 5, y + SCALE * 54, TOXID);

    drawstr(LIST_RIGHT + SCALE * 5, y + SCALE * 76, PREVIEW);

    drawstr(LIST_RIGHT + SCALE * 5, y + SCALE * 113, DEVICESELECTION);

    drawstr(LIST_RIGHT + SCALE * 5, y + SCALE * 195, OTHERSETTINGS);

    setfont(FONT_MISC);
    setcolor(C_RED);
    drawstr(LIST_RIGHT + SCALE * 5, y + SCALE * 302, WARNING);

    setcolor(C_TITLE);
    setfont(FONT_TEXT);
    drawstr(LIST_RIGHT + SCALE * 5, y + SCALE * 334, AUDIONOTIFICATIONS);
}
开发者ID:draziw-,项目名称:uTox,代码行数:45,代码来源:ui.c

示例8: drawmenu

void
drawmenu(void) {
	int curpos;
	Item *item;

	dc->x = 0;
	dc->y = 0;
	dc->h = bh;
	drawrect(dc, 0, 0, mw, mh, True, normcol->BG);

	if(prompt && *prompt) {
		dc->w = promptw;
		drawtext(dc, prompt, selcol);
		dc->x = dc->w;
	}
	/* draw input field */
	dc->w = (lines > 0 || !matches) ? mw - dc->x : inputw;
	drawtext(dc, text, normcol);
	if((curpos = textnw(dc, text, cursor) + dc->font.height/2) < dc->w)
		drawrect(dc, curpos, (dc->h - dc->font.height)/2 + 1, 1, dc->font.height -1, True, normcol->FG);

    if(!quiet || strlen(text) > 0) {    
        if(lines > 0) {
            /* draw vertical list */
            dc->w = mw - dc->x;
            for(item = curr; item != next; item = item->right) {
                dc->y += dc->h;
                drawtext(dc, item->text, (item == sel) ? selcol : normcol);
            }
        }
        else if(matches) {
            /* draw horizontal list */
            dc->x += inputw;
            dc->w = textw(dc, "<");
            if(curr->left)
                drawtext(dc, "<", normcol);
            for(item = curr; item != next; item = item->right) {
                dc->x += dc->w;
                dc->w = MIN(textw(dc, item->text), mw - dc->x - textw(dc, ">"));
                drawtext(dc, item->text, (item == sel) ? selcol : normcol);
            }
            dc->w = textw(dc, ">");
            dc->x = mw - dc->w;
            if(next)
                drawtext(dc, ">", normcol);
        }
    }
	mapdc(dc, win, mw, mh);
}
开发者ID:OliverUv,项目名称:dmenu-q-xywh-xft,代码行数:49,代码来源:dmenu.c

示例9: handleevents

ULONG handleevents(struct Window *win, struct Screen *screen, WORD x, WORD y)
{
    struct IntuiMessage *imsg;
    WORD y1;
    struct MsgPort *port = win->UserPort;
    BOOL terminated = FALSE;
    ULONG retidcmp = 0;
	
    while (!terminated)
    {
	if ((imsg = (struct IntuiMessage *)GetMsg(port)) != NULL)
	{
	    
	    switch (imsg->Class)
	    {
	    case IDCMP_CLOSEWINDOW:
	    	terminated = TRUE;
	    	break;

	    case IDCMP_INTUITICKS:
	        y1 = drawtext(win, x, y, "Screen position: (%d, %d)               ", screen->LeftEdge, screen->TopEdge);
		y1 = drawtext(win, x, y1, "Mouse position: (%d, %d)               ", screen->MouseX, screen->MouseY);
		y1 = drawtext(win, x, y1, "ViewPort size: %dx%d               ", screen->ViewPort.DWidth, screen->ViewPort.DHeight);
		y1 = drawtext(win, x, y1, "ViewPort position: (%d, %d)               ", screen->ViewPort.DxOffset, screen->ViewPort.DyOffset);
		y1 = drawtext(win, x, y1, "RasInfo position: (%d, %d)               ", screen->ViewPort.RasInfo->RxOffset, screen->ViewPort.RasInfo->RyOffset);
		y1 = drawtext(win, x, y1, "Window position: (%d, %d)               ", win->LeftEdge, win->TopEdge);
		drawtext(win, x, y1, "Window mouse position: (%d, %d)       ",
                    win->MouseX, win->MouseY);
		break;

	    } /* switch (imsg->Class) */
	    ReplyMsg((struct Message *)imsg);
	    
	    			
	} /* if ((imsg = GetMsg(port)) != NULL) */
	else
	{
	    Wait(1L << port->mp_SigBit);
	}
    } /* while (!terminated) */
    
    return retidcmp;
	
} /* HandleEvents() */
开发者ID:michalsc,项目名称:AROS,代码行数:44,代码来源:screentest.c

示例10: drawInit

static void drawInit( int sizex, int sizey, char* seqName, char* filename, float score) {

 int i,k=0;
 int x,y;
 char* c;
 c =(char*)malloc(sizeof(char)*1000);
 


/* initialize display */
 init_graphics("RNA");


/* still picture drawing allows user to zoom, etc. */
 init_world (0.,0.,CELLSIZE*sizex,CELLSIZE*sizey);
 //event_loop(button_press, drawscreen);   

/* animation section */
 clearscreen();
 init_postscript(filename);
 clearscreen();
 
 sprintf(c, "%s%s%s%d%s%f%s", "RNA: ", seqName, ", length = ", sizex, ", energy = ",-score/1000.0, " kal/mol");
 //printf(" output string is %s\n",c);
 update_message("RNA secondary structure");
 flushinput();
 
 drawtext (sizex*CELLSIZE/2,sizey*CELLSIZE/10,c,1.0e6);
 flushinput();
 setcolor (BLACK);
 setlinewidth(1);
 setlinestyle (SOLID);
 for (i=0;i<=sizex;i++) {
    drawline (i*CELLSIZE,(sizey/2-1)*CELLSIZE,i*CELLSIZE,CELLSIZE*sizey/2);
    flushinput();
 }
 drawline(0,(sizey/2-1)*CELLSIZE, sizex*CELLSIZE, CELLSIZE*(sizey/2-1));
 drawline(0,sizey*CELLSIZE/2, sizex*CELLSIZE, CELLSIZE*sizey/2);
 flushinput();
 free(c);
}
开发者ID:mayc2,项目名称:PseudoKnot_research,代码行数:41,代码来源:PlotRna.c

示例11: drawnode

uint
drawnode(Tnode *t, Image *m, Image *clipr, Point o)
{
    int i;
    char *fs, *s;
    uint dy;
    Point oo;

    if(t == nil)
        return 0;

    t->offset = o;

    oo = Pt(o.x+Nubwidth+2, o.y);
//	if(t->draw)
//		dy = (*t->draw)(t, m, clipr, oo);
//	else{
    fs = nil;
    if(t->str)
        s = t->str;
    //	else if(t->strfn)
    //		fs = s = (*t->strfn)(t);
    else
        s = "???";
    dy = drawtext(s, m, clipr, oo);
    free(fs);
//	}

    if(t->expanded) {
        if(t->nkid == -1 && t->expand)
            (*t->expand)(t);
        oo = Pt(o.x+Nubwidth+(Linewidth-Nubwidth)/2, o.y+dy);
        for(i=0; i<t->nkid; i++)
            oo.y += drawnode(t->kid[i], m, clipr, oo);
        dy = oo.y - o.y;
    }
    drawnub(m, clipr, o, t);
    return dy;
}
开发者ID:brandondyck,项目名称:plan9port,代码行数:39,代码来源:view.c

示例12: draw_button

static void draw_button(control c, rect r)
{
	rect textrect;
	rgb up, down;
	font f;
	rgb old = currentcolour();

	clear(c);

	/* Draw the button name. */
	if (isenabled(c))
		setcolour(getforeground(c));
	else
		setcolour(Grey);
	f = gettextfont(c);
	setfont(f);
	textrect = r;
	if (ishighlighted(c))
		textrect.x += 1, textrect.y += 1;
	drawtext(textrect, Center|VCenter, getname(c));

	/* Draw button border. */
	setlinewidth(1);
	drawrect(r);
	r = insetr(r,1);

	/* Draw button shadow. */
	up = White, down = Grey;
	if (ishighlighted(c))
		up = Grey, down = LightGrey;
	else if (hasfocus(c)) {
		setcolour(Black);
		drawrect(r);
		r = insetr(r,1);
	}
	draw_shadow(r, up, down, SHADOW_WIDTH);

	setcolour(old);
}
开发者ID:Vladimir84,项目名称:rcc,代码行数:39,代码来源:buttons.c

示例13: renderhold

int renderhold(int h) {
  int i, j, x, y;
  const int shape_sz = 18;
  const int const_h = shape_sz * SHAPE_MAX_H + 6;
  if (g_state != GAME_STARTED) return h;
  drawtext(panel, X_MARGIN, h, "\nHolding:", 0xff, 0xff, 0xff, 0xff);
  h += FONT_H*2 + 3;
  drawrect(panel, X_MARGIN, h, shape_sz * SHAPE_MAX_W + 6,
           shape_sz * SHAPE_MAX_H + 6, 0xff, 0xff, 0xff, 0x7f);
  h += 3;
  if (g_hold == -1) return h+const_h;
  for (i = 0; i != g_shape[g_hold].w; ++i) {
    for (j = 0; j != g_shape[g_hold].h; ++j) {
      if (g_shape[g_hold].pixels[j][i]) {
        x = (i + g_shape[g_hold].off_x) * 18; y = j * 18;
        x += X_MARGIN + 3; y += h;
        fillrect(panel, x, y, 18, 18,
                 UNPIXRGB(g_shape[g_hold].color), 0xff);
      }
    }
  }
  return h+const_h;
}
开发者ID:shouya,项目名称:blockgame,代码行数:23,代码来源:extpanel.c

示例14: renderqueue

int renderqueue(int h) {
  int i, j, x, y, q = 0;
  const int nxt_sz = 15;
  const int oth_sz = 4;
  if (g_state != GAME_STARTED) return h;

  drawtext(panel, X_MARGIN, h, "\nNext:", 0xff, 0xff, 0xff, 0xff);
  h += FONT_H*2 + 3;

  for (i = 0; i != g_shape[g_queue[q]].w; ++i) {
    for (j = 0; j != g_shape[g_queue[q]].h; ++j) {
      if (g_shape[g_queue[q]].pixels[j][i]) {
        x = (i /*+ g_shape[g_queue[q]].off_x*/) * nxt_sz; y = j * nxt_sz;
        x += X_MARGIN; y += h;
        fillrect(panel, x, y, nxt_sz, nxt_sz,
                 UNPIXRGB(g_shape[g_queue[q]].color), 0xff);
      }
    }
  }

  for (q = 1; q != QUEUE_SIZE; ++q) {
    for (i = 0; i != g_shape[g_queue[q]].w; ++i) {
      for (j = 0; j != g_shape[g_queue[q]].h; ++j) {
        if (g_shape[g_queue[q]].pixels[j][i]) {
          x = (i /*+ g_shape[g_queue[q]].off_x*/) * oth_sz; y = j * oth_sz;
          x += X_MARGIN+nxt_sz*SHAPE_MAX_W+10; y += h;
          fillrect(panel, x, y, oth_sz, oth_sz,
                   UNPIXRGB(g_shape[g_queue[q]].color),
                   0xff-0xf0*q/QUEUE_SIZE);
        }
      }
    }
    h += SHAPE_MAX_H * oth_sz + 3;
  }

  return h; /* 6*4 + 6 */
}
开发者ID:shouya,项目名称:blockgame,代码行数:37,代码来源:extpanel.c

示例15: draw_timeline

void 
draw_timeline(BWAnal *aa) {
   double off0= (aa->c.off) / aa->rate;
   double off1= (aa->c.off + aa->c.sx * aa->c.tbase) / aa->rate;
   double step= (off1 - off0)/5;
   int log10= (int)floor(log(step) / M_LN10);
   double step10= exp(M_LN10 * log10);
   double off;
   
   if (step >= step10 * 5) step= step10*5;
   else if (step >= step10 * 2) step= step10*2;
   else step= step10;

   modf((off0 + step * 0.999) / step, &off);
   off *= step;

   clear_rect(d_tim_xx, d_tim_yy, d_tim_sx, d_tim_sy, colour[0]);

   while (off < off1) {
      int xx= d_tim_xx + (int)((off-off0) / (off1-off0) * d_tim_sx);
      char buf[32];
      
      vline(xx, d_tim_yy + d_tim_sy/2, d_tim_sy/2, colour[9]);

      if (log10 < 0)
	 sprintf(buf, "\x8E%.*f", -log10, off);
      else 
	 sprintf(buf, "\x8E%g", off);

      drawtext(disp_font, xx + 3, d_tim_yy, buf);
      off += step;
   }

   // Update
   update(d_tim_xx, d_tim_yy, d_tim_sx, d_tim_sy);
}
开发者ID:BesnikMulici,项目名称:INF-PRO-FHL,代码行数:36,代码来源:display.c


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