本文整理汇总了C++中cdCanvasForeground函数的典型用法代码示例。如果您正苦于以下问题:C++ cdCanvasForeground函数的具体用法?C++ cdCanvasForeground怎么用?C++ cdCanvasForeground使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cdCanvasForeground函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cdIupDrawHorizSunkenMark
void cdIupDrawHorizSunkenMark(cdCanvas *canvas, int x1, int x2, int y, long light_shadow, long dark_shadow)
{
cdCanvasForeground(canvas, dark_shadow);
cdCanvasLine(canvas, x1, y+1, x2, y+1);
cdCanvasForeground(canvas, light_shadow);
cdCanvasLine(canvas, x1, y, x2, y);
}
示例2: iDialDrawCircular
static void iDialDrawCircular(Ihandle* ih)
{
double delta = 2 * M_PI / ih->data->num_div, a = ih->data->angle;
int i, xc = ih->data->w / 2, yc = ih->data->h / 2, wide;
ih->data->radius = dialmin(ih->data->w, ih->data->h) / 2 - 2 * IDIAL_SPACE;
wide = (int)(2 * ih->data->radius);
cdCanvasForeground(ih->data->cd_canvas, ih->data->mid_shadow);
cdCanvasLineWidth(ih->data->cd_canvas, 2);
cdCanvasArc(ih->data->cd_canvas, xc, yc, wide-1, wide-1, -135, 45.0);
cdCanvasLineWidth(ih->data->cd_canvas, 1);
cdCanvasForeground(ih->data->cd_canvas, ih->data->bgcolor);
cdCanvasSector(ih->data->cd_canvas, xc, yc, wide-2, wide-2, 0.0, 360.0);
cdCanvasForeground(ih->data->cd_canvas, ih->data->light_shadow);
cdCanvasArc(ih->data->cd_canvas, xc, yc, wide, wide, 45, 225);
cdCanvasForeground(ih->data->cd_canvas, ih->data->dark_shadow);
cdCanvasArc(ih->data->cd_canvas, xc, yc, wide, wide, -135, 45);
for (i = 0; i < ih->data->num_div; ++i)
{
int x2 = (int)(xc + (ih->data->radius - 6) * cos(a));
int y2 = (int)(yc + (ih->data->radius - 6) * sin(a));
if (i == 0)
{
cdCanvasForeground(ih->data->cd_canvas, CD_BLACK);
cdCanvasLine(ih->data->cd_canvas, xc, yc, x2, y2);
}
iDialDrawCircularMark(ih, x2-2, y2-2);
a += delta;
}
iDialDrawCircularMark(ih, xc-2, yc-2);
}
示例3: iDialDrawVerticalBackground
static void iDialDrawVerticalBackground(Ihandle* ih, double amin, double amax, int *ymin, int *ymax)
{
double delta = (0.5 * M_PI - amin) / IDIAL_NCOLORS;
double a, yc = ih->data->h / 2.0;
*ymin = *ymax = ih->data->h / 2;
for (a = amin; a < 0.5 * M_PI; a += delta) /* shading */
{
int y0 = (int)(yc - ih->data->radius * cos(a));
int y1 = (int)(yc - ih->data->radius * cos(a+delta));
cdCanvasForeground(ih->data->cd_canvas, iDialGetFgColor(ih, a, amin));
cdCanvasBox(ih->data->cd_canvas, IDIAL_SPACE+1, ih->data->w-1-IDIAL_SPACE-2, y0, y1);
if (y0 < *ymin) *ymin = y0;
if (abs(y1-y0) < 2)
continue;
}
for (a = 0.5 * M_PI; a < amax; a += delta)
{
int y0 = (int)(yc + ih->data->radius * fabs(cos(a)));
int y1 = (int)(yc + ih->data->radius * fabs(cos(a+delta)));
cdCanvasForeground(ih->data->cd_canvas, iDialGetFgColor(ih, a, amin));
cdCanvasBox(ih->data->cd_canvas, IDIAL_SPACE+1, ih->data->w-1-IDIAL_SPACE-2, y0, y1);
if (y1 > *ymax) *ymax = y1;
if (abs(y1-y0) < 2)
continue;
}
}
示例4: iDialDrawHorizontalBackground
static void iDialDrawHorizontalBackground(Ihandle* ih,double amin,double amax, int *xmin, int *xmax)
{
double delta = (0.5 * M_PI - amin) / IDIAL_NCOLORS;
double a, xc = ih->data->w / 2.0;
*xmin = *xmax = ih->data->w / 2;
for (a = amin; a < 0.5 * M_PI; a += delta)
{
int x0=(int)(xc - ih->data->radius * cos(a));
int x1=(int)(xc - ih->data->radius * cos(a + delta));
cdCanvasForeground(ih->data->cd_canvas,iDialGetFgColor(ih, a, amin));
cdCanvasBox(ih->data->cd_canvas, x0, x1, IDIAL_SPACE+2, ih->data->h-1-IDIAL_SPACE-1);
if (x0 < *xmin) *xmin = x0;
if (abs(x1 - x0) < 2)
continue;
}
for (a = 0.5 * M_PI; a < amax; a += delta)
{
int x0 =(int)(xc + ih->data->radius * fabs(cos(a)));
int x1 =(int)(xc + ih->data->radius * fabs(cos(a + delta)));
cdCanvasForeground(ih->data->cd_canvas, iDialGetFgColor(ih, a, amin));
cdCanvasBox(ih->data->cd_canvas, x0, x1, IDIAL_SPACE+2, ih->data->h-1-IDIAL_SPACE-1);
if (x1 > *xmax) *xmax = x1;
if (abs(x1-x0) < 2)
continue;
}
}
示例5: draw_cb
static int draw_cb(Ihandle* h, int i, int j, int xmin, int xmax, int ymin, int ymax, cdCanvas* canvas)
{
int xm = (xmax + xmin) / 2;
int ym = (ymax + ymin) / 2;
static char buffer[64];
if (i == 1 && j == 2) return IUP_DEFAULT;
if (i == 2 && j == 1) return IUP_DEFAULT;
if (i == 2 && j == 2) return IUP_DEFAULT;
if (i == 5 && j == 6) return IUP_DEFAULT;
if (i == 6 && j == 5) return IUP_DEFAULT;
if (i == 6 && j == 6) return IUP_DEFAULT;
if (i == 1 && j == 1)
cdCanvasForeground(canvas, CD_WHITE);
else
cdCanvasForeground(canvas, cdEncodeColor(
(unsigned char)(i*20),
(unsigned char)(j*100),
(unsigned char)(i+100)));
cdCanvasBox(canvas, xmin, xmax, ymin, ymax);
cdCanvasTextAlignment(canvas, CD_CENTER);
cdCanvasForeground(canvas, CD_BLACK);
sprintf(buffer, "(%02d, %02d)", i, j);
cdCanvasText(canvas, xm, ym, buffer);
return IUP_DEFAULT;
}
示例6: cdIupDrawVertSunkenMark
void cdIupDrawVertSunkenMark(cdCanvas *canvas, int x, int y1, int y2, long light_shadow, long dark_shadow)
{
cdCanvasForeground(canvas, dark_shadow);
cdCanvasLine(canvas, x-1, y1, x-1, y2);
cdCanvasForeground(canvas, light_shadow);
cdCanvasLine(canvas, x, y1, x, y2);
}
示例7: draw_cb
static int draw_cb(Ihandle* h, int i, int j, int xmin, int xmax, int ymin, int ymax, cdCanvas* canvas)
{
if (((i%2) && (j%2)) || (((i+1)%2) && ((j+1)%2)))
cdCanvasForeground(canvas, CD_WHITE);
else
cdCanvasForeground(canvas, CD_BLACK);
cdCanvasBox(canvas, xmin, xmax, ymin, ymax);
return IUP_DEFAULT;
}
示例8: cdIupDrawFocusRect
void cdIupDrawFocusRect(cdCanvas *canvas, int x1, int y1, int x2, int y2)
{
int old_linestyle = cdCanvasLineStyle(canvas, CD_DOTTED);
int old_foreground = cdCanvasForeground(canvas, CD_WHITE);
int old_writemode = cdCanvasWriteMode(canvas, CD_XOR);
cdCanvasRect(canvas, x1, x2, y1, y2);
cdCanvasWriteMode(canvas, old_writemode);
cdCanvasForeground(canvas, old_foreground);
cdCanvasLineStyle(canvas, old_linestyle);
}
示例9: cdIupDrawRaiseRect
void cdIupDrawRaiseRect(cdCanvas *canvas, int x1, int y1, int x2, int y2, long light_shadow, long mid_shadow, long dark_shadow)
{
cdCanvasForeground(canvas, light_shadow);
cdCanvasLine(canvas, x1, y1+1, x1, y2);
cdCanvasLine(canvas, x1, y2, x2-1, y2);
cdCanvasForeground(canvas, dark_shadow);
cdCanvasLine(canvas, x1, y1, x2, y1);
cdCanvasLine(canvas, x2, y1, x2, y2);
cdCanvasForeground(canvas, mid_shadow);
cdCanvasLine(canvas, x1+1, y1+1, x2-1, y1+1);
cdCanvasLine(canvas, x2-1, y1+2, x2-1, y2-1);
}
示例10: iMatrixDrawComboFeedback
static void iMatrixDrawComboFeedback(Ihandle* ih, int x2, int y1, int y2, int active, long framecolor)
{
int xh2, yh2, x1;
/* feedback area */
x2 -= IMAT_PADDING_W/2 + IMAT_FRAME_W/2;
x1 = x2 - IMAT_COMBOBOX_W;
y1 += IMAT_PADDING_H/2 + IMAT_FRAME_H/2;
y2 -= IMAT_PADDING_H/2 + IMAT_FRAME_H/2;
/* feedback background */
iMatrixDrawSetBgColor(ih, 0, 0, 0, active);
iupMATRIX_BOX(ih, x1, x2, y1, y2);
/* feedback frame */
cdCanvasForeground(ih->data->cddbuffer, framecolor);
iupMATRIX_RECT(ih, x1, x2, y1, y2);
/* feedback arrow */
xh2 = x2 - IMAT_COMBOBOX_W / 2;
yh2 = y2 - (y2 - y1) / 2;
cdCanvasBegin(ih->data->cddbuffer, CD_FILL);
iupMATRIX_VERTEX(ih, xh2, yh2 + 3);
iupMATRIX_VERTEX(ih, xh2 + 4, yh2 - 1);
iupMATRIX_VERTEX(ih, xh2 - 4, yh2 - 1);
cdCanvasEnd(ih->data->cddbuffer);
}
示例11: mouse
/*
%F Muda a largura da coluna interativamente, so muda a linha na tela.
Qando o usuario termina o drag, a funcao iupmatColresFinish e chamada
para realmente mudar a largura da coluna.
%i h : handle da matriz,
x : coordenada x do mouse (coordenadas do canvas).
*/
void iupmatColresMove(Ihandle *h, int x)
{
Tmat *mat=(Tmat*)matrix_data(h);
int y1,y2, charwidth,charheight;
iupdrvGetCharSize(h,&charwidth,&charheight);
/* Se tamanho da coluna ficou muito pequeno, nao muda tamanho da coluna */
if (x < DragColStartPos+charwidth+DECOR_X)
return;
y1 = mat_ht(mat);
y2 = YmaxCanvas(mat);
cdCanvasWriteMode(mat->cdcanvas, CD_XOR);
cdCanvasForeground(mat->cdcanvas, RESIZE_COLOR);
/* Se nao e a primeira vez, retira linha antiga */
if (Lastxpos != -1)
cdCanvasLine(mat->cdcanvas,Lastxpos,INVY(y1),Lastxpos,INVY(y2));
cdCanvasLine(mat->cdcanvas,x,INVY(y1),x,INVY(y2));
Lastxpos = x;
cdCanvasWriteMode(mat->cdcanvas, CD_REPLACE);
}
示例12: iupMatrixColResFinish
void iupMatrixColResFinish(Ihandle* ih, int x)
{
char str[100];
int width = x - ih->data->colres_drag_col_start_x;
if (width < 0)
width = 0;
/* delete feedback */
if (ih->data->colres_drag_col_last_x != -1)
{
int y1 = ih->data->lines.sizes[0]; /* from the bottom of the line of titles */
int y2 = ih->data->h-1; /* to the bottom of the matrix */
cdCanvasWriteMode(ih->data->cdcanvas, CD_XOR);
cdCanvasForeground(ih->data->cdcanvas, IMAT_RESIZE_COLOR);
cdCanvasLine(ih->data->cdcanvas, ih->data->colres_drag_col_last_x, iupMatrixInvertYAxis(ih, y1),
ih->data->colres_drag_col_last_x, iupMatrixInvertYAxis(ih, y2));
cdCanvasWriteMode(ih->data->cdcanvas, CD_REPLACE);
}
ih->data->colres_dragging = 0;
sprintf(str, "RASTERWIDTH%d", ih->data->colres_drag_col);
iupAttribSetInt(ih, str, width-IMAT_PADDING_W-IMAT_FRAME_W);
sprintf(str, "WIDTH%d", ih->data->colres_drag_col);
iupAttribSetStr(ih, str, NULL);
ih->data->need_calcsize = 1;
iupMatrixDraw(ih, 0);
}
示例13: iupMatrixColResMove
/* Change the column width interactively, just change the line in the screen.
When the user finishes the drag, the iupMatrixColResFinish function is called
to truly change the column width. */
void iupMatrixColResMove(Ihandle* ih, int x)
{
int y1, y2;
int width = x - ih->data->colres_drag_col_start_x;
if (width < 0)
return;
y1 = ih->data->lines.sizes[0]; /* from the bottom of the line of titles */
y2 = ih->data->h-1; /* to the bottom of the matrix */
cdCanvasWriteMode(ih->data->cdcanvas, CD_XOR);
cdCanvasForeground(ih->data->cdcanvas, IMAT_RESIZE_COLOR);
/* If it is not the first time, move old line */
if (ih->data->colres_drag_col_last_x != -1)
{
cdCanvasLine(ih->data->cdcanvas, ih->data->colres_drag_col_last_x, iupMatrixInvertYAxis(ih, y1),
ih->data->colres_drag_col_last_x, iupMatrixInvertYAxis(ih, y2));
}
cdCanvasLine(ih->data->cdcanvas, x, iupMatrixInvertYAxis(ih, y1),
x, iupMatrixInvertYAxis(ih, y2));
ih->data->colres_drag_col_last_x = x;
cdCanvasWriteMode(ih->data->cdcanvas, CD_REPLACE);
}
示例14: repaint_cell_in
/**
* Repaint function for one cell in a given coordinate;
* (assume that the canvas is already activated).
*/
static void repaint_cell_in(TCells* obj, int i, int j,
int xmin, int xmax, int ymin, int ymax) {
int k;
int w = obj->width;
int h = obj->height;
int hspan = 1;
int vspan = 1;
/* Checking if the cells is out of range. (no span will affect it!) */
if (xmin > w || ymax < 0) return;
/* Calculating cell spans */
hspan = get_hspan(obj, i, j);
vspan = get_vspan(obj, i, j);
/* if any span is set to zero, then another cell invaded its space and
* the cell does not need to draw itself */
if (hspan == 0 || vspan == 0) return;
/* Increasing cell's width and height according to its spans */
for(k = 1; k < hspan; k++) xmax += get_width(obj, j+k);
for(k = 1; k < vspan; k++) ymin -= get_height(obj, i+k);
/* Checking if the cell expanded enough to appear inside the canvas */
if (xmax < 0 || ymin > h) return;
/* Calling application's draw callback */
call_apl_draw(obj, xmin, xmax, ymin, ymax, i, j);
/* Drawing a box in cell's area */
if (obj->boxed) {
cdCanvasForeground(obj->cddbuffer,CD_BLACK);
cdCanvasRect(obj->cddbuffer,xmin, xmax, ymin, ymax);
}
}
示例15: iMatrixDrawDropFeedback
static void iMatrixDrawDropFeedback(Ihandle* ih, int x2, int y1, int y2, int active, long framecolor)
{
int xh2, yh2, x1;
/* feedback area */
iupMatrixDrawSetDropFeedbackArea(&x1, &y1, &x2, &y2);
/* feedback background */
iMatrixDrawSetBgColor(ih, 0, 0, 0, active);
iupMATRIX_BOX(ih, x1, x2, y1, y2);
/* feedback frame */
cdCanvasForeground(ih->data->cd_canvas, framecolor);
iupMATRIX_RECT(ih, x1, x2, y1, y2);
/* feedback arrow */
xh2 = x2 - IMAT_DROPBOX_W/2;
yh2 = y2 - (y2 - y1)/2;
cdCanvasBegin(ih->data->cd_canvas, CD_FILL);
iupMATRIX_VERTEX(ih, xh2, yh2 + 3);
iupMATRIX_VERTEX(ih, xh2 + 4, yh2 - 1);
iupMATRIX_VERTEX(ih, xh2 - 4, yh2 - 1);
cdCanvasEnd(ih->data->cd_canvas);
}