summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fb051bf)
raw | patch | inline | side by side (parent: fb051bf)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Tue, 12 Aug 2008 22:42:21 +0000 (22:42 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Tue, 12 Aug 2008 22:42:21 +0000 (22:42 +0000) |
29 files changed:
diff --git a/src/extension/implementation/implementation.cpp b/src/extension/implementation/implementation.cpp
index 0f2580eb955eab97db9f0144d68c24e1022e0a6b..6090b72d071a747be60a013d8f4291d9fd389a0d 100644 (file)
/* Rendering methods */
unsigned int
-Implementation::bind(Inkscape::Extension::Print */*module*/, NR::Matrix const */*transform*/, float /*opacity*/)
+Implementation::bind(Inkscape::Extension::Print */*module*/, Geom::Matrix const */*transform*/, float /*opacity*/)
{
return 0;
}
@@ -166,14 +166,14 @@ Implementation::comment(Inkscape::Extension::Print */*module*/, char const */*co
}
unsigned int
-Implementation::fill(Inkscape::Extension::Print */*module*/, Geom::PathVector const &/*pathv*/, NR::Matrix const */*ctm*/, SPStyle const */*style*/,
+Implementation::fill(Inkscape::Extension::Print */*module*/, Geom::PathVector const &/*pathv*/, Geom::Matrix const */*ctm*/, SPStyle const */*style*/,
NRRect const */*pbox*/, NRRect const */*dbox*/, NRRect const */*bbox*/)
{
return 0;
}
unsigned int
-Implementation::stroke(Inkscape::Extension::Print */*module*/, Geom::PathVector const &/*pathv*/, NR::Matrix const */*transform*/, SPStyle const */*style*/,
+Implementation::stroke(Inkscape::Extension::Print */*module*/, Geom::PathVector const &/*pathv*/, Geom::Matrix const */*transform*/, SPStyle const */*style*/,
NRRect const */*pbox*/, NRRect const */*dbox*/, NRRect const */*bbox*/)
{
return 0;
@@ -181,14 +181,14 @@ Implementation::stroke(Inkscape::Extension::Print */*module*/, Geom::PathVector
unsigned int
Implementation::image(Inkscape::Extension::Print */*module*/, unsigned char */*px*/, unsigned int /*w*/, unsigned int /*h*/, unsigned int /*rs*/,
- NR::Matrix const */*transform*/, SPStyle const */*style*/)
+ Geom::Matrix const */*transform*/, SPStyle const */*style*/)
{
return 0;
}
unsigned int
Implementation::text(Inkscape::Extension::Print */*module*/, char const */*text*/,
- NR::Point /*p*/, SPStyle const */*style*/)
+ Geom::Point /*p*/, SPStyle const */*style*/)
{
return 0;
}
diff --git a/src/extension/implementation/implementation.h b/src/extension/implementation/implementation.h
index d90d2e7a9965c42b03008376e8a95261dba62df1..9de70dce76ca536fa9b4e8ecd0caa793bd554425 100644 (file)
/* ----- Rendering methods ----- */
virtual unsigned bind(Inkscape::Extension::Print *module,
- NR::Matrix const *transform,
+ Geom::Matrix const *transform,
float opacity);
virtual unsigned release(Inkscape::Extension::Print *module);
virtual unsigned comment(Inkscape::Extension::Print *module, const char * comment);
virtual unsigned fill(Inkscape::Extension::Print *module,
Geom::PathVector const &pathv,
- NR::Matrix const *ctm,
+ Geom::Matrix const *ctm,
SPStyle const *style,
NRRect const *pbox,
NRRect const *dbox,
NRRect const *bbox);
virtual unsigned stroke(Inkscape::Extension::Print *module,
Geom::PathVector const &pathv,
- NR::Matrix const *transform,
+ Geom::Matrix const *transform,
SPStyle const *style,
NRRect const *pbox,
NRRect const *dbox,
unsigned int w,
unsigned int h,
unsigned int rs,
- NR::Matrix const *transform,
+ Geom::Matrix const *transform,
SPStyle const *style);
virtual unsigned text(Inkscape::Extension::Print *module,
char const *text,
- NR::Point p,
+ Geom::Point p,
SPStyle const *style);
virtual void processPath(Inkscape::XML::Node * node);
};
diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp
index b19e4b31667919afbc456b3e7c5e620bf2d04c91..13302831e510996e3806b539befbb19c9c0bf9f6 100644 (file)
}
void
-CairoRenderContext::transform(NR::Matrix const *transform)
+CairoRenderContext::transform(Geom::Matrix const *transform)
{
g_assert( _is_valid );
}
void
-CairoRenderContext::setTransform(NR::Matrix const *transform)
+CairoRenderContext::setTransform(Geom::Matrix const *transform)
{
g_assert( _is_valid );
}
void
-CairoRenderContext::getTransform(NR::Matrix *copy) const
+CairoRenderContext::getTransform(Geom::Matrix *copy) const
{
g_assert( _is_valid );
}
void
-CairoRenderContext::getParentTransform(NR::Matrix *copy) const
+CairoRenderContext::getParentTransform(Geom::Matrix *copy) const
{
g_assert( _is_valid );
CairoRenderState *parent_state = getParentState();
- memcpy(copy, &parent_state->transform, sizeof(NR::Matrix));
+ memcpy(copy, &parent_state->transform, sizeof(Geom::Matrix));
}
void
@@ -908,9 +908,9 @@ CairoRenderContext::_createPatternPainter(SPPaintServer const *const paintserver
SPPattern *pat = SP_PATTERN (paintserver);
- NR::Matrix ps2user, pcs2dev;
- ps2user.set_identity();
- pcs2dev.set_identity();
+ Geom::Matrix ps2user, pcs2dev;
+ ps2user = Geom::identity();
+ pcs2dev = Geom::identity();
double x = pattern_x(pat);
double y = pattern_y(pat);
@@ -922,7 +922,7 @@ CairoRenderContext::_createPatternPainter(SPPaintServer const *const paintserver
TRACE(("%f x %f pattern\n", width, height));
if (pbox && pattern_patternUnits(pat) == SP_PATTERN_UNITS_OBJECTBOUNDINGBOX) {
- //NR::Matrix bbox2user (pbox->x1 - pbox->x0, 0.0, 0.0, pbox->y1 - pbox->y0, pbox->x0, pbox->y0);
+ //Geom::Matrix bbox2user (pbox->x1 - pbox->x0, 0.0, 0.0, pbox->y1 - pbox->y0, pbox->x0, pbox->y0);
bbox_width_scaler = pbox->x1 - pbox->x0;
bbox_height_scaler = pbox->y1 - pbox->y0;
ps2user[4] = x * bbox_width_scaler + pbox->x0;
@@ -935,7 +935,7 @@ CairoRenderContext::_createPatternPainter(SPPaintServer const *const paintserver
}
// apply pattern transformation
- NR::Matrix pattern_transform(pattern_patternTransform(pat));
+ Geom::Matrix pattern_transform(pattern_patternTransform(pat));
ps2user *= pattern_transform;
// create pattern contents coordinate system
@@ -964,7 +964,7 @@ CairoRenderContext::_createPatternPainter(SPPaintServer const *const paintserver
// calculate the size of the surface which has to be created
// the scaling needs to be taken into account in the ctm after the pattern transformation
- NR::Matrix temp;
+ Geom::Matrix temp;
temp = pattern_transform * _state->transform;
double width_scaler = sqrt(temp[0] * temp[0] + temp[2] * temp[2]);
double height_scaler = sqrt(temp[1] * temp[1] + temp[3] * temp[3]);
@@ -986,8 +986,8 @@ CairoRenderContext::_createPatternPainter(SPPaintServer const *const paintserver
double scale_height = surface_height / (bbox_height_scaler * height);
if (scale_width != 1.0 || scale_height != 1.0 || _vector_based_target) {
TRACE(("needed to scale with %f %f\n", scale_width, scale_height));
- pcs2dev *= NR::scale(1.0 / scale_width, 1.0 / scale_height);
- ps2user *= NR::scale(scale_width, scale_height);
+ pcs2dev *= Geom::Scale(1.0 / scale_width, 1.0 / scale_height);
+ ps2user *= Geom::Scale(scale_width, scale_height);
}
pattern_ctx->setTransform(&pcs2dev);
@@ -1054,17 +1054,17 @@ CairoRenderContext::_createPatternForPaintServer(SPPaintServer const *const pain
sp_gradient_ensure_vector(SP_GRADIENT(lg)); // when exporting from commandline, vector is not built
- NR::Point p1 (lg->x1.computed, lg->y1.computed);
- NR::Point p2 (lg->x2.computed, lg->y2.computed);
+ Geom::Point p1 (lg->x1.computed, lg->y1.computed);
+ Geom::Point p2 (lg->x2.computed, lg->y2.computed);
if (pbox && SP_GRADIENT(lg)->units == SP_GRADIENT_UNITS_OBJECTBOUNDINGBOX) {
// convert to userspace
- NR::Matrix bbox2user(pbox->x1 - pbox->x0, 0, 0, pbox->y1 - pbox->y0, pbox->x0, pbox->y0);
+ Geom::Matrix bbox2user(pbox->x1 - pbox->x0, 0, 0, pbox->y1 - pbox->y0, pbox->x0, pbox->y0);
p1 *= bbox2user;
p2 *= bbox2user;
}
// create linear gradient pattern
- pattern = cairo_pattern_create_linear(p1[NR::X], p1[NR::Y], p2[NR::X], p2[NR::Y]);
+ pattern = cairo_pattern_create_linear(p1[Geom::X], p1[Geom::Y], p2[Geom::X], p2[Geom::Y]);
// add stops
for (gint i = 0; unsigned(i) < lg->vector.stops.size(); i++) {
@@ -1078,14 +1078,14 @@ CairoRenderContext::_createPatternForPaintServer(SPPaintServer const *const pain
sp_gradient_ensure_vector(SP_GRADIENT(rg)); // when exporting from commandline, vector is not built
- NR::Point c (rg->cx.computed, rg->cy.computed);
- NR::Point f (rg->fx.computed, rg->fy.computed);
+ Geom::Point c (rg->cx.computed, rg->cy.computed);
+ Geom::Point f (rg->fx.computed, rg->fy.computed);
double r = rg->r.computed;
if (pbox && SP_GRADIENT(rg)->units == SP_GRADIENT_UNITS_OBJECTBOUNDINGBOX)
apply_bbox2user = true;
// create radial gradient pattern
- pattern = cairo_pattern_create_radial(f[NR::X], f[NR::Y], 0, c[NR::X], c[NR::Y], r);
+ pattern = cairo_pattern_create_radial(f[Geom::X], f[Geom::Y], 0, c[Geom::X], c[Geom::Y], r);
// add stops
for (gint i = 0; unsigned(i) < rg->vector.stops.size(); i++) {
@@ -1323,7 +1323,7 @@ CairoRenderContext::renderPath(const_NRBPath const *bpath, SPStyle const *style,
bool
CairoRenderContext::renderImage(guchar *px, unsigned int w, unsigned int h, unsigned int rs,
- NR::Matrix const *image_transform, SPStyle const *style)
+ Geom::Matrix const *image_transform, SPStyle const *style)
{
g_assert( _is_valid );
@@ -1438,7 +1438,7 @@ CairoRenderContext::_showGlyphs(cairo_t *cr, PangoFont *font, std::vector<CairoG
}
bool
-CairoRenderContext::renderGlyphtext(PangoFont *font, NR::Matrix const *font_matrix,
+CairoRenderContext::renderGlyphtext(PangoFont *font, Geom::Matrix const *font_matrix,
std::vector<CairoGlyphInfo> const &glyphtext, SPStyle const *style)
{
// create a cairo_font_face from PangoFont
@@ -1572,7 +1572,7 @@ CairoRenderContext::_concatTransform(cairo_t *cr, double xx, double yx, double x
}
void
-CairoRenderContext::_initCairoMatrix(cairo_matrix_t *matrix, NR::Matrix const *transform)
+CairoRenderContext::_initCairoMatrix(cairo_matrix_t *matrix, Geom::Matrix const *transform)
{
matrix->xx = (*transform)[0];
matrix->yx = (*transform)[1];
@@ -1583,7 +1583,7 @@ CairoRenderContext::_initCairoMatrix(cairo_matrix_t *matrix, NR::Matrix const *t
}
void
-CairoRenderContext::_concatTransform(cairo_t *cr, NR::Matrix const *transform)
+CairoRenderContext::_concatTransform(cairo_t *cr, Geom::Matrix const *transform)
{
_concatTransform(cr, (*transform)[0], (*transform)[1],
(*transform)[2], (*transform)[3],
diff --git a/src/extension/internal/cairo-render-context.h b/src/extension/internal/cairo-render-context.h
index 68a615234ffcca6a54e9e5ce83e2bec5f67f783f..fe76cb105861b0cb15e274cd653fd25c11e395f2 100644 (file)
SPClipPath *clip_path;
SPMask* mask;
- NR::Matrix transform; // the CTM
+ Geom::Matrix transform; // the CTM
};
class CairoRenderContext {
CairoRenderState *getParentState(void) const;
void setStateForStyle(SPStyle const *style);
- void transform(NR::Matrix const *transform);
- void setTransform(NR::Matrix const *transform);
- void getTransform(NR::Matrix *copy) const;
- void getParentTransform(NR::Matrix *copy) const;
+ void transform(Geom::Matrix const *transform);
+ void setTransform(Geom::Matrix const *transform);
+ void getTransform(Geom::Matrix *copy) const;
+ void getParentTransform(Geom::Matrix *copy) const;
/* Clipping methods */
void addClipPath(NArtBpath const *bp, SPIEnum const *fill_rule);
bool renderPathVector(Geom::PathVector const & pathv, SPStyle const *style, NRRect const *pbox);
bool renderPath(const_NRBPath const *bpath, SPStyle const *style, NRRect const *pbox);
bool renderImage(unsigned char *px, unsigned int w, unsigned int h, unsigned int rs,
- NR::Matrix const *image_transform, SPStyle const *style);
- bool renderGlyphtext(PangoFont *font, NR::Matrix const *font_matrix,
+ Geom::Matrix const *image_transform, SPStyle const *style);
+ bool renderGlyphtext(PangoFont *font, Geom::Matrix const *font_matrix,
std::vector<CairoGlyphInfo> const &glyphtext, SPStyle const *style);
/* More general rendering methods will have to be added (like fill, stroke) */
void _setFillStyle(SPStyle const *style, NRRect const *pbox);
void _setStrokeStyle(SPStyle const *style, NRRect const *pbox);
- void _initCairoMatrix(cairo_matrix_t *matrix, NR::Matrix const *transform);
+ void _initCairoMatrix(cairo_matrix_t *matrix, Geom::Matrix const *transform);
void _concatTransform(cairo_t *cr, double xx, double yx, double xy, double yy, double x0, double y0);
- void _concatTransform(cairo_t *cr, NR::Matrix const *transform);
+ void _concatTransform(cairo_t *cr, Geom::Matrix const *transform);
CairoRenderState *_createState(void);
};
index 914a543f2846e2fea35a0f5defc6b0259163f8f8..8c27632e11a9fb8bcc9a9263a025fb361f8988e8 100644 (file)
// create initial render state
CairoRenderState *state = new_context->_createState();
- state->transform.set_identity();
+ state->transform = Geom::identity();
new_context->_state_stack = g_slist_prepend(new_context->_state_stack, state);
new_context->_state = state;
if (!shape->curve) return;
/* fixme: Think (Lauris) */
- sp_item_invoke_bbox(item, &pbox, NR::identity(), TRUE);
+ sp_item_invoke_bbox(item, &pbox, Geom::identity(), TRUE);
SPStyle* style = SP_OBJECT_STYLE (item);
CairoRenderer *renderer = ctx->getRenderer();
SPMarker* marker = SP_MARKER (shape->marker[SP_MARKER_LOC_START]);
SPItem* marker_item = sp_item_first_item_child (SP_OBJECT (shape->marker[SP_MARKER_LOC_START]));
- NR::Matrix tr(sp_shape_marker_get_transform_at_start(path_it->front()));
+ Geom::Matrix tr(sp_shape_marker_get_transform_at_start(path_it->front()));
if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) {
- tr = NR::scale(style->stroke_width.computed) * tr;
+ tr = Geom::Scale(style->stroke_width.computed) * tr;
}
- tr = marker_item->transform * marker->c2p * tr;
+ tr = (Geom::Matrix)marker_item->transform * (Geom::Matrix)marker->c2p * tr;
- NR::Matrix old_tr = marker_item->transform;
+ Geom::Matrix old_tr = marker_item->transform;
marker_item->transform = tr;
renderer->renderItem (ctx, marker_item);
marker_item->transform = old_tr;
SPMarker* marker = SP_MARKER (shape->marker[SP_MARKER_LOC_MID]);
SPItem* marker_item = sp_item_first_item_child (SP_OBJECT (shape->marker[SP_MARKER_LOC_MID]));
- NR::Matrix tr(sp_shape_marker_get_transform(*curve_it1, *curve_it2));
+ Geom::Matrix tr(sp_shape_marker_get_transform(*curve_it1, *curve_it2));
if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) {
- tr = NR::scale(style->stroke_width.computed) * tr;
+ tr = Geom::Scale(style->stroke_width.computed) * tr;
}
- tr = marker_item->transform * marker->c2p * tr;
+ tr = (Geom::Matrix)marker_item->transform * (Geom::Matrix)marker->c2p * tr;
- NR::Matrix old_tr = marker_item->transform;
+ Geom::Matrix old_tr = marker_item->transform;
marker_item->transform = tr;
renderer->renderItem (ctx, marker_item);
marker_item->transform = old_tr;
}
Geom::Curve const &lastcurve = (*path_it)[index];
- NR::Matrix tr = sp_shape_marker_get_transform_at_end(lastcurve);
+ Geom::Matrix tr = sp_shape_marker_get_transform_at_end(lastcurve);
if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) {
- tr = NR::scale(style->stroke_width.computed) * tr;
+ tr = Geom::Scale(style->stroke_width.computed) * tr;
}
- tr = marker_item->transform * marker->c2p * tr;
+ tr = (Geom::Matrix)marker_item->transform * (Geom::Matrix)marker->c2p * tr;
- NR::Matrix old_tr = marker_item->transform;
+ Geom::Matrix old_tr = marker_item->transform;
marker_item->transform = tr;
renderer->renderItem (ctx, marker_item);
marker_item->transform = old_tr;
CairoRenderer *renderer = ctx->getRenderer();
if ((use->x._set && use->x.computed != 0) || (use->y._set && use->y.computed != 0)) {
- NR::Matrix tp(NR::translate(use->x.computed, use->y.computed));
+ Geom::Matrix tp(Geom::Translate(use->x.computed, use->y.computed));
ctx->pushState();
ctx->transform(&tp);
translated = true;
ctx->addClippingRect(image->x.computed, image->y.computed, image->width.computed, image->height.computed);
}
- NR::translate tp(x, y);
- NR::scale s(width / (double)w, height / (double)h);
- NR::Matrix t(s * tp);
+ Geom::Translate tp(x, y);
+ Geom::Scale s(width / (double)w, height / (double)h);
+ Geom::Matrix t(s * tp);
ctx->renderImage (px, w, h, rs, &t, SP_OBJECT_STYLE (item));
}
// apply viewbox if set
if (0 /*symbol->viewBox_set*/) {
- NR::Matrix vb2user;
+ Geom::Matrix vb2user;
double x, y, width, height;
double view_width, view_height;
x = 0.0;
&x, &y,&width, &height);
// [itemTransform *] translate(x, y) * scale(w/vw, h/vh) * translate(-vx, -vy);
- vb2user.set_identity();
+ vb2user = Geom::identity();
vb2user[0] = width / view_width;
vb2user[3] = height / view_height;
vb2user[4] = x - symbol->viewBox.x0 * vb2user[0];
ctx->pushState();
renderer->setStateForItem(ctx, item);
- ctx->transform(&root->c2p);
+ Geom::Matrix tempmat (root->c2p);
+ ctx->transform(&tempmat);
sp_group_render(item, ctx);
ctx->popState();
}
Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document);
// Get the bounding box of the selection
- //boost::optional<NR::Rect> _bbox = item->getBounds(sp_item_i2d_affine(item));
+ //boost::optional<Geom::Rect> _bbox = item->getBounds(sp_item_i2d_affine(item));
// NRRect bbox = item->getBounds(sp_item_i2d_affine(item));
NRRect bbox(item->getBounds(sp_item_i2d_affine(item)));
}
*/
// Calculate the matrix that will be applied to the image so that it exactly overlaps the source objects
- NR::Matrix eek = sp_item_i2d_affine (SP_ITEM(parent_object));
- NR::Matrix t;
+ Geom::Matrix eek = sp_item_i2d_affine (SP_ITEM(parent_object));
+ Geom::Matrix t;
double shift_x = bbox.x0;
double shift_y = bbox.y1;
shift_x = round (shift_x);
shift_y = -round (-shift_y); // this gets correct rounding despite coordinate inversion, remove the negations when the inversion is gone
}
- t = (NR::Matrix)(NR::scale(1, -1) * (NR::Matrix)(NR::translate (shift_x, shift_y)* eek.inverse()));
+ t = (Geom::Matrix)(Geom::Scale(1, -1) * (Geom::Matrix)(Geom::Translate (shift_x, shift_y)* eek.inverse()));
- //t = t * ((NR::Matrix)ctx->getCurrentState()->transform).inverse();
+ //t = t * ((Geom::Matrix)ctx->getCurrentState()->transform).inverse();
// Do the export
GdkPixbuf *pb = sp_generate_internal_bitmap(document, NULL,
unsigned int w = gdk_pixbuf_get_width(pb);
unsigned int h = gdk_pixbuf_get_height(pb);
unsigned int rs = gdk_pixbuf_get_rowstride(pb);
- NR::Matrix matrix;
+ Geom::Matrix matrix;
matrix = t;
- //matrix = ((NR::Matrix)ctx->getCurrentState()->transform).inverse();
+ //matrix = ((Geom::Matrix)ctx->getCurrentState()->transform).inverse();
//matrix.set_identity();
ctx->renderImage (px, w, h, rs, &matrix, SP_OBJECT_STYLE (item));
state->merge_opacity = FALSE;
ctx->pushLayer();
}
- ctx->transform(&item->transform);
+ Geom::Matrix tempmat (item->transform);
+ ctx->transform(&tempmat);
sp_item_invoke_render(item, ctx);
if (state->need_layer)
CairoRenderContext::CairoRenderMode saved_mode = ctx->getRenderMode();
ctx->setRenderMode(CairoRenderContext::RENDER_MODE_CLIP);
- NR::Matrix saved_ctm;
+ Geom::Matrix saved_ctm;
if (cp->clipPathUnits == SP_CONTENT_UNITS_OBJECTBOUNDINGBOX) {
//SP_PRINT_DRECT("clipd", cp->display->bbox);
NRRect clip_bbox(cp->display->bbox);
- NR::Matrix t(NR::scale(clip_bbox.x1 - clip_bbox.x0, clip_bbox.y1 - clip_bbox.y0));
+ Geom::Matrix t(Geom::Scale(clip_bbox.x1 - clip_bbox.x0, clip_bbox.y1 - clip_bbox.y0));
t[4] = clip_bbox.x0;
t[5] = clip_bbox.y0;
t *= ctx->getCurrentState()->transform;
NRRect mask_bbox(mask->display->bbox);
// TODO: should the bbox be transformed if maskUnits != userSpaceOnUse ?
if (mask->maskContentUnits == SP_CONTENT_UNITS_OBJECTBOUNDINGBOX) {
- NR::Matrix t(NR::scale(mask_bbox.x1 - mask_bbox.x0, mask_bbox.y1 - mask_bbox.y0));
+ Geom::Matrix t(Geom::Scale(mask_bbox.x1 - mask_bbox.x0, mask_bbox.y1 - mask_bbox.y0));
t[4] = mask_bbox.x0;
t[5] = mask_bbox.y0;
t *= ctx->getCurrentState()->transform;
diff --git a/src/extension/internal/emf-win32-print.cpp b/src/extension/internal/emf-win32-print.cpp
index 6e0a7bf0b6e13bd59de1e24c36813617ee62ad47..f4d021830670873b93ca52c32450c56977bbc7a0 100644 (file)
g_free(local_fn);
g_free(unicode_fn);
- m_tr_stack.push( NR::scale(1, -1) * NR::translate(0, sp_document_height(doc)));
+ m_tr_stack.push( Geom::Scale(1, -1) * Geom::Translate(0, sp_document_height(doc)));
return 0;
}
void
-PrintEmfWin32::create_pen(SPStyle const *style, const NR::Matrix *transform)
+PrintEmfWin32::create_pen(SPStyle const *style, const Geom::Matrix *transform)
{
if (style) {
float rgb[3];
DWORD *dash = NULL;
float oldmiterlimit;
- using NR::X;
- using NR::Y;
+ using Geom::X;
+ using Geom::Y;
- NR::Matrix tf = *transform;
+ Geom::Matrix tf = *transform;
- NR::Point zero(0, 0);
- NR::Point one(1, 1);
- NR::Point p0(zero * tf);
- NR::Point p1(one * tf);
- NR::Point p(p1 - p0);
+ Geom::Point zero(0, 0);
+ Geom::Point one(1, 1);
+ Geom::Point p0(zero * tf);
+ Geom::Point p1(one * tf);
+ Geom::Point p(p1 - p0);
double scale = sqrt( (p[X]*p[X]) + (p[Y]*p[Y]) ) / sqrt(2);
}
unsigned int
-PrintEmfWin32::bind(Inkscape::Extension::Print *mod, NR::Matrix const *transform, float opacity)
+PrintEmfWin32::bind(Inkscape::Extension::Print *mod, Geom::Matrix const *transform, float opacity)
{
- NR::Matrix tr = *transform;
+ Geom::Matrix tr = *transform;
if (m_tr_stack.size()) {
- NR::Matrix tr_top = m_tr_stack.top();
+ Geom::Matrix tr_top = m_tr_stack.top();
m_tr_stack.push(tr * tr_top);
} else {
m_tr_stack.push(tr);
unsigned int
PrintEmfWin32::fill(Inkscape::Extension::Print *mod,
- Geom::PathVector const &pathv, NR::Matrix const *transform, SPStyle const *style,
+ Geom::PathVector const &pathv, Geom::Matrix const *transform, SPStyle const *style,
NRRect const *pbox, NRRect const *dbox, NRRect const *bbox)
{
if (!hdc) return 0;
- NR::Matrix tf = m_tr_stack.top();
+ Geom::Matrix tf = m_tr_stack.top();
flush_fill(); // flush any pending fills
unsigned int
PrintEmfWin32::stroke (Inkscape::Extension::Print *mod,
- Geom::PathVector const &pathv, const NR::Matrix *transform, const SPStyle *style,
+ Geom::PathVector const &pathv, const Geom::Matrix *transform, const SPStyle *style,
const NRRect *pbox, const NRRect *dbox, const NRRect *bbox)
{
if (!hdc) return 0;
- NR::Matrix tf = m_tr_stack.top();
+ Geom::Matrix tf = m_tr_stack.top();
NArtBpath * bpath = BPath_from_2GeomPath(pathv);
bool
-PrintEmfWin32::print_simple_shape(const NArtBpath *bpath, const NR::Matrix *transform, NRRect const *pbox)
+PrintEmfWin32::print_simple_shape(const NArtBpath *bpath, const Geom::Matrix *transform, NRRect const *pbox)
{
NR::Matrix tf = *transform;
const NArtBpath *bp = bpath;
@@ -645,12 +645,12 @@ PrintEmfWin32::print_simple_shape(const NArtBpath *bpath, const NR::Matrix *tran
bp = bpath;
while (bp->code != NR_END)
{
- using NR::X;
- using NR::Y;
+ using Geom::X;
+ using Geom::Y;
- NR::Point p1(bp->c(1) * tf);
- NR::Point p2(bp->c(2) * tf);
- NR::Point p3(bp->c(3) * tf);
+ Geom::Point p1(bp->c(1) * tf);
+ Geom::Point p2(bp->c(2) * tf);
+ Geom::Point p3(bp->c(3) * tf);
p1[X] = (p1[X] * IN_PER_PX * dwDPI);
p2[X] = (p2[X] * IN_PER_PX * dwDPI);
@@ -768,12 +768,12 @@ PrintEmfWin32::print_simple_shape(const NArtBpath *bpath, const NR::Matrix *tran
}
unsigned int
-PrintEmfWin32::print_bpath(const NArtBpath *bp, const NR::Matrix *transform, NRRect const *pbox)
+PrintEmfWin32::print_bpath(NArtBpath const *bp, Geom::Matrix const *transform, NRRect const *pbox)
{
unsigned int closed;
NR::Matrix tf = *transform;
- simple_shape = print_simple_shape(bp, &tf, pbox);
+ simple_shape = print_simple_shape(bp, transform, pbox);
if (simple_shape)
return TRUE;
@@ -781,12 +781,12 @@ PrintEmfWin32::print_bpath(const NArtBpath *bp, const NR::Matrix *transform, NRR
BeginPath( hdc );
closed = FALSE;
while (bp->code != NR_END) {
- using NR::X;
- using NR::Y;
+ using Geom::X;
+ using Geom::Y;
- NR::Point p1(bp->c(1) * tf);
- NR::Point p2(bp->c(2) * tf);
- NR::Point p3(bp->c(3) * tf);
+ Geom::Point p1(bp->c(1) * tf);
+ Geom::Point p2(bp->c(2) * tf);
+ Geom::Point p3(bp->c(3) * tf);
p1[X] = (p1[X] * IN_PER_PX * dwDPI);
p2[X] = (p2[X] * IN_PER_PX * dwDPI);
}
unsigned int
-PrintEmfWin32::text(Inkscape::Extension::Print *mod, char const *text, NR::Point p,
+PrintEmfWin32::text(Inkscape::Extension::Print *mod, char const *text, Geom::Point p,
SPStyle const *const style)
{
if (!hdc) return 0;
@@ -961,14 +961,14 @@ PrintEmfWin32::text(Inkscape::Extension::Print *mod, char const *text, NR::Point
// Transparent text background
SetBkMode(hdc, TRANSPARENT);
- NR::Matrix tf = m_tr_stack.top();
+ Geom::Matrix tf = m_tr_stack.top();
p = p * tf;
- p[NR::X] = (p[NR::X] * IN_PER_PX * dwDPI);
- p[NR::Y] = (p[NR::Y] * IN_PER_PX * dwDPI);
+ p[Geom::X] = (p[Geom::X] * IN_PER_PX * dwDPI);
+ p[Geom::Y] = (p[Geom::Y] * IN_PER_PX * dwDPI);
- LONG const xpos = (LONG) round(p[NR::X]);
- LONG const ypos = (LONG) round(rc.bottom-p[NR::Y]);
+ LONG const xpos = (LONG) round(p[Geom::X]);
+ LONG const ypos = (LONG) round(rc.bottom-p[Geom::Y]);
if (PrintWin32::is_os_wide()) {
gunichar2 *unicode_text = g_utf8_to_utf16( text, -1, NULL, NULL, NULL );
index 11b265dccb3fd31bcfeee00548fa95a1f966d1e5..63232dad11e7142455af1ab1b724a301e6738d68 100644 (file)
@@ -44,18 +44,18 @@ class PrintEmfWin32 : public Inkscape::Extension::Implementation::Implementation
HBRUSH hbrush, hbrushOld;
HPEN hpen, hpenOld;
- std::stack<NR::Matrix> m_tr_stack;
+ std::stack<Geom::Matrix> m_tr_stack;
NArtBpath *fill_path;
NArtBpath *fill_path_copy;
- NR::Matrix fill_transform;
+ Geom::Matrix fill_transform;
NRRect fill_pbox;
-// NR::Matrix text_transform;
+// Geom::Matrix text_transform;
bool stroke_and_fill;
bool fill_only;
bool simple_shape;
- unsigned int print_bpath (const NArtBpath *bp, const NR::Matrix *transform, NRRect const *pbox);
- bool print_simple_shape (const NArtBpath *bp, const NR::Matrix *transform, NRRect const *pbox);
+ unsigned int print_bpath (const NArtBpath *bp, const Geom::Matrix *transform, NRRect const *pbox);
+ bool print_simple_shape (const NArtBpath *bp, const Geom::Matrix *transform, NRRect const *pbox);
public:
PrintEmfWin32 (void);
virtual unsigned int finish (Inkscape::Extension::Print * module);
/* Rendering methods */
- virtual unsigned int bind(Inkscape::Extension::Print *module, NR::Matrix const *transform, float opacity);
+ virtual unsigned int bind(Inkscape::Extension::Print *module, Geom::Matrix const *transform, float opacity);
virtual unsigned int release(Inkscape::Extension::Print *module);
virtual unsigned int fill (Inkscape::Extension::Print * module,
- Geom::PathVector const &pathv, const NR::Matrix *ctm, const SPStyle *style,
+ Geom::PathVector const &pathv, const Geom::Matrix *ctm, const SPStyle *style,
const NRRect *pbox, const NRRect *dbox, const NRRect *bbox);
virtual unsigned int stroke (Inkscape::Extension::Print * module,
- Geom::PathVector const &pathv, const NR::Matrix *transform, const SPStyle *style,
+ Geom::PathVector const &pathv, const Geom::Matrix *transform, const SPStyle *style,
const NRRect *pbox, const NRRect *dbox, const NRRect *bbox);
virtual unsigned int comment(Inkscape::Extension::Print *module, const char * comment);
virtual unsigned int text(Inkscape::Extension::Print *module, char const *text,
- NR::Point p, SPStyle const *style);
+ Geom::Point p, SPStyle const *style);
bool textToPath (Inkscape::Extension::Print * ext);
static void init (void);
void destroy_brush();
- void create_pen(SPStyle const *style, const NR::Matrix *transform);
+ void create_pen(SPStyle const *style, const Geom::Matrix *transform);
void destroy_pen();
index e206b2a68dddf9bee4adcb121e4873c2fb5f910c..729b53cfd4f5c3a009b7b2fb37acf031fd1a55c0 100644 (file)
namespace {
-Glib::ustring build_lines(int axis, NR::Rect bounding_area,
+Glib::ustring build_lines(int axis, Geom::Rect bounding_area,
float offset, float spacing)
{
- NR::Point point_offset(0.0, 0.0);
+ Geom::Point point_offset(0.0, 0.0);
point_offset[axis] = offset;
SVG::PathString path_data;
- for (NR::Point start_point = bounding_area.min();
+ for (Geom::Point start_point = bounding_area.min();
start_point[axis] + offset <= (bounding_area.max())[axis];
start_point[axis] += spacing) {
- NR::Point end_point = start_point;
+ Geom::Point end_point = start_point;
end_point[1-axis] = (bounding_area.max())[1-axis];
path_data.moveTo(start_point + point_offset)
@@ -78,22 +78,21 @@ Grid::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *doc
{
Inkscape::Selection * selection = ((SPDesktop *)document)->selection;
- NR::Rect bounding_area = NR::Rect(NR::Point(0,0), NR::Point(100,100));
+ Geom::Rect bounding_area = Geom::Rect(Geom::Point(0,0), Geom::Point(100,100));
if (selection->isEmpty()) {
/* get page size */
SPDocument * doc = document->doc();
- bounding_area = NR::Rect(NR::Point(0,0),
- NR::Point(sp_document_width(doc),
- sp_document_height(doc)));
+ bounding_area = Geom::Rect( Geom::Point(0,0),
+ Geom::Point(sp_document_width(doc), sp_document_height(doc)) );
} else {
boost::optional<NR::Rect> bounds = selection->bounds();
if (bounds) {
- bounding_area = *bounds;
+ bounding_area = to_2geom(*bounds);
}
gdouble doc_height = sp_document_height(document->doc());
- NR::Rect temprec = NR::Rect(NR::Point(bounding_area.min()[NR::X], doc_height - bounding_area.min()[NR::Y]),
- NR::Point(bounding_area.max()[NR::X], doc_height - bounding_area.max()[NR::Y]));
+ Geom::Rect temprec = Geom::Rect(Geom::Point(bounding_area.min()[Geom::X], doc_height - bounding_area.min()[Geom::Y]),
+ Geom::Point(bounding_area.max()[Geom::X], doc_height - bounding_area.max()[Geom::Y]));
bounding_area = temprec;
}
index eeda6f1879bf784d1f9f2c58558cfa1bdfae296d..84e493afaf696f213462f962ea1d2927c4b79d5b 100644 (file)
os << "\\begin{pspicture}(" << sp_document_width(doc) << "," << sp_document_height(doc) << ")\n";
}
- m_tr_stack.push( NR::scale(1, -1) * NR::translate(0, sp_document_height(doc)));
+ m_tr_stack.push( Geom::Scale(1, -1) * Geom::Translate(0, sp_document_height(doc)));
return fprintf(_stream, "%s", os.str().c_str());
}
}
unsigned int
-PrintLatex::bind(Inkscape::Extension::Print *mod, NR::Matrix const *transform, float opacity)
+PrintLatex::bind(Inkscape::Extension::Print *mod, Geom::Matrix const *transform, float opacity)
{
- NR::Matrix tr = *transform;
+ Geom::Matrix tr = *transform;
if(m_tr_stack.size()){
- NR::Matrix tr_top = m_tr_stack.top();
+ Geom::Matrix tr_top = m_tr_stack.top();
m_tr_stack.push(tr * tr_top);
}else
m_tr_stack.push(tr);
unsigned int
PrintLatex::fill(Inkscape::Extension::Print *mod,
- Geom::PathVector const &pathv, NR::Matrix const *transform, SPStyle const *style,
+ Geom::PathVector const &pathv, Geom::Matrix const *transform, SPStyle const *style,
NRRect const *pbox, NRRect const *dbox, NRRect const *bbox)
{
if (!_stream) return 0; // XXX: fixme, returning -1 as unsigned.
}
unsigned int
-PrintLatex::stroke (Inkscape::Extension::Print *mod, Geom::PathVector const &pathv, const NR::Matrix *transform, const SPStyle *style,
+PrintLatex::stroke (Inkscape::Extension::Print *mod, Geom::PathVector const &pathv, const Geom::Matrix *transform, const SPStyle *style,
const NRRect *pbox, const NRRect *dbox, const NRRect *bbox)
{
if (!_stream) return 0; // XXX: fixme, returning -1 as unsigned.
@@ -238,8 +238,8 @@ PrintLatex::stroke (Inkscape::Extension::Print *mod, Geom::PathVector const &pat
if (style->stroke.isColor()) {
Inkscape::SVGOStringStream os;
float rgb[3];
- NR::Matrix tr_stack = m_tr_stack.top();
- double const scale = expansion(tr_stack);
+ Geom::Matrix tr_stack = m_tr_stack.top();
+ double const scale = tr_stack.descrim();
os.setf(std::ios::fixed);
sp_color_get_rgb_floatv(&style->stroke.value.color, rgb);
@@ -274,13 +274,13 @@ PrintLatex::stroke (Inkscape::Extension::Print *mod, Geom::PathVector const &pat
// FIXME: why is 'transform' argument not used?
void
-PrintLatex::print_pathvector(SVGOStringStream &os, Geom::PathVector const &pathv_in, const NR::Matrix * /*transform*/)
+PrintLatex::print_pathvector(SVGOStringStream &os, Geom::PathVector const &pathv_in, const Geom::Matrix * /*transform*/)
{
if (pathv_in.empty())
return;
-// NR::Matrix tf=*transform; // why was this here?
- NR::Matrix tf_stack=m_tr_stack.top(); // and why is transform argument not used?
+// Geom::Matrix tf=*transform; // why was this here?
+ Geom::Matrix tf_stack=m_tr_stack.top(); // and why is transform argument not used?
Geom::PathVector pathv = pathv_in * tf_stack; // generates new path, which is a bit slow, but this doesn't have to be performance optimized
os << "\\newpath\n";
index 3ce54d4c2e29f9c9140162e85f4da1f8398576e7..a33e169e84103a8a0f3dd8d20f641630dc1525cb 100644 (file)
float _height;
FILE * _stream;
- std::stack<NR::Matrix> m_tr_stack;
+ std::stack<Geom::Matrix> m_tr_stack;
- void print_pathvector(SVGOStringStream &os, Geom::PathVector const &pathv_in, const NR::Matrix * /*transform*/);
+ void print_pathvector(SVGOStringStream &os, Geom::PathVector const &pathv_in, const Geom::Matrix * /*transform*/);
void print_2geomcurve(SVGOStringStream &os, Geom::Curve const & c );
public:
virtual unsigned int finish (Inkscape::Extension::Print * module);
/* Rendering methods */
- virtual unsigned int bind(Inkscape::Extension::Print *module, NR::Matrix const *transform, float opacity);
+ virtual unsigned int bind(Inkscape::Extension::Print *module, Geom::Matrix const *transform, float opacity);
virtual unsigned int release(Inkscape::Extension::Print *module);
- virtual unsigned int fill (Inkscape::Extension::Print * module, Geom::PathVector const &pathv, const NR::Matrix *ctm, const SPStyle *style,
+ virtual unsigned int fill (Inkscape::Extension::Print * module, Geom::PathVector const &pathv, const Geom::Matrix *ctm, const SPStyle *style,
const NRRect *pbox, const NRRect *dbox, const NRRect *bbox);
- virtual unsigned int stroke (Inkscape::Extension::Print * module, Geom::PathVector const &pathv, const NR::Matrix *transform, const SPStyle *style,
+ virtual unsigned int stroke (Inkscape::Extension::Print * module, Geom::PathVector const &pathv, const Geom::Matrix *transform, const SPStyle *style,
const NRRect *pbox, const NRRect *dbox, const NRRect *bbox);
virtual unsigned int comment(Inkscape::Extension::Print *module, const char * comment);
bool textToPath (Inkscape::Extension::Print * ext);
index 8ad9b5031e5067d6b04536f8b93ccd8e5677aa83..01690628964480c352f800d5e9c811d49831bd6a 100644 (file)
* NOTE:
* This class is ported almost verbatim from the public domain
* JAMA Matrix package. It is modified to handle only 3x3 matrices
- * and our NR::Matrix affine transform class. We give full
+ * and our Geom::Matrix affine transform class. We give full
* attribution to them, along with many thanks. JAMA can be found at:
* http://math.nist.gov/javanumerics/jama
*
}
-static Glib::ustring formatTransform(NR::Matrix &tf)
+static Glib::ustring formatTransform(Geom::Matrix &tf)
{
Glib::ustring str;
- if (!tf.test_identity())
+ if (!tf.isIdentity())
{
StringOutputStream outs;
OutputStreamWriter out(outs);
* Get the general transform from SVG pixels to
* ODF cm
*/
-static NR::Matrix getODFTransform(const SPItem *item)
+static Geom::Matrix getODFTransform(const SPItem *item)
{
//### Get SVG-to-ODF transform
- NR::Matrix tf (sp_item_i2d_affine(item));
+ Geom::Matrix tf (sp_item_i2d_affine(item));
//Flip Y into document coordinates
double doc_height = sp_document_height(SP_ACTIVE_DOCUMENT);
- NR::Matrix doc2dt_tf = NR::Matrix(NR::scale(1.0, -1.0));
- doc2dt_tf = doc2dt_tf * NR::Matrix(NR::translate(0, doc_height));
+ Geom::Matrix doc2dt_tf = Geom::Matrix(Geom::Scale(1.0, -1.0));
+ doc2dt_tf = doc2dt_tf * Geom::Matrix(Geom::Translate(0, doc_height));
tf = tf * doc2dt_tf;
- tf = tf * NR::Matrix(NR::scale(pxToCm));
+ tf = tf * Geom::Matrix(Geom::Scale(pxToCm));
return tf;
}
* Get the bounding box of an item, as mapped onto
* an ODF document, in cm.
*/
-static boost::optional<NR::Rect> getODFBoundingBox(const SPItem *item)
+static boost::optional<Geom::Rect> getODFBoundingBox(const SPItem *item)
{
- boost::optional<NR::Rect> bbox = sp_item_bbox_desktop((SPItem *)item);
- if (bbox) {
+ boost::optional<NR::Rect> bbox_temp = sp_item_bbox_desktop((SPItem *)item);
+ boost::optional<Geom::Rect> bbox;
+ if (bbox_temp) {
+ bbox = to_2geom(*bbox_temp);
double doc_height = sp_document_height(SP_ACTIVE_DOCUMENT);
- NR::Matrix doc2dt_tf = NR::Matrix(NR::scale(1.0, -1.0));
- doc2dt_tf = doc2dt_tf * NR::Matrix(NR::translate(0, doc_height));
+ Geom::Matrix doc2dt_tf = Geom::Matrix(Geom::Scale(1.0, -1.0));
+ doc2dt_tf = doc2dt_tf * Geom::Matrix(Geom::Translate(0, doc_height));
bbox = *bbox * doc2dt_tf;
- bbox = *bbox * NR::Matrix(NR::scale(pxToCm));
+ bbox = *bbox * Geom::Matrix(Geom::Scale(pxToCm));
}
return bbox;
}
* Get the transform for an item, correcting for
* handedness reversal
*/
-static NR::Matrix getODFItemTransform(const SPItem *item)
+static Geom::Matrix getODFItemTransform(const SPItem *item)
{
- NR::Matrix itemTransform = NR::Matrix(NR::scale(1, -1));
- itemTransform = itemTransform * item->transform;
- itemTransform = itemTransform * NR::Matrix(NR::scale(1, -1));
+ Geom::Matrix itemTransform (Geom::Scale(1, -1));
+ itemTransform = itemTransform * (Geom::Matrix)item->transform;
+ itemTransform = itemTransform * Geom::Scale(1, -1);
return itemTransform;
}
/**
* Get some fun facts from the transform
*/
-static void analyzeTransform(NR::Matrix &tf,
+static void analyzeTransform(Geom::Matrix &tf,
double &rotate, double &/*xskew*/, double &/*yskew*/,
double &xscale, double &yscale)
{
}
SPItem *item = SP_ITEM(reprobj);
//### Get SVG-to-ODF transform
- NR::Matrix tf = getODFTransform(item);
+ Geom::Matrix tf = getODFTransform(item);
if (nodeName == "image" || nodeName == "svg:image")
{
bool OdfOutput::processGradient(Writer &outs, SPItem *item,
- const Glib::ustring &id, NR::Matrix &/*tf*/)
+ const Glib::ustring &id, Geom::Matrix &/*tf*/)
{
if (!item)
return false;
gi.style = "linear";
SPLinearGradient *linGrad = SP_LINEARGRADIENT(gradient);
/*
- NR::Point p1(linGrad->x1.value, linGrad->y1.value);
+ Geom::Point p1(linGrad->x1.value, linGrad->y1.value);
p1 = p1 * tf;
- gi.x1 = p1[NR::X];
- gi.y1 = p1[NR::Y];
- NR::Point p2(linGrad->x2.value, linGrad->y2.value);
+ gi.x1 = p1[Geom::X];
+ gi.y1 = p1[Geom::Y];
+ Geom::Point p2(linGrad->x2.value, linGrad->y2.value);
p2 = p2 * tf;
- gi.x2 = p2[NR::X];
- gi.y2 = p2[NR::Y];
+ gi.x2 = p2[Geom::X];
+ gi.y2 = p2[Geom::Y];
*/
gi.x1 = linGrad->x1.value;
gi.y1 = linGrad->y1.value;
Glib::ustring id = getAttribute(node, "id");
//### Get SVG-to-ODF transform
- NR::Matrix tf = getODFTransform(item);
+ Geom::Matrix tf = getODFTransform(item);
//### Get ODF bounding box params for item
- boost::optional<NR::Rect> bbox = getODFBoundingBox(item);
+ boost::optional<Geom::Rect> bbox = getODFBoundingBox(item);
if (!bbox) {
return true;
}
- double bbox_x = bbox->min()[NR::X];
- double bbox_y = bbox->min()[NR::Y];
- double bbox_width = bbox->extent(NR::X);
- double bbox_height = bbox->extent(NR::Y);
+ double bbox_x = bbox->min()[Geom::X];
+ double bbox_y = bbox->min()[Geom::Y];
+ double bbox_width = (*bbox)[Geom::X].extent();
+ double bbox_height = (*bbox)[Geom::Y].extent();
double rotate;
double xskew;
double iwidth = img->width.value;
double iheight = img->height.value;
- NR::Rect ibbox(NR::Point(ix, iy), NR::Point(ix+iwidth, iy+iheight));
+ Geom::Rect ibbox(Geom::Point(ix, iy), Geom::Point(ix+iwidth, iy+iheight));
ibbox = ibbox * tf;
- ix = ibbox.min()[NR::X];
- iy = ibbox.min()[NR::Y];
- //iwidth = ibbox.max()[NR::X] - ibbox.min()[NR::X];
- //iheight = ibbox.max()[NR::Y] - ibbox.min()[NR::Y];
+ ix = ibbox.min()[Geom::X];
+ iy = ibbox.min()[Geom::Y];
+ //iwidth = ibbox.max()[Geom::X] - ibbox.min()[Geom::X];
+ //iheight = ibbox.max()[Geom::Y] - ibbox.min()[Geom::Y];
iwidth = xscale * iwidth;
iheight = yscale * iheight;
- NR::Matrix itemTransform = getODFItemTransform(item);
+ Geom::Matrix itemTransform = getODFItemTransform(item);
Glib::ustring itemTransformString = formatTransform(itemTransform);
index a12ab4b02ecbb3a188924733309e466e5647e014..8d38e530f97f87de8da485d0bfbec943cbcf2b38 100644 (file)
bool processStyle(Writer &outs, SPItem *item, const Glib::ustring &id);
bool processGradient(Writer &outs, SPItem *item,
- const Glib::ustring &id, NR::Matrix &tf);
+ const Glib::ustring &id, Geom::Matrix &tf);
bool writeStyleHeader(Writer &outs);
index 2b3c9382489c63413697fcba3a34acff2c5eb250..6c2b2ed62382e548af57aa2e5780d24b3825027b 100644 (file)
bool pageBoundingBox = mod->get_param_bool("pageBoundingBox");
SPItem* doc_item = SP_ITEM(mod->base);
// printf("Page Bounding Box: %s\n", pageBoundingBox ? "TRUE" : "FALSE");
- NR::Matrix t (NR::identity());
+ Geom::Matrix t (Geom::identity());
if (pageBoundingBox) {
d.x0 = d.y0 = 0;
d.x1 = _width;
// complete transform, including doc_item's own transform
t = sp_item_i2doc_affine (doc_item);
// subreact doc_item's transform (comes first) from it
- t = NR::Matrix(doc_item->transform).inverse() * t;
+ t = Geom::Matrix(doc_item->transform).inverse() * t;
// create cairo context
pdf_surface = cairo_pdf_surface_create_for_stream(Inkscape::Extension::Internal::_write_callback, _stream, d.x1-d.x0, d.y1-d.y0);
}
unsigned int
-PrintCairoPDF::bind(Inkscape::Extension::Print *mod, NR::Matrix const *transform, float opacity)
+PrintCairoPDF::bind(Inkscape::Extension::Print *mod, Geom::Matrix const *transform, float opacity)
{
if (!_stream) return 0; // XXX: fixme, returning -1 as unsigned.
if (_bitmap) return 0;
@@ -465,17 +465,17 @@ PrintCairoPDF::create_pattern_for_paint(SPPaintServer const *const paintserver,
sp_gradient_ensure_vector(SP_GRADIENT(lg)); // when exporting from commandline, vector is not built
- NR::Point p1 (lg->x1.computed, lg->y1.computed);
- NR::Point p2 (lg->x2.computed, lg->y2.computed);
+ Geom::Point p1 (lg->x1.computed, lg->y1.computed);
+ Geom::Point p2 (lg->x2.computed, lg->y2.computed);
if (pbox && SP_GRADIENT(lg)->units == SP_GRADIENT_UNITS_OBJECTBOUNDINGBOX) {
// convert to userspace
- NR::Matrix bbox2user(pbox->x1 - pbox->x0, 0, 0, pbox->y1 - pbox->y0, pbox->x0, pbox->y0);
+ Geom::Matrix bbox2user(pbox->x1 - pbox->x0, 0, 0, pbox->y1 - pbox->y0, pbox->x0, pbox->y0);
p1 *= bbox2user;
p2 *= bbox2user;
}
// create linear gradient pattern
- pattern = cairo_pattern_create_linear(p1[NR::X], p1[NR::Y], p2[NR::X], p2[NR::Y]);
+ pattern = cairo_pattern_create_linear(p1[Geom::X], p1[Geom::Y], p2[Geom::X], p2[Geom::Y]);
// add stops
for (gint i = 0; unsigned(i) < lg->vector.stops.size(); i++) {
@@ -489,21 +489,21 @@ PrintCairoPDF::create_pattern_for_paint(SPPaintServer const *const paintserver,
sp_gradient_ensure_vector(SP_GRADIENT(rg)); // when exporting from commandline, vector is not built
- NR::Point c (rg->cx.computed, rg->cy.computed);
- NR::Point f (rg->fx.computed, rg->fy.computed);
+ Geom::Point c (rg->cx.computed, rg->cy.computed);
+ Geom::Point f (rg->fx.computed, rg->fy.computed);
double r = rg->r.computed;
- NR::Coord const df = hypot(f[NR::X] - c[NR::X], f[NR::Y] - c[NR::Y]);
+ Geom::Coord const df = hypot(f[Geom::X] - c[Geom::X], f[Geom::Y] - c[Geom::Y]);
if (df >= r) {
- f[NR::X] = c[NR::X] + (f[NR::X] - c[NR::X] ) * r / (float) df;
- f[NR::Y] = c[NR::Y] + (f[NR::Y] - c[NR::Y] ) * r / (float) df;
+ f[Geom::X] = c[Geom::X] + (f[Geom::X] - c[Geom::X] ) * r / (float) df;
+ f[Geom::Y] = c[Geom::Y] + (f[Geom::Y] - c[Geom::Y] ) * r / (float) df;
}
if (pbox && SP_GRADIENT(rg)->units == SP_GRADIENT_UNITS_OBJECTBOUNDINGBOX)
apply_bbox2user = true;
// create radial gradient pattern
- pattern = cairo_pattern_create_radial(f[NR::X], f[NR::Y], 0, c[NR::X], c[NR::Y], r);
+ pattern = cairo_pattern_create_radial(f[Geom::X], f[Geom::Y], 0, c[Geom::X], c[Geom::Y], r);
// add stops
for (gint i = 0; unsigned(i) < rg->vector.stops.size(); i++) {
}
unsigned int
-PrintCairoPDF::fill(Inkscape::Extension::Print *mod, Geom::PathVector const &pathv, NR::Matrix const *ctm, SPStyle const *const style,
+PrintCairoPDF::fill(Inkscape::Extension::Print *mod, Geom::PathVector const &pathv, Geom::Matrix const *ctm, SPStyle const *const style,
NRRect const *pbox, NRRect const *dbox, NRRect const *bbox)
{
if (!_stream) return 0; // XXX: fixme, returning -1 as unsigned.
@@ -686,7 +686,7 @@ PrintCairoPDF::print_stroke_style(cairo_t *cr, SPStyle const *style, NRRect cons
}
unsigned int
-PrintCairoPDF::stroke(Inkscape::Extension::Print *mod, Geom::PathVector const &pathv, NR::Matrix const *ctm, SPStyle const *style,
+PrintCairoPDF::stroke(Inkscape::Extension::Print *mod, Geom::PathVector const &pathv, Geom::Matrix const *ctm, SPStyle const *style,
NRRect const *pbox, NRRect const *dbox, NRRect const *bbox)
{
if (!_stream) return 0; // XXX: fixme, returning -1 as unsigned.
@@ -712,7 +712,7 @@ PrintCairoPDF::stroke(Inkscape::Extension::Print *mod, Geom::PathVector const &p
unsigned int
PrintCairoPDF::image(Inkscape::Extension::Print *mod, guchar *px, unsigned int w, unsigned int h, unsigned int rs,
- NR::Matrix const *transform, SPStyle const *style)
+ Geom::Matrix const *transform, SPStyle const *style)
{
if (!_stream) return 0; // XXX: fixme, returning -1 as unsigned.
if (_bitmap) return 0;
@@ -786,8 +786,8 @@ PrintCairoPDF::image(Inkscape::Extension::Print *mod, guchar *px, unsigned int w
#ifndef RENDER_WITH_PANGO_CAIRO
-NR::Point
-PrintCairoPDF::draw_glyphs(cairo_t *cr, NR::Point p, PangoFont *font, PangoGlyphString *glyph_string,
+Geom::Point
+PrintCairoPDF::draw_glyphs(cairo_t *cr, Geom::Point p, PangoFont *font, PangoGlyphString *glyph_string,
bool vertical, bool stroke)
{
cairo_glyph_t glyph_array[GLYPH_ARRAY_SIZE];
@@ -808,8 +808,8 @@ PrintCairoPDF::draw_glyphs(cairo_t *cr, NR::Point p, PangoFont *font, PangoGlyph
}
glyphs[i - num_invalid_glyphs].index = info->glyph;
- glyphs[i - num_invalid_glyphs].x = p[NR::X] + (x_offset + info->geometry.x_offset)/PANGO_SCALE;
- glyphs[i - num_invalid_glyphs].y = p[NR::Y] + (y_offset + info->geometry.y_offset)/PANGO_SCALE;
+ glyphs[i - num_invalid_glyphs].x = p[Geom::X] + (x_offset + info->geometry.x_offset)/PANGO_SCALE;
+ glyphs[i - num_invalid_glyphs].y = p[Geom::Y] + (y_offset + info->geometry.y_offset)/PANGO_SCALE;
if (vertical) {
cairo_text_extents_t extents;
@@ -828,14 +828,14 @@ PrintCairoPDF::draw_glyphs(cairo_t *cr, NR::Point p, PangoFont *font, PangoGlyph
if (glyph_string->num_glyphs > GLYPH_ARRAY_SIZE)
g_free(glyphs);
- return NR::Point(x_offset, y_offset);
+ return Geom::Point(x_offset, y_offset);
}
#endif
unsigned int
-PrintCairoPDF::text(Inkscape::Extension::Print *mod, char const *text, NR::Point p,
+PrintCairoPDF::text(Inkscape::Extension::Print *mod, char const *text, Geom::Point p,
SPStyle const *const style)
{
bool dirty_pattern = false;
@@ -923,7 +923,7 @@ PrintCairoPDF::text(Inkscape::Extension::Print *mod, char const *text, NR::Point
print_fill_style(cr, style, NULL);
#ifndef RENDER_WITH_PANGO_CAIRO
- NR::Point cursor(_last_tx, _last_ty);
+ Geom::Point cursor(_last_tx, _last_ty);
for (GSList *tmpList = line->runs; tmpList && tmpList->data; tmpList = tmpList->next) {
PangoLayoutRun *run = (PangoLayoutRun *)tmpList->data;
cursor += draw_glyphs(cr, cursor, run->item->analysis.font, run->glyphs, dirty_pattern, false) / PANGO_SCALE;
@@ -951,7 +951,7 @@ PrintCairoPDF::text(Inkscape::Extension::Print *mod, char const *text, NR::Point
// paint stroke
#ifndef RENDER_WITH_PANGO_CAIRO
- NR::Point cursor(_last_tx, _last_ty);
+ Geom::Point cursor(_last_tx, _last_ty);
for (GSList *tmpList = line->runs; tmpList && tmpList->data; tmpList = tmpList->next) {
PangoLayoutRun *run = (PangoLayoutRun *)tmpList->data;
cursor += draw_glyphs(cr, cursor, run->item->analysis.font, run->glyphs, dirty_pattern, true) / PANGO_SCALE;
index c309add15aaf1183c5a23ff125b782d7efba8c63..2b81fa30e8c236385b2977262a26f118ae611f62 100644 (file)
void print_stroke_style(cairo_t *cr, SPStyle const *style, NRRect const *pbox);
#ifndef RENDER_WITH_PANGO_CAIRO
- NR::Point draw_glyphs(cairo_t *cr, NR::Point p, PangoFont *font, PangoGlyphString *glyph_string,
+ Geom::Point draw_glyphs(cairo_t *cr, Geom::Point p, PangoFont *font, PangoGlyphString *glyph_string,
bool vertical, bool stroke);
#endif
virtual unsigned int finish(Inkscape::Extension::Print *module);
/* Rendering methods */
- virtual unsigned int bind(Inkscape::Extension::Print *module, NR::Matrix const *transform, float opacity);
+ virtual unsigned int bind(Inkscape::Extension::Print *module, Geom::Matrix const *transform, float opacity);
virtual unsigned int release(Inkscape::Extension::Print *module);
virtual unsigned int comment(Inkscape::Extension::Print *module, char const *comment);
- virtual unsigned int fill(Inkscape::Extension::Print *module, Geom::PathVector const &pathv, NR::Matrix const *ctm, SPStyle const *style,
+ virtual unsigned int fill(Inkscape::Extension::Print *module, Geom::PathVector const &pathv, Geom::Matrix const *ctm, SPStyle const *style,
NRRect const *pbox, NRRect const *dbox, NRRect const *bbox);
- virtual unsigned int stroke(Inkscape::Extension::Print *module, Geom::PathVector const &pathv, NR::Matrix const *transform, SPStyle const *style,
+ virtual unsigned int stroke(Inkscape::Extension::Print *module, Geom::PathVector const &pathv, Geom::Matrix const *transform, SPStyle const *style,
NRRect const *pbox, NRRect const *dbox, NRRect const *bbox);
virtual unsigned int image(Inkscape::Extension::Print *module, unsigned char *px, unsigned int w, unsigned int h, unsigned int rs,
- NR::Matrix const *transform, SPStyle const *style);
+ Geom::Matrix const *transform, SPStyle const *style);
virtual unsigned int text(Inkscape::Extension::Print *module, char const *text,
- NR::Point p, SPStyle const *style);
+ Geom::Point p, SPStyle const *style);
bool textToPath(Inkscape::Extension::Print *ext);
static void init(void);
diff --git a/src/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp
index 718dfbcb0cc959b01904ada4d8197a72b490509f..e28264eff9aa2166476c14103418e9ef47c7605d 100644 (file)
static void svgSetTransform(Inkscape::XML::Node *node, double c0, double c1,
double c2, double c3, double c4, double c5) {
- NR::Matrix matrix(c0, c1, c2, c3, c4, c5);
+ Geom::Matrix matrix(c0, c1, c2, c3, c4, c5);
gchar *transform_text = sp_svg_transform_write(matrix);
node->setAttribute("transform", transform_text);
g_free(transform_text);
* \return true on success; false on invalid transformation
*/
bool SvgBuilder::getTransform(double *transform) {
- NR::Matrix svd;
+ Geom::Matrix svd;
gchar const *tr = _container->attribute("transform");
bool valid = sp_svg_transform_read(tr, &svd);
if (valid) {
Inkscape::XML::Node *pattern_node = _xml_doc->createElement("svg:pattern");
// Set pattern transform matrix
double *p2u = tiling_pattern->getMatrix();
- NR::Matrix pat_matrix(p2u[0], p2u[1], p2u[2], p2u[3], p2u[4], p2u[5]);
+ Geom::Matrix pat_matrix(p2u[0], p2u[1], p2u[2], p2u[3], p2u[4], p2u[5]);
gchar *transform_text = sp_svg_transform_write(pat_matrix);
pattern_node->setAttribute("patternTransform", transform_text);
g_free(transform_text);
@@ -717,10 +717,10 @@ gchar *SvgBuilder::_createGradient(GfxShading *shading, double *matrix, bool for
gradient->setAttribute("gradientUnits", "userSpaceOnUse");
// If needed, flip the gradient transform around the y axis
if (matrix) {
- NR::Matrix pat_matrix(matrix[0], matrix[1], matrix[2], matrix[3],
+ Geom::Matrix pat_matrix(matrix[0], matrix[1], matrix[2], matrix[3],
matrix[4], matrix[5]);
if ( !for_shading && _is_top_level ) {
- NR::Matrix flip(1.0, 0.0, 0.0, -1.0, 0.0, _height * PT_PER_PX);
+ Geom::Matrix flip(1.0, 0.0, 0.0, -1.0, 0.0, _height * PT_PER_PX);
pat_matrix *= flip;
}
gchar *transform_text = sp_svg_transform_write(pat_matrix);
* \brief Updates current text position
*/
void SvgBuilder::updateTextPosition(double tx, double ty) {
- NR::Point new_position(tx, ty);
+ Geom::Point new_position(tx, ty);
_text_position = new_position;
}
max_scale = h_scale;
}
// Calculate new text matrix
- NR::Matrix new_text_matrix(text_matrix[0] * state->getHorizScaling(),
+ Geom::Matrix new_text_matrix(text_matrix[0] * state->getHorizScaling(),
text_matrix[1] * state->getHorizScaling(),
-text_matrix[2], -text_matrix[3],
0.0, 0.0);
Inkscape::XML::Node *text_node = _xml_doc->createElement("svg:text");
// Set text matrix
- NR::Matrix text_transform(_text_matrix);
+ Geom::Matrix text_transform(_text_matrix);
text_transform[4] = first_glyph.position[0];
text_transform[5] = first_glyph.position[1];
gchar *transform = sp_svg_transform_write(text_transform);
bool new_tspan = true;
bool same_coords[2] = {true, true};
- NR::Point last_delta_pos;
+ Geom::Point last_delta_pos;
unsigned int glyphs_in_a_row = 0;
Inkscape::XML::Node *tspan_node = NULL;
Glib::ustring x_coords;
}
}
// Append the coordinates to their respective strings
- NR::Point delta_pos( glyph.text_position - first_glyph.text_position );
+ Geom::Point delta_pos( glyph.text_position - first_glyph.text_position );
delta_pos[1] += glyph.rise;
delta_pos[1] *= -1.0; // flip it
delta_pos *= _font_scaling;
bool is_space = ( uLen == 1 && u[0] == 32 );
// Skip beginning space
if ( is_space && _glyphs.size() < 1 ) {
- NR::Point delta(dx, dy);
+ Geom::Point delta(dx, dy);
_text_position += delta;
return;
}
// Allow only one space in a row
if ( is_space && _glyphs[_glyphs.size() - 1].code_size == 1 &&
_glyphs[_glyphs.size() - 1].code[0] == 32 ) {
- NR::Point delta(dx, dy);
+ Geom::Point delta(dx, dy);
_text_position += delta;
return;
}
SvgGlyph new_glyph;
new_glyph.is_space = is_space;
- new_glyph.position = NR::Point( x - originX, y - originY );
+ new_glyph.position = Geom::Point( x - originX, y - originY );
new_glyph.text_position = _text_position;
new_glyph.dx = dx;
new_glyph.dy = dy;
- NR::Point delta(dx, dy);
+ Geom::Point delta(dx, dy);
_text_position += delta;
// Convert the character to UTF-8 since that's our SVG document's encoding
@@ -1631,7 +1631,7 @@ void SvgBuilder::addMaskedImage(GfxState *state, Stream *str, int width, int hei
mask_image_node->setAttribute("transform", NULL);
mask_node->appendChild(mask_image_node);
// Scale the mask to the size of the image
- NR::Matrix mask_transform((double)width, 0.0, 0.0, (double)height, 0.0, 0.0);
+ Geom::Matrix mask_transform((double)width, 0.0, 0.0, (double)height, 0.0, 0.0);
gchar *transform_text = sp_svg_transform_write(mask_transform);
mask_node->setAttribute("maskTransform", transform_text);
g_free(transform_text);
diff --git a/src/extension/internal/pdfinput/svg-builder.h b/src/extension/internal/pdfinput/svg-builder.h
index 4a57d5bb9aa3ec92bca1124ced42636b4a095c92..28f7e1be3200fb736403b821270d855a27458f99 100644 (file)
* to the document yet.
*/
struct SvgGlyph {
- NR::Point position; // Absolute glyph coords
- NR::Point text_position; // Absolute glyph coords in text space
+ Geom::Point position; // Absolute glyph coords
+ Geom::Point text_position; // Absolute glyph coords in text space
double dx, dy; // Advance values
double rise; // Text rise parameter
char code[8]; // UTF-8 coded character
char *_font_specification;
double _font_scaling;
bool _need_font_update;
- NR::Matrix _text_matrix;
- NR::Point _text_position;
+ Geom::Matrix _text_matrix;
+ Geom::Point _text_position;
std::vector<SvgGlyph> _glyphs; // Added characters
bool _in_text_object; // Whether we are inside a text object
bool _invalidated_style;
index 15b0bd8f40d95bc57e8a592c1fea40ec64df9d9f..97582bd1336fe8d96f7e1d91477626de903f75c2 100644 (file)
memset(px, 0xff, 4 * width * 64);
nr_arena_item_invoke_render(NULL, mod->root, &bbox, &pb, 0);
/* Blitter goes here */
- NR::Matrix imgt;
+ Geom::Matrix imgt;
imgt[0] = (bbox.x1 - bbox.x0) / dots_per_pt;
imgt[1] = 0.0;
imgt[2] = 0.0;
}
unsigned int
-PrintPS::bind(Inkscape::Extension::Print */*mod*/, NR::Matrix const *transform, float /*opacity*/)
+PrintPS::bind(Inkscape::Extension::Print */*mod*/, Geom::Matrix const *transform, float /*opacity*/)
{
if (!_stream) return 0; // XXX: fixme, returning -1 as unsigned.
if (_bitmap) return 0;
@@ -687,17 +687,17 @@ PrintPS::print_fill_style(SVGOStringStream &os, SPStyle const *const style, NRRe
if (SP_IS_LINEARGRADIENT(SP_STYLE_FILL_SERVER(style))) {
SPLinearGradient *lg = SP_LINEARGRADIENT(SP_STYLE_FILL_SERVER(style));
- NR::Point p1 (lg->x1.computed, lg->y1.computed);
- NR::Point p2 (lg->x2.computed, lg->y2.computed);
+ Geom::Point p1 (lg->x1.computed, lg->y1.computed);
+ Geom::Point p2 (lg->x2.computed, lg->y2.computed);
if (pbox && SP_GRADIENT(lg)->units == SP_GRADIENT_UNITS_OBJECTBOUNDINGBOX) {
// convert to userspace
- NR::Matrix bbox2user(pbox->x1 - pbox->x0, 0, 0, pbox->y1 - pbox->y0, pbox->x0, pbox->y0);
+ Geom::Matrix bbox2user(pbox->x1 - pbox->x0, 0, 0, pbox->y1 - pbox->y0, pbox->x0, pbox->y0);
p1 *= bbox2user;
p2 *= bbox2user;
}
os << "<<\n/ShadingType 2\n/ColorSpace /DeviceRGB\n";
- os << "/Coords [" << p1[NR::X] << " " << p1[NR::Y] << " " << p2[NR::X] << " " << p2[NR::Y] <<"]\n";
+ os << "/Coords [" << p1[Geom::X] << " " << p1[Geom::Y] << " " << p2[Geom::X] << " " << p2[Geom::Y] <<"]\n";
os << "/Extend [true true]\n";
os << "/Domain [0 1]\n";
os << "/Function <<\n/FunctionType 3\n/Functions\n[\n";
@@ -728,21 +728,21 @@ PrintPS::print_fill_style(SVGOStringStream &os, SPStyle const *const style, NRRe
} else if (SP_IS_RADIALGRADIENT(SP_STYLE_FILL_SERVER(style))) {
SPRadialGradient *rg = SP_RADIALGRADIENT(SP_STYLE_FILL_SERVER(style));
- NR::Point c(rg->cx.computed, rg->cy.computed);
- NR::Point f(rg->fx.computed, rg->fy.computed);
+ Geom::Point c(rg->cx.computed, rg->cy.computed);
+ Geom::Point f(rg->fx.computed, rg->fy.computed);
double r = rg->r.computed;
if (pbox && SP_GRADIENT(rg)->units == SP_GRADIENT_UNITS_OBJECTBOUNDINGBOX) {
// convert to userspace
- NR::Matrix const bbox2user(pbox->x1 - pbox->x0, 0,
+ Geom::Matrix const bbox2user(pbox->x1 - pbox->x0, 0,
0, pbox->y1 - pbox->y0,
pbox->x0, pbox->y0);
c *= bbox2user;
f *= bbox2user;
- r *= NR::expansion(bbox2user);
+ r *= bbox2user.descrim();
}
os << "<<\n/ShadingType 3\n/ColorSpace /DeviceRGB\n";
- os << "/Coords ["<< f[NR::X] <<" "<< f[NR::Y] <<" 0 "<< c[NR::X] <<" "<< c[NR::Y] <<" "<< r <<"]\n";
+ os << "/Coords ["<< f[Geom::X] <<" "<< f[Geom::Y] <<" 0 "<< c[Geom::X] <<" "<< c[Geom::Y] <<" "<< r <<"]\n";
os << "/Extend [true true]\n";
os << "/Domain [0 1]\n";
os << "/Function <<\n/FunctionType 3\n/Functions\n[\n";
unsigned int
-PrintPS::fill(Inkscape::Extension::Print *mod, Geom::PathVector const &pathv, NR::Matrix const *ctm, SPStyle const *const style,
+PrintPS::fill(Inkscape::Extension::Print *mod, Geom::PathVector const &pathv, Geom::Matrix const *ctm, SPStyle const *const style,
NRRect const *pbox, NRRect const *dbox, NRRect const *bbox)
{
if (!_stream) return 0; // XXX: fixme, returning -1 as unsigned.
@@ -883,7 +883,7 @@ PrintPS::fill(Inkscape::Extension::Print *mod, Geom::PathVector const &pathv, NR
unsigned int
-PrintPS::stroke(Inkscape::Extension::Print *mod, Geom::PathVector const &pathv, NR::Matrix const *ctm, SPStyle const *style,
+PrintPS::stroke(Inkscape::Extension::Print *mod, Geom::PathVector const &pathv, Geom::Matrix const *ctm, SPStyle const *style,
NRRect const *pbox, NRRect const *dbox, NRRect const *bbox)
{
if (!_stream) return 0; // XXX: fixme, returning -1 as unsigned.
unsigned int
PrintPS::image(Inkscape::Extension::Print *mod, guchar *px, unsigned int w, unsigned int h, unsigned int rs,
- NR::Matrix const *transform, SPStyle const *style)
+ Geom::Matrix const *transform, SPStyle const *style)
{
if (!_stream) return 0; // XXX: fixme, returning -1 as unsigned.
if (_bitmap) return 0;
@@ -1261,7 +1261,7 @@ void PrintPS::print_glyphlist(SVGOStringStream &os, font_instance* font, Glib::u
}
unsigned int
-PrintPS::text(Inkscape::Extension::Print *mod, char const *text, NR::Point p,
+PrintPS::text(Inkscape::Extension::Print *mod, char const *text, Geom::Point p,
SPStyle const *const style)
{
if (!_stream) return 0; // XXX: fixme, returning -1 as unsigned.
// (text is black) for some reason.
os << "newpath\n";
- os << p[NR::X] << " " << p[NR::Y] << " moveto\n";
+ os << p[Geom::X] << " " << p[Geom::Y] << " moveto\n";
os << "(";
if(font_embedded) print_glyphlist(os, tf, s);
else os << escaped_text.str();
// paint stroke
os << "newpath\n";
- os << p[NR::X] << " " << p[NR::Y] << " moveto\n";
+ os << p[Geom::X] << " " << p[Geom::Y] << " moveto\n";
os << "(";
if(font_embedded) print_glyphlist(os, tf, s);
else os << escaped_text.str();
unsigned int
PrintPS::print_image(FILE *ofp, guchar *px, unsigned int width, unsigned int height, unsigned int rs,
- NR::Matrix const *transform)
+ Geom::Matrix const *transform)
{
Inkscape::SVGOStringStream os;
index 179779e25d7b7e55487ac83b7192272f268ae6b3..b872aa425cf3c3783e225b641a70e35ed69fe868 100644 (file)
void print_glyphlist(SVGOStringStream &os, font_instance* font, Glib::ustring unistring);
unsigned int print_image(FILE *ofp, guchar *px, unsigned int width, unsigned int height, unsigned int rs,
- NR::Matrix const *transform);
+ Geom::Matrix const *transform);
void compress_packbits(int nin, guchar *src, int *nout, guchar *dst);
/* ASCII 85 variables */
virtual unsigned int finish(Inkscape::Extension::Print *module);
/* Rendering methods */
- virtual unsigned int bind(Inkscape::Extension::Print *module, NR::Matrix const *transform, float opacity);
+ virtual unsigned int bind(Inkscape::Extension::Print *module, Geom::Matrix const *transform, float opacity);
virtual unsigned int release(Inkscape::Extension::Print *module);
virtual unsigned int comment(Inkscape::Extension::Print *module, char const *comment);
- virtual unsigned int fill(Inkscape::Extension::Print *module, Geom::PathVector const &pathv, NR::Matrix const *ctm, SPStyle const *style,
+ virtual unsigned int fill(Inkscape::Extension::Print *module, Geom::PathVector const &pathv, Geom::Matrix const *ctm, SPStyle const *style,
NRRect const *pbox, NRRect const *dbox, NRRect const *bbox);
- virtual unsigned int stroke(Inkscape::Extension::Print *module, Geom::PathVector const &pathv, NR::Matrix const *transform, SPStyle const *style,
+ virtual unsigned int stroke(Inkscape::Extension::Print *module, Geom::PathVector const &pathv, Geom::Matrix const *transform, SPStyle const *style,
NRRect const *pbox, NRRect const *dbox, NRRect const *bbox);
virtual unsigned int image(Inkscape::Extension::Print *module, unsigned char *px, unsigned int w, unsigned int h, unsigned int rs,
- NR::Matrix const *transform, SPStyle const *style);
+ Geom::Matrix const *transform, SPStyle const *style);
virtual unsigned int text(Inkscape::Extension::Print *module, char const *text,
- NR::Point p, SPStyle const *style);
+ Geom::Point p, SPStyle const *style);
bool textToPath(Inkscape::Extension::Print *ext);
static void init(void);
index 1d242d80d8c87c573dcf32627bf37b475b23ae88..85f502f00e8d2eb1222df7c024949eb9c9b40584 100644 (file)
static void
my_gdk_event_handler (GdkEvent *event)
{
- if (SPWin32Modal) {
- /* Win32 widget is modal, filter events */
- switch (event->type) {
- case GDK_NOTHING:
- case GDK_DELETE:
- case GDK_SCROLL:
- case GDK_BUTTON_PRESS:
- case GDK_2BUTTON_PRESS:
- case GDK_3BUTTON_PRESS:
- case GDK_BUTTON_RELEASE:
- case GDK_KEY_PRESS:
- case GDK_KEY_RELEASE:
- case GDK_DRAG_STATUS:
- case GDK_DRAG_ENTER:
- case GDK_DRAG_LEAVE:
- case GDK_DRAG_MOTION:
- case GDK_DROP_START:
- case GDK_DROP_FINISHED:
- return;
- break;
- default:
- break;
- }
- }
- gtk_main_do_event (event);
+ if (SPWin32Modal) {
+ /* Win32 widget is modal, filter events */
+ switch (event->type) {
+ case GDK_NOTHING:
+ case GDK_DELETE:
+ case GDK_SCROLL:
+ case GDK_BUTTON_PRESS:
+ case GDK_2BUTTON_PRESS:
+ case GDK_3BUTTON_PRESS:
+ case GDK_BUTTON_RELEASE:
+ case GDK_KEY_PRESS:
+ case GDK_KEY_RELEASE:
+ case GDK_DRAG_STATUS:
+ case GDK_DRAG_ENTER:
+ case GDK_DRAG_LEAVE:
+ case GDK_DRAG_MOTION:
+ case GDK_DROP_START:
+ case GDK_DROP_FINISHED:
+ return;
+ break;
+ default:
+ break;
+ }
+ }
+ gtk_main_do_event (event);
}
void
PrintWin32::main_init (int argc, char **argv, const char *name)
{
- gdk_event_handler_set ((GdkEventFunc) my_gdk_event_handler, NULL, NULL);
+ gdk_event_handler_set ((GdkEventFunc) my_gdk_event_handler, NULL, NULL);
}
void
static VOID CALLBACK
my_timer (HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
{
- int cdown = 0;
- while ((cdown++ < SP_FOREIGN_MAX_ITER) && gdk_events_pending ()) {
- gtk_main_iteration_do (FALSE);
- }
- gtk_main_iteration_do (FALSE);
+ int cdown = 0;
+ while ((cdown++ < SP_FOREIGN_MAX_ITER) && gdk_events_pending ()) {
+ gtk_main_iteration_do (FALSE);
+ }
+ gtk_main_iteration_do (FALSE);
}
gboolean
PrintWin32::is_os_wide()
{
- static gboolean initialized = FALSE;
- static gboolean is_wide = FALSE;
- static OSVERSIONINFOA osver;
-
- if ( !initialized )
- {
- BOOL result;
-
- initialized = TRUE;
-
- memset (&osver, 0, sizeof(OSVERSIONINFOA));
- osver.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);
- result = GetVersionExA (&osver);
- if (result)
- {
- if (osver.dwPlatformId == VER_PLATFORM_WIN32_NT)
- is_wide = TRUE;
- }
- // If we can't even call to get the version, fall back to ANSI API
- }
-
- return is_wide;
+ static gboolean initialized = FALSE;
+ static gboolean is_wide = FALSE;
+ static OSVERSIONINFOA osver;
+
+ if ( !initialized )
+ {
+ BOOL result;
+
+ initialized = TRUE;
+
+ memset (&osver, 0, sizeof(OSVERSIONINFOA));
+ osver.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);
+ result = GetVersionExA (&osver);
+ if (result)
+ {
+ if (osver.dwPlatformId == VER_PLATFORM_WIN32_NT)
+ is_wide = TRUE;
+ }
+ // If we can't even call to get the version, fall back to ANSI API
+ }
+
+ return is_wide;
}
PrintWin32::PrintWin32 (void)
{
- /* Nothing here */
+ /* Nothing here */
}
PrintWin32::~PrintWin32 (void)
{
- DeleteDC (_hDC);
+ DeleteDC (_hDC);
}
print_hook (HWND hdlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
{
#if 0
- int cdown = 0;
- while ((cdown++ < SP_FOREIGN_MAX_ITER) && gdk_events_pending ()) {
- gtk_main_iteration_do (FALSE);
- }
- gtk_main_iteration_do (FALSE);
+ int cdown = 0;
+ while ((cdown++ < SP_FOREIGN_MAX_ITER) && gdk_events_pending ()) {
+ gtk_main_iteration_do (FALSE);
+ }
+ gtk_main_iteration_do (FALSE);
#endif
- return 0;
+ return 0;
}
unsigned int
PrintWin32::setup (Inkscape::Extension::Print *mod)
{
- HRESULT res;
- PRINTDLG pd = {
- sizeof (PRINTDLG),
- NULL, /* hwndOwner */
- NULL, /* hDevMode */
- NULL, /* hDevNames */
- NULL, /* hDC */
- PD_NOPAGENUMS | PD_NOSELECTION | PD_RETURNDC | PD_USEDEVMODECOPIESANDCOLLATE, /* Flags */
- 1, 1, 1, 1, /* nFromPage, nToPage, nMinPage, nMaxPage */
- 1, /* nCoies */
- NULL, /* hInstance */
- 0, /* lCustData */
- NULL, NULL, NULL, NULL, NULL, NULL
- };
- UINT_PTR timer;
-
- SPWin32Modal = TRUE;
- pd.Flags |= PD_ENABLEPRINTHOOK;
- pd.lpfnPrintHook = print_hook;
- timer = SetTimer (NULL, 0, 40, my_timer);
-
- res = PrintDlg (&pd);
-
- KillTimer (NULL, timer);
- SPWin32Modal = FALSE;
-
- if (!res) return FALSE;
-
- _hDC = pd.hDC;
+ HRESULT res;
+ PRINTDLG pd = {
+ sizeof (PRINTDLG),
+ NULL, /* hwndOwner */
+ NULL, /* hDevMode */
+ NULL, /* hDevNames */
+ NULL, /* hDC */
+ PD_NOPAGENUMS | PD_NOSELECTION | PD_RETURNDC | PD_USEDEVMODECOPIESANDCOLLATE, /* Flags */
+ 1, 1, 1, 1, /* nFromPage, nToPage, nMinPage, nMaxPage */
+ 1, /* nCoies */
+ NULL, /* hInstance */
+ 0, /* lCustData */
+ NULL, NULL, NULL, NULL, NULL, NULL
+ };
+ UINT_PTR timer;
+
+ SPWin32Modal = TRUE;
+ pd.Flags |= PD_ENABLEPRINTHOOK;
+ pd.lpfnPrintHook = print_hook;
+ timer = SetTimer (NULL, 0, 40, my_timer);
+
+ res = PrintDlg (&pd);
+
+ KillTimer (NULL, timer);
+ SPWin32Modal = FALSE;
+
+ if (!res) return FALSE;
+
+ _hDC = pd.hDC;
#if 0
- caps = GetDeviceCaps (_hDC, RASTERCAPS);
- if (caps & RC_BANDING) {
- printf ("needs banding\n");
- }
- if (caps & RC_BITBLT) {
- printf ("does bitblt\n");
- }
- if (caps & RC_DIBTODEV) {
- printf ("does dibtodev\n");
- }
- if (caps & RC_STRETCHDIB) {
- printf ("does stretchdib\n");
- }
+ caps = GetDeviceCaps (_hDC, RASTERCAPS);
+ if (caps & RC_BANDING) {
+ printf ("needs banding\n");
+ }
+ if (caps & RC_BITBLT) {
+ printf ("does bitblt\n");
+ }
+ if (caps & RC_DIBTODEV) {
+ printf ("does dibtodev\n");
+ }
+ if (caps & RC_STRETCHDIB) {
+ printf ("does stretchdib\n");
+ }
#endif
- if (pd.hDevMode) {
- DEVMODE *devmodep;
- devmodep = (DEVMODE *)pd.hDevMode;
- if (devmodep->dmFields & DM_ORIENTATION) {
- _landscape = (devmodep->dmOrientation == DMORIENT_LANDSCAPE);
- }
- }
-
- return TRUE;
+ if (pd.hDevMode) {
+ DEVMODE *devmodep;
+ devmodep = (DEVMODE *)pd.hDevMode;
+ if (devmodep->dmFields & DM_ORIENTATION) {
+ _landscape = (devmodep->dmOrientation == DMORIENT_LANDSCAPE);
+ }
+ }
+
+ return TRUE;
}
unsigned int
PrintWin32::begin (Inkscape::Extension::Print *mod, SPDocument *doc)
{
- DOCINFO di = {
- sizeof (DOCINFO),
- NULL, /* lpszDocName */
- NULL, /* lpszOutput */
- NULL, /* lpszDatatype */
- 0 /* DI_APPBANDING */ /* fwType */
- };
- int res;
+ DOCINFO di = {
+ sizeof (DOCINFO),
+ NULL, /* lpszDocName */
+ NULL, /* lpszOutput */
+ NULL, /* lpszDatatype */
+ 0 /* DI_APPBANDING */ /* fwType */
+ };
+ int res;
- _PageWidth = sp_document_width (doc);
- _PageHeight = sp_document_height (doc);
+ _PageWidth = sp_document_width (doc);
+ _PageHeight = sp_document_height (doc);
- di.lpszDocName = SP_DOCUMENT_NAME (doc);
+ di.lpszDocName = SP_DOCUMENT_NAME (doc);
- SPWin32Modal = TRUE;
+ SPWin32Modal = TRUE;
- res = StartDoc (_hDC, &di);
- res = StartPage (_hDC);
+ res = StartDoc (_hDC, &di);
+ res = StartPage (_hDC);
- SPWin32Modal = FALSE;
+ SPWin32Modal = FALSE;
- return 0;
+ return 0;
}
unsigned int
PrintWin32::finish (Inkscape::Extension::Print *mod)
{
- int dpiX, dpiY;
- int pPhysicalWidth, pPhysicalHeight;
- int pPhysicalOffsetX, pPhysicalOffsetY;
- int pPrintableWidth, pPrintableHeight;
- float scalex, scaley;
- int x0, y0, x1, y1;
- int width, height;
- NR::Matrix affine;
- unsigned char *px;
- int sheight, row;
- BITMAPINFO bmInfo = {
- {
- sizeof (BITMAPINFOHEADER), // bV4Size
- 64, // biWidth
- 64, // biHeight
- 1, // biPlanes
- 32, // biBitCount
- BI_RGB, // biCompression
- 0, // biSizeImage
- 2835, // biXPelsPerMeter
- 2835, // biYPelsPerMeter
- 0, // biClrUsed
- 0 // biClrImportant
- },
- { { 0, 0, 0, 0 } } // bmiColors
- };
- //RECT wrect;
- int res;
-
- SPWin32Modal = TRUE;
-
- // Number of pixels per logical inch
- dpiX = (int) GetDeviceCaps (_hDC, LOGPIXELSX);
- dpiY = (int) GetDeviceCaps (_hDC, LOGPIXELSY);
- // Size in pixels of the printable area
- pPhysicalWidth = GetDeviceCaps (_hDC, PHYSICALWIDTH);
- pPhysicalHeight = GetDeviceCaps (_hDC, PHYSICALHEIGHT);
- // Top left corner of prontable area
- pPhysicalOffsetX = GetDeviceCaps (_hDC, PHYSICALOFFSETX);
- pPhysicalOffsetY = GetDeviceCaps (_hDC, PHYSICALOFFSETY);
- // Size in pixels of the printable area
- pPrintableWidth = GetDeviceCaps (_hDC, HORZRES);
- pPrintableHeight = GetDeviceCaps (_hDC, VERTRES);
-
- // Scaling from document to device
- scalex = dpiX / 72.0;
- scaley = dpiY / 72.0;
-
- // We simply map document 0,0 to physical page 0,0
- affine[0] = scalex / 1.25;
- affine[1] = 0.0;
- affine[2] = 0.0;
- affine[3] = scaley / 1.25;
- affine[4] = 0.0;
- affine[5] = 0.0;
-
- nr_arena_item_set_transform (mod->root, &affine);
-
- // Calculate printable area in device coordinates
- x0 = pPhysicalOffsetX;
- y0 = pPhysicalOffsetY;
- x1 = x0 + pPrintableWidth;
- y1 = y0 + pPrintableHeight;
- x1 = MIN (x1, (int) (_PageWidth * scalex));
- y1 = MIN (y1, (int) (_PageHeight * scaley));
-
- width = x1 - x0;
- height = y1 - y0;
-
- px = g_new (unsigned char, 4 * 64 * width);
- sheight = 64;
-
- /* Printing goes here */
- for (row = 0; row < height; row += 64) {
- NRPixBlock pb;
- NRRectL bbox;
- NRGC gc(NULL);
- int num_rows;
- int i;
-
- num_rows = sheight;
- if ((row + num_rows) > height) num_rows = height - row;
-
- /* Set area of interest */
- bbox.x0 = x0;
- bbox.y0 = y0 + row;
- bbox.x1 = bbox.x0 + width;
- bbox.y1 = bbox.y0 + num_rows;
- /* Update to renderable state */
- gc.transform.set_identity();
- nr_arena_item_invoke_update (mod->root, &bbox, &gc, NR_ARENA_ITEM_STATE_ALL, NR_ARENA_ITEM_STATE_NONE);
-
- nr_pixblock_setup_extern (&pb, NR_PIXBLOCK_MODE_R8G8B8A8N, bbox.x0, bbox.y0, bbox.x1, bbox.y1, px, 4 * (bbox.x1 - bbox.x0), FALSE, FALSE);
-
- /* Blitter goes here */
- bmInfo.bmiHeader.biWidth = bbox.x1 - bbox.x0;
- bmInfo.bmiHeader.biHeight = -(bbox.y1 - bbox.y0);
-
- memset (px, 0xff, 4 * num_rows * width);
- /* Render */
- nr_arena_item_invoke_render (NULL, mod->root, &bbox, &pb, 0);
-
- /* Swap red and blue channels; we use RGBA, whereas
- * the Win32 GDI uses BGRx.
- */
- for ( i = 0 ; i < num_rows * width ; i++ ) {
- unsigned char temp=px[i*4];
- px[i*4] = px[i*4+2];
- px[i*4+2] = temp;
- }
-
- SetStretchBltMode(_hDC, COLORONCOLOR);
- res = StretchDIBits (_hDC,
- bbox.x0 - x0, bbox.y0 - y0, bbox.x1 - bbox.x0, bbox.y1 - bbox.y0,
- 0, 0, bbox.x1 - bbox.x0, bbox.y1 - bbox.y0,
- px,
- &bmInfo,
+ int dpiX, dpiY;
+ int pPhysicalWidth, pPhysicalHeight;
+ int pPhysicalOffsetX, pPhysicalOffsetY;
+ int pPrintableWidth, pPrintableHeight;
+ float scalex, scaley;
+ int x0, y0, x1, y1;
+ int width, height;
+ NR::Matrix affine;
+ unsigned char *px;
+ int sheight, row;
+ BITMAPINFO bmInfo = {
+ {
+ sizeof (BITMAPINFOHEADER), // bV4Size
+ 64, // biWidth
+ 64, // biHeight
+ 1, // biPlanes
+ 32, // biBitCount
+ BI_RGB, // biCompression
+ 0, // biSizeImage
+ 2835, // biXPelsPerMeter
+ 2835, // biYPelsPerMeter
+ 0, // biClrUsed
+ 0 // biClrImportant
+ },
+ { { 0, 0, 0, 0 } } // bmiColors
+ };
+ //RECT wrect;
+ int res;
+
+ SPWin32Modal = TRUE;
+
+ // Number of pixels per logical inch
+ dpiX = (int) GetDeviceCaps (_hDC, LOGPIXELSX);
+ dpiY = (int) GetDeviceCaps (_hDC, LOGPIXELSY);
+ // Size in pixels of the printable area
+ pPhysicalWidth = GetDeviceCaps (_hDC, PHYSICALWIDTH);
+ pPhysicalHeight = GetDeviceCaps (_hDC, PHYSICALHEIGHT);
+ // Top left corner of prontable area
+ pPhysicalOffsetX = GetDeviceCaps (_hDC, PHYSICALOFFSETX);
+ pPhysicalOffsetY = GetDeviceCaps (_hDC, PHYSICALOFFSETY);
+ // Size in pixels of the printable area
+ pPrintableWidth = GetDeviceCaps (_hDC, HORZRES);
+ pPrintableHeight = GetDeviceCaps (_hDC, VERTRES);
+
+ // Scaling from document to device
+ scalex = dpiX / 72.0;
+ scaley = dpiY / 72.0;
+
+ // We simply map document 0,0 to physical page 0,0
+ affine[0] = scalex / 1.25;
+ affine[1] = 0.0;
+ affine[2] = 0.0;
+ affine[3] = scaley / 1.25;
+ affine[4] = 0.0;
+ affine[5] = 0.0;
+
+ nr_arena_item_set_transform (mod->root, &affine);
+
+ // Calculate printable area in device coordinates
+ x0 = pPhysicalOffsetX;
+ y0 = pPhysicalOffsetY;
+ x1 = x0 + pPrintableWidth;
+ y1 = y0 + pPrintableHeight;
+ x1 = MIN (x1, (int) (_PageWidth * scalex));
+ y1 = MIN (y1, (int) (_PageHeight * scaley));
+
+ width = x1 - x0;
+ height = y1 - y0;
+
+ px = g_new (unsigned char, 4 * 64 * width);
+ sheight = 64;
+
+ /* Printing goes here */
+ for (row = 0; row < height; row += 64) {
+ NRPixBlock pb;
+ NRRectL bbox;
+ NRGC gc(NULL);
+ int num_rows;
+ int i;
+
+ num_rows = sheight;
+ if ((row + num_rows) > height) num_rows = height - row;
+
+ /* Set area of interest */
+ bbox.x0 = x0;
+ bbox.y0 = y0 + row;
+ bbox.x1 = bbox.x0 + width;
+ bbox.y1 = bbox.y0 + num_rows;
+ /* Update to renderable state */
+ gc.transform.set_identity();
+ nr_arena_item_invoke_update (mod->root, &bbox, &gc, NR_ARENA_ITEM_STATE_ALL, NR_ARENA_ITEM_STATE_NONE);
+
+ nr_pixblock_setup_extern (&pb, NR_PIXBLOCK_MODE_R8G8B8A8N, bbox.x0, bbox.y0, bbox.x1, bbox.y1, px, 4 * (bbox.x1 - bbox.x0), FALSE, FALSE);
+
+ /* Blitter goes here */
+ bmInfo.bmiHeader.biWidth = bbox.x1 - bbox.x0;
+ bmInfo.bmiHeader.biHeight = -(bbox.y1 - bbox.y0);
+
+ memset (px, 0xff, 4 * num_rows * width);
+ /* Render */
+ nr_arena_item_invoke_render (NULL, mod->root, &bbox, &pb, 0);
+
+ /* Swap red and blue channels; we use RGBA, whereas
+ * the Win32 GDI uses BGRx.
+ */
+ for ( i = 0 ; i < num_rows * width ; i++ ) {
+ unsigned char temp=px[i*4];
+ px[i*4] = px[i*4+2];
+ px[i*4+2] = temp;
+ }
+
+ SetStretchBltMode(_hDC, COLORONCOLOR);
+ res = StretchDIBits (_hDC,
+ bbox.x0 - x0, bbox.y0 - y0, bbox.x1 - bbox.x0, bbox.y1 - bbox.y0,
+ 0, 0, bbox.x1 - bbox.x0, bbox.y1 - bbox.y0,
+ px,
+ &bmInfo,
DIB_RGB_COLORS,
SRCCOPY);
- /* Blitter ends here */
+ /* Blitter ends here */
- nr_pixblock_release (&pb);
- }
+ nr_pixblock_release (&pb);
+ }
- g_free (px);
+ g_free (px);
- res = EndPage (_hDC);
- res = EndDoc (_hDC);
+ res = EndPage (_hDC);
+ res = EndDoc (_hDC);
- SPWin32Modal = FALSE;
+ SPWin32Modal = FALSE;
- return 0;
+ return 0;
}
/* File dialogs */
char *
PrintWin32::get_open_filename (unsigned char *dir, unsigned char *filter, unsigned char *title)
{
- char fnbuf[4096] = {0};
- OPENFILENAME ofn = {
- sizeof (OPENFILENAME),
- NULL, /* hwndOwner */
- NULL, /* hInstance */
- (const CHAR *)filter, /* lpstrFilter */
- NULL, /* lpstrCustomFilter */
- 0, /* nMaxCustFilter */
- 1, /* nFilterIndex */
- fnbuf, /* lpstrFile */
- sizeof (fnbuf), /* nMaxFile */
- NULL, /* lpstrFileTitle */
- 0, /* nMaxFileTitle */
- (const CHAR *)dir, /* lpstrInitialDir */
- (const CHAR *)title, /* lpstrTitle */
- OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY, /* Flags */
- 0, /* nFileOffset */
- 0, /* nFileExtension */
- NULL, /* lpstrDefExt */
- 0, /* lCustData */
- NULL, /* lpfnHook */
- NULL /* lpTemplateName */
- };
- int retval;
- UINT_PTR timer;
-
- SPWin32Modal = TRUE;
- timer = SetTimer (NULL, 0, 40, my_timer);
-
- retval = GetOpenFileName (&ofn);
-
- KillTimer (NULL, timer);
- SPWin32Modal = FALSE;
-
- if (!retval) {
- int errcode;
- errcode = CommDlgExtendedError();
- return NULL;
+ char fnbuf[4096] = {0};
+ OPENFILENAME ofn = {
+ sizeof (OPENFILENAME),
+ NULL, /* hwndOwner */
+ NULL, /* hInstance */
+ (const CHAR *)filter, /* lpstrFilter */
+ NULL, /* lpstrCustomFilter */
+ 0, /* nMaxCustFilter */
+ 1, /* nFilterIndex */
+ fnbuf, /* lpstrFile */
+ sizeof (fnbuf), /* nMaxFile */
+ NULL, /* lpstrFileTitle */
+ 0, /* nMaxFileTitle */
+ (const CHAR *)dir, /* lpstrInitialDir */
+ (const CHAR *)title, /* lpstrTitle */
+ OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY, /* Flags */
+ 0, /* nFileOffset */
+ 0, /* nFileExtension */
+ NULL, /* lpstrDefExt */
+ 0, /* lCustData */
+ NULL, /* lpfnHook */
+ NULL /* lpTemplateName */
+ };
+ int retval;
+ UINT_PTR timer;
+
+ SPWin32Modal = TRUE;
+ timer = SetTimer (NULL, 0, 40, my_timer);
+
+ retval = GetOpenFileName (&ofn);
+
+ KillTimer (NULL, timer);
+ SPWin32Modal = FALSE;
+
+ if (!retval) {
+ int errcode;
+ errcode = CommDlgExtendedError();
+ return NULL;
}
- return g_strdup (fnbuf);
+ return g_strdup (fnbuf);
}
char *
PrintWin32::get_write_filename (unsigned char *dir, unsigned char *filter, unsigned char *title)
{
- return NULL;
+ return NULL;
}
char *
PrintWin32::get_save_filename (unsigned char *dir, unsigned int *spns)
{
- char fnbuf[4096] = {0};
- OPENFILENAME ofn = {
- sizeof (OPENFILENAME),
- NULL, /* hwndOwner */
- NULL, /* hInstance */
- "Inkscape SVG (*.svg)\0*\0Plain SVG (*.svg)\0*\0", /* lpstrFilter */
- NULL, /* lpstrCustomFilter */
- 0, /* nMaxCustFilter */
- 1, /* nFilterIndex */
- fnbuf, /* lpstrFile */
- sizeof (fnbuf), /* nMaxFile */
- NULL, /* lpstrFileTitle */
- 0, /* nMaxFileTitle */
- (const CHAR *)dir, /* lpstrInitialDir */
- "Save document to file", /* lpstrTitle */
- OFN_HIDEREADONLY, /* Flags */
- 0, /* nFileOffset */
- 0, /* nFileExtension */
- NULL, /* lpstrDefExt */
- 0, /* lCustData */
- NULL, /* lpfnHook */
- NULL /* lpTemplateName */
- };
- int retval;
- UINT_PTR timer;
-
- SPWin32Modal = TRUE;
- timer = SetTimer (NULL, 0, 40, my_timer);
-
- retval = GetSaveFileName (&ofn);
-
- KillTimer (NULL, timer);
- SPWin32Modal = FALSE;
-
- if (!retval) {
- int errcode;
- errcode = CommDlgExtendedError();
- return NULL;
+ char fnbuf[4096] = {0};
+ OPENFILENAME ofn = {
+ sizeof (OPENFILENAME),
+ NULL, /* hwndOwner */
+ NULL, /* hInstance */
+ "Inkscape SVG (*.svg)\0*\0Plain SVG (*.svg)\0*\0", /* lpstrFilter */
+ NULL, /* lpstrCustomFilter */
+ 0, /* nMaxCustFilter */
+ 1, /* nFilterIndex */
+ fnbuf, /* lpstrFile */
+ sizeof (fnbuf), /* nMaxFile */
+ NULL, /* lpstrFileTitle */
+ 0, /* nMaxFileTitle */
+ (const CHAR *)dir, /* lpstrInitialDir */
+ "Save document to file", /* lpstrTitle */
+ OFN_HIDEREADONLY, /* Flags */
+ 0, /* nFileOffset */
+ 0, /* nFileExtension */
+ NULL, /* lpstrDefExt */
+ 0, /* lCustData */
+ NULL, /* lpfnHook */
+ NULL /* lpTemplateName */
+ };
+ int retval;
+ UINT_PTR timer;
+
+ SPWin32Modal = TRUE;
+ timer = SetTimer (NULL, 0, 40, my_timer);
+
+ retval = GetSaveFileName (&ofn);
+
+ KillTimer (NULL, timer);
+ SPWin32Modal = FALSE;
+
+ if (!retval) {
+ int errcode;
+ errcode = CommDlgExtendedError();
+ return NULL;
}
- *spns = (ofn.nFilterIndex != 2);
- return g_strdup (fnbuf);
+ *spns = (ofn.nFilterIndex != 2);
+ return g_strdup (fnbuf);
}
#include "clear-n_.h"
void
PrintWin32::init (void)
{
- Inkscape::Extension::Extension * ext;
+ Inkscape::Extension::Extension * ext;
- /* SVG in */
+ /* SVG in */
ext = Inkscape::Extension::build_from_mem(
- "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n"
- "<name>" N_("Windows 32-bit Print") "</name>\n"
- "<id>" SP_MODULE_KEY_PRINT_WIN32 "</id>\n"
- "<param name=\"textToPath\" type=\"boolean\">true</param>\n"
- "<print/>\n"
- "</inkscape-extension>", new PrintWin32());
-
- return;
+ "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n"
+ "<name>" N_("Windows 32-bit Print") "</name>\n"
+ "<id>" SP_MODULE_KEY_PRINT_WIN32 "</id>\n"
+ "<param name=\"textToPath\" type=\"boolean\">true</param>\n"
+ "<print/>\n"
+ "</inkscape-extension>", new PrintWin32());
+
+ return;
}
} /* namespace Internal */
index 8fd16edf24b582fd31520e62e4772e5dc1fbbdb0..f32e354ee2b06b71f7588bbe222ddfdbadfca7c4 100644 (file)
/* Rendering methods */
/*
- virtual unsigned int bind (Inkscape::Extension::Print * module, const NR::Matrix *transform, float opacity);
+ virtual unsigned int bind (Inkscape::Extension::Print * module, const Geom::Matrix *transform, float opacity);
virtual unsigned int release (Inkscape::Extension::Print * module);
virtual unsigned int comment (Inkscape::Extension::Print * module, const char * comment);
- virtual unsigned int fill (Inkscape::Extension::Print * module, const const_NRBPath *bpath, const NR::Matrix *ctm, const SPStyle *style,
+ virtual unsigned int fill (Inkscape::Extension::Print * module, const const_NRBPath *bpath, const Geom::Matrix *ctm, const SPStyle *style,
const NRRect *pbox, const NRRect *dbox, const NRRect *bbox);
- virtual unsigned int stroke (Inkscape::Extension::Print * module, const const_NRBPath *bpath, const NR::Matrix *transform, const SPStyle *style,
+ virtual unsigned int stroke (Inkscape::Extension::Print * module, const const_NRBPath *bpath, const Geom::Matrix *transform, const SPStyle *style,
const NRRect *pbox, const NRRect *dbox, const NRRect *bbox);
virtual unsigned int image (Inkscape::Extension::Print * module, unsigned char *px, unsigned int w, unsigned int h, unsigned int rs,
- const NR::Matrix *transform, const SPStyle *style);
+ const Geom::Matrix *transform, const SPStyle *style);
*/
};
index 035865825f3cf93eca5c80c63be49904840716df..2d4177d606376c77bb1e9d1806804c62e5693f8c 100644 (file)
--- a/src/extension/print.cpp
+++ b/src/extension/print.cpp
}
unsigned int
-Print::bind (const NR::Matrix *transform, float opacity)
+Print::bind (const Geom::Matrix *transform, float opacity)
{
return imp->bind (this, transform, opacity);
}
}
unsigned int
-Print::fill (Geom::PathVector const &pathv, const NR::Matrix *ctm, const SPStyle *style,
+Print::fill (Geom::PathVector const &pathv, const Geom::Matrix *ctm, const SPStyle *style,
const NRRect *pbox, const NRRect *dbox, const NRRect *bbox)
{
return imp->fill (this, pathv, ctm, style, pbox, dbox, bbox);
}
unsigned int
-Print::stroke (Geom::PathVector const &pathv, const NR::Matrix *transform, const SPStyle *style,
+Print::stroke (Geom::PathVector const &pathv, const Geom::Matrix *transform, const SPStyle *style,
const NRRect *pbox, const NRRect *dbox, const NRRect *bbox)
{
return imp->stroke (this, pathv, transform, style, pbox, dbox, bbox);
@@ -94,13 +94,13 @@ Print::stroke (Geom::PathVector const &pathv, const NR::Matrix *transform, const
unsigned int
Print::image (unsigned char *px, unsigned int w, unsigned int h, unsigned int rs,
- const NR::Matrix *transform, const SPStyle *style)
+ const Geom::Matrix *transform, const SPStyle *style)
{
return imp->image (this, px, w, h, rs, transform, style);
}
unsigned int
-Print::text (const char* text, NR::Point p, const SPStyle* style)
+Print::text (const char* text, Geom::Point p, const SPStyle* style)
{
return imp->text (this, text, p, style);
}
diff --git a/src/extension/print.h b/src/extension/print.h
index c5f49dd9dbe3e5b6c2b8f47ab13007124627e5fa..de9c8c59830738be47f7f99918717827ff498614 100644 (file)
--- a/src/extension/print.h
+++ b/src/extension/print.h
unsigned int finish (void);
/* Rendering methods */
- unsigned int bind (NR::Matrix const *transform,
+ unsigned int bind (Geom::Matrix const *transform,
float opacity);
unsigned int release (void);
unsigned int comment (const char * comment);
unsigned int fill (Geom::PathVector const &pathv,
- NR::Matrix const *ctm,
+ Geom::Matrix const *ctm,
SPStyle const *style,
NRRect const *pbox,
NRRect const *dbox,
NRRect const *bbox);
unsigned int stroke (Geom::PathVector const &pathv,
- NR::Matrix const *transform,
+ Geom::Matrix const *transform,
SPStyle const *style,
NRRect const *pbox,
NRRect const *dbox,
unsigned int w,
unsigned int h,
unsigned int rs,
- NR::Matrix const *transform,
+ Geom::Matrix const *transform,
SPStyle const *style);
unsigned int text (char const *text,
- NR::Point p,
+ Geom::Point p,
SPStyle const *style);
bool textToPath (void);
bool fontEmbedded (void);
index b2de090a0a1507b1672976e3623686534c06be7e..aa387504825a95973d9a28f67cec243406dc2dbe 100644 (file)
{
if (_input_stream.empty()) return;
+ Geom::Matrix ctm_2geom(ctm);
Direction block_progression = _blockProgression();
bool text_to_path = ctx->module->textToPath();
for (unsigned glyph_index = 0 ; glyph_index < _glyphs.size() ; ) {
_getGlyphTransformMatrix(glyph_index, &glyph_matrix);
Geom::PathVector temp_pv = (*pv) * glyph_matrix;
if (!text_source->style->fill.isNone())
- sp_print_fill(ctx, temp_pv, &ctm, text_source->style, pbox, dbox, bbox);
+ sp_print_fill(ctx, temp_pv, &ctm_2geom, text_source->style, pbox, dbox, bbox);
if (!text_source->style->stroke.isNone())
- sp_print_stroke(ctx, temp_pv, &ctm, text_source->style, pbox, dbox, bbox);
+ sp_print_stroke(ctx, temp_pv, &ctm_2geom, text_source->style, pbox, dbox, bbox);
}
glyph_index++;
} else {
if (_path_fitted) {
ctx->pushState();
- ctx->transform(&glyph_matrix);
+ ctx->transform(&to_2geom(glyph_matrix));
} else if (opacity != 1.0) {
ctx->pushState();
ctx->setStateForStyle(style);
ctx->pushLayer();
}
if (glyph_index - first_index > 0)
- ctx->renderGlyphtext(span.font->pFont, &font_matrix, glyphtext, style);
+ ctx->renderGlyphtext(span.font->pFont, &to_2geom(font_matrix), glyphtext, style);
if (_path_fitted)
ctx->popState();
else if (opacity != 1.0) {
diff --git a/src/print.cpp b/src/print.cpp
index 6d4572031957a73074abdf795341b63e8b263a91..7b032fe4e41801102b0a9dc776abca6f7ea34a3d 100644 (file)
--- a/src/print.cpp
+++ b/src/print.cpp
/* Identity typedef */
-unsigned int sp_print_bind(SPPrintContext *ctx, NR::Matrix const &transform, float opacity)
+unsigned int sp_print_bind(SPPrintContext *ctx, Geom::Matrix const &transform, float opacity)
{
- NR::Matrix const ntransform(transform);
+ Geom::Matrix const ntransform(transform);
return sp_print_bind(ctx, &ntransform, opacity);
}
unsigned int
-sp_print_bind(SPPrintContext *ctx, NR::Matrix const *transform, float opacity)
+sp_print_bind(SPPrintContext *ctx, Geom::Matrix const *transform, float opacity)
{
return ctx->module->bind(transform, opacity);
}
}
unsigned int
-sp_print_fill(SPPrintContext *ctx, Geom::PathVector const &pathv, NR::Matrix const *ctm, SPStyle const *style,
+sp_print_fill(SPPrintContext *ctx, Geom::PathVector const &pathv, Geom::Matrix const *ctm, SPStyle const *style,
NRRect const *pbox, NRRect const *dbox, NRRect const *bbox)
{
return ctx->module->fill(pathv, ctm, style, pbox, dbox, bbox);
}
unsigned int
-sp_print_stroke(SPPrintContext *ctx, Geom::PathVector const &pathv, NR::Matrix const *ctm, SPStyle const *style,
+sp_print_stroke(SPPrintContext *ctx, Geom::PathVector const &pathv, Geom::Matrix const *ctm, SPStyle const *style,
NRRect const *pbox, NRRect const *dbox, NRRect const *bbox)
{
return ctx->module->stroke(pathv, ctm, style, pbox, dbox, bbox);
@@ -68,12 +68,12 @@ sp_print_stroke(SPPrintContext *ctx, Geom::PathVector const &pathv, NR::Matrix c
unsigned int
sp_print_image_R8G8B8A8_N(SPPrintContext *ctx,
guchar *px, unsigned int w, unsigned int h, unsigned int rs,
- NR::Matrix const *transform, SPStyle const *style)
+ Geom::Matrix const *transform, SPStyle const *style)
{
return ctx->module->image(px, w, h, rs, transform, style);
}
-unsigned int sp_print_text(SPPrintContext *ctx, char const *text, NR::Point p,
+unsigned int sp_print_text(SPPrintContext *ctx, char const *text, Geom::Point p,
SPStyle const *style)
{
return ctx->module->text(text, p, style);
diff --git a/src/print.h b/src/print.h
index ed56c966376dbf45cf38ffc9359c9ba2be1091d7..577a169cf819ebdbebce3f13226559ab30399fe3 100644 (file)
--- a/src/print.h
+++ b/src/print.h
*/
#include <gtkmm.h>
-#include <libnr/nr-path.h>
+//#include <libnr/nr-path.h>
#include <2geom/forward.h>
#include "forward.h"
#include "extension/extension-forward.h"
Inkscape::Extension::Print *module;
};
-unsigned int sp_print_bind(SPPrintContext *ctx, NR::Matrix const &transform, float opacity);
-unsigned int sp_print_bind(SPPrintContext *ctx, NR::Matrix const *transform, float opacity);
+unsigned int sp_print_bind(SPPrintContext *ctx, Geom::Matrix const &transform, float opacity);
+unsigned int sp_print_bind(SPPrintContext *ctx, Geom::Matrix const *transform, float opacity);
unsigned int sp_print_release(SPPrintContext *ctx);
unsigned int sp_print_comment(SPPrintContext *ctx, char const *comment);
-unsigned int sp_print_fill(SPPrintContext *ctx, Geom::PathVector const &pathv, NR::Matrix const *ctm, SPStyle const *style,
+unsigned int sp_print_fill(SPPrintContext *ctx, Geom::PathVector const &pathv, Geom::Matrix const *ctm, SPStyle const *style,
NRRect const *pbox, NRRect const *dbox, NRRect const *bbox);
-unsigned int sp_print_stroke(SPPrintContext *ctx, Geom::PathVector const &pathv, NR::Matrix const *transform, SPStyle const *style,
+unsigned int sp_print_stroke(SPPrintContext *ctx, Geom::PathVector const &pathv, Geom::Matrix const *transform, SPStyle const *style,
NRRect const *pbox, NRRect const *dbox, NRRect const *bbox);
unsigned int sp_print_image_R8G8B8A8_N(SPPrintContext *ctx,
guchar *px, unsigned int w, unsigned int h, unsigned int rs,
- NR::Matrix const *transform, SPStyle const *style);
+ Geom::Matrix const *transform, SPStyle const *style);
-unsigned int sp_print_text(SPPrintContext *ctx, char const *text, NR::Point p,
+unsigned int sp_print_text(SPPrintContext *ctx, char const *text, Geom::Point p,
SPStyle const *style);
void sp_print_get_param(SPPrintContext *ctx, gchar *name, bool *value);
diff --git a/src/sp-image.cpp b/src/sp-image.cpp
index 5a02517e260267d27800ca44e2de314c7fbde740..f49812ac78c21870fc945e33dd509815ed8a36dc 100644 (file)
--- a/src/sp-image.cpp
+++ b/src/sp-image.cpp
rs = gdk_pixbuf_get_rowstride (image->pixbuf);
pixskip = gdk_pixbuf_get_n_channels (image->pixbuf) * gdk_pixbuf_get_bits_per_sample (image->pixbuf) / 8;
- NR::Matrix t;
+ Geom::Matrix t;
if (image->aspect_align == SP_ASPECT_NONE) {
/* fixme: (Lauris) */
- NR::translate tp = NR::translate(image->x.computed, image->y.computed);
- NR::scale s = NR::scale(image->width.computed, -image->height.computed);
- NR::translate ti = NR::translate(0.0, -1.0);
+ Geom::Translate tp (image->x.computed, image->y.computed);
+ Geom::Scale s (image->width.computed, -image->height.computed);
+ Geom::Translate ti (0.0, -1.0);
t = s * tp;
t = ti * t;
} else { // preserveAspectRatio
- NR::translate tp = NR::translate(image->viewx, image->viewy);
- NR::scale s = NR::scale(image->viewwidth, -image->viewheight);
- NR::translate ti = NR::translate(0.0, -1.0);
+ Geom::Translate tp (image->viewx, image->viewy);
+ Geom::Scale s (image->viewwidth, -image->viewheight);
+ Geom::Translate ti (0.0, -1.0);
t = s * tp;
t = ti * t;
}
diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp
index 7c1cd20eae45dfda33a7206a22367c69257d4f71..92c1e51288d00141959d7bd05d0868e62ee23ab1 100644 (file)
--- a/src/sp-shape.cpp
+++ b/src/sp-shape.cpp
g_free(comment);
}
- /* fixme: Think (Lauris) */
- sp_item_invoke_bbox(item, &pbox, NR::identity(), TRUE);
- dbox.x0 = 0.0;
- dbox.y0 = 0.0;
- dbox.x1 = sp_document_width (SP_OBJECT_DOCUMENT (item));
- dbox.y1 = sp_document_height (SP_OBJECT_DOCUMENT (item));
- sp_item_bbox_desktop (item, &bbox);
- NR::Matrix const i2d(sp_item_i2d_affine(item));
+ /* fixme: Think (Lauris) */
+ sp_item_invoke_bbox(item, &pbox, NR::identity(), TRUE);
+ dbox.x0 = 0.0;
+ dbox.y0 = 0.0;
+ dbox.x1 = sp_document_width (SP_OBJECT_DOCUMENT (item));
+ dbox.y1 = sp_document_height (SP_OBJECT_DOCUMENT (item));
+ sp_item_bbox_desktop (item, &bbox);
+ Geom::Matrix const i2d(sp_item_i2d_affine(item));
SPStyle* style = SP_OBJECT_STYLE (item);
diff --git a/src/sp-symbol.cpp b/src/sp-symbol.cpp
index 7420f660eddc0c2694e297f70f47d1353cd2ef4d..064c43442f4929bd2206541f71eac6704b4ae751 100644 (file)
--- a/src/sp-symbol.cpp
+++ b/src/sp-symbol.cpp
GType
sp_symbol_get_type (void)
{
- static GType type = 0;
- if (!type) {
- GTypeInfo info = {
- sizeof (SPSymbolClass),
- NULL, NULL,
- (GClassInitFunc) sp_symbol_class_init,
- NULL, NULL,
- sizeof (SPSymbol),
- 16,
- (GInstanceInitFunc) sp_symbol_init,
- NULL, /* value_table */
- };
- type = g_type_register_static (SP_TYPE_GROUP, "SPSymbol", &info, (GTypeFlags)0);
- }
- return type;
+ static GType type = 0;
+ if (!type) {
+ GTypeInfo info = {
+ sizeof (SPSymbolClass),
+ NULL, NULL,
+ (GClassInitFunc) sp_symbol_class_init,
+ NULL, NULL,
+ sizeof (SPSymbol),
+ 16,
+ (GInstanceInitFunc) sp_symbol_init,
+ NULL, /* value_table */
+ };
+ type = g_type_register_static (SP_TYPE_GROUP, "SPSymbol", &info, (GTypeFlags)0);
+ }
+ return type;
}
static void
sp_symbol_class_init (SPSymbolClass *klass)
{
- GObjectClass *object_class;
- SPObjectClass *sp_object_class;
- SPItemClass *sp_item_class;
-
- object_class = G_OBJECT_CLASS (klass);
- sp_object_class = (SPObjectClass *) klass;
- sp_item_class = (SPItemClass *) klass;
-
- parent_class = (SPGroupClass *)g_type_class_ref (SP_TYPE_GROUP);
-
- sp_object_class->build = sp_symbol_build;
- sp_object_class->release = sp_symbol_release;
- sp_object_class->set = sp_symbol_set;
- sp_object_class->child_added = sp_symbol_child_added;
- sp_object_class->update = sp_symbol_update;
- sp_object_class->modified = sp_symbol_modified;
- sp_object_class->write = sp_symbol_write;
-
- sp_item_class->show = sp_symbol_show;
- sp_item_class->hide = sp_symbol_hide;
- sp_item_class->bbox = sp_symbol_bbox;
- sp_item_class->print = sp_symbol_print;
+ GObjectClass *object_class;
+ SPObjectClass *sp_object_class;
+ SPItemClass *sp_item_class;
+
+ object_class = G_OBJECT_CLASS (klass);
+ sp_object_class = (SPObjectClass *) klass;
+ sp_item_class = (SPItemClass *) klass;
+
+ parent_class = (SPGroupClass *)g_type_class_ref (SP_TYPE_GROUP);
+
+ sp_object_class->build = sp_symbol_build;
+ sp_object_class->release = sp_symbol_release;
+ sp_object_class->set = sp_symbol_set;
+ sp_object_class->child_added = sp_symbol_child_added;
+ sp_object_class->update = sp_symbol_update;
+ sp_object_class->modified = sp_symbol_modified;
+ sp_object_class->write = sp_symbol_write;
+
+ sp_item_class->show = sp_symbol_show;
+ sp_item_class->hide = sp_symbol_hide;
+ sp_item_class->bbox = sp_symbol_bbox;
+ sp_item_class->print = sp_symbol_print;
}
static void
sp_symbol_init (SPSymbol *symbol)
{
- symbol->viewBox_set = FALSE;
+ symbol->viewBox_set = FALSE;
- symbol->c2p.set_identity();
+ symbol->c2p = Geom::identity();
}
static void
sp_symbol_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
{
- SPGroup *group;
- SPSymbol *symbol;
+ SPGroup *group;
+ SPSymbol *symbol;
- group = (SPGroup *) object;
- symbol = (SPSymbol *) object;
+ group = (SPGroup *) object;
+ symbol = (SPSymbol *) object;
- sp_object_read_attr (object, "viewBox");
- sp_object_read_attr (object, "preserveAspectRatio");
+ sp_object_read_attr (object, "viewBox");
+ sp_object_read_attr (object, "preserveAspectRatio");
- if (((SPObjectClass *) parent_class)->build)
- ((SPObjectClass *) parent_class)->build (object, document, repr);
+ if (((SPObjectClass *) parent_class)->build)
+ ((SPObjectClass *) parent_class)->build (object, document, repr);
}
static void
sp_symbol_release (SPObject *object)
{
- SPSymbol * symbol;
+ SPSymbol * symbol;
- symbol = (SPSymbol *) object;
+ symbol = (SPSymbol *) object;
- if (((SPObjectClass *) parent_class)->release)
- ((SPObjectClass *) parent_class)->release (object);
+ if (((SPObjectClass *) parent_class)->release)
+ ((SPObjectClass *) parent_class)->release (object);
}
static void
sp_symbol_set (SPObject *object, unsigned int key, const gchar *value)
{
- SPItem *item;
- SPSymbol *symbol;
-
- item = SP_ITEM (object);
- symbol = SP_SYMBOL (object);
-
- switch (key) {
- case SP_ATTR_VIEWBOX:
- if (value) {
- double x, y, width, height;
- char *eptr;
- /* fixme: We have to take original item affine into account */
- /* fixme: Think (Lauris) */
- eptr = (gchar *) value;
- x = g_ascii_strtod (eptr, &eptr);
- while (*eptr && ((*eptr == ',') || (*eptr == ' '))) eptr++;
- y = g_ascii_strtod (eptr, &eptr);
- while (*eptr && ((*eptr == ',') || (*eptr == ' '))) eptr++;
- width = g_ascii_strtod (eptr, &eptr);
- while (*eptr && ((*eptr == ',') || (*eptr == ' '))) eptr++;
- height = g_ascii_strtod (eptr, &eptr);
- while (*eptr && ((*eptr == ',') || (*eptr == ' '))) eptr++;
- if ((width > 0) && (height > 0)) {
- /* Set viewbox */
- symbol->viewBox.x0 = x;
- symbol->viewBox.y0 = y;
- symbol->viewBox.x1 = x + width;
- symbol->viewBox.y1 = y + height;
- symbol->viewBox_set = TRUE;
- } else {
- symbol->viewBox_set = FALSE;
- }
- } else {
- symbol->viewBox_set = FALSE;
- }
- object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG);
- break;
- case SP_ATTR_PRESERVEASPECTRATIO:
- /* Do setup before, so we can use break to escape */
- symbol->aspect_set = FALSE;
- symbol->aspect_align = SP_ASPECT_NONE;
- symbol->aspect_clip = SP_ASPECT_MEET;
- object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG);
- if (value) {
- int len;
- gchar c[256];
- const gchar *p, *e;
- unsigned int align, clip;
- p = value;
- while (*p && *p == 32) p += 1;
- if (!*p) break;
- e = p;
- while (*e && *e != 32) e += 1;
- len = e - p;
- if (len > 8) break;
- memcpy (c, value, len);
- c[len] = 0;
- /* Now the actual part */
- if (!strcmp (c, "none")) {
- align = SP_ASPECT_NONE;
- } else if (!strcmp (c, "xMinYMin")) {
- align = SP_ASPECT_XMIN_YMIN;
- } else if (!strcmp (c, "xMidYMin")) {
- align = SP_ASPECT_XMID_YMIN;
- } else if (!strcmp (c, "xMaxYMin")) {
- align = SP_ASPECT_XMAX_YMIN;
- } else if (!strcmp (c, "xMinYMid")) {
- align = SP_ASPECT_XMIN_YMID;
- } else if (!strcmp (c, "xMidYMid")) {
- align = SP_ASPECT_XMID_YMID;
- } else if (!strcmp (c, "xMaxYMin")) {
- align = SP_ASPECT_XMAX_YMID;
- } else if (!strcmp (c, "xMinYMax")) {
- align = SP_ASPECT_XMIN_YMAX;
- } else if (!strcmp (c, "xMidYMax")) {
- align = SP_ASPECT_XMID_YMAX;
- } else if (!strcmp (c, "xMaxYMax")) {
- align = SP_ASPECT_XMAX_YMAX;
- } else {
- break;
- }
- clip = SP_ASPECT_MEET;
- while (*e && *e == 32) e += 1;
- if (e) {
- if (!strcmp (e, "meet")) {
- clip = SP_ASPECT_MEET;
- } else if (!strcmp (e, "slice")) {
- clip = SP_ASPECT_SLICE;
- } else {
- break;
- }
- }
- symbol->aspect_set = TRUE;
- symbol->aspect_align = align;
- symbol->aspect_clip = clip;
- }
- break;
- default:
- if (((SPObjectClass *) parent_class)->set)
- ((SPObjectClass *) parent_class)->set (object, key, value);
- break;
- }
+ SPItem *item;
+ SPSymbol *symbol;
+
+ item = SP_ITEM (object);
+ symbol = SP_SYMBOL (object);
+
+ switch (key) {
+ case SP_ATTR_VIEWBOX:
+ if (value) {
+ double x, y, width, height;
+ char *eptr;
+ /* fixme: We have to take original item affine into account */
+ /* fixme: Think (Lauris) */
+ eptr = (gchar *) value;
+ x = g_ascii_strtod (eptr, &eptr);
+ while (*eptr && ((*eptr == ',') || (*eptr == ' '))) eptr++;
+ y = g_ascii_strtod (eptr, &eptr);
+ while (*eptr && ((*eptr == ',') || (*eptr == ' '))) eptr++;
+ width = g_ascii_strtod (eptr, &eptr);
+ while (*eptr && ((*eptr == ',') || (*eptr == ' '))) eptr++;
+ height = g_ascii_strtod (eptr, &eptr);
+ while (*eptr && ((*eptr == ',') || (*eptr == ' '))) eptr++;
+ if ((width > 0) && (height > 0)) {
+ /* Set viewbox */
+ symbol->viewBox.x0 = x;
+ symbol->viewBox.y0 = y;
+ symbol->viewBox.x1 = x + width;
+ symbol->viewBox.y1 = y + height;
+ symbol->viewBox_set = TRUE;
+ } else {
+ symbol->viewBox_set = FALSE;
+ }
+ } else {
+ symbol->viewBox_set = FALSE;
+ }
+ object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG);
+ break;
+ case SP_ATTR_PRESERVEASPECTRATIO:
+ /* Do setup before, so we can use break to escape */
+ symbol->aspect_set = FALSE;
+ symbol->aspect_align = SP_ASPECT_NONE;
+ symbol->aspect_clip = SP_ASPECT_MEET;
+ object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG);
+ if (value) {
+ int len;
+ gchar c[256];
+ const gchar *p, *e;
+ unsigned int align, clip;
+ p = value;
+ while (*p && *p == 32) p += 1;
+ if (!*p) break;
+ e = p;
+ while (*e && *e != 32) e += 1;
+ len = e - p;
+ if (len > 8) break;
+ memcpy (c, value, len);
+ c[len] = 0;
+ /* Now the actual part */
+ if (!strcmp (c, "none")) {
+ align = SP_ASPECT_NONE;
+ } else if (!strcmp (c, "xMinYMin")) {
+ align = SP_ASPECT_XMIN_YMIN;
+ } else if (!strcmp (c, "xMidYMin")) {
+ align = SP_ASPECT_XMID_YMIN;
+ } else if (!strcmp (c, "xMaxYMin")) {
+ align = SP_ASPECT_XMAX_YMIN;
+ } else if (!strcmp (c, "xMinYMid")) {
+ align = SP_ASPECT_XMIN_YMID;
+ } else if (!strcmp (c, "xMidYMid")) {
+ align = SP_ASPECT_XMID_YMID;
+ } else if (!strcmp (c, "xMaxYMin")) {
+ align = SP_ASPECT_XMAX_YMID;
+ } else if (!strcmp (c, "xMinYMax")) {
+ align = SP_ASPECT_XMIN_YMAX;
+ } else if (!strcmp (c, "xMidYMax")) {
+ align = SP_ASPECT_XMID_YMAX;
+ } else if (!strcmp (c, "xMaxYMax")) {
+ align = SP_ASPECT_XMAX_YMAX;
+ } else {
+ break;
+ }
+ clip = SP_ASPECT_MEET;
+ while (*e && *e == 32) e += 1;
+ if (e) {
+ if (!strcmp (e, "meet")) {
+ clip = SP_ASPECT_MEET;
+ } else if (!strcmp (e, "slice")) {
+ clip = SP_ASPECT_SLICE;
+ } else {
+ break;
+ }
+ }
+ symbol->aspect_set = TRUE;
+ symbol->aspect_align = align;
+ symbol->aspect_clip = clip;
+ }
+ break;
+ default:
+ if (((SPObjectClass *) parent_class)->set)
+ ((SPObjectClass *) parent_class)->set (object, key, value);
+ break;
+ }
}
static void
sp_symbol_child_added (SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref)
{
- SPSymbol *symbol;
- SPGroup *group;
+ SPSymbol *symbol;
+ SPGroup *group;
- symbol = (SPSymbol *) object;
- group = (SPGroup *) object;
+ symbol = (SPSymbol *) object;
+ group = (SPGroup *) object;
- if (((SPObjectClass *) (parent_class))->child_added)
- ((SPObjectClass *) (parent_class))->child_added (object, child, ref);
+ if (((SPObjectClass *) (parent_class))->child_added)
+ ((SPObjectClass *) (parent_class))->child_added (object, child, ref);
}
static void
sp_symbol_update (SPObject *object, SPCtx *ctx, guint flags)
{
- SPItem *item;
- SPSymbol *symbol;
- SPItemCtx *ictx, rctx;
- SPItemView *v;
+ SPItem *item;
+ SPSymbol *symbol;
+ SPItemCtx *ictx, rctx;
+ SPItemView *v;
- item = SP_ITEM (object);
- symbol = SP_SYMBOL (object);
- ictx = (SPItemCtx *) ctx;
+ item = SP_ITEM (object);
+ symbol = SP_SYMBOL (object);
+ ictx = (SPItemCtx *) ctx;
- if (SP_OBJECT_IS_CLONED (object)) {
- /* Cloned <symbol> is actually renderable */
+ if (SP_OBJECT_IS_CLONED (object)) {
+ /* Cloned <symbol> is actually renderable */
- /* fixme: We have to set up clip here too */
+ /* fixme: We have to set up clip here too */
- /* Create copy of item context */
- rctx = *ictx;
+ /* Create copy of item context */
+ rctx = *ictx;
- /* Calculate child to parent transformation */
- /* Apply parent <use> translation (set up as vewport) */
+ /* Calculate child to parent transformation */
+ /* Apply parent <use> translation (set up as vewport) */
symbol->c2p = NR::Matrix(NR::translate(rctx.vp.x0, rctx.vp.y0));
- if (symbol->viewBox_set) {
- double x, y, width, height;
- NR::Matrix q;
- /* Determine actual viewbox in viewport coordinates */
- if (symbol->aspect_align == SP_ASPECT_NONE) {
- x = 0.0;
- y = 0.0;
- width = rctx.vp.x1 - rctx.vp.x0;
- height = rctx.vp.y1 - rctx.vp.y0;
- } else {
- double scalex, scaley, scale;
- /* Things are getting interesting */
- scalex = (rctx.vp.x1 - rctx.vp.x0) / (symbol->viewBox.x1 - symbol->viewBox.x0);
- scaley = (rctx.vp.y1 - rctx.vp.y0) / (symbol->viewBox.y1 - symbol->viewBox.y0);
- scale = (symbol->aspect_clip == SP_ASPECT_MEET) ? MIN (scalex, scaley) : MAX (scalex, scaley);
- width = (symbol->viewBox.x1 - symbol->viewBox.x0) * scale;
- height = (symbol->viewBox.y1 - symbol->viewBox.y0) * scale;
- /* Now place viewbox to requested position */
- switch (symbol->aspect_align) {
- case SP_ASPECT_XMIN_YMIN:
- x = 0.0;
- y = 0.0;
- break;
- case SP_ASPECT_XMID_YMIN:
- x = 0.5 * ((rctx.vp.x1 - rctx.vp.x0) - width);
- y = 0.0;
- break;
- case SP_ASPECT_XMAX_YMIN:
- x = 1.0 * ((rctx.vp.x1 - rctx.vp.x0) - width);
- y = 0.0;
- break;
- case SP_ASPECT_XMIN_YMID:
- x = 0.0;
- y = 0.5 * ((rctx.vp.y1 - rctx.vp.y0) - height);
- break;
- case SP_ASPECT_XMID_YMID:
- x = 0.5 * ((rctx.vp.x1 - rctx.vp.x0) - width);
- y = 0.5 * ((rctx.vp.y1 - rctx.vp.y0) - height);
- break;
- case SP_ASPECT_XMAX_YMID:
- x = 1.0 * ((rctx.vp.x1 - rctx.vp.x0) - width);
- y = 0.5 * ((rctx.vp.y1 - rctx.vp.y0) - height);
- break;
- case SP_ASPECT_XMIN_YMAX:
- x = 0.0;
- y = 1.0 * ((rctx.vp.y1 - rctx.vp.y0) - height);
- break;
- case SP_ASPECT_XMID_YMAX:
- x = 0.5 * ((rctx.vp.x1 - rctx.vp.x0) - width);
- y = 1.0 * ((rctx.vp.y1 - rctx.vp.y0) - height);
- break;
- case SP_ASPECT_XMAX_YMAX:
- x = 1.0 * ((rctx.vp.x1 - rctx.vp.x0) - width);
- y = 1.0 * ((rctx.vp.y1 - rctx.vp.y0) - height);
- break;
- default:
- x = 0.0;
- y = 0.0;
- break;
- }
- }
- /* Compose additional transformation from scale and position */
- q[0] = width / (symbol->viewBox.x1 - symbol->viewBox.x0);
- q[1] = 0.0;
- q[2] = 0.0;
- q[3] = height / (symbol->viewBox.y1 - symbol->viewBox.y0);
- q[4] = -symbol->viewBox.x0 * q[0] + x;
- q[5] = -symbol->viewBox.y0 * q[3] + y;
- /* Append viewbox transformation */
- symbol->c2p = q * symbol->c2p;
- }
-
- rctx.i2doc = symbol->c2p * rctx.i2doc;
-
- /* If viewBox is set initialize child viewport */
- /* Otherwise <use> has set it up already */
- if (symbol->viewBox_set) {
- rctx.vp.x0 = symbol->viewBox.x0;
- rctx.vp.y0 = symbol->viewBox.y0;
- rctx.vp.x1 = symbol->viewBox.x1;
- rctx.vp.y1 = symbol->viewBox.y1;
- rctx.i2vp = NR::identity();
- }
-
- /* And invoke parent method */
- if (((SPObjectClass *) (parent_class))->update)
- ((SPObjectClass *) (parent_class))->update (object, (SPCtx *) &rctx, flags);
-
- /* As last step set additional transform of arena group */
- for (v = item->display; v != NULL; v = v->next) {
- nr_arena_group_set_child_transform(NR_ARENA_GROUP(v->arenaitem), &symbol->c2p);
- }
- } else {
- /* No-op */
- if (((SPObjectClass *) (parent_class))->update)
- ((SPObjectClass *) (parent_class))->update (object, ctx, flags);
- }
+ if (symbol->viewBox_set) {
+ double x, y, width, height;
+ /* Determine actual viewbox in viewport coordinates */
+ if (symbol->aspect_align == SP_ASPECT_NONE) {
+ x = 0.0;
+ y = 0.0;
+ width = rctx.vp.x1 - rctx.vp.x0;
+ height = rctx.vp.y1 - rctx.vp.y0;
+ } else {
+ double scalex, scaley, scale;
+ /* Things are getting interesting */
+ scalex = (rctx.vp.x1 - rctx.vp.x0) / (symbol->viewBox.x1 - symbol->viewBox.x0);
+ scaley = (rctx.vp.y1 - rctx.vp.y0) / (symbol->viewBox.y1 - symbol->viewBox.y0);
+ scale = (symbol->aspect_clip == SP_ASPECT_MEET) ? MIN (scalex, scaley) : MAX (scalex, scaley);
+ width = (symbol->viewBox.x1 - symbol->viewBox.x0) * scale;
+ height = (symbol->viewBox.y1 - symbol->viewBox.y0) * scale;
+ /* Now place viewbox to requested position */
+ switch (symbol->aspect_align) {
+ case SP_ASPECT_XMIN_YMIN:
+ x = 0.0;
+ y = 0.0;
+ break;
+ case SP_ASPECT_XMID_YMIN:
+ x = 0.5 * ((rctx.vp.x1 - rctx.vp.x0) - width);
+ y = 0.0;
+ break;
+ case SP_ASPECT_XMAX_YMIN:
+ x = 1.0 * ((rctx.vp.x1 - rctx.vp.x0) - width);
+ y = 0.0;
+ break;
+ case SP_ASPECT_XMIN_YMID:
+ x = 0.0;
+ y = 0.5 * ((rctx.vp.y1 - rctx.vp.y0) - height);
+ break;
+ case SP_ASPECT_XMID_YMID:
+ x = 0.5 * ((rctx.vp.x1 - rctx.vp.x0) - width);
+ y = 0.5 * ((rctx.vp.y1 - rctx.vp.y0) - height);
+ break;
+ case SP_ASPECT_XMAX_YMID:
+ x = 1.0 * ((rctx.vp.x1 - rctx.vp.x0) - width);
+ y = 0.5 * ((rctx.vp.y1 - rctx.vp.y0) - height);
+ break;
+ case SP_ASPECT_XMIN_YMAX:
+ x = 0.0;
+ y = 1.0 * ((rctx.vp.y1 - rctx.vp.y0) - height);
+ break;
+ case SP_ASPECT_XMID_YMAX:
+ x = 0.5 * ((rctx.vp.x1 - rctx.vp.x0) - width);
+ y = 1.0 * ((rctx.vp.y1 - rctx.vp.y0) - height);
+ break;
+ case SP_ASPECT_XMAX_YMAX:
+ x = 1.0 * ((rctx.vp.x1 - rctx.vp.x0) - width);
+ y = 1.0 * ((rctx.vp.y1 - rctx.vp.y0) - height);
+ break;
+ default:
+ x = 0.0;
+ y = 0.0;
+ break;
+ }
+ }
+ /* Compose additional transformation from scale and position */
+ Geom::Matrix q;
+ q[0] = width / (symbol->viewBox.x1 - symbol->viewBox.x0);
+ q[1] = 0.0;
+ q[2] = 0.0;
+ q[3] = height / (symbol->viewBox.y1 - symbol->viewBox.y0);
+ q[4] = -symbol->viewBox.x0 * q[0] + x;
+ q[5] = -symbol->viewBox.y0 * q[3] + y;
+ /* Append viewbox transformation */
+ symbol->c2p = q * symbol->c2p;
+ }
+
+ rctx.i2doc = symbol->c2p * (Geom::Matrix)rctx.i2doc;
+
+ /* If viewBox is set initialize child viewport */
+ /* Otherwise <use> has set it up already */
+ if (symbol->viewBox_set) {
+ rctx.vp.x0 = symbol->viewBox.x0;
+ rctx.vp.y0 = symbol->viewBox.y0;
+ rctx.vp.x1 = symbol->viewBox.x1;
+ rctx.vp.y1 = symbol->viewBox.y1;
+ rctx.i2vp = NR::identity();
+ }
+
+ /* And invoke parent method */
+ if (((SPObjectClass *) (parent_class))->update)
+ ((SPObjectClass *) (parent_class))->update (object, (SPCtx *) &rctx, flags);
+
+ /* As last step set additional transform of arena group */
+ for (v = item->display; v != NULL; v = v->next) {
+ nr_arena_group_set_child_transform(NR_ARENA_GROUP(v->arenaitem), symbol->c2p);
+ }
+ } else {
+ /* No-op */
+ if (((SPObjectClass *) (parent_class))->update)
+ ((SPObjectClass *) (parent_class))->update (object, ctx, flags);
+ }
}
static void
sp_symbol_modified (SPObject *object, guint flags)
{
- SPSymbol *symbol;
+ SPSymbol *symbol;
- symbol = SP_SYMBOL (object);
+ symbol = SP_SYMBOL (object);
- if (((SPObjectClass *) (parent_class))->modified)
- (* ((SPObjectClass *) (parent_class))->modified) (object, flags);
+ if (((SPObjectClass *) (parent_class))->modified)
+ (* ((SPObjectClass *) (parent_class))->modified) (object, flags);
}
static Inkscape::XML::Node *
sp_symbol_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
{
- SPSymbol *symbol;
+ SPSymbol *symbol;
- symbol = SP_SYMBOL (object);
+ symbol = SP_SYMBOL (object);
- if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) {
- repr = xml_doc->createElement("svg:symbol");
- }
+ if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) {
+ repr = xml_doc->createElement("svg:symbol");
+ }
- repr->setAttribute("viewBox", object->repr->attribute("viewBox"));
- repr->setAttribute("preserveAspectRatio", object->repr->attribute("preserveAspectRatio"));
+ repr->setAttribute("viewBox", object->repr->attribute("viewBox"));
+ repr->setAttribute("preserveAspectRatio", object->repr->attribute("preserveAspectRatio"));
- if (((SPObjectClass *) (parent_class))->write)
- ((SPObjectClass *) (parent_class))->write (object, xml_doc, repr, flags);
+ if (((SPObjectClass *) (parent_class))->write)
+ ((SPObjectClass *) (parent_class))->write (object, xml_doc, repr, flags);
- return repr;
+ return repr;
}
static NRArenaItem *
sp_symbol_show (SPItem *item, NRArena *arena, unsigned int key, unsigned int flags)
{
- SPSymbol *symbol;
- NRArenaItem *ai;
-
- symbol = SP_SYMBOL (item);
-
- if (SP_OBJECT_IS_CLONED (symbol)) {
- /* Cloned <symbol> is actually renderable */
- if (((SPItemClass *) (parent_class))->show) {
- ai = ((SPItemClass *) (parent_class))->show (item, arena, key, flags);
- if (ai) {
- nr_arena_group_set_child_transform(NR_ARENA_GROUP(ai), &symbol->c2p);
- }
- } else {
- ai = NULL;
- }
- } else {
- ai = NULL;
- }
-
- return ai;
+ SPSymbol *symbol;
+ NRArenaItem *ai;
+
+ symbol = SP_SYMBOL (item);
+
+ if (SP_OBJECT_IS_CLONED (symbol)) {
+ /* Cloned <symbol> is actually renderable */
+ if (((SPItemClass *) (parent_class))->show) {
+ ai = ((SPItemClass *) (parent_class))->show (item, arena, key, flags);
+ if (ai) {
+ nr_arena_group_set_child_transform(NR_ARENA_GROUP(ai), symbol->c2p);
+ }
+ } else {
+ ai = NULL;
+ }
+ } else {
+ ai = NULL;
+ }
+
+ return ai;
}
static void
sp_symbol_hide (SPItem *item, unsigned int key)
{
- SPSymbol *symbol;
+ SPSymbol *symbol;
- symbol = SP_SYMBOL (item);
+ symbol = SP_SYMBOL (item);
- if (SP_OBJECT_IS_CLONED (symbol)) {
- /* Cloned <symbol> is actually renderable */
- if (((SPItemClass *) (parent_class))->hide)
- ((SPItemClass *) (parent_class))->hide (item, key);
- }
+ if (SP_OBJECT_IS_CLONED (symbol)) {
+ /* Cloned <symbol> is actually renderable */
+ if (((SPItemClass *) (parent_class))->hide)
+ ((SPItemClass *) (parent_class))->hide (item, key);
+ }
}
static void
sp_symbol_bbox(SPItem const *item, NRRect *bbox, NR::Matrix const &transform, unsigned const flags)
{
- SPSymbol const *symbol = SP_SYMBOL(item);
+ SPSymbol const *symbol = SP_SYMBOL(item);
- if (SP_OBJECT_IS_CLONED (symbol)) {
- /* Cloned <symbol> is actually renderable */
+ if (SP_OBJECT_IS_CLONED (symbol)) {
+ /* Cloned <symbol> is actually renderable */
- if (((SPItemClass *) (parent_class))->bbox) {
- NR::Matrix const a( symbol->c2p * transform );
- ((SPItemClass *) (parent_class))->bbox(item, bbox, a, flags);
- }
- }
+ if (((SPItemClass *) (parent_class))->bbox) {
+ Geom::Matrix const a( symbol->c2p * (Geom::Matrix)transform );
+ ((SPItemClass *) (parent_class))->bbox(item, bbox, a, flags);
+ }
+ }
}
static void
sp_symbol_print (SPItem *item, SPPrintContext *ctx)
{
- SPSymbol *symbol = SP_SYMBOL(item);
- if (SP_OBJECT_IS_CLONED (symbol)) {
- /* Cloned <symbol> is actually renderable */
+ SPSymbol *symbol = SP_SYMBOL(item);
+ if (SP_OBJECT_IS_CLONED (symbol)) {
+ /* Cloned <symbol> is actually renderable */
- sp_print_bind(ctx, &symbol->c2p, 1.0);
+ sp_print_bind(ctx, &symbol->c2p, 1.0);
- if (((SPItemClass *) (parent_class))->print) {
- ((SPItemClass *) (parent_class))->print (item, ctx);
- }
+ if (((SPItemClass *) (parent_class))->print) {
+ ((SPItemClass *) (parent_class))->print (item, ctx);
+ }
- sp_print_release (ctx);
- }
+ sp_print_release (ctx);
+ }
}
diff --git a/src/sp-symbol.h b/src/sp-symbol.h
index 672710fd0833e852cc4effab7c3ad7ca7b2141d1..61951cf646e46c08b2e8460d7410459b3a454e20 100644 (file)
--- a/src/sp-symbol.h
+++ b/src/sp-symbol.h
class SPSymbolClass;
#include <libnr/nr-matrix.h>
+#include <2geom/matrix.h>
#include <libnr/nr-rect.h>
#include "svg/svg-length.h"
#include "enums.h"
unsigned int aspect_clip : 1;
/* Child to parent additional transform */
- NR::Matrix c2p;
+ Geom::Matrix c2p;
};
struct SPSymbolClass {