drawing-pattern.cpp revision 93cce75c515069567a34a17f5f75a9742881695d
/**
* @file
* Canvas belonging to SVG pattern.
*//*
* Authors:
* Tomasz Boczkowski <penginsbacon@gmail.com>
*
* Copyright (C) 2014 Authors
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include "display/cairo-utils.h"
#include "display/drawing-context.h"
#include "display/drawing-pattern.h"
#include "display/drawing-surface.h"
namespace Inkscape {
, _overflow_steps(1)
{
}
{
delete _pattern_to_user; // delete NULL; is safe
}
void
if (_pattern_to_user) {
}
// mark the area where the object was for redraw.
if (new_trans.isIdentity()) {
delete _pattern_to_user; // delete NULL; is safe
} else {
}
_markForUpdate(STATE_ALL, true);
}
}
void
}
void
DrawingPattern::setOverflow(Geom::Affine initial_transform, int steps, Geom::Affine step_transform) {
}
if (!visible) {
return NULL;
}
return NULL;
}
//TODO: If pattern_to_user set it to identity transform
// The DrawingSurface class handles the mapping from "logical space"
// (coordinates in the rendering) to "physical space" (surface pixels).
// An oversampling is done as the pattern may not pixel align with the final surface.
// The cairo surface is created when the DrawingContext is declared.
// Create drawing surface with size of pattern tile (in pattern space) but with number of pixels
// based on required resolution (c).
// Render pattern.
if (needs_opacity) {
}
if (_debug) {
}
//FIXME: What flags to choose?
if (_overflow_steps == 1) {
} else {
//Overflow transforms need to be transformed to the new coordinate system
//introduced by dc.transform( pattern_surface.drawingTransform().inverse() );
for (int i = 0; i < _overflow_steps; i++) {
}
}
//Uncomment to debug
// cairo_surface_t* raw = pattern_surface.raw();
// std::cout << " cairo_surface (sp-pattern): "
// << " width: " << cairo_image_surface_get_width( raw )
// << " height: " << cairo_image_surface_get_height( raw )
// << std::endl;
// std::string filename = "drawing-pattern.png";
// cairo_surface_write_to_png( pattern_surface.raw(), filename.c_str() );
if (needs_opacity) {
}
// Apply transformation to user space. Also compensate for oversampling.
if (_pattern_to_user) {
} else {
}
if (_debug) {
} else {
}
return cp;
}
// TODO investigate if area should be used.
unsigned DrawingPattern::_updateItem(Geom::IntRect const &area, UpdateContext const &ctx, unsigned flags, unsigned reset)
{
return STATE_NONE;
}
const double oversampling = 2.0;
//FIXME: When scale is too big (zooming in a hatch), cairo doesn't render the pattern
//More precisely it fails when seting pattern matrix in DrawingPattern::renderPattern
//Fully correct solution should make use of visible area bbox and change hach tile rect
//accordingly
if (scale > 25) {
scale = 25;
}
_pattern_resolution = c.ceil();
}
} // 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 :