On Thu, Sep 20, 2001 at 03:05:23PM +0100, Angus Leeming wrote:

> > It's because we need to do the equivalent of :
> > 
> >         xpm_col.name = NULL;
> >         xpm_col.value = "none";
> >         xpm_col.pixel = backgroundcolor;
> >         xpm_attr.valuemask = XpmColorSymbols;
> >         xpm_attr.numsymbols = 1;
> >         xpm_attr.colorsymbols = &xpm_col;
> >         XpmCreatePixmapFromData(display, RootWindow(display,screen), 
> nofill_xpm, &nofill, &dummy, &xpm_attr);
> 
> ImageLoaderXPM::runImageLoader(string const & filename)
> {
>       Display * display = GUIRunTime::x11Display();
> 
>       //(BE 2000-08-05)
>       // This might be a dirty thing, but I dont know any other solution.
>       Screen * screen = ScreenOfDisplay(display, GUIRunTime::x11Screen());
> 
>       Pixmap pixmap;
>       Pixmap mask;
>       XpmAttributes attrib;
>       
>       attrib.valuemask = XpmCloseness;
>       attrib.closeness = 10000;
>       
>       int status = XpmReadFileToPixmap(
>                       display, 
>                       XRootWindowOfScreen(screen), 
>                       const_cast<char *>(filename.c_str()), 
>                       &pixmap, &mask, &attrib);
> 
> 
>       ...
> }
> 
> so this is where we should apply your "repair"? Ie, pass runImageLoader the 
> background pixel colour and set the attributes there.

I think so.

XpmColorSymbol xpm_col;

xpm_col.name = NULL;
xpm_col.value = "none";
xpm_col.pixel = lyxColorHandler->colorPixel(LColor::graphicsbg);
etc. etc.

should work I think ...

> Figinset does things differently. Ie, it modifies an already loaded pixmap. 
> Maybe this is better for us, because if we load an image and discover the 
> background colour is bad, we'll want to change that background and see an 
> effect.

I'm not sure what you mean here ... are you referring to if the user changes the
canvas bg colour or something ?

> Can we create, therefore, a
> ImageLoaderXPM::setBackgroundColor()
> that does the same as figinset in this regard?
> 
> Note that I have NO X skills so I'll need you to (at the very least) hold my 
> hand here!

Note the code you showed is actually done /before/ the rendering (check the execlp
below it).

To modify an image after its loaded we would need to mung the Pixmap with
XGet/PutPixel or something equally ugly.

hth,
john

-- 
"If you're not part of the problem, you're part of the problem space." 

Reply via email to