~ubuntu-branches/ubuntu/precise/inkscape/precise-updates

« back to all changes in this revision

Viewing changes to src/display/nr-arena.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alex Valavanis
  • Date: 2010-09-12 19:44:58 UTC
  • mfrom: (1.1.12 upstream) (45.1.3 maverick)
  • Revision ID: james.westby@ubuntu.com-20100912194458-4sjwmbl7dlsrk5dc
Tags: 0.48.0-1ubuntu1
* Merge with Debian unstable (LP: #628048, LP: #401567, LP: #456248, 
  LP: #463602, LP: #591986)
* debian/control: 
  - Ubuntu maintainers
  - Promote python-lxml, python-numpy, python-uniconvertor to Recommends.
  - Demote pstoedit to Suggests (universe package).
  - Suggests ttf-dejavu instead of ttf-bitstream-vera (LP: #513319)
* debian/rules:
  - Run intltool-update on build (Ubuntu-specific).
  - Add translation domain to .desktop files (Ubuntu-specific).
* debian/dirs:
  - Add usr/share/pixmaps.  Allow inkscape.xpm installation
* drop 50-poppler-API.dpatch (now upstream)
* drop 51-paste-in-unwritable-directory.dpatch (now upstream) 

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
#include "nr-filter-types.h"
19
19
#include <libnr/nr-blit.h>
20
20
#include "preferences.h"
 
21
#include "color.h"
21
22
 
22
23
static void nr_arena_class_init (NRArenaClass *klass);
23
24
static void nr_arena_init (NRArena *arena);
181
182
 
182
183
}
183
184
 
 
185
#define FLOAT_TO_UINT8(f) (int(f*255))
 
186
#define RGBA_R(v) ((v) >> 24)
 
187
#define RGBA_G(v) (((v) >> 16) & 0xff)
 
188
#define RGBA_B(v) (((v) >> 8) & 0xff)
 
189
#define RGBA_A(v) ((v) & 0xff)
 
190
 
 
191
void nr_arena_separate_color_plates(guint32* rgba){
 
192
    Inkscape::Preferences *prefs = Inkscape::Preferences::get();
 
193
    bool render_cyan = prefs->getBool("/options/printcolorspreview/cyan", true);
 
194
    bool render_magenta = prefs->getBool("/options/printcolorspreview/magenta", true);
 
195
    bool render_yellow = prefs->getBool("/options/printcolorspreview/yellow", true);
 
196
    bool render_black = prefs->getBool("/options/printcolorspreview/black", true);
 
197
 
 
198
    float rgb_v[3];
 
199
    float cmyk_v[4];
 
200
    sp_color_rgb_to_cmyk_floatv (cmyk_v, RGBA_R(*rgba)/256.0, RGBA_G(*rgba)/256.0, RGBA_B(*rgba)/256.0); 
 
201
    sp_color_cmyk_to_rgb_floatv (rgb_v, render_cyan ? cmyk_v[0] : 0,
 
202
                                        render_magenta ? cmyk_v[1] : 0,
 
203
                                        render_yellow ? cmyk_v[2] : 0,
 
204
                                        render_black ? cmyk_v[3] : 0);
 
205
    *rgba = (FLOAT_TO_UINT8(rgb_v[0])<<24) + (FLOAT_TO_UINT8(rgb_v[1])<<16) + (FLOAT_TO_UINT8(rgb_v[2])<<8) + 0xff;
 
206
}
 
207
 
184
208
/*
185
209
  Local Variables:
186
210
  mode:c++