本文整理汇总了C++中DIAG_NOTE函数的典型用法代码示例。如果您正苦于以下问题:C++ DIAG_NOTE函数的具体用法?C++ DIAG_NOTE怎么用?C++ DIAG_NOTE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DIAG_NOTE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: export_data
/* dia export funtion */
static gboolean
export_data(DiagramData *data, DiaContext *ctx,
const gchar *filename, const gchar *diafilename,
void* user_data)
{
WpgRenderer *renderer;
FILE *file;
Rectangle *extent;
real width, height;
file = g_fopen(filename, "wb"); /* "wb" for binary! */
if (file == NULL) {
dia_context_add_message_with_errno (ctx, errno, _("Can't open output file %s"),
dia_context_get_filename(ctx));
return FALSE;
}
renderer = g_object_new (WPG_TYPE_RENDERER, NULL);
renderer->file = file;
renderer->ctx = ctx;
extent = &data->extents;
/* use extents */
DIAG_NOTE(g_message("export_data extents %f,%f -> %f,%f",
extent->left, extent->top, extent->right, extent->bottom));
width = extent->right - extent->left;
height = extent->bottom - extent->top;
#if 0
/* extend to use full range */
renderer->Scale = 0.001;
if (width > height)
while (renderer->Scale * width < 3276.7) renderer->Scale *= 10.0;
else
while (renderer->Scale * height < 3276.7) renderer->Scale *= 10.0;
#else
/* scale from Dia's cm to WPU (1/1200 inch) */
renderer->Scale = WPU_PER_DCM;
/* avoid int16 overflow */
if (width > height)
while (renderer->Scale * width > 32767) renderer->Scale /= 10.0;
else
while (renderer->Scale * height > 32767) renderer->Scale /= 10.0;
renderer->XOffset = - extent->left;
renderer->YOffset = extent->bottom;
#endif
renderer->Box.Width = width * renderer->Scale;
renderer->Box.Height = height * renderer->Scale;
renderer->Box.Flag = 0;
renderer->Box.Version = 0;
data_render(data, DIA_RENDERER(renderer), NULL, NULL, NULL);
g_object_unref(renderer);
return TRUE;
}
示例2: fill_arc
static void
fill_arc(DiaRenderer *self,
Point *center,
real width, real height,
real angle1, real angle2,
Color *color)
{
DiaCairoRenderer *renderer = DIA_CAIRO_RENDERER (self);
Point start;
double a1, a2;
DIAG_NOTE(g_message("draw_arc %fx%f <%f,<%f",
width, height, angle1, angle2));
cairo_set_source_rgba (renderer->cr, color->red, color->green, color->blue, 1.0);
cairo_new_path (renderer->cr);
start.x = center->x + (width / 2.0) * cos((M_PI / 180.0) * angle1);
start.y = center->y - (height / 2.0) * sin((M_PI / 180.0) * angle1);
cairo_move_to (renderer->cr, center->x, center->y);
cairo_line_to (renderer->cr, start.x, start.y);
a1 = - (angle1 / 180.0) * G_PI;
a2 = - (angle2 / 180.0) * G_PI;
/* FIXME: to handle width != height some cairo_scale/cairo_translate would be needed */
cairo_arc_negative (renderer->cr, center->x, center->y,
width > height ? height / 2.0 : width / 2.0, /* FIXME 2nd radius */
a1, a2);
cairo_line_to (renderer->cr, center->x, center->y);
cairo_close_path (renderer->cr);
cairo_fill (renderer->cr);
DIAG_STATE(renderer->cr)
}
示例3: draw_polyline
static void
draw_polyline(DiaRenderer *object,
Point *points, int num_points,
Color *line_colour)
{
HpglRenderer *renderer = HPGL_RENDERER (object);
int i;
DIAG_NOTE(g_message("draw_polyline n:%d %f,%f ...",
num_points, points->x, points->y));
g_return_if_fail(1 < num_points);
hpgl_select_pen(renderer, line_colour, 0.0);
fprintf (renderer->file, "PU%d,%d;PD;PA",
hpgl_scale(renderer, points[0].x),
hpgl_scale(renderer, -points[0].y));
/* absolute movement */
for (i = 1; i < num_points-1; i++)
fprintf(renderer->file, "%d,%d,",
hpgl_scale(renderer, points[i].x),
hpgl_scale(renderer, -points[i].y));
i = num_points - 1;
fprintf(renderer->file, "%d,%d;\n",
hpgl_scale(renderer, points[i].x),
hpgl_scale(renderer, -points[i].y));
}
示例4: fill_bezier
/* not defined in compatibility layer */
static void
fill_bezier(DiaRenderer *self,
BezPoint *points, /* Last point must be same as first point */
int numpoints,
Color *colour)
{
WmfRenderer *renderer = WMF_RENDERER (self);
W32::HGDIOBJ hBrush, hBrOld;
W32::COLORREF rgb = W32COLOR(colour);
DIAG_NOTE(renderer, "fill_bezier n:%d %fx%f ...\n",
numpoints, points->p1.x, points->p1.y);
hBrush = W32::CreateSolidBrush(rgb);
hBrOld = W32::SelectObject(renderer->hFileDC, hBrush);
W32::BeginPath (renderer->hFileDC);
draw_bezier(self, points, numpoints, NULL);
W32::EndPath (renderer->hFileDC);
W32::FillPath (renderer->hFileDC);
W32::SelectObject(renderer->hFileDC,
W32::GetStockObject (HOLLOW_BRUSH) );
W32::DeleteObject(hBrush);
}
示例5: draw_bezier
static void
draw_bezier(DiaRenderer *self,
BezPoint *points,
int numpoints,
Color *colour)
{
WpgRenderer *renderer = WPG_RENDERER (self);
WPGPoint* pts;
guint16 data[2];
int i;
DIAG_NOTE(g_message("draw_bezier n:%d %fx%f ...",
numpoints, points->p1.x, points->p1.y));
WriteLineAttr(renderer, colour);
WriteRecHead(renderer, WPG_POLYCURVE, (3 * numpoints - 2) * sizeof(WPGPoint) + 3 * sizeof(guint16));
pts = g_new(WPGPoint, 3 * numpoints - 2);
/* ??? size of equivalent data in pre5.1 files ? DWORD */
memset (data, 0, sizeof(guint16) * 2);
fwrite_le(data, sizeof(guint16), 2, renderer->file);
/* num points */
data[0] = 3 * numpoints - 2;
fwrite_le(data, sizeof(guint16), 1, renderer->file);
/* WPG's Poly Curve is a cubic bezier compatible with Dia's bezier.
* http://www.fileformat.info/format/wpg/egff.htm
* could lead to the assumption of ony quadratic bezier support,
* but that's not the case.
*/
pts[0].x = SCX( points[0].p1.x);
pts[0].y = SCY(-points[0].p1.y);
for (i = 1; i < numpoints; i++)
{
switch (points[i].type)
{
case BEZ_MOVE_TO:
case BEZ_LINE_TO:
/* just the point */
pts[i*3-2].x = pts[i*3-1].x = pts[i*3].x = SCX( points[i].p1.x);
pts[i*3-2].y = pts[i*3-1].y = pts[i*3].y = SCY(-points[i].p1.y);
break;
case BEZ_CURVE_TO:
/* first control point */
pts[i*3-2].x = SCX( points[i].p1.x);
pts[i*3-2].y = SCY(-points[i].p1.y);
/* second control point */
pts[i*3-1].x = SCX( points[i].p2.x);
pts[i*3-1].y = SCY(-points[i].p2.y);
/* this segments end point */
pts[i*3].x = SCX( points[i].p3.x);
pts[i*3].y = SCY(-points[i].p3.y);
break;
}
}
fwrite_le(pts, sizeof(gint16), 2*(numpoints*3-2), renderer->file);
g_free(pts);
}
示例6: draw_beziergon
static void
draw_beziergon (DiaRenderer *self,
BezPoint *points,
int numpoints,
Color *fill,
Color *stroke)
{
DIAG_NOTE(g_message("draw_beziezgon %d points", numpoints));
#if 1
/* Use fallback from base class until another program can
* actually correctly show the filled Polycurve created
* by Dia (our own import can).
*/
if (fill)
DIA_RENDERER_CLASS(parent_class)->draw_beziergon (self, points, numpoints, fill, NULL);
#else
if (fill) {
WpgRenderer *renderer = WPG_RENDERER (self);
WriteFillAttr(renderer, fill, TRUE);
draw_bezier (self, points, numpoints, fill);
WriteFillAttr(renderer, fill, FALSE);
}
#endif
if (stroke) /* XXX: still not closing the path */
draw_bezier (self, points, numpoints, stroke);
}
示例7: draw_ellipse
static void
draw_ellipse(DiaRenderer *self,
Point *center,
real width, real height,
Color *fill, Color *stroke)
{
WpgRenderer *renderer = WPG_RENDERER (self);
WPGEllipse ell;
DIAG_NOTE(g_message("draw_ellipse %fx%f center @ %f,%f",
width, height, center->x, center->y));
ell.x = SCX(center->x);
ell.y = SCY(-center->y);
ell.RotAngle = 0;
ell.rx = SC(width / 2.0);
ell.ry = SC(height / 2.0);
ell.StartAngle = 0;
ell.EndAngle = 360;
ell.Flags = 0;
if (stroke)
WriteLineAttr(renderer, stroke);
if (fill)
WriteFillAttr(renderer, fill, TRUE);
WriteRecHead(renderer, WPG_ELLIPSE, sizeof(WPGEllipse));
g_assert(16 == sizeof(WPGEllipse));
fwrite_le(&ell, sizeof(guint16), sizeof(WPGEllipse) / sizeof(guint16), renderer->file);
if (fill)
WriteFillAttr(renderer, fill, FALSE);
}
示例8: draw_polyline
static void
draw_polyline(DiaRenderer *self,
Point *points, int num_points,
Color *line_colour)
{
WpgRenderer *renderer = WPG_RENDERER (self);
int i;
gint16* pData;
DIAG_NOTE(g_message("draw_polyline n:%d %f,%f ...",
num_points, points->x, points->y));
g_return_if_fail(1 < num_points);
WriteLineAttr(renderer, line_colour);
WriteRecHead(renderer, WPG_POLYLINE, num_points * 2 * sizeof(gint16) + sizeof(gint16));
pData = g_new(gint16, num_points * 2);
/* number of points */
pData[0] = num_points;
fwrite_le(pData, sizeof(gint16), 1, renderer->file);
/* point data */
for (i = 0; i < num_points; i++)
{
pData[2*i] = SCX(points[i].x);
pData[2*i+1] = SCY(-points[i].y);
}
fwrite_le(pData, sizeof(gint16), num_points*2, renderer->file);
g_free(pData);
}
示例9: set_linestyle
static void
set_linestyle(DiaRenderer *self, LineStyle mode, real dash_length)
{
WpgRenderer *renderer = WPG_RENDERER (self);
DIAG_NOTE(g_message("set_linestyle %d, %g", mode, dash_length));
/* line type */
switch (mode) {
case LINESTYLE_SOLID:
renderer->LineAttr.Type = WPG_LA_SOLID;
break;
case LINESTYLE_DASHED:
if (dash_length < 0.5)
renderer->LineAttr.Type = WPG_LA_SHORTDASH;
else
renderer->LineAttr.Type = WPG_LA_MEDIUMDASH;
break;
case LINESTYLE_DASH_DOT:
renderer->LineAttr.Type = WPG_LA_DASHDOT;
break;
case LINESTYLE_DASH_DOT_DOT:
renderer->LineAttr.Type = WPG_LA_DASHDOTDOT;
break;
case LINESTYLE_DOTTED:
renderer->LineAttr.Type = WPG_LA_DOTS;
break;
default:
g_warning("WpgRenderer : Unsupported fill mode specified!\n");
}
}
示例10: draw_arc
static void
draw_arc(DiaRenderer *self,
Point *center,
real width, real height,
real angle1, real angle2,
Color *colour)
{
WmfRenderer *renderer = WMF_RENDERER (self);
W32::HPEN hPen;
W32::POINT ptStart, ptEnd;
DIAG_NOTE(renderer, "draw_arc %fx%f <%f,<%f @%f,%f\n",
width, height, angle1, angle2, center->x, center->y);
hPen = UsePen(renderer, colour);
/* calculate start and end points of arc */
ptStart.x = SCX(center->x + (width / 2.0) * cos((M_PI / 180.0) * angle1));
ptStart.y = SCY(center->y - (height / 2.0) * sin((M_PI / 180.0) * angle1));
ptEnd.x = SCX(center->x + (width / 2.0) * cos((M_PI / 180.0) * angle2));
ptEnd.y = SCY(center->y - (height / 2.0) * sin((M_PI / 180.0) * angle2));
W32::MoveToEx(renderer->hFileDC, ptStart.x, ptStart.y, NULL);
W32::Arc(renderer->hFileDC,
SCX(center->x - width / 2), /* bbox corners */
SCY(center->y - height / 2),
SCX(center->x + width / 2),
SCY(center->y + height / 2),
ptStart.x, ptStart.y, ptEnd.x, ptEnd.y);
DonePen(renderer, hPen);
}
示例11: set_linestyle
static void
set_linestyle(DiaRenderer *object, LineStyle mode, real dash_length)
{
HpglRenderer *renderer = HPGL_RENDERER (object);
DIAG_NOTE(g_message("set_linestyle %d", mode));
/* line type */
switch (mode) {
case LINESTYLE_SOLID:
fprintf(renderer->file, "LT;\n");
break;
case LINESTYLE_DASHED:
if (dash_length > 0.5) /* ??? unit of dash_lenght ? */
fprintf(renderer->file, "LT2;\n"); /* short */
else
fprintf(renderer->file, "LT3;\n"); /* long */
break;
case LINESTYLE_DASH_DOT:
fprintf(renderer->file, "LT4;\n");
break;
case LINESTYLE_DASH_DOT_DOT:
fprintf(renderer->file, "LT5;\n"); /* ??? Mittellinie? */
break;
case LINESTYLE_DOTTED:
fprintf(renderer->file, "LT1;\n");
break;
default:
g_warning("HpglRenderer : Unsupported fill mode specified!");
}
}
示例12: set_font
static void
set_font(DiaRenderer *self, DiaFont *font, real height)
{
DiaCairoRenderer *renderer = DIA_CAIRO_RENDERER (self);
/* pango/cairo wants the font size, not the (line-) height */
real size = dia_font_get_size (font) * (height / dia_font_get_height (font));
PangoFontDescription *pfd = pango_font_description_copy (dia_font_get_description (font));
DIAG_NOTE(g_message("set_font %f %s", height, dia_font_get_family(font)));
#ifdef HAVE_PANGOCAIRO_H
/* select font and size */
pango_font_description_set_absolute_size (pfd, (int)(size * PANGO_SCALE));
pango_layout_set_font_description (renderer->layout, pfd);
pango_font_description_free (pfd);
#else
if (renderer->cr) {
DiaFontStyle style = dia_font_get_style (font);
const char *family_name = dia_font_get_family(font);
cairo_select_font_face (
renderer->cr,
family_name,
DIA_FONT_STYLE_GET_SLANT(style) == DIA_FONT_NORMAL ? CAIRO_FONT_SLANT_NORMAL : CAIRO_FONT_SLANT_ITALIC,
DIA_FONT_STYLE_GET_WEIGHT(style) < DIA_FONT_MEDIUM ? CAIRO_FONT_WEIGHT_NORMAL : CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size (renderer->cr, size);
DIAG_STATE(renderer->cr)
}
示例13: draw_ellipse
static void
draw_ellipse(DiaRenderer *object,
Point *center,
real width, real height,
Color *fill, Color *stroke)
{
HpglRenderer *renderer = HPGL_RENDERER (object);
Color *colour = fill ? fill : stroke;
DIAG_NOTE(g_message("draw_ellipse %fx%f center @ %f,%f",
width, height, center->x, center->y));
if (width != height)
{
draw_ellipse_by_arc(object, center, width, height, colour);
}
else
{
hpgl_select_pen(renderer, colour, 0.0);
fprintf (renderer->file, "PU%d,%d;CI%d;\n",
hpgl_scale(renderer, center->x),
hpgl_scale(renderer, -center->y),
hpgl_scale(renderer, width / 2.0));
}
}
示例14: draw_arc
static void
draw_arc(DiaRenderer *object,
Point *center,
real width, real height,
real angle1, real angle2,
Color *colour)
{
HpglRenderer *renderer = HPGL_RENDERER (object);
Point start;
DIAG_NOTE(g_message("draw_arc %fx%f <%f,<%f",
width, height, angle1, angle2));
hpgl_select_pen(renderer, colour, 0.0);
/* make counter-clockwise swapping start/end */
if (angle2 < angle1) {
real tmp = angle1;
angle1 = angle2;
angle2 = tmp;
}
/* move to start point */
start.x = center->x + (width / 2.0) * cos((M_PI / 180.0) * angle1);
start.y = - center->y + (height / 2.0) * sin((M_PI / 180.0) * angle1);
fprintf (renderer->file, "PU%d,%d;PD;",
hpgl_scale(renderer, start.x),
hpgl_scale(renderer, start.y));
/* Arc Absolute - around center */
fprintf (renderer->file, "AA%d,%d,%d;",
hpgl_scale(renderer, center->x),
hpgl_scale(renderer, - center->y),
(int)floor(360.0 - angle1 + angle2));
}
示例15: _polygon
static void
_polygon(DiaRenderer *self,
Point *points, int num_points,
Color *color,
gboolean fill)
{
DiaCairoRenderer *renderer = DIA_CAIRO_RENDERER (self);
int i;
DIAG_NOTE(g_message("%s_polygon n:%d %f,%f ...",
fill ? "fill" : "draw",
num_points, points->x, points->y));
g_return_if_fail(1 < num_points);
cairo_set_source_rgba (renderer->cr, color->red, color->green, color->blue, 1.0);
cairo_new_path (renderer->cr);
/* point data */
cairo_move_to (renderer->cr, points[0].x, points[0].y);
for (i = 1; i < num_points; i++)
{
cairo_line_to (renderer->cr, points[i].x, points[i].y);
}
cairo_line_to (renderer->cr, points[0].x, points[0].y);
cairo_close_path (renderer->cr);
if (fill)
cairo_fill (renderer->cr);
else
cairo_stroke (renderer->cr);
DIAG_STATE(renderer->cr)
}