Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!newstop!sun!argv From: argv@turnpike.Eng.Sun.COM (Dan Heller) Newsgroups: comp.windows.x.motif Subject: Re: Loading pixmap in drawn button on color display? Message-ID: <141427@sun.Eng.Sun.COM> Date: 28 Aug 90 07:38:50 GMT References: <1990Aug27.005946.5857@elroy.jpl.nasa.gov> <1990Aug27.132311.11381@sunrise.com> <141351@sun.Eng.Sun.COM> <1990Aug27.175009.29113@elroy.jpl.nasa.gov> Sender: news@sun.Eng.Sun.COM Organization: O'Reilly && Associates Lines: 27 In article <1990Aug27.175009.29113@elroy.jpl.nasa.gov> pjs@aristotle.jpl.nasa.gov writes: > In article <141351@sun.Eng.Sun.COM>, argv@turnpike.Eng.Sun.COM (Dan > Heller) writes: > > In article larry@sunrise.com (Larry Rogers) writes: > > > You have to generate an image and then generate a pixmap from the > > > image. An easier solution under Motif is to use XmGetPixmap. It > > In this particular person's application, he is allowing the user > > to select (at run time) a bitmap file. He's got to load the file > > somehow, and the only way to do it is into a pixmap. > XmGetPixmap states "... If an image is not found, the image_name is > used as a filename, and a search is made for an X10 or X11 bitmap file. Yes, this is true -- but the pixmap is still cached. Having an application that browses a directory of bitmaps is going to eat up all your memory quickly if those images are never freed. > I just reprogrammed it this way and it works on both the B/W and > color systems. And the code is a lot shorter! Thanks, Larry. Don't misunderstand my intentions here. I am not discarding XmGetPixmap(). It's a great convenience function. I'm just suggesting that problems may arise if you are not careful -- caches, as we all know, can fill up real fast if used inappropriately. -- dan ---------------------------------------------------- O'Reilly && Associates argv@sun.com / argv@ora.com Opinions expressed reflect those of the author only.