summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: cd21e1b)
raw | patch | inline | side by side (parent: cd21e1b)
author | Felipe C. da S. Sanches <juca@members.fsf.org> | |
Fri, 11 Dec 2009 09:16:15 +0000 (07:16 -0200) | ||
committer | Felipe C. da S. Sanches <juca@members.fsf.org> | |
Fri, 11 Dec 2009 09:16:15 +0000 (07:16 -0200) |
index 429f1ed32c186c7f61481eccf68a731ab6ff2b91..db09229156bdcbed9a2ddca0aa851981275ed8f6 100644 (file)
@@ -444,6 +444,7 @@ nr_arena_glyphs_group_render(cairo_t *ct, NRArenaItem *item, NRRectL *area, NRPi
SPStyle const *style = ggroup->style;
guint ret = item->state;
+ bool print_colors_preview = (item->arena->rendermode == Inkscape::RENDERMODE_PRINT_COLORS_PREVIEW);
if (item->arena->rendermode == Inkscape::RENDERMODE_OUTLINE) {
@@ -511,6 +512,10 @@ nr_arena_glyphs_group_render(cairo_t *ct, NRArenaItem *item, NRRectL *area, NRPi
} else {
rgba = style->fill.value.color.toRGBA32( SP_SCALE24_TO_FLOAT(style->fill_opacity.value) );
}
+
+ if (print_colors_preview)
+ nr_arena_separate_color_plates(&rgba);
+
nr_blit_pixblock_mask_rgba32(pb, &m, rgba);
pb->empty = FALSE;
}
@@ -551,6 +556,10 @@ nr_arena_glyphs_group_render(cairo_t *ct, NRArenaItem *item, NRRectL *area, NRPi
} else {
rgba = style->stroke.value.color.toRGBA32( SP_SCALE24_TO_FLOAT(style->stroke_opacity.value) );
}
+
+ if (print_colors_preview)
+ nr_arena_separate_color_plates(&rgba);
+
nr_blit_pixblock_mask_rgba32(pb, &m, rgba);
pb->empty = FALSE;
} else {
index d5a098c391d91ef390ea47a3aa8d32f65a241311..e2a9e958064128a00df160849ce4fba434611b56 100644 (file)
#include <typeinfo>
#include <cairo.h>
#include "preferences.h"
-#include "svg/svg-device-color.h"
#include <glib.h>
#include "svg/svg.h"
@@ -833,7 +832,6 @@ cairo_arena_shape_render_stroke(NRArenaItem *item, NRRectL *area, NRPixBlock *pb
pb->empty = FALSE;
}
-
/**
* Renders the item. Markers are just composed into the parent buffer.
*/
if (!shape->style) return item->state;
bool outline = (NR_ARENA_ITEM(shape)->arena->rendermode == Inkscape::RENDERMODE_OUTLINE);
- bool print_colors = (NR_ARENA_ITEM(shape)->arena->rendermode == Inkscape::RENDERMODE_PRINT_COLORS_PREVIEW);
+ bool print_colors_preview = (NR_ARENA_ITEM(shape)->arena->rendermode == Inkscape::RENDERMODE_PRINT_COLORS_PREVIEW);
if (outline) { // cairo outline rendering
@@ -876,21 +874,7 @@ nr_arena_shape_render(cairo_t *ct, NRArenaItem *item, NRRectL *area, NRPixBlock
}
}
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
-
SPStyle const *style = shape->style;
- bool render_cyan = prefs->getBool("/options/printcolorspreview/cyan", true);
- bool render_magenta = prefs->getBool("/options/printcolorspreview/magenta", true);
- bool render_yellow = prefs->getBool("/options/printcolorspreview/yellow", true);
- bool render_black = prefs->getBool("/options/printcolorspreview/black", true);
-
- float rgb_v[3];
- float cmyk_v[4];
-#define FLOAT_TO_UINT8(f) (int(f*255))
-#define RGBA_R(v) ((v) >> 24)
-#define RGBA_G(v) (((v) >> 16) & 0xff)
-#define RGBA_B(v) (((v) >> 8) & 0xff)
-#define RGBA_A(v) ((v) & 0xff)
if (shape->fill_shp) {
NRPixBlock m;
@@ -920,14 +904,8 @@ nr_arena_shape_render(cairo_t *ct, NRArenaItem *item, NRRectL *area, NRPixBlock
rgba = fill_color->toRGBA32( shape->_fill.opacity );
}
- if (print_colors){
- sp_color_rgb_to_cmyk_floatv (cmyk_v, RGBA_R(rgba)/256.0, RGBA_G(rgba)/256.0, RGBA_B(rgba)/256.0);
- sp_color_cmyk_to_rgb_floatv (rgb_v, render_cyan ? cmyk_v[0] : 0,
- render_magenta ? cmyk_v[1] : 0,
- render_yellow ? cmyk_v[2] : 0,
- render_black ? cmyk_v[3] : 0);
- rgba = (FLOAT_TO_UINT8(rgb_v[0])<<24) + (FLOAT_TO_UINT8(rgb_v[1])<<16) + (FLOAT_TO_UINT8(rgb_v[2])<<8) + 0xff;
- }
+ if (print_colors_preview)
+ nr_arena_separate_color_plates(&rgba);
nr_blit_pixblock_mask_rgba32(pb, &m, rgba);
pb->empty = FALSE;
@@ -967,14 +945,8 @@ nr_arena_shape_render(cairo_t *ct, NRArenaItem *item, NRRectL *area, NRPixBlock
rgba = stroke_color->toRGBA32( shape->_stroke.opacity );
}
- if (print_colors){
- sp_color_rgb_to_cmyk_floatv (cmyk_v, RGBA_R(rgba)/256.0, RGBA_G(rgba)/256.0, RGBA_B(rgba)/256.0);
- sp_color_cmyk_to_rgb_floatv (rgb_v, render_cyan ? cmyk_v[0] : 0,
- render_magenta ? cmyk_v[1] : 0,
- render_yellow ? cmyk_v[2] : 0,
- render_black ? cmyk_v[3] : 0);
- rgba = (FLOAT_TO_UINT8(rgb_v[0])<<24) + (FLOAT_TO_UINT8(rgb_v[1])<<16) + (FLOAT_TO_UINT8(rgb_v[2])<<8) + 0xff;
- }
+ if (print_colors_preview)
+ nr_arena_separate_color_plates(&rgba);
nr_blit_pixblock_mask_rgba32(pb, &m, rgba);
pb->empty = FALSE;
index 74e0f409c85525ef0d96468c63d2605efa44aafd..33870a11839648b9e5608930dd7f4d49f3dbc09f 100644 (file)
--- a/src/display/nr-arena.cpp
+++ b/src/display/nr-arena.cpp
#include "nr-filter-types.h"
#include <libnr/nr-blit.h>
#include "preferences.h"
+#include "color.h"
static void nr_arena_class_init (NRArenaClass *klass);
static void nr_arena_init (NRArena *arena);
}
+#define FLOAT_TO_UINT8(f) (int(f*255))
+#define RGBA_R(v) ((v) >> 24)
+#define RGBA_G(v) (((v) >> 16) & 0xff)
+#define RGBA_B(v) (((v) >> 8) & 0xff)
+#define RGBA_A(v) ((v) & 0xff)
+
+void nr_arena_separate_color_plates(guint32* rgba){
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ bool render_cyan = prefs->getBool("/options/printcolorspreview/cyan", true);
+ bool render_magenta = prefs->getBool("/options/printcolorspreview/magenta", true);
+ bool render_yellow = prefs->getBool("/options/printcolorspreview/yellow", true);
+ bool render_black = prefs->getBool("/options/printcolorspreview/black", true);
+
+ float rgb_v[3];
+ float cmyk_v[4];
+ sp_color_rgb_to_cmyk_floatv (cmyk_v, RGBA_R(*rgba)/256.0, RGBA_G(*rgba)/256.0, RGBA_B(*rgba)/256.0);
+ sp_color_cmyk_to_rgb_floatv (rgb_v, render_cyan ? cmyk_v[0] : 0,
+ render_magenta ? cmyk_v[1] : 0,
+ render_yellow ? cmyk_v[2] : 0,
+ render_black ? cmyk_v[3] : 0);
+ *rgba = (FLOAT_TO_UINT8(rgb_v[0])<<24) + (FLOAT_TO_UINT8(rgb_v[1])<<16) + (FLOAT_TO_UINT8(rgb_v[2])<<8) + 0xff;
+}
+
/*
Local Variables:
mode:c++
diff --git a/src/display/nr-arena.h b/src/display/nr-arena.h
index 1c091b7c76eb9aafc025b15bf6fdc197a9dac8d3..d2f9dc24655fcee9a71328e601ea15e5c58ed905 100644 (file)
--- a/src/display/nr-arena.h
+++ b/src/display/nr-arena.h
void nr_arena_render_paintserver_fill (NRPixBlock *pb, NRRectL *area, SPPainter *painter, float opacity, NRPixBlock *mask);
+void nr_arena_separate_color_plates(guint32* rgba);
+
#endif