Hi Marti,

I want to know how many grid points are used in a clut tag. I've got code to achieve that, but I've had to do some dodgy casts in the process. The clut details are in _cmsStageCLutData from lcms2_plugin.h (I'm not using a plugin though), but to use it I've had to use _cmsStage_struct from lcms2_internal.h which isn't ideal. Is there some better way of doing this or is it something that I'll have to live with. I've included some simple code that I hope illustrates the problem.

Many thanks.

------------
#include "lcms2.h"
#include "lcms2_plugin.h"

#include "lcms2_internal.h"

void print_grid_points(void *p) {
    unsigned int i;
    void *pipeline;
    cmsStage *stage;
    struct _cmsStage_struct *stage_intern;
    _cmsStageCLutData *clut;

    // 'p' contains a clut.
    // We can easily find the clut stage of the A2B0 tag..
    pipeline = cmsReadTag(p, cmsSigAToB0Tag);
    stage = cmsPipelineGetPtrToFirstStage(pipeline);
    while (stage != NULL && cmsStageType(stage) != cmsSigCLutElemType)
        stage = cmsStageNext(stage);

// Accessing the clut details from lcms2_plugin.h requires exposing a struct
    // from lcms2_internal.h.
    stage_intern = (struct _cmsStage_struct *) stage;
    clut = (_cmsStageCLutData *) stage_intern->Data;

    // Print the grid points.
    printf("Number of grid points =");
    for (i = 0; i < clut->Params->nInputs; i++)
        printf(" %d,", clut->Params->nSamples[i]);
    printf("\n");
}
------------

John

------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Lcms-user mailing list
Lcms-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lcms-user

Reply via email to