color-profile.cpp revision f4f363e00f5db7462fde1b988be156d80d02f502
#include "color-profile.h"
#include "color-profile-fns.h"
#include "attributes.h"
#include "inkscape.h"
#include "document.h"
#include "prefs-utils.h"
//#define DEBUG_LCMS
#ifdef DEBUG_LCMS
#include <gtk/gtkmessagedialog.h>
#endif // DEBUG_LCMS
using Inkscape::ColorProfile;
using Inkscape::ColorProfileClass;
namespace Inkscape
{
static void colorprofile_build( SPObject *object, SPDocument *document, Inkscape::XML::Node *repr );
static Inkscape::XML::Node *colorprofile_write( SPObject *object, Inkscape::XML::Node *repr, guint flags );
}
#ifdef DEBUG_LCMS
extern guint update_in_progress;
#define DEBUG_MESSAGE(key, ...) \
{\
if ( dump )\
{\
g_message( __VA_ARGS__ );\
\
}\
if ( dumpD )\
{\
);\
dialog); \
}\
}
#endif // DEBUG_LCMS
static SPObject *cprof_parent_class;
/**
* Register ColorProfile class and return its type.
*/
{
if (!type) {
sizeof(ColorProfileClass),
sizeof(ColorProfile),
16,
NULL, /* value_table */
};
}
return type;
}
/**
* ColorProfile vtable initialization.
*/
{
}
/**
* Callback for ColorProfile object initialization.
*/
{
#if ENABLE_LCMS
cprof->profHandle = 0;
#endif // ENABLE_LCMS
}
/**
* Callback: free object
*/
{
}
}
}
}
#if ENABLE_LCMS
if ( cprof->profHandle ) {
cprof->profHandle = 0;
}
#endif // ENABLE_LCMS
}
/**
* Callback: set attributes from associated repr.
*/
static void Inkscape::colorprofile_build( SPObject *object, SPDocument *document, Inkscape::XML::Node *repr )
{
}
}
/**
* Callback: set attribute.
*/
{
switch (key) {
case SP_ATTR_XLINK_HREF:
}
if ( value ) {
#if ENABLE_LCMS
// TODO open filename and URIs properly
//FILE* fp = fopen_utf8name( filename, "r" );
//LCMSAPI cmsHPROFILE LCMSEXPORT cmsOpenProfileFromMem(LPVOID MemPtr, DWORD dwSize);
// Try to open relative
if (!doc) {
g_warning("object has no document. using active");
}
//# 1. Get complete URI of document
if (!docbase)
{
g_warning("null docbase");
docbase = "";
}
//g_message("docbase:%s\n", docbase);
//# 2. Get href of icc file. we don't care if it's rel or abs
//# 3. Resolve the href according the docBase. This follows
// the w3c specs. All absolute and relative issues are considered
#ifdef DEBUG_LCMS
DEBUG_MESSAGE( lcmsOne, "cmsOpenProfileFromFile( '%s'...) = %p", fullname, (void*)cprof->profHandle );
#endif // DEBUG_LCMS
#endif // ENABLE_LCMS
}
}
break;
case SP_ATTR_LOCAL:
}
break;
case SP_ATTR_NAME:
}
#ifdef DEBUG_LCMS
#endif // DEBUG_LCMS
break;
case SP_ATTR_RENDERING_INTENT:
}
if ( value ) {
} else {
}
} else {
}
break;
default:
}
break;
}
}
/**
* Callback: write attributes to associated repr.
*/
static Inkscape::XML::Node* Inkscape::colorprofile_write( SPObject *object, Inkscape::XML::Node *repr, guint flags )
{
}
}
}
}
}
}
return repr;
}
#if ENABLE_LCMS
{
if ( curr ) {
if ( IS_COLORPROFILE(curr) ) {
if ( prof ) {
}
}
} else {
if ( curr->hasChildren() ) {
if ( !result ) {
}
};
}
}
}
return result;
}
cmsHPROFILE Inkscape::colorprofile_get_handle( SPDocument* document, guint* intent, gchar const* name )
{
cmsHPROFILE prof = 0;
if ( thing ) {
}
if ( intent ) {
}
#ifdef DEBUG_LCMS
DEBUG_MESSAGE( lcmsThree, "<color-profile> queried for profile of '%s'. Returning %p with intent of %d", name, prof, (intent? *intent:0) );
#endif // DEBUG_LCMS
return prof;
}
class ProfileInfo
{
public:
private:
};
{
}
{
for ( std::vector<ProfileInfo>::iterator it = knownProfiles.begin(); it != knownProfiles.end(); ++it ) {
}
}
return result;
}
{
for ( std::vector<ProfileInfo>::iterator it = knownProfiles.begin(); it != knownProfiles.end(); ++it ) {
break;
}
}
return result;
}
static void findThings() {
{
}
if (dir) {
if ( prof ) {
cmsCloseProfile( prof );
bool sameName = false;
for ( std::vector<ProfileInfo>::iterator it = knownProfiles.begin(); it != knownProfiles.end(); ++it ) {
sameName = true;
break;
}
}
if ( !sameName ) {
}
}
}
}
}
// toss the dirname
}
}
{
static cmsHPROFILE theOne = 0;
static bool init = false;
if ( !init ) {
findThings();
init = true;
}
long long int which = prefs_get_int_attribute_limited( "options.displayprofile", "enable", 0, 0, 1 );
if ( theOne ) {
}
if ( theOne ) {
// a display profile must have the proper stuff
if ( profClass != icSigDisplayClass ) {
g_warning("Not a display profile");
theOne = 0;
} else if ( space != icSigRgbData ) {
g_warning("Not an RGB profile");
theOne = 0;
} else {
}
}
}
} else if ( theOne ) {
theOne = 0;
}
return theOne;
}
#endif // ENABLE_LCMS
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :