2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these libraries and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
24 * $XConsortium: PixmapGraphic.C /main/8 1996/10/04 11:07:06 drk $
26 * Copyright (c) 1992 HaL Computer Systems, Inc. All rights reserved.
27 * UNPUBLISHED -- rights reserved under the Copyright Laws of the United
28 * States. Use of a copyright notice is precautionary only and does not
29 * imply publication or disclosure.
31 * This software contains confidential information and trade secrets of HaL
32 * Computer Systems, Inc. Use, disclosure, or reproduction is prohibited
33 * without the prior express written permission of HaL Computer Systems, Inc.
35 * RESTRICTED RIGHTS LEGEND
36 * Use, duplication, or disclosure by the Government is subject to
37 * restrictions as set forth in subparagraph (c)(l)(ii) of the Rights in
38 * Technical Data and Computer Software clause at DFARS 252.227-7013.
39 * HaL Computer Systems, Inc.
40 * 1315 Dell Avenue, Campbell, CA 95008
47 #define C_WindowSystem
50 #define C_PixmapGraphic
55 // for GraphicsHandler
56 #define C_NodeWindowAgent
57 #define C_GraphicAgent
62 // /////////////////////////////////////////////////////////////////////////
64 // /////////////////////////////////////////////////////////////////////////
67 PixmapFromGraphic (void *gr)
69 return ((Graphic*) gr)->graphic()->pixmap();
72 // /////////////////////////////////////////////////////////////////////////
73 // regular constructor
74 // /////////////////////////////////////////////////////////////////////////
77 PixmapGraphic::PixmapGraphic(Pixmap pixmap, Dimension width, Dimension height,
91 // /////////////////////////////////////////////////////////////////////////
93 // /////////////////////////////////////////////////////////////////////////
95 PixmapGraphic::PixmapGraphic(const PixmapGraphic *pg)
96 : f_pixmap(pg->f_pixmap),
98 f_height(pg->f_height),
102 // do not want these to be copied
107 // /////////////////////////////////////////////////////////////////
109 // /////////////////////////////////////////////////////////////////
111 PixmapGraphic::~PixmapGraphic()
113 if (f_pixmap && (f_flag == NORMAL))
115 XFreePixmap (window_system().display(), f_pixmap);
118 XFreeColors (window_system().display(), f_colormap,
119 f_colors, f_num_colors, 0 );
122 printf( "pixmap %lx and its colors freed in PixmapGraphic %p\n",
129 printf( "pixmap %lx and TIFF context %p freed in PixmapGraphic %p\n",
130 f_pixmap, f_tiff_context, this );
132 _DtGrDestroyContext(f_tiff_context);
133 delete f_tiff_context ; // free the struct memory we own
139 // hold colormap info allocated for the f_pixmap we are maintaining
141 PixmapGraphic::set_colormap( Colormap cm,
146 f_colormap = cm; // the containing colormap
147 f_num_colors = num; // num colors allocated
148 f_colors = pixels; // colors allocated
150 f_tiff_context = tc; // tiff only, in lieu of above values
154 PixmapGraphic::register_handler(GraphicsHandler *graphics_handler)
156 UAS_Sender<DetachGraphic>::request(graphics_handler);
157 UAS_Sender<ReAttachGraphic>::request(graphics_handler);
160 graphics_handler->UAS_Sender<DisplayGraphic>::request(f_agent);