本文整理汇总了C++中cmsDeleteTransform函数的典型用法代码示例。如果您正苦于以下问题:C++ cmsDeleteTransform函数的具体用法?C++ cmsDeleteTransform怎么用?C++ cmsDeleteTransform使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cmsDeleteTransform函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lcms_image_transform_indexed
static void
lcms_image_transform_indexed (gint32 image,
cmsHPROFILE src_profile,
cmsHPROFILE dest_profile,
GimpColorRenderingIntent intent,
gboolean bpc)
{
cmsHTRANSFORM transform;
guchar *cmap;
gint n_cmap_bytes;
cmsUInt32Number format = TYPE_RGB_8;
cmap = gimp_image_get_colormap (image, &n_cmap_bytes);
transform = cmsCreateTransform (src_profile, format,
dest_profile, format,
intent,
cmsFLAGS_NOOPTIMIZE |
bpc ? cmsFLAGS_BLACKPOINTCOMPENSATION : 0);
if (transform)
{
cmsDoTransform (transform, cmap, cmap, n_cmap_bytes / 3);
cmsDeleteTransform (transform);
}
else
{
g_warning ("cmsCreateTransform() failed!");
}
gimp_image_set_colormap (image, cmap, n_cmap_bytes);
}
示例2: gscms_release_link
/* Have the CMS release the link */
void
gscms_release_link(gsicc_link_t *icclink)
{
if (icclink->link_handle !=NULL )
cmsDeleteTransform(icclink->link_handle);
icclink->link_handle = NULL;
}
示例3: gui_cleanup
void gui_cleanup(struct dt_iop_module_t *self)
{
dt_iop_colortransfer_gui_data_t *g = (dt_iop_colortransfer_gui_data_t *)self->gui_data;
dt_colorspaces_cleanup_profile(g->hsRGB);
dt_colorspaces_cleanup_profile(g->hLab);
cmsDeleteTransform(g->xform);
free(self->gui_data);
self->gui_data = NULL;
}
示例4: 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;
}
示例5: gimp_view_renderer_transform_free
static void
gimp_view_renderer_transform_free (GimpViewRenderer *renderer)
{
if (renderer->profile_transform)
{
cmsDeleteTransform (renderer->profile_transform);
renderer->profile_transform = NULL;
renderer->profile_src_format = NULL;
renderer->profile_dest_format = NULL;
}
}
示例6: gui_cleanup
void gui_cleanup(struct dt_iop_module_t *self)
{
dt_iop_colorzones_gui_data_t *c = (dt_iop_colorzones_gui_data_t *)self->gui_data;
dt_conf_set_int("plugins/darkroom/colorzones/gui_channel", c->channel);
dt_colorspaces_cleanup_profile(c->hsRGB);
dt_colorspaces_cleanup_profile(c->hLab);
cmsDeleteTransform(c->xform);
dt_draw_curve_destroy(c->minmax_curve);
free(self->gui_data);
self->gui_data = NULL;
}
示例7: cleanup_pipe
void cleanup_pipe(struct dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
{
dt_iop_colorout_data_t *d = (dt_iop_colorout_data_t *)piece->data;
if(d->xform)
{
cmsDeleteTransform(d->xform);
d->xform = NULL;
}
free(piece->data);
piece->data = NULL;
}
示例8: cdisplay_lcms_finalize
static void
cdisplay_lcms_finalize (GObject *object)
{
CdisplayLcms *lcms = CDISPLAY_LCMS (object);
if (lcms->transform)
{
cmsDeleteTransform (lcms->transform);
lcms->transform = NULL;
}
G_OBJECT_CLASS (cdisplay_lcms_parent_class)->finalize (object);
}
示例9: cleanup_pipe
void cleanup_pipe (struct dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
{
dt_iop_colorout_data_t *d = (dt_iop_colorout_data_t *)piece->data;
if(d->output) dt_colorspaces_cleanup_profile(d->output);
dt_colorspaces_cleanup_profile(d->Lab);
if (d->xform)
{
cmsDeleteTransform(d->xform);
d->xform = 0;
}
free(piece->data);
}
示例10: 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;
}
示例11: 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);
}
示例12: 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;
}
}
}
示例13: 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;
}
示例14: CloseTransforms
static
void CloseTransforms(void)
{
int i;
if (hColorTransform) cmsDeleteTransform(hColorTransform);
if (hInput) cmsCloseProfile(hInput);
if (hOutput) cmsCloseProfile(hOutput);
if (hProof) cmsCloseProfile(hProof);
for (i=0; i < nProfiles; i++)
cmsCloseProfile(hProfiles[i]);
hColorTransform = NULL; hInput = NULL; hOutput = NULL; hProof = NULL;
}
示例15: cmsDetectTAC
// Detect Total area coverage of the profile
cmsFloat64Number CMSEXPORT cmsDetectTAC(cmsHPROFILE hProfile)
{
cmsTACestimator bp;
cmsUInt32Number dwFormatter;
cmsUInt32Number GridPoints[MAX_INPUT_DIMENSIONS];
cmsHPROFILE hLab;
cmsContext ContextID = cmsGetProfileContextID(hProfile);
// TAC only works on output profiles
if (cmsGetDeviceClass(hProfile) != cmsSigOutputClass) {
return 0;
}
// Create a fake formatter for result
dwFormatter = cmsFormatterForColorspaceOfProfile(hProfile, 4, TRUE);
bp.nOutputChans = T_CHANNELS(dwFormatter);
bp.MaxTAC = 0; // Initial TAC is 0
// for safety
if (bp.nOutputChans >= cmsMAXCHANNELS) return 0;
hLab = cmsCreateLab4ProfileTHR(ContextID, NULL);
if (hLab == NULL) return 0;
// Setup a roundtrip on perceptual intent in output profile for TAC estimation
bp.hRoundTrip = cmsCreateTransformTHR(ContextID, hLab, TYPE_Lab_16,
hProfile, dwFormatter, INTENT_PERCEPTUAL, cmsFLAGS_NOOPTIMIZE|cmsFLAGS_NOCACHE);
cmsCloseProfile(hLab);
if (bp.hRoundTrip == NULL) return 0;
// For L* we only need black and white. For C* we need many points
GridPoints[0] = 6;
GridPoints[1] = 74;
GridPoints[2] = 74;
if (!cmsSliceSpace16(3, GridPoints, EstimateTAC, &bp)) {
bp.MaxTAC = 0;
}
cmsDeleteTransform(bp.hRoundTrip);
// Results in %
return bp.MaxTAC;
}