canvas-grid.cpp revision 9e87caa574d67b9b1aa1015d4faae055336c9d30
#define SP_CANVAS_GRID_C
/*
* SPCGrid
*
* Copyright (C) Lauris Kaplinski 2000
*
*/
#include "sp-canvas-util.h"
#include "canvas-grid.h"
#include "display-forward.h"
#include <libnr/nr-pixops.h>
enum {
};
static SPCanvasItemClass * parent_class;
sp_cgrid_get_type (void)
{
static GtkType cgrid_type = 0;
if (!cgrid_type) {
"SPCGrid",
sizeof (SPCGrid),
sizeof (SPCGridClass),
};
}
return cgrid_type;
}
static void
{
}
static void
{
}
static void
{
}
static void
{
switch (arg_id) {
case ARG_ORIGINX:
break;
case ARG_ORIGINY:
break;
case ARG_SPACINGX:
break;
case ARG_SPACINGY:
break;
case ARG_COLOR:
break;
case ARG_EMPCOLOR:
break;
case ARG_EMPSPACING:
// std::cout << "Emphasis Spacing: " << grid->empspacing << std::endl;
break;
default:
break;
}
}
static void
{
guint r, g, b, a;
guchar *p;
r = NR_RGBA32_R (rgba);
g = NR_RGBA32_G (rgba);
b = NR_RGBA32_B (rgba);
a = NR_RGBA32_A (rgba);
p[0] = NR_COMPOSEN11_1111 (r, a, p[0]);
p += 3;
}
}
}
static void
{
guint r, g, b, a;
guchar *p;
r = NR_RGBA32_R(rgba);
g = NR_RGBA32_G (rgba);
b = NR_RGBA32_B (rgba);
a = NR_RGBA32_A (rgba);
p[0] = NR_COMPOSEN11_1111 (r, a, p[0]);
p += buf->buf_rowstride;
}
}
}
/**
\brief This function renders the grid on a particular canvas buffer
\param item The grid to render on the buffer
\param buf The buffer to render the grid on
This function gets called a touch more than you might believe,
about once per tile. This means that it could probably be optimized
and help things out.
Basically this function has to determine where in the canvas it is,
and how that associates with the grid. It does this first by looking
at the bounding box of the buffer, and then calculates where the grid
starts in that buffer. It will then step through grid lines until
it is outside of the buffer.
For each grid line it is drawn using the function \c sp_grid_hline
or \c sp_grid_vline. These are convience functions for the sake
of making the function easier to read.
Also, there are emphisized lines on the grid. While the \c syg and
\c sxg variable track grid positioning, the \c xlinestart and \c
ylinestart variables track the 'count' of what lines they are. If
that count is a multiple of the line seperation between emphisis
lines, then that line is drawn in the emphisis color.
*/
static void
{
const gdouble sxg = floor ((buf->rect.x0 - grid->ow[NR::X]) / grid->sw[NR::X]) * grid->sw[NR::X] + grid->ow[NR::X];
const gdouble syg = floor ((buf->rect.y0 - grid->ow[NR::Y]) / grid->sw[NR::Y]) * grid->sw[NR::Y] + grid->ow[NR::Y];
gdouble y;
} else {
}
gdouble x;
} else {
}
}
}
}
static void
{
if (parent_class->update)
if (scaling_factor <= 1)
scaling_factor = 5;
/* First pass, go up to the major line spacing, then
keep increasing by two. */
scaling_factor = 2;
}
}
if (grid->empspacing == 0) {
}
-1000000, -1000000,
1000000, 1000000);
}
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :