## Documentation

Table of Contents
Class Inheritance Tree
Widget Screenshots
Package groups

1.     -----------------------------------------------------------------------

2.     --               GtkAda - Ada95 binding for Gtk+/Gnome               --

3.     --                                                                   --

4.     --   Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet   --

5.     --                Copyright (C) 2000-2007, AdaCore                   --

6.     --                                                                   --

7.     -- This library is free software; you can redistribute it and/or     --

8.     -- modify it under the terms of the GNU General Public               --

9.     -- License as published by the Free Software Foundation; either      --

10.     -- version 2 of the License, or (at your option) any later version.  --

11.     --                                                                   --

12.     -- This library is distributed in the hope that it will be useful,   --

13.     -- but WITHOUT ANY WARRANTY; without even the implied warranty of    --

14.     -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU --

15.     -- General Public License for more details.                          --

16.     --                                                                   --

17.     -- You should have received a copy of the GNU General Public         --

18.     -- License along with this library; if not, write to the             --

19.     -- Free Software Foundation, Inc., 59 Temple Place - Suite 330,      --

20.     -- Boston, MA 02111-1307, USA.                                       --

21.     --                                                                   --

22.     -- As a special exception, if other files instantiate generics from  --

23.     -- this unit, or you link this unit with other files to produce an   --

24.     -- executable, this  unit  does not  by itself cause  the resulting  --

25.     -- executable to be covered by the GNU General Public License. This  --

26.     -- exception does not however invalidate any other reasons why the   --

27.     -- executable file  might be covered by the  GNU Public License.     --

28.     -----------------------------------------------------------------------

30.     --  <description>

31.     --

32.     --  This package implements a client-side pixmap. As opposed to the pixmaps

33.     --  found in Gdk.Pixmap, this one simply implements a local buffer, which

34.     --  can be manipulated at the pixel level easily. This buffer then needs to

35.     --  be sent to the server.

36.     --  The major efficiency difference is that the same amount of data needs

37.     --  to be sent to the server no matter how much things were modified.

38.     --  Gdk.Pixmaps requires one communication with the server per drawing

39.     --  function.

40.     --  Some X servers are also optimized so that the buffers in this package

41.     --  can be implemented in shared memory with the server, which of course

42.     --  makes it much faster to transfer the data.

43.     --  This package is basically an implementation of XImage (on X-Window),

44.     --  which means that it handles transparently different depths, byte

45.     --  ordering,... It also provides some color dithering functions.

46.     --

47.     --  See the commands Get_Visual and Get_Cmap below on how to use the

48.     --  colormaps and visual with this package

49.     --

50.     --  Dithering simulates a higher number of colors than what is available on

51.     --  the current visual (only for 8-bit and 16-bit displays).

52.     --

53.     --  </description>

55.     --  <c_version>1.3.6</c_version>

56.     --  <group>Gdk, the low-level API</group>

58.     with GlibTo API docTo specTo body;

59.     with Gdk.ColorTo API docTo specTo body;

60.     with Gdk.VisualTo API docTo specTo body;

61.     with Gdk.GCTo API docTo specTo body;

62.     with Gdk.DrawableTo API docTo specTo body;

64.     package Gdk.RgbTo API docTo specTo body is

66.        function Get_VisualTo API docTo body return Gdk.Visual.Gdk_VisualTo API docTo spec;

67.        --  See Get_Cmap.

69.        function Get_CmapTo API docTo body return Gdk.Color.Gdk_ColormapTo API docTo spec;

70.        --  Return the visual and the color map used internally in this package.

71.        --  Note that these are not the same as returned by Gtk.Widget or

72.        --  Gdk.Window, and you should use these if you are using this package.

73.        --

74.        --  The drawable you intend to copy the RGB buffer to must use this visual

75.        --  and this colormap. Therefore, before creating the widget, you need to do

76.        --  the following:

77.        --    - Gtk.Widget.Push_Colormap (Gdk.Rgb.Get_Cmap);

78.        --    - Gtk_New (....)

79.        --    - Gtk.Widget.Pop_Colormap;

81.        type Rgb_Record is record

82.           Red, Green, Blue : Glib.GucharTo API docTo spec;

83.        end record;

84.        pragma Convention (C, Rgb_RecordTo API docTo spec);

86.        type Rgb_Buffer is array (Glib.GuintTo API docTo spec range <>) of Rgb_RecordTo API docTo spec;

87.        pragma Pack (Rgb_BufferTo API docTo spec);

88.        --  This is the buffer that will contain the image. You can manipulate each

89.        --  byte in it independantly, although there is no high level routine

90.        --  to draw lines, circles, ...

91.        --  Once you are done drawing into this buffer, you can copy it to any

92.        --  drawable on the screen, *if* the widget was created with the correct

93.        --  visual and colormap (see above).

95.        type Unchecked_Rgb_Buffer is array (Glib.GuintTo API docTo spec) of Rgb_RecordTo API docTo spec;

96.        pragma Convention (C, Unchecked_Rgb_BufferTo API docTo spec);

97.        type Rgb_Buffer_Access is access all Unchecked_Rgb_BufferTo API docTo spec;

98.        pragma Convention (C, Rgb_Buffer_AccessTo API docTo spec);

99.        --  Type used By Gdk.Pixbufs.Get_Pixels to return an array with no

100.        --  bound checks that is compatible with C (also known as a flat array).

102.        type Gdk_Rgb_Dither is (Dither_None, Dither_Normal, Dither_Max);

103.        --  The three kinds of dithering that are implemented in this package:

104.        --  - Dither_None: No dithering will be done

105.        --  - Dither_Normal: Specifies dithering on 8 bit displays, but not 16-bit.

106.        --                   Usually the best choice.

107.        --  - Dither_Max: Specifies dithering on every kind of display

108.        for Gdk_Rgb_DitherTo API docTo spec'Size use Glib.GintTo API docTo spec'Size;

110.        ------------------------

111.        -- Color manipulation --

112.        ------------------------

114.        subtype Rgb_Item is Glib.Guint32To API docTo spec;

115.        --  This represents the coding for a rbg value. The exact encoding depends

116.        --  on the visual used and its depth (pseudo-color, true-color, ...)

118.        function Xpixel_From_RgbTo API docTo body (Value : in Rgb_ItemTo API docTo spec) return Glib.GulongTo API docTo spec;

119.        --  Convert the Rgb representation to the usual one found in Gdk.Color.

120.        --  pragma Deprecated (Xpixel_From_Rgb);

122.        procedure GC_Set_ForegroundTo API docTo body

123.          (GC : Gdk.GC.Gdk_GCTo API docTo spec; Value : Rgb_ItemTo API docTo spec);

124.        --  See GC_Set_Background.

125.        --  pragma Deprecated (GC_Set_Foreground);

127.        procedure GC_Set_BackgroundTo API docTo body

128.          (GC : Gdk.GC.Gdk_GCTo API docTo spec; Value : Rgb_ItemTo API docTo spec);

129.        --  Modify the foreground and the background of a graphic context with a

130.        --  value. These are exactly the same functions has found in Gdk.Gc, but do

131.        --  not use the same parameters.

132.        --  pragma Deprecated (GC_Set_Background);

134.        ---------------------------

135.        -- Colormap manipulation --

136.        ---------------------------

138.        type Gdk_Rgb_Cmap is new Gdk.C_ProxyTo API docTo spec;

139.        --  This is the full colormap, ie a set of 256 Rgb items.

140.        --  You can extract values using the functions Get or Set below.

142.        type Rgb_Cmap_Index is new Natural range 0 .. 255;

144.        function GetTo API docTo body (Cmap : Gdk_Rgb_CmapTo API docTo spec; Index : Rgb_Cmap_IndexTo API docTo spec) return Rgb_ItemTo API docTo spec;

145.        --  Access an item in a colormap.

147.        procedure SetTo API docTo body

148.          (Cmap : Gdk_Rgb_CmapTo API docTo spec; Index : Rgb_Cmap_IndexTo API docTo spec; Value : Rgb_ItemTo API docTo spec);

149.        --  Set an item in Cmap.

151.        procedure Gdk_NewTo API docTo body (Cmap : out Gdk_Rgb_CmapTo API docTo spec; Colors : Glib.Guint32_ArrayTo API docTo spec);

152.        --  Create a colormap.

154.        procedure FreeTo API docTo body (Cmap : Gdk_Rgb_CmapTo API docTo spec);

155.        --  Free a colormap.

157.        --------------------

158.        -- Drawing Images --

159.        --------------------

161.        procedure Draw_Rgb_ImageTo API docTo body

162.          (Drawable      : Gdk.Drawable.Gdk_DrawableTo API docTo spec;

163.           GC            : Gdk.GC.Gdk_GCTo API docTo spec;

164.           X, Y          : Glib.GintTo API docTo spec;

165.           Width, Height : Glib.GintTo API docTo spec;

166.           DithTo API docTo body          : Gdk_Rgb_DitherTo API docTo spec;

167.           Rgb_Buf       : Rgb_BufferTo API docTo spec;

168.           Rowstride     : Glib.GintTo API docTo spec);

169.        procedure Draw_Rgb_ImageTo API docTo body

170.          (Drawable      : Gdk.Drawable.Gdk_DrawableTo API docTo spec;

171.           GC            : Gdk.GC.Gdk_GCTo API docTo spec;

172.           X, Y          : Glib.GintTo API docTo spec;

173.           Width, Height : Glib.GintTo API docTo spec;

174.           DithTo API docTo body          : Gdk_Rgb_DitherTo API docTo spec;

175.           Rgb_Buf       : Unchecked_Rgb_BufferTo API docTo spec;

176.           Rowstride     : Glib.GintTo API docTo spec);

177.        --  Render a Gdk buffer with 24 bit Data.

178.        --  Such a buffer is a one dimensional array of bytes, where every byte

179.        --  triplet makes up a pixel (byte 0 is red, byte 1 is green and byte 2 is

180.        --  blue).

181.        --

182.        --  - Width: Number of pixels (byte triplets) per row of the image.

183.        --  - Height: Number of rows in the image.

184.        --  - RowStride: Number of bytes between rows... (row n+1 will start at byte

185.        --     row n + Rowstride). Gdk.Rgb is faster if both the source pointer and

186.        --     the rowstride are aligned to a 4 byte boundary.

187.        --  - (X, Y, Width, Height): Define a region in the target to copy the

188.        --     buffer to.

190.        procedure Draw_Rgb_Image_DithalignTo API docTo body

191.          (Drawable      : Gdk.Drawable.Gdk_DrawableTo API docTo spec;

192.           GC            : Gdk.GC.Gdk_GCTo API docTo spec;

193.           X, Y          : Glib.GintTo API docTo spec;

194.           Width, Height : Glib.GintTo API docTo spec;

195.           DithTo API docTo body          : Gdk_Rgb_DitherTo API docTo spec;

196.           Rgb_Buf       : Rgb_BufferTo API docTo spec;

197.           Rowstride     : Glib.GintTo API docTo spec;

198.           Xdith, Ydith  : Glib.GintTo API docTo spec);

199.        procedure Draw_Rgb_Image_DithalignTo API docTo body

200.          (Drawable      : Gdk.Drawable.Gdk_DrawableTo API docTo spec;

201.           GC            : Gdk.GC.Gdk_GCTo API docTo spec;

202.           X, Y          : Glib.GintTo API docTo spec;

203.           Width, Height : Glib.GintTo API docTo spec;

204.           DithTo API docTo body          : Gdk_Rgb_DitherTo API docTo spec;

205.           Rgb_Buf       : Unchecked_Rgb_BufferTo API docTo spec;

206.           Rowstride     : Glib.GintTo API docTo spec;

207.           Xdith, Ydith  : Glib.GintTo API docTo spec);

208.        --  Same kind of function as above, but for different buffer types (???).

210.        procedure Draw_Rgb_32_ImageTo API docTo body

211.          (Drawable      : Gdk.Drawable.Gdk_DrawableTo API docTo spec;

212.           GC            : Gdk.GC.Gdk_GCTo API docTo spec;

213.           X, Y          : Glib.GintTo API docTo spec;

214.           Width, Height : Glib.GintTo API docTo spec;

215.           DithTo API docTo body          : Gdk_Rgb_DitherTo API docTo spec;

216.           Rgb_Buf       : Rgb_BufferTo API docTo spec;

217.           Rowstride     : Glib.GintTo API docTo spec);

218.        procedure Draw_Rgb_32_ImageTo API docTo body

219.          (Drawable      : Gdk.Drawable.Gdk_DrawableTo API docTo spec;

220.           GC            : Gdk.GC.Gdk_GCTo API docTo spec;

221.           X, Y          : Glib.GintTo API docTo spec;

222.           Width, Height : Glib.GintTo API docTo spec;

223.           DithTo API docTo body          : Gdk_Rgb_DitherTo API docTo spec;

224.           Rgb_Buf       : Unchecked_Rgb_BufferTo API docTo spec;

225.           Rowstride     : Glib.GintTo API docTo spec);

226.        --  Same kind of function as above, but for different buffer types (???).

228.        procedure Draw_Rgb_32_Image_DithalignTo API docTo body

229.          (Drawable      : Gdk.Drawable.Gdk_DrawableTo API docTo spec;

230.           GC            : Gdk.GC.Gdk_GCTo API docTo spec;

231.           X, Y          : Glib.GintTo API docTo spec;

232.           Width, Height : Glib.GintTo API docTo spec;

233.           DithTo API docTo body          : Gdk_Rgb_DitherTo API docTo spec;

234.           Rgb_Buf       : Rgb_BufferTo API docTo spec;

235.           Rowstride     : Glib.GintTo API docTo spec;

236.           Xdith, Ydith  : Glib.GintTo API docTo spec);

237.        procedure Draw_Rgb_32_Image_DithalignTo API docTo body

238.          (Drawable      : Gdk.Drawable.Gdk_DrawableTo API docTo spec;

239.           GC            : Gdk.GC.Gdk_GCTo API docTo spec;

240.           X, Y          : Glib.GintTo API docTo spec;

241.           Width, Height : Glib.GintTo API docTo spec;

242.           DithTo API docTo body          : Gdk_Rgb_DitherTo API docTo spec;

243.           Rgb_Buf       : Unchecked_Rgb_BufferTo API docTo spec;

244.           Rowstride     : Glib.GintTo API docTo spec;

245.           Xdith, Ydith  : Glib.GintTo API docTo spec);

246.        --  Same kind of function as above, but for different buffer types (???).

248.        procedure Draw_Gray_ImageTo API docTo body

249.          (Drawable      : Gdk.Drawable.Gdk_DrawableTo API docTo spec;

250.           GC            : Gdk.GC.Gdk_GCTo API docTo spec;

251.           X, Y          : Glib.GintTo API docTo spec;

252.           Width, Height : Glib.GintTo API docTo spec;

253.           DithTo API docTo body          : Gdk_Rgb_DitherTo API docTo spec;

254.           Rgb_Buf       : Rgb_BufferTo API docTo spec;

255.           Rowstride     : Glib.GintTo API docTo spec);

256.        procedure Draw_Gray_ImageTo API docTo body

257.          (Drawable      : Gdk.Drawable.Gdk_DrawableTo API docTo spec;

258.           GC            : Gdk.GC.Gdk_GCTo API docTo spec;

259.           X, Y          : Glib.GintTo API docTo spec;

260.           Width, Height : Glib.GintTo API docTo spec;

261.           DithTo API docTo body          : Gdk_Rgb_DitherTo API docTo spec;

262.           Rgb_Buf       : Unchecked_Rgb_BufferTo API docTo spec;

263.           Rowstride     : Glib.GintTo API docTo spec);

264.        --  Same kind of function as above, but for different buffer types (???).

266.        procedure Draw_Indexed_ImageTo API docTo body

267.          (Drawable      : Gdk.Drawable.Gdk_DrawableTo API docTo spec;

268.           GC            : Gdk.GC.Gdk_GCTo API docTo spec;

269.           X, Y          : Glib.GintTo API docTo spec;

270.           Width, Height : Glib.GintTo API docTo spec;

271.           DithTo API docTo body          : Gdk_Rgb_DitherTo API docTo spec;

272.           Rgb_Buf       : Rgb_BufferTo API docTo spec;

273.           Rowstride     : Glib.GintTo API docTo spec;

274.           Cmap          : Gdk_Rgb_CmapTo API docTo spec);

275.        procedure Draw_Indexed_ImageTo API docTo body

276.          (Drawable      : Gdk.Drawable.Gdk_DrawableTo API docTo spec;

277.           GC            : Gdk.GC.Gdk_GCTo API docTo spec;

278.           X, Y          : Glib.GintTo API docTo spec;

279.           Width, Height : Glib.GintTo API docTo spec;

280.           DithTo API docTo body          : Gdk_Rgb_DitherTo API docTo spec;

281.           Rgb_Buf       : Unchecked_Rgb_BufferTo API docTo spec;

282.           Rowstride     : Glib.GintTo API docTo spec;

283.           Cmap          : Gdk_Rgb_CmapTo API docTo spec);

284.        --  Same kind of function as above, but for different buffer types (???).

286.     private

287.        pragma Inline (GetTo API docTo specTo body);

288.        pragma Inline (SetTo API docTo specTo body);

290.        pragma Import (C, GC_Set_BackgroundTo API docTo spec, "gdk_rgb_gc_set_background");

291.        pragma Import (C, GC_Set_ForegroundTo API docTo spec, "gdk_rgb_gc_set_foreground");

292.        pragma Import (C, Get_CmapTo API docTo spec, "gdk_rgb_get_colormap");

293.        pragma Import (C, Get_VisualTo API docTo spec, "gdk_rgb_get_visual");

294.        pragma Import (C, Xpixel_From_RgbTo API docTo spec, "gdk_rgb_xpixel_from_rgb");

295.        pragma Import (C, GetTo API docTo spec, "ada_rgb_cmap_get");

296.        pragma Import (C, SetTo API docTo spec, "ada_rgb_cmap_set");

297.        pragma Import (C, FreeTo API docTo spec, "gdk_rgb_cmap_free");

298.     end Gdk.RgbTo API docTo specTo body;