/src/wrappers/gdk/library/gdk_gc.e

http://github.com/tybor/Liberty · Specman e · 87 lines · 43 code · 16 blank · 28 comment · 2 complexity · 620082b81d2f4a7b2778b5bd6b02551d MD5 · raw file

  1. indexing
  2. description: "Graphics Contexts -- Objects to encapsulate drawing properties"
  3. copyright: "[
  4. Copyright (C) 2006 eiffel-libraries team, GTK+ team
  5. This library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public License
  7. as published by the Free Software Foundation; either version 2.1 of
  8. the License, or (at your option) any later version.
  9. This library is distributed in the hope that it will be useful, but
  10. WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public
  14. License along with this library; if not, write to the Free Software
  15. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  16. 02110-1301 USA
  17. ]"
  18. -- All drawing operations in GDK take a graphics context (GC) argument.
  19. -- A graphics context encapsulates information about the way things are drawn,
  20. -- such as the foreground color or line width. By using graphics contexts, the
  21. -- number of arguments to each drawing call is greatly reduced, and
  22. -- communication overhead is minimized, since identical arguments do not need
  23. -- to be passed repeatedly.
  24. --
  25. -- Most values of a graphics context can be set at creation time by using
  26. -- create gc.with_values() (NOT IMPLEMENTED), or can be set one-by-one using
  27. -- functions such as gc.set_foreground(). A few of the values in the GC,
  28. -- such as the dash pattern, can only be set by the latter method.
  29. class GDK_GC
  30. inherit
  31. G_OBJECT
  32. insert
  33. GDK_GC_EXTERNALS
  34. creation from_external_pointer, make
  35. feature {} -- Creation
  36. make (a_drawable: GDK_DRAWABLE) is
  37. -- Create a new graphics context with default values.
  38. do
  39. from_external_pointer (gdk_gc_new (a_drawable.handle))
  40. end
  41. feature -- size
  42. struct_size: INTEGER is
  43. external "C inline use <gtk/gtk.h>"
  44. alias "sizeof(GdkGc)"
  45. end
  46. feature -- Operations
  47. set_rgb_fg_color (a_color: GDK_COLOR) is
  48. -- Set the foreground color of a GC using an unallocated color.
  49. -- The pixel value for the color will be determined using GdkRGB.
  50. -- If the colormap for the GC has not previously been initialized
  51. -- for GdkRGB, then for pseudo-color colormaps (colormaps with a
  52. -- small modifiable number of colors), a colorcube will be
  53. -- allocated in the colormap.
  54. --
  55. -- Calling this function for a GC without a colormap is an error.
  56. do
  57. gdk_gc_set_rgb_fg_color (handle, a_color.handle)
  58. end
  59. set_rgb_bg_color (a_color: GDK_COLOR) is
  60. -- Set the background color of a GC using an unallocated color.
  61. -- The pixel value for the color will be determined using GdkRGB.
  62. -- If the colormap for the GC has not previously been initialized
  63. -- for GdkRGB, then for pseudo-color colormaps (colormaps with a
  64. -- small modifiable number of colors), a colorcube will be
  65. -- allocated in the colormap.
  66. --
  67. -- Calling this function for a GC without a colormap is an error.
  68. do
  69. gdk_gc_set_rgb_bg_color (handle, a_color.handle)
  70. end
  71. end