Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
Inkscape::Colors::CMS::Transform Class Reference

#include <transform.h>

Public Member Functions

 Transform (cmsHTRANSFORM handle, bool global=false)
 
 ~Transform ()
 
 Transform (Transform const &)=delete
 
Transformoperator= (Transform const &)=delete
 
cmsHTRANSFORM getHandle () const
 
void do_transform (unsigned char *inBuf, unsigned char *outBuf, unsigned size) const
 Wrap lcms2 cmsDoTransform to transform the pixel buffer's color channels.
 
void do_transform (cairo_surface_t *in, cairo_surface_t *out) const
 Apply the CMS transform to the cairo surface and paint it into the output surface.
 
void do_transform (Cairo::RefPtr< Cairo::ImageSurface > &in, Cairo::RefPtr< Cairo::ImageSurface > &out) const
 Apply the CMS transform to the cairomm surface and paint it into the output surface.
 
bool do_transform (std::vector< double > &io) const
 Apply the CMS transform to a single Color object's data.
 
void set_gamut_warn (std::vector< double > const &input)
 Set the gamut alarm code for this cms transform (and only this one).
 
bool check_gamut (std::vector< double > const &input) const
 Return true if the input color is outside of the gamut if it was transformed using this cms transform.
 

Static Public Member Functions

static std::shared_ptr< Transform > const create (cmsHTRANSFORM handle, bool global=false)
 Construct a color transform object from the lcms2 object.
 
static std::shared_ptr< Transform > const create_for_cairo (std::shared_ptr< Profile > const &from, std::shared_ptr< Profile > const &to, std::shared_ptr< Profile > const &proof=nullptr, RenderingIntent proof_intent=RenderingIntent::AUTO, bool with_gamut_warn=false)
 Construct a transformation suitable for display conversion in a cairo buffer.
 
static std::shared_ptr< Transform > const create_for_cms (std::shared_ptr< Profile > const &from, std::shared_ptr< Profile > const &to, RenderingIntent intent)
 Construct a transformation suitable for Space::CMS transformations using the given rendering intent.
 
static std::shared_ptr< Transform > const create_for_cms_checker (std::shared_ptr< Profile > const &from, std::shared_ptr< Profile > const &to)
 Construct a transformation suitable for gamut checking Space::CMS colors.
 

Public Attributes

unsigned int _channels_in
 
unsigned int _channels_out
 

Static Private Member Functions

static unsigned int lcms_intent (RenderingIntent intent, unsigned int &flags)
 Get the lcms2 intent enum from the inkscape intent enum.
 

Private Attributes

cmsHTRANSFORM _handle
 
cmsContext _context
 

Detailed Description

Definition at line 22 of file transform.h.

Constructor & Destructor Documentation

◆ Transform() [1/2]

Inkscape::Colors::CMS::Transform::Transform ( cmsHTRANSFORM  handle,
bool  global = false 
)
inline

Definition at line 36 of file transform.h.

References _handle.

◆ ~Transform()

Inkscape::Colors::CMS::Transform::~Transform ( )
inline

Definition at line 44 of file transform.h.

References _context, and _handle.

◆ Transform() [2/2]

Inkscape::Colors::CMS::Transform::Transform ( Transform const &  )
delete

Member Function Documentation

◆ check_gamut()

bool Inkscape::Colors::CMS::Transform::check_gamut ( std::vector< double > const &  input) const

Return true if the input color is outside of the gamut if it was transformed using this cms transform.

  • input - The input color as a vector of numbers between 0.0 and 1.0

Definition at line 222 of file transform.cpp.

References _handle.

◆ create()

std::shared_ptr< Transform > const Inkscape::Colors::CMS::Transform::create ( cmsHTRANSFORM  handle,
bool  global = false 
)
static

Construct a color transform object from the lcms2 object.

Definition at line 26 of file transform.cpp.

◆ create_for_cairo()

std::shared_ptr< Transform > const Inkscape::Colors::CMS::Transform::create_for_cairo ( std::shared_ptr< Profile > const &  from,
std::shared_ptr< Profile > const &  to,
std::shared_ptr< Profile > const &  proof = nullptr,
RenderingIntent  proof_intent = RenderingIntent::AUTO,
bool  with_gamut_warn = false 
)
static

Construct a transformation suitable for display conversion in a cairo buffer.

  • from - The RGB CMS Profile the cairo data will start in.
  • to - The target RGB CMS Profile the cairo data needs to end up in.
  • proof - A profile to apply a proofing step to, this can be CMYK for example.

Definition at line 38 of file transform.cpp.

References create, and lcms_intent().

Referenced by Inkscape::Colors::CMS::System::getDisplayTransform().

◆ create_for_cms()

std::shared_ptr< Transform > const Inkscape::Colors::CMS::Transform::create_for_cms ( std::shared_ptr< Profile > const &  from,
std::shared_ptr< Profile > const &  to,
RenderingIntent  intent 
)
static

Construct a transformation suitable for Space::CMS transformations using the given rendering intent.

  • from - The CMS Profile the color data will start in
  • to - The target CMS Profile the color data needs to end up in.
  • intent - The rendering intent to use when changing the gamut and white balance.

Definition at line 66 of file transform.cpp.

References create, and lcms_intent().

Referenced by Inkscape::Colors::Space::AnySpace::profileToProfile().

◆ create_for_cms_checker()

std::shared_ptr< Transform > const Inkscape::Colors::CMS::Transform::create_for_cms_checker ( std::shared_ptr< Profile > const &  from,
std::shared_ptr< Profile > const &  to 
)
static

Construct a transformation suitable for gamut checking Space::CMS colors.

  • from - The CMS Profile the color data will start in
  • to - The target CMS Profile the color data needs to end up in.

Definition at line 86 of file transform.cpp.

References create.

Referenced by Inkscape::Colors::Space::AnySpace::outOfGamut().

◆ do_transform() [1/4]

void Inkscape::Colors::CMS::Transform::do_transform ( Cairo::RefPtr< Cairo::ImageSurface > &  in,
Cairo::RefPtr< Cairo::ImageSurface > &  out 
) const

Apply the CMS transform to the cairomm surface and paint it into the output surface.

  • in - The source cairomm surface with the pixels to transform.
  • out - The destination cairomm surface which may be the same as in.

Definition at line 184 of file transform.cpp.

References do_transform().

◆ do_transform() [2/4]

void Inkscape::Colors::CMS::Transform::do_transform ( cairo_surface_t in,
cairo_surface_t out 
) const

Apply the CMS transform to the cairo surface and paint it into the output surface.

  • in - The source cairo surface with the pixels to transform.
  • out - The destination cairo surface which may be the same as in.

Definition at line 153 of file transform.cpp.

References do_transform(), height, stride, and width.

◆ do_transform() [3/4]

bool Inkscape::Colors::CMS::Transform::do_transform ( std::vector< double > &  io) const

Apply the CMS transform to a single Color object's data.

  • io - The input/output color as a vector of numbers between 0.0 and 1.0
Returns
the modified color in io

Definition at line 196 of file transform.cpp.

References _channels_in, _channels_out, and _handle.

◆ do_transform() [4/4]

void Inkscape::Colors::CMS::Transform::do_transform ( unsigned char *  inBuf,
unsigned char *  outBuf,
unsigned  size 
) const

Wrap lcms2 cmsDoTransform to transform the pixel buffer's color channels.

  • inBuf - The input pixel buffer to transform.
  • outBug - The output pixel buffer, which can be the same as inBuf.
  • size - The size of the buffer to transform.

Definition at line 137 of file transform.cpp.

References _handle, and Inkscape::size.

Referenced by do_transform(), and do_transform().

◆ getHandle()

cmsHTRANSFORM Inkscape::Colors::CMS::Transform::getHandle ( ) const
inline

Definition at line 53 of file transform.h.

References _handle.

◆ lcms_intent()

unsigned int Inkscape::Colors::CMS::Transform::lcms_intent ( RenderingIntent  intent,
unsigned int &  flags 
)
staticprivate

Get the lcms2 intent enum from the inkscape intent enum.

@args intent - The Inkscape RenderingIntent enum

Returns
flags - Any flags modifications for the given intent
lcms intent enum, default is INTENT_PERCEPTUAL

Definition at line 244 of file transform.cpp.

References Inkscape::Colors::ABSOLUTE_COLORIMETRIC, Inkscape::Colors::AUTO, Inkscape::Colors::PERCEPTUAL, Inkscape::Colors::RELATIVE_COLORIMETRIC, Inkscape::Colors::RELATIVE_COLORIMETRIC_NOBPC, Inkscape::Colors::SATURATION, and Inkscape::Colors::UNKNOWN.

Referenced by create_for_cairo(), and create_for_cms().

◆ operator=()

Transform & Inkscape::Colors::CMS::Transform::operator= ( Transform const &  )
delete

◆ set_gamut_warn()

void Inkscape::Colors::CMS::Transform::set_gamut_warn ( std::vector< double > const &  input)

Set the gamut alarm code for this cms transform (and only this one).

NOTE: If the transform doesn't have a context because it was created for cms color transforms instead of cairo transforms, this won't do anything.

  • input - The values per channel in the output to use. For example if the transform is RGB to CMYK, the input vector should be four channels in size.

Definition at line 118 of file transform.cpp.

References _channels_in, and _context.

Member Data Documentation

◆ _channels_in

unsigned int Inkscape::Colors::CMS::Transform::_channels_in

Definition at line 70 of file transform.h.

Referenced by do_transform(), and set_gamut_warn().

◆ _channels_out

unsigned int Inkscape::Colors::CMS::Transform::_channels_out

Definition at line 71 of file transform.h.

Referenced by do_transform().

◆ _context

cmsContext Inkscape::Colors::CMS::Transform::_context
private

Definition at line 65 of file transform.h.

Referenced by set_gamut_warn(), and ~Transform().

◆ _handle

cmsHTRANSFORM Inkscape::Colors::CMS::Transform::_handle
private

Definition at line 64 of file transform.h.

Referenced by check_gamut(), do_transform(), do_transform(), getHandle(), Transform(), and ~Transform().


The documentation for this class was generated from the following files: