Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

LibWmf Query

Help
sps
2014-01-10
2014-01-10
  • sps
    sps
    2014-01-10

    I am using the the libwmf (0.2.7)to convert wmf to png on mac os x. The
    resultant image has the colors messed up big time. I am attaching the wmf
    source file, the resultant file an the expected png file. You can see that
    all the colors are in red tone. What could be the reason? The code I have
    used is following

    wmfAPI_Options options;

        wmfAPI* API;
    
        wmf_error_t error;
    
        unsigned long flags = WMF_OPT_FUNCTION | WMF_OPT_IGNORE_NONFATAL;
    
        wmf_gd_t* ddata;
    
        options.function = wmf_gd_function;
    
        /* Other Options */
    
        error = wmf_api_create (&API,flags,&options);
    
        if (error != wmf_E_None) {
    
            wmf_api_destroy (API);
    
            return NULL;
    
        }
    
        ddata = WMF_GD_GetData (API);
    
        if ((ddata->flags & WMF_GD_SUPPORTS_PNG) == 0) {
    
            wmf_api_destroy (API);
    
            return NULL;
    
        }
    
        error = wmf_mem_open (API, (unsigned char*)data, size);
    
        if (error != wmf_E_None) {
    
            wmf_mem_close (API);
    
            wmf_api_destroy (API);
    
            return NULL;
    
        }
    
        wmfD_Rect bbox;
    
        error = wmf_scan (API, 0, &bbox);
    
        if (error != wmf_E_None) {
    
            wmf_api_destroy (API);
    
            return NULL;
    
        }
    

    if 1

        ddata->type = wmf_gd_png;
    
        ddata->flags |= WMF_GD_OUTPUT_MEMORY;
    
        ddata->bbox = bbox;
    
        ddata->width  = (unsigned int) ceil (ddata->bbox.BR.x - ddata->bbox.
    

    TL.x);

        ddata->height = (unsigned int) ceil (ddata->bbox.BR.y - ddata->bbox.
    

    TL.y);

    else

        FILE* out = fopen ("/file.jpeg","w");
    
        if (out == 0)
    
        { wmf_api_destroy (API);
    
            /* */
    
        }
    
        ddata->type = wmf_gd_jpeg;
    
        ddata->flags |= WMF_GD_OUTPUT_FILE;
    
        ddata->file = out;
    
        ddata->bbox = bbox;
    
        ddata->width  = (unsigned int) ceil (ddata->bbox.BR.x -
    

    ddata->bbox.TL.x);

        ddata->height = (unsigned int) ceil (ddata->bbox.BR.y -
    

    ddata->bbox.TL.y);

    endif

        error = wmf_play (API, 0, &bbox);
    
        if (error != wmf_E_None) {
    
            wmf_api_destroy (API);
    
        }