drawing-shape.cpp revision de843c4e0b086a164491232bcf99a51cb5f7dd68
/**
* @file
* Shape (styled path) belonging to an SVG drawing.
*//*
* Authors:
* Krzysztof KosiĆski <tweenk.pl@gmail.com>
*
* Copyright (C) 2011 Authors
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include <glibmm.h>
#include "display/cairo-utils.h"
#include "display/canvas-arena.h"
#include "display/canvas-bpath.h"
#include "display/drawing-context.h"
#include "display/drawing-group.h"
#include "display/drawing-shape.h"
#include "helper/geom-curves.h"
#include "preferences.h"
#include "style.h"
namespace Inkscape {
, _last_pick(NULL)
, _repick_after(0)
{}
{
if (_curve)
}
void
{
if (_curve) {
}
if (curve) {
}
_markForUpdate(STATE_ALL, false);
}
void
{
}
unsigned
DrawingShape::_updateItem(Geom::IntRect const &area, UpdateContext const &ctx, unsigned flags, unsigned reset)
{
// update markers
}
if (!(flags & STATE_RENDER)) {
/* We do not have to create rendering structures */
if (flags & STATE_BBOX) {
if (_curve) {
if (boundingbox) {
} else {
}
}
if (beststate & STATE_BBOX) {
}
}
}
}
// clear Cairo data to force update
if (_curve) {
}
// those pesky miters, now
if ( miterMax > 0.01 ) {
// grunt mode. we should compute the various miters instead
// (one for each point on the curve)
}
}
}
if (!_curve ||
!_style ||
{
return STATE_ALL;
}
if (beststate & STATE_BBOX) {
}
}
return STATE_ALL;
}
void
{
if( has_fill ) {
dc.fillPreserve();
}
}
void
{
if( has_stroke ) {
// TODO: remove segments outside of bbox when no dashes present
dc.strokePreserve();
}
}
void
DrawingShape::_renderMarkers(DrawingContext &dc, Geom::IntRect const &area, unsigned flags, DrawingItem *stop_at)
{
// marker rendering
}
}
unsigned
DrawingShape::_renderItem(DrawingContext &dc, Geom::IntRect const &area, unsigned flags, DrawingItem *stop_at)
{
if (outline) {
// paint-order doesn't matter
}
}
return RENDER_OK;
}
// This is the most common case, special case so we don't call get_pathvector(), etc. twice
{
// we assume the context has no path
// update fill and stroke paints.
// this cannot be done during nr_arena_shape_update, because we need a Cairo context
// to render svg:pattern
if (has_fill || has_stroke) {
// TODO: remove segments outside of bbox when no dashes present
if (has_fill) {
dc.fillPreserve();
}
if (has_stroke) {
dc.strokePreserve();
}
} // has fill or stroke pattern
}
return RENDER_OK;
}
// Handle different paint orders
for (unsigned i = 0; i < NRStyle::PAINT_ORDER_LAYERS; ++i) {
switch (_nrstyle.paint_order_layer[i]) {
case NRStyle::PAINT_ORDER_FILL:
break;
case NRStyle::PAINT_ORDER_STROKE:
break;
case NRStyle::PAINT_ORDER_MARKER:
break;
default:
// PAINT_ORDER_AUTO Should not happen
break;
}
}
return RENDER_OK;
}
{
if (!_curve) return;
// handle clip-rule
if (_style) {
} else {
}
}
}
{
if (_repick_after > 0)
if (_repick_after > 0) // we are a slow, huge path
return _last_pick; // skip this pick, returning what was returned last time
// fully transparent, no pick unless outline mode
return NULL;
double width;
if (pick_as_clip) {
width = 0; // no width should be applied to clip picking
// this overrides display mode and stroke style considerations
} else if (outline) {
// for normal picking calculate the distance corresponding top the stroke width
// FIXME BUG: this is incorrect for transformed strokes
} else {
width = 0;
}
int wind = 0;
// actual shape picking
pathv_matrix_point_bbox_wind_distance(_curve->get_pathvector(), _ctm, p, NULL, needfill? &wind : NULL, &dist, 0.5, &viewbox);
} else {
pathv_matrix_point_bbox_wind_distance(_curve->get_pathvector(), _ctm, p, NULL, needfill? &wind : NULL, &dist, 0.5, NULL);
}
//g_print ("pick time %lu\n", this_pick);
}
// covered by fill?
if (needfill) {
if (wind_evenodd) {
if (wind & 0x1) {
_last_pick = this;
return this;
}
} else {
if (wind != 0) {
_last_pick = this;
return this;
}
}
}
// close to the edge, as defined by strokewidth and delta?
// this ignores dashing (as if the stroke is solid) and always works as if caps are round
_last_pick = this;
return this;
}
}
// if not picked on the shape itself, try its markers
if (ret) {
_last_pick = this;
return this;
}
}
_last_pick = NULL;
return NULL;
}
bool
{
return true;
}
} // end namespace Inkscape
/*
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:fileencoding=utf-8:textwidth=99 :