/*
5 * Authors: see git history
7 * Copyright (C) 2018 Authors
8 * Released under GNU GPL v2+, read the file
'COPYING' for more information.
14#include <giomm/error.h>
66 _uri = std::make_unique<Inkscape::URI>(value, fn ? (
"file://" + std::string(fn)).c_str() :
nullptr);
75 _local = value ? value :
"";
81 _name = value ? value :
"";
90 if (pair.second == value) {
109 if ((flags & SP_OBJECT_WRITE_BUILD) && !
repr) {
113 if ((flags & SP_OBJECT_WRITE_ALL) ||
_uri) {
136 return _uri->getContents();
137 }
catch (
const Gio::Error &e) {
138 g_warning(
"Couldn't get color profile: %s", e.what());
168 std::optional<Colors::RenderingIntent> intent)
171 g_error(
"Refusing to create a color profile with an empty name!");
Lookup dictionary for attributes/properties.
std::string getProfileData() const
Return the profile data, if any.
Colors::RenderingIntent _intent
static ColorProfile * createFromProfile(SPDocument *doc, Colors::CMS::Profile const &profile, std::string const &name, ColorProfileStorage storage, std::optional< Colors::RenderingIntent > intent)
Create a profile for the given profile in the given document.
std::unique_ptr< Inkscape::URI > _uri
void set(SPAttr key, char const *value) override
Callback: set attribute.
void build(SPDocument *doc, Inkscape::XML::Node *repr) override
Callback: set attributes from associated repr.
Inkscape::XML::Node * write(Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, unsigned int flags) override
Callback: write attributes to associated repr.
void setRenderingIntent(Colors::RenderingIntent intent)
Set the rendering intent for this color profile.
const std::string & getId() const
std::string dumpBase64() const
Dump the entire profile as a base64 encoded string.
std::string const & getPath() const
static URI from_native_filename(char const *path)
Construct a "file" URI from an absolute filename.
Interface for refcounted XML nodes.
void setAttributeOrRemoveIfEmpty(Inkscape::Util::const_char_ptr key, Inkscape::Util::const_char_ptr value)
Change an attribute of this node.
Typed SVG document implementation.
bool removeResource(char const *key, SPObject *object)
char const * getDocumentFilename() const
bool addResource(char const *key, SPObject *object)
SPDefs * getDefs()
Return the main defs object for the document.
Inkscape::XML::Document * getReprDoc()
Our Inkscape::XML::Document.
Inkscape::XML::Node * repr
void setAttribute(Inkscape::Util::const_char_ptr key, Inkscape::Util::const_char_ptr value)
void requestModified(unsigned int flags)
Requests that a modification notification signal be emitted later (e.g.
virtual void set(SPAttr key, const char *value)
virtual Inkscape::XML::Node * write(Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, unsigned int flags)
void readAttr(char const *key)
Read value of key attribute from XML node into object.
SPObject * appendChildRepr(Inkscape::XML::Node *repr)
Append repr as child of this object.
virtual void build(SPDocument *doc, Inkscape::XML::Node *repr)
SPObject of the color-profile object found a direct child of defs.
static std::map< RenderingIntent, std::string > intentIds
Helper class to stream background task notifications as a series of messages.
void setHrefAttribute(XML::Node &node, Util::const_char_ptr value)
If the 'href' attribute already exists for the given node, then set a new value for it.
static cairo_user_data_key_t key
Singleton class to access the preferences file in a convenient way.
Authors: see git history.
Interface for XML documents.
virtual Node * createElement(char const *name)=0
Interface for XML documents.