本文整理汇总了C++中cmsCreateTransform函数的典型用法代码示例。如果您正苦于以下问题:C++ cmsCreateTransform函数的具体用法?C++ cmsCreateTransform怎么用?C++ cmsCreateTransform使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cmsCreateTransform函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WriteNamedColorCRD
static
int WriteNamedColorCRD(cmsIOHANDLER* m, cmsHPROFILE hNamedColor, int Intent, cmsUInt32Number dwFlags)
{
cmsHTRANSFORM xform;
int i, nColors, nColorant;
cmsUInt32Number OutputFormat;
char ColorName[32];
char Colorant[128];
cmsNAMEDCOLORLIST* NamedColorList;
OutputFormat = cmsFormatterForColorspaceOfProfile(hNamedColor, 2, FALSE);
nColorant = T_CHANNELS(OutputFormat);
xform = cmsCreateTransform(hNamedColor, TYPE_NAMED_COLOR_INDEX, NULL, OutputFormat, Intent, dwFlags);
if (xform == NULL) return 0;
NamedColorList = cmsGetNamedColorList(xform);
if (NamedColorList == NULL) return 0;
_cmsIOPrintf(m, "<<\n");
_cmsIOPrintf(m, "(colorlistcomment) (%s) \n", "Named profile");
_cmsIOPrintf(m, "(Prefix) [ (Pantone ) (PANTONE ) ]\n");
_cmsIOPrintf(m, "(Suffix) [ ( CV) ( CVC) ( C) ]\n");
nColors = cmsNamedColorCount(NamedColorList);
for (i=0; i < nColors; i++) {
cmsUInt16Number In[1];
cmsUInt16Number Out[cmsMAXCHANNELS];
In[0] = (cmsUInt16Number) i;
if (!cmsNamedColorInfo(NamedColorList, i, ColorName, NULL, NULL, NULL, NULL))
continue;
cmsDoTransform(xform, In, Out, 1);
BuildColorantList(Colorant, nColorant, Out);
_cmsIOPrintf(m, " (%s) [ %s ]\n", ColorName, Colorant);
}
_cmsIOPrintf(m, " >>");
if (!(dwFlags & cmsFLAGS_NODEFAULTRESOURCEDEF)) {
_cmsIOPrintf(m, " /Current exch /HPSpotTable defineresource pop\n");
}
cmsDeleteTransform(xform);
return 1;
}
示例2: gui_init
void gui_init(struct dt_iop_module_t *self)
{
self->gui_data = malloc(sizeof(dt_iop_colortransfer_gui_data_t));
self->widget = gtk_label_new(_("this module will be removed in the future\nand is only here so you can "
"switch it off\nand move to the new color mapping module."));
gtk_misc_set_alignment(GTK_MISC(self->widget), 0.0f, 0.5f);
#if 0
self->gui_data = malloc(sizeof(dt_iop_colortransfer_gui_data_t));
dt_iop_colortransfer_gui_data_t *g = (dt_iop_colortransfer_gui_data_t *)self->gui_data;
// dt_iop_colortransfer_params_t *p = (dt_iop_colortransfer_params_t *)self->params;
g->flowback_set = 0;
g->hsRGB = dt_colorspaces_create_srgb_profile();
g->hLab = dt_colorspaces_create_lab_profile();
g->xform = cmsCreateTransform(g->hLab, TYPE_Lab_DBL, g->hsRGB, TYPE_RGB_DBL, INTENT_PERCEPTUAL, 0);
self->widget = GTK_WIDGET(gtk_vbox_new(FALSE, DT_GUI_IOP_MODULE_CONTROL_SPACING));
g_signal_connect (G_OBJECT(self->widget), "expose-event",
G_CALLBACK(expose), self);
g->area = gtk_drawing_area_new();
gtk_widget_set_size_request(GTK_WIDGET(g->area), 300, 100);
gtk_box_pack_start(GTK_BOX(self->widget), g->area, TRUE, TRUE, 0);
g_signal_connect (G_OBJECT (g->area), "expose-event", G_CALLBACK (cluster_preview_expose), self);
GtkBox *box = GTK_BOX(gtk_hbox_new(FALSE, 5));
gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(box), TRUE, TRUE, 0);
GtkWidget *button;
g->spinbutton = GTK_SPIN_BUTTON(gtk_spin_button_new_with_range(1, MAXN, 1));
g_object_set(G_OBJECT(g->spinbutton), "tooltip-text", _("number of clusters to find in image"), (char *)NULL);
gtk_box_pack_start(box, GTK_WIDGET(g->spinbutton), FALSE, FALSE, 0);
g_signal_connect(G_OBJECT(g->spinbutton), "value-changed", G_CALLBACK(spinbutton_changed), (gpointer)self);
button = dtgtk_button_new_with_label(_("acquire"), NULL, CPF_STYLE_FLAT|CPF_DO_NOT_USE_BORDER);
g->acquire_button = button;
g_object_set(G_OBJECT(button), "tooltip-text", _("analyze this image"), (char *)NULL);
gtk_box_pack_start(box, button, TRUE, TRUE, 0);
g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(acquire_button_pressed), (gpointer)self);
g->apply_button = dtgtk_button_new_with_label(_("apply"), NULL, CPF_STYLE_FLAT|CPF_DO_NOT_USE_BORDER);
g_object_set(G_OBJECT(g->apply_button), "tooltip-text", _("apply previously analyzed image look to this image"), (char *)NULL);
gtk_box_pack_start(box, g->apply_button, TRUE, TRUE, 0);
g_signal_connect(G_OBJECT(g->apply_button), "clicked", G_CALLBACK(apply_button_pressed), (gpointer)self);
FILE *f = fopen("/tmp/dt_colortransfer_loaded", "rb");
if(f)
{
if(fread(&g->flowback, self->params_size, 1, f) > 0) g->flowback_set = 1;
fclose(f);
}
else gtk_widget_set_sensitive(GTK_WIDGET(g->apply_button), FALSE);
#endif
}
示例3: gui_init
void gui_init(struct dt_iop_module_t *self)
{
self->gui_data = malloc(sizeof(dt_iop_colortransfer_gui_data_t));
self->widget = gtk_label_new(_("this module will be removed in the future\nand is only here so you can "
"switch it off\nand move to the new color mapping module."));
gtk_widget_set_halign(self->widget, GTK_ALIGN_START);
#if 0
self->gui_data = malloc(sizeof(dt_iop_colortransfer_gui_data_t));
dt_iop_colortransfer_gui_data_t *g = (dt_iop_colortransfer_gui_data_t *)self->gui_data;
// dt_iop_colortransfer_params_t *p = (dt_iop_colortransfer_params_t *)self->params;
g->flowback_set = 0;
cmsHPROFILE hsRGB = dt_colorspaces_get_profile(DT_COLORSPACE_SRGB, "", DT_PROFILE_DIRECTION_IN)->profile;
cmsHPROFILE hLab = dt_colorspaces_get_profile(DT_COLORSPACE_LAB, "", DT_PROFILE_DIRECTION_ANY)->profile;
g->xform = cmsCreateTransform(hLab, TYPE_Lab_DBL, hsRGB, TYPE_RGB_DBL, INTENT_PERCEPTUAL, 0);
self->widget = GTK_WIDGET(gtk_box_new(GTK_ORIENTATION_VERTICAL, DT_GUI_IOP_MODULE_CONTROL_SPACING));
g_signal_connect (G_OBJECT(self->widget), "draw",
G_CALLBACK(draw), self);
g->area = gtk_drawing_area_new();
gtk_widget_set_size_request(GTK_WIDGET(g->area), 300, 100);
gtk_box_pack_start(GTK_BOX(self->widget), g->area, TRUE, TRUE, 0);
g_signal_connect (G_OBJECT (g->area), "draw", G_CALLBACK (cluster_preview_draw), self);
GtkBox *box = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5));
gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(box), TRUE, TRUE, 0);
GtkWidget *button;
g->spinbutton = GTK_SPIN_BUTTON(gtk_spin_button_new_with_range(1, MAXN, 1));
gtk_widget_set_tooltip_text(GTK_WIDGET(g->spinbutton), _("number of clusters to find in image"));
gtk_box_pack_start(box, GTK_WIDGET(g->spinbutton), FALSE, FALSE, 0);
g_signal_connect(G_OBJECT(g->spinbutton), "value-changed", G_CALLBACK(spinbutton_changed), (gpointer)self);
button = gtk_button_new_with_label(_("acquire"));
g->acquire_button = button;
gtk_widget_set_tooltip_text(button, _("analyze this image"));
gtk_box_pack_start(box, button, TRUE, TRUE, 0);
g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(acquire_button_pressed), (gpointer)self);
g->apply_button = gtk_button_new_with_label(_("apply"));
gtk_widget_set_tooltip_text(g->apply_button, _("apply previously analyzed image look to this image"));
gtk_box_pack_start(box, g->apply_button, TRUE, TRUE, 0);
g_signal_connect(G_OBJECT(g->apply_button), "clicked", G_CALLBACK(apply_button_pressed), (gpointer)self);
FILE *f = g_fopen("/tmp/dt_colortransfer_loaded", "rb");
if(f)
{
if(fread(&g->flowback, self->params_size, 1, f) > 0) g->flowback_set = 1;
fclose(f);
}
else gtk_widget_set_sensitive(GTK_WIDGET(g->apply_button), FALSE);
#endif
}
示例4: cmmCreateTransform
cmsHTRANSFORM cmmCreateTransform(cmsHPROFILE Input,
DWORD InputFormat,
cmsHPROFILE Output,
DWORD OutputFormat,
int Intent,
DWORD dwFlags) {
// Make sure that modifications are saved in the profile buffer for both in and out
updateAll(Input);
updateAll(Output);
// Pass profiles to LCMS
return cmsCreateTransform(Input, InputFormat, Output, OutputFormat, Intent, dwFlags);
}
示例5: convert_space
void* convert_space (const void *source_data_ptr, int width, int height) {
// Assign the memory for the transform
void *YourOutputBuffer = malloc(sizeof(void)*width*height*4);
// Create the required variables
cmsHPROFILE hInProfile, hOutProfile;
cmsHTRANSFORM hTransform;
// Load the colour profiles
hInProfile = cmsOpenProfileFromFile("/Library/Application Support/Nikon/Profiles/NKAdobe.icm", "r");
hOutProfile = cmsCreate_sRGBProfile();
// Create the transform matrix
hTransform = cmsCreateTransform(hInProfile,
TYPE_RGBA_8,
hOutProfile,
TYPE_RGBA_8,
INTENT_PERCEPTUAL,
0);
// Convert the image colours
cmsDoTransform(hTransform,
source_data_ptr,
YourOutputBuffer,
width*height);
// Delete the opened stuff
cmsDeleteTransform(hTransform);
cmsCloseProfile(hInProfile);
cmsCloseProfile(hOutProfile);
// Create the return data object
// CFDataRef ret_val = CFDataCreate (NULL, YourOutputBuffer, height * width * 4);
// release the old image
// CFRelease (source_data_ptr);
// Null the pointer after releasing
source_data_ptr = NULL;
// NULL the pointer
source_data_ptr = NULL;
// Free the temp buffer for the colour space image
// free(YourOutputBuffer);
fprintf(stdout, "Colour space converted.");
// return the new image
return YourOutputBuffer;
}
示例6: gcm_cell_renderer_set_color
static void
gcm_cell_renderer_set_color (GcmCellRendererColor *renderer)
{
CdColorRGB8 rgb;
GdkPixbuf *pixbuf = NULL;
gint height = 26; /* TODO: needs to be a property */
gint width = 400; /* TODO: needs to be a property */
gint x, y;
guchar *pixels;
guint pos;
cmsHPROFILE profile_srgb = NULL;
cmsHPROFILE profile_lab = NULL;
cmsHTRANSFORM xform = NULL;
/* nothing set yet */
if (renderer->color == NULL)
goto out;
/* convert the color to sRGB */
profile_lab = cmsCreateLab2Profile (NULL);
profile_srgb = cmsCreate_sRGBProfile ();
xform = cmsCreateTransform (profile_lab, TYPE_Lab_DBL,
profile_srgb, TYPE_RGB_8,
INTENT_ABSOLUTE_COLORIMETRIC, 0);
cmsDoTransform (xform, renderer->color, &rgb, 1);
/* create a pixbuf of the right size */
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, width, height);
width = gdk_pixbuf_get_width (pixbuf);
height = gdk_pixbuf_get_height (pixbuf);
pixels = gdk_pixbuf_get_pixels (pixbuf);
for (y=0; y<height; y++) {
for (x=0; x<width; x++) {
pos = (y*width+x) * 3;
pixels[pos+0] = rgb.R;
pixels[pos+1] = rgb.G;
pixels[pos+2] = rgb.B;
}
}
out:
g_object_set (renderer, "pixbuf", pixbuf, NULL);
if (profile_srgb != NULL)
cmsCloseProfile (profile_srgb);
if (profile_lab != NULL)
cmsCloseProfile (profile_lab);
if (xform != NULL)
cmsDeleteTransform (xform);
if (pixbuf != NULL)
g_object_unref (pixbuf);
}
示例7: dkCmsCreateTransform
cmsHTRANSFORM dkCmsCreateTransform(cmsHPROFILE Input,
DWORD InputFormat,
cmsHPROFILE Output,
DWORD OutputFormat,
int Intent,
DWORD dwFlags)
{
return cmsCreateTransform(Input,
static_cast<cmsUInt32Number>( InputFormat ),
Output,
static_cast<cmsUInt32Number>( OutputFormat ),
static_cast<cmsUInt32Number>( Intent ),
static_cast<cmsUInt32Number>( dwFlags ));
}
示例8: Q_ASSERT
void IccColorProfile::calculateFloatUIMinMax(void)
{
QVector<KoChannelInfo::DoubleRange> &ret = d->shared->uiMinMaxes;
cmsHPROFILE cprofile = d->shared->lcmsProfile->lcmsProfile();
Q_ASSERT(cprofile);
cmsColorSpaceSignature color_space_sig = cmsGetColorSpace(cprofile);
unsigned int num_channels = cmsChannelsOf(color_space_sig);
unsigned int color_space_mask = _cmsLCMScolorSpace(color_space_sig);
Q_ASSERT(num_channels>=1 && num_channels <=4); // num_channels==1 is for grayscale, we need to handle it
Q_ASSERT(color_space_mask);
// to try to find the max range of float/doubles for this profile,
// pass in min/max int and make the profile convert that
// this is far from perfect, we need a better way, if possible to get the "bounds" of a profile
uint16_t in_min_pixel[4] = {0,0,0,0};
uint16_t in_max_pixel[4] = {0xFFFF,0xFFFF,0xFFFF,0xFFFF};
double out_min_pixel[4] = {0,0,0,0};
double out_max_pixel[4] = {0,0,0,0};
cmsHTRANSFORM trans = cmsCreateTransform(
cprofile,
(COLORSPACE_SH(color_space_mask)|CHANNELS_SH(num_channels)|BYTES_SH(2)),
cprofile,
(COLORSPACE_SH(color_space_mask)|FLOAT_SH(1)|CHANNELS_SH(num_channels)|BYTES_SH(0)), //NOTE THAT 'BYTES' FIELD IS SET TO ZERO ON DLB because 8 bytes overflows the bitfield
INTENT_PERCEPTUAL, 0); // does the intent matter in this case?
if (trans) {
cmsDoTransform(trans, in_min_pixel, out_min_pixel, 1);
cmsDoTransform(trans, in_max_pixel, out_max_pixel, 1);
cmsDeleteTransform(trans);
}//else, we'll just default to [0..1] below
ret.resize(num_channels);
for (unsigned int i=0; i<num_channels; ++i) {
if (out_min_pixel[i] < out_max_pixel[i]) {
ret[i].minVal = out_min_pixel[i];
ret[i].maxVal = out_max_pixel[i];
} else {
// aparently we can't even guarentee that converted_to_double(0x0000) < converted_to_double(0xFFFF)
// assume [0..1] in such cases
// we need to find a really solid way of determining the bounds of a profile, if possible
ret[i].minVal = 0;
ret[i].maxVal = 1;
}
}
}
示例9: main
int main(int argc, char* argv[])
{
int r, g, b;
cmsUInt8Number RGB[3], RGB_OUT[3];
cmsHTRANSFORM xform;
cmsHPROFILE hProfile;
double err, SumX=0, SumX2=0, Peak = 0, n = 0;
if (argc != 2) {
printf("roundtrip <RGB icc profile>\n");
return 1;
}
hProfile = cmsOpenProfileFromFile(argv[1], "r");
xform = cmsCreateTransform(hProfile,TYPE_RGB_8, hProfile, TYPE_RGB_8, INTENT_RELATIVE_COLORIMETRIC, cmsFLAGS_NOOPTIMIZE);
for (r=0; r< 256; r++) {
printf("%d \r", r);
for (g=0; g < 256; g++) {
for (b=0; b < 256; b++) {
RGB[0] = r;
RGB[1] = g;
RGB[2] = b;
cmsDoTransform(xform, RGB, RGB_OUT, 1);
err = VecDist(RGB, RGB_OUT);
SumX += err;
SumX2 += err * err;
n += 1.0;
if (err > Peak)
Peak = err;
}
}
}
printf("Average %g\n", SumX / n);
printf("Max %g\n", Peak);
printf("Std %g\n", sqrt((n*SumX2 - SumX * SumX) / (n*(n-1))));
cmsCloseProfile(hProfile);
cmsDeleteTransform(xform);
return 0;
}
示例10: gui_init
void gui_init(struct dt_iop_module_t *self)
{
self->gui_data = malloc(sizeof(dt_iop_monochrome_gui_data_t));
dt_iop_monochrome_gui_data_t *g = (dt_iop_monochrome_gui_data_t *)self->gui_data;
g->dragging = 0;
self->request_color_pick = DT_REQUEST_COLORPICK_OFF;
self->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, DT_BAUHAUS_SPACE);
dt_gui_add_help_link(self->widget, dt_get_help_url(self->op));
g->area = GTK_DRAWING_AREA(dtgtk_drawing_area_new_with_aspect_ratio(1.0));
gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(g->area), TRUE, TRUE, 0);
gtk_widget_set_tooltip_text(GTK_WIDGET(g->area), _("drag and scroll mouse wheel to adjust the virtual color filter"));
gtk_widget_add_events(GTK_WIDGET(g->area), GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK
| GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
| GDK_LEAVE_NOTIFY_MASK | darktable.gui->scroll_mask);
g_signal_connect(G_OBJECT(g->area), "draw", G_CALLBACK(dt_iop_monochrome_draw), self);
g_signal_connect(G_OBJECT(g->area), "button-press-event", G_CALLBACK(dt_iop_monochrome_button_press), self);
g_signal_connect(G_OBJECT(g->area), "button-release-event", G_CALLBACK(dt_iop_monochrome_button_release),
self);
g_signal_connect(G_OBJECT(g->area), "motion-notify-event", G_CALLBACK(dt_iop_monochrome_motion_notify),
self);
g_signal_connect(G_OBJECT(g->area), "leave-notify-event", G_CALLBACK(dt_iop_monochrome_leave_notify), self);
g_signal_connect(G_OBJECT(g->area), "scroll-event", G_CALLBACK(dt_iop_monochrome_scrolled), self);
GtkWidget *box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, DT_BAUHAUS_SPACE);
g->highlights = dt_bauhaus_slider_new_with_range(self, 0.0, 1.0, 0.01, 0.0, 2);
gtk_widget_set_tooltip_text(g->highlights, _("how much to keep highlights"));
dt_bauhaus_widget_set_label(g->highlights, NULL, _("highlights"));
gtk_box_pack_start(GTK_BOX(box), g->highlights, TRUE, TRUE, 0);
g_signal_connect(G_OBJECT(g->highlights), "value-changed", G_CALLBACK(highlights_callback), self);
g->colorpicker = dtgtk_togglebutton_new(dtgtk_cairo_paint_colorpicker, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER, NULL);
gtk_widget_set_size_request(GTK_WIDGET(g->colorpicker), DT_PIXEL_APPLY_DPI(14), DT_PIXEL_APPLY_DPI(14));
gtk_box_pack_end(GTK_BOX(box), GTK_WIDGET(g->colorpicker), FALSE, FALSE, 0);
g_signal_connect(G_OBJECT(g->colorpicker), "toggled", G_CALLBACK(picker_callback), self);
gtk_box_pack_end(GTK_BOX(self->widget), GTK_WIDGET(box), TRUE, TRUE, 0);
cmsHPROFILE hsRGB = dt_colorspaces_get_profile(DT_COLORSPACE_SRGB, "", DT_PROFILE_DIRECTION_IN)->profile;
cmsHPROFILE hLab = dt_colorspaces_get_profile(DT_COLORSPACE_LAB, "", DT_PROFILE_DIRECTION_ANY)->profile;
g->xform = cmsCreateTransform(hLab, TYPE_Lab_DBL, hsRGB, TYPE_RGB_DBL, INTENT_PERCEPTUAL,
0); // cmsFLAGS_NOTPRECALC);
}
示例11: WriteNamedColorCSA
static
int WriteNamedColorCSA(cmsIOHANDLER* m, cmsHPROFILE hNamedColor, int Intent)
{
cmsHTRANSFORM xform;
cmsHPROFILE hLab;
int i, nColors;
char ColorName[32];
cmsNAMEDCOLORLIST* NamedColorList;
hLab = cmsCreateLab4ProfileTHR(m ->ContextID, NULL);
xform = cmsCreateTransform(hNamedColor, TYPE_NAMED_COLOR_INDEX, hLab, TYPE_Lab_DBL, Intent, 0);
if (xform == NULL) return 0;
NamedColorList = cmsGetNamedColorList(xform);
if (NamedColorList == NULL) return 0;
_cmsIOPrintf(m, "<<\n");
_cmsIOPrintf(m, "(colorlistcomment) (%s)\n", "Named color CSA");
_cmsIOPrintf(m, "(Prefix) [ (Pantone ) (PANTONE ) ]\n");
_cmsIOPrintf(m, "(Suffix) [ ( CV) ( CVC) ( C) ]\n");
nColors = cmsNamedColorCount(NamedColorList);
for (i=0; i < nColors; i++) {
cmsUInt16Number In[1];
cmsCIELab Lab;
In[0] = (cmsUInt16Number) i;
if (!cmsNamedColorInfo(NamedColorList, i, ColorName, NULL, NULL, NULL, NULL))
continue;
cmsDoTransform(xform, In, &Lab, 1);
_cmsIOPrintf(m, " (%s) [ %.3f %.3f %.3f ]\n", ColorName, Lab.L, Lab.a, Lab.b);
}
_cmsIOPrintf(m, ">>\n");
cmsDeleteTransform(xform);
cmsCloseProfile(hLab);
return 1;
}
示例12: main
int main(void) {
cmsHPROFILE hInProfile, hOutProfile;
cmsHTRANSFORM hTransform;
int i;
hInProfile = cmsOpenProfileFromFile("USWebCoatedSWOP.icc", "r");
hOutProfile = cmsOpenProfileFromFile("AdobeRGB1998.icc", "r");
hTransform = cmsCreateTransform(hInProfile, TYPE_CMYK_8,
hOutProfile, TYPE_RGB_8, INTENT_PERCEPTUAL, 0);
cmsCloseProfile(hInProfile);
cmsCloseProfile(hOutProfile);
return 0;
}
示例13: gscms_get_link
/* Get the link from the CMS. TODO: Add error checking */
gcmmhlink_t
gscms_get_link(gcmmhprofile_t lcms_srchandle,
gcmmhprofile_t lcms_deshandle,
gsicc_rendering_param_t *rendering_params)
{
DWORD src_data_type,des_data_type;
icColorSpaceSignature src_color_space,des_color_space;
int src_nChannels,des_nChannels;
int lcms_src_color_space, lcms_des_color_space;
/* Check for case of request for a transfrom from a device link profile
in that case, the destination profile is NULL */
/* First handle all the source stuff */
src_color_space = cmsGetColorSpace(lcms_srchandle);
lcms_src_color_space = _cmsLCMScolorSpace(src_color_space);
/* littlecms returns -1 for types it does not (but should) understand */
if (lcms_src_color_space < 0) lcms_src_color_space = 0;
src_nChannels = _cmsChannelsOf(src_color_space);
/* For now, just do single byte data, interleaved. We can change this
when we use the transformation. */
src_data_type = (COLORSPACE_SH(lcms_src_color_space)|
CHANNELS_SH(src_nChannels)|BYTES_SH(2));
if (lcms_deshandle != NULL) {
des_color_space = cmsGetColorSpace(lcms_deshandle);
} else {
/* We must have a device link profile. */
des_color_space = cmsGetPCS(lcms_deshandle);
}
lcms_des_color_space = _cmsLCMScolorSpace(des_color_space);
if (lcms_des_color_space < 0) lcms_des_color_space = 0;
des_nChannels = _cmsChannelsOf(des_color_space);
des_data_type = (COLORSPACE_SH(lcms_des_color_space)|
CHANNELS_SH(des_nChannels)|BYTES_SH(2));
/* Create the link */
return(cmsCreateTransform(lcms_srchandle, src_data_type, lcms_deshandle,
des_data_type, rendering_params->rendering_intent,
(cmsFLAGS_BLACKPOINTCOMPENSATION | cmsFLAGS_HIGHRESPRECALC)));
/* cmsFLAGS_HIGHRESPRECALC) cmsFLAGS_NOTPRECALC cmsFLAGS_LOWRESPRECALC*/
}
示例14: gui_init
void gui_init(struct dt_iop_module_t *self)
{
self->gui_data = malloc(sizeof(dt_iop_colorcorrection_gui_data_t));
dt_iop_colorcorrection_gui_data_t *g = (dt_iop_colorcorrection_gui_data_t *)self->gui_data;
g->selected = 0;
self->widget = gtk_vbox_new(FALSE, DT_BAUHAUS_SPACE);
g->area = GTK_DRAWING_AREA(gtk_drawing_area_new());
GtkWidget *asp = gtk_aspect_frame_new(NULL, 0.5, 0.5, 1.0, TRUE);
gtk_box_pack_start(GTK_BOX(self->widget), asp, TRUE, TRUE, 0);
gtk_container_add(GTK_CONTAINER(asp), GTK_WIDGET(g->area));
gtk_drawing_area_size(g->area, 258, 258);
g_object_set (GTK_OBJECT(g->area), "tooltip-text", _("drag the line for split toning. "
"bright means highlights, dark means shadows. "
"use mouse wheel to change saturation."), (char *)NULL);
gtk_widget_add_events(GTK_WIDGET(g->area), GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_LEAVE_NOTIFY_MASK);
g_signal_connect (G_OBJECT (g->area), "expose-event",
G_CALLBACK (dt_iop_colorcorrection_expose), self);
g_signal_connect (G_OBJECT (g->area), "button-press-event",
G_CALLBACK (dt_iop_colorcorrection_button_press), self);
g_signal_connect (G_OBJECT (g->area), "motion-notify-event",
G_CALLBACK (dt_iop_colorcorrection_motion_notify), self);
g_signal_connect (G_OBJECT (g->area), "leave-notify-event",
G_CALLBACK (dt_iop_colorcorrection_leave_notify), self);
g_signal_connect (G_OBJECT (g->area), "scroll-event",
G_CALLBACK (dt_iop_colorcorrection_scrolled), self);
g->slider = dt_bauhaus_slider_new_with_range(self, -3.0f, 3.0f, 0.01f, 1.0f, 2);
gtk_box_pack_start(GTK_BOX(self->widget), g->slider, TRUE, TRUE, 0);
g_object_set (GTK_OBJECT(g->slider), "tooltip-text", _("set the global saturation"), (char *)NULL);
dt_bauhaus_widget_set_label(g->slider,_("saturation"));
g_signal_connect (G_OBJECT (g->slider), "value-changed",
G_CALLBACK (sat_callback), self);
g->hsRGB = dt_colorspaces_create_srgb_profile();
g->hLab = dt_colorspaces_create_lab_profile();
g->xform = cmsCreateTransform(g->hLab, TYPE_Lab_DBL, g->hsRGB, TYPE_RGB_DBL,
INTENT_PERCEPTUAL, 0);//cmsFLAGS_NOTPRECALC);
}
示例15: _buildTransform
static cmsHTRANSFORM
_buildTransform(cmsHPROFILE hInputProfile, cmsHPROFILE hOutputProfile, char *sInMode, char *sOutMode, int iRenderingIntent, cmsUInt32Number cmsFLAGS)
{
cmsHTRANSFORM hTransform;
Py_BEGIN_ALLOW_THREADS
/* create the transform */
hTransform = cmsCreateTransform(hInputProfile,
findLCMStype(sInMode),
hOutputProfile,
findLCMStype(sOutMode),
iRenderingIntent, cmsFLAGS);
Py_END_ALLOW_THREADS
if (!hTransform)
PyErr_SetString(PyExc_ValueError, "cannot build transform");
return hTransform; /* if NULL, an exception is set */
}