~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Tina6/tina-tools/tinatool/gphx/gdk2/gphxGdk_props.c

Version: ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /**********
  2  * 
  3  * Copyright (c) 2003, Division of Imaging Science and Biomedical Engineering,
  4  * University of Manchester, UK.  All rights reserved.
  5  * 
  6  * Redistribution and use in source and binary forms, with or without modification, 
  7  * are permitted provided that the following conditions are met:
  8  * 
  9  *   . Redistributions of source code must retain the above copyright notice, 
 10  *     this list of conditions and the following disclaimer.
 11  *    
 12  *   . Redistributions in binary form must reproduce the above copyright notice,
 13  *     this list of conditions and the following disclaimer in the documentation 
 14  *     and/or other materials provided with the distribution.
 15  * 
 16  *   . Neither the name of the University of Manchester nor the names of its
 17  *     contributors may be used to endorse or promote products derived from this 
 18  *     software without specific prior written permission.
 19  * 
 20  * 
 21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
 22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
 23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
 24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
 25  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
 26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
 27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
 29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
 30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
 31  * POSSIBILITY OF SUCH DAMAGE.
 32  *
 33  **********
 34  * 
 35  * Program :  TINA
 36  * File    :  $Source: /home/tina/cvs/tina-tools/tinatool/gphx/gdk2/gphxGdk_props.c,v $
 37  * Date    :  $Date: 2007/02/15 01:55:50 $
 38  * Version :  $Revision: 1.2 $
 39  * CVS Id  :  $Id: gphxGdk_props.c,v 1.2 2007/02/15 01:55:50 paul Exp $
 40  *
 41  * Author  :  giob@man.ac.uk, paul.bromiley@manchester.ac.uk
 42  *
 43  *********
 44 */
 45 /** 
 46  *  @file  gphxGdk_props.c
 47  *  @brief Set drawing properties of Tv_screens.
 48  *
 49  *  Functions to set foreground and background screen colours, linewidths and the 
 50  *  logical display functions. 
 51  *
 52  *  Note: the functions in this file are duplicated for each graphics lib (x11, GDK, etc ...).
 53  *
 54  */
 55 
 56 
 57 #include "gphxGdk_props.h"
 58 
 59 #if HAVE_CONFIG_H
 60   #include <config.h>
 61 #endif
 62 
 63 #include <gtk/gtk.h>
 64 #include "gphxGdk_color.h"
 65 
 66 /**
 67  * @brief   Set the background color of a tv_screen graphics context.  
 68  * @param   tv_screen  Pointer to the Tv_screen for which to set the GC background.
 69  * @param   color      A long u_int representing the Tina-defined colour to be set.
 70  * 
 71  * Note:  This sets the background colour in the graphics context and does not affect the 
 72  *        window background (see tv_screen_background_set in gphxGdk_color.c) ...
 73  */
 74 void   tv_screen_set_bkgrnd(Tv_screen *tv_screen, long unsigned int  color)
 75 {
 76   guint32  *newrgb = g_malloc(sizeof(guint32));
 77     
 78   if (!tv_screen)
 79     return ;
 80 
 81   if (rgb_from_long_uint(tv_screen, color, newrgb)); /* fixme: undeclared */
 82     gdk_rgb_gc_set_background(tv_screen->gc, *newrgb);
 83   
 84   g_free(newrgb);
 85 }
 86 
 87 /**
 88  * @brief   Set the foreground color of a tv_screen graphics context.  
 89  * @param   tv_screen  Pointer to the Tv_screen for which to set the GC foreground.
 90  * @param   color      A long u_int representing the Tina-defined colour to be set.
 91  */
 92 void   tv_screen_set_color(Tv_screen *tv_screen, long unsigned int  color)
 93 {
 94   tv_screen_color_set(tv_screen, color);
 95 }
 96 
 97 /**
 98  * @brief   Set the logical display function for the tv_screen graphics context.  
 99  * @param   tv_screen  Pointer to the Tv_screen for which to set the GC display function.
100  * @param   op         Integer from enumeration defining the logical display function.
101  */
102 void   tv_screen_set_op(Tv_screen *tv_screen, int op)
103 {
104   if (tv_screen == NULL)
105     return;
106 
107   gdk_gc_set_function(tv_screen->gc, (GdkFunction) op);
108 }
109 
110 /**
111  * @brief   Set the linewidth to the specified value.  
112  * @param   tv_screen  Pointer to the Tv_screen for which to set the GC line width.
113  * @param   width      Integer line width to be set.
114  * 
115  * Note:  Gdk only provides one function with which to set all line parameters.  Therefore,
116  *        this function is more complex that it needed to be.  The GC values struct must
117  *        be filled from the tv_screen GC, and only the appropriate field altered.
118  */
119 void   tv_screen_set_linewidth(Tv_screen *tv_screen, int width)
120 {
121   GdkGCValues *gc_values;
122 
123   if (tv_screen == NULL)
124     return;
125   
126   gc_values = (GdkGCValues *) g_malloc(sizeof(GdkGCValues));
127   gdk_gc_get_values (tv_screen->gc,
128                      gc_values);
129 
130   gdk_gc_set_line_attributes (tv_screen->gc,
131                               (gint) width,
132                               gc_values->line_style,
133                               gc_values->cap_style,
134                               gc_values->join_style);
135 
136   g_free(gc_values);
137 }
138 
139 /**
140  * @brief   Set the line style to the specified value.  
141  * @param   tv_screen  Pointer to the Tv_screen for which to set the GC line style.
142  * @param   width      Integer line style to be set.
143  * 
144  * Note:  Gdk only provides one function with which to set all line parameters.  Therefore,
145  *        this function is more complex that it needed to be.  The GC values struct must
146  *        be filled from the tv_screen GC, and only the appropriate field altered.
147  */
148 void   tv_screen_set_linestyle(Tv_screen *tv_screen, int style)
149 {
150   GdkGCValues *gc_values;
151 
152   if (tv_screen == NULL)
153     return;
154 
155   gc_values = (GdkGCValues *) g_malloc(sizeof(GdkGCValues));
156   gdk_gc_get_values (tv_screen->gc,
157                      gc_values);
158   gdk_gc_set_line_attributes (tv_screen->gc,
159                               gc_values->line_width,
160                               (GdkLineStyle) style,
161                               gc_values->cap_style,
162                               gc_values->join_style);
163 
164   g_free(gc_values);
165 }
166 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.