[ruby-gnome2-doc-cvs] [Hiki] update - Gdk::Drawable

Back to archive index

ruby-****@sourc***** ruby-****@sourc*****
2003年 11月 8日 (土) 15:01:29 JST


-------------------------
REMOTE_ADDR = 218.231.180.123
REMOTE_HOST = 
        URL = http://ruby-gnome2.sourceforge.jp/?Gdk%3A%3ADrawable
-------------------------
  = class Gdk::Drawable
  Gdk::Drawable is the base class for all objects that can accept drawing commands.
  
- The Gdk::Drawable interface enables one to draw lines, points, elliptical arcs, rectangles, text, or images.  In order to use a Gdk::Drawable, you must also have a Gdk::GC (graphics context) object to control the style of your drawing.   
- The Gdk::GC can control the color, for example.  In all of the methods that take a width or height parameter, -1 may be used to indicate that the largest possible meaningful value should be used instead of giving an explicit dimension.
+ The Gdk::Drawable interface enables one to draw lines, points, elliptical arcs, rectangles, text, or images.  In order to use a Gdk::Drawable, you must also have a ((<Gdk::GC>)) (graphics context) object to control the style of your drawing.   
+ The ((<Gdk::GC>)) can control the color, for example.  In all of the methods that take a width or height parameter, -1 may be used to indicate that the largest possible meaningful value should be used instead of giving an explicit dimension.
  
  == Object Hierarchy
  * Object
    * Glib::Instantiable
      * Glib::Object
        * Gdk::Drawable
  
  == Instance Methods
  --- display
      Returns the Gdk::Display associated with this object. ((* Since 2.2 *))
      * Returns: the Gdk::Display associated with this object
  
  --- screen
      Returns the Gdk::Screen associated with this object. ((* Since 2.2 *))
      * Returns: the Gdk::Screen associated with this object
  
  --- visual
      Gets the Gdk::Visual describing the pixel format of this object.
      * Returns: a Gdk::Visual 
  
  --- colormap
      Gets the colormap for this object, if one is set; returns nil otherwise.
      * Returns: the Gdk::Colormap that this object is using
  
  --- colormap=(colormap)
-     Sets the colormap associated with the Gdk::Drawable. Normally this will happen automatically when the drawable is created; you only need to use this method if the drawable-creating method did not have a way to determine the colormap, and you then use drawable operations that require a colormap. The colormap for all drawables and graphics contexts you intend to use together should match. i.e. when using a Gdk::GC to draw to a Gdk::Drawable, or copying one Gdk::Drawable to another, the colormaps should match.
+     Sets the colormap associated with the Gdk::Drawable. Normally this will happen automatically when the drawable is created; you only need to use this method if the drawable-creating method did not have a way to determine the colormap, and you then use drawable operations that require a colormap. The colormap for all drawables and graphics contexts you intend to use together should match. i.e. when using a ((<Gdk::GC>)) to draw to a Gdk::Drawable, or copying one Gdk::Drawable to another, the colormaps should match.
      * colormap: a Gdk::Colormap 
      * Returns: colormap
  
  --- set_colormap(color)
      Same as colormap=.
      * colormap: a Gdk::Colormap 
      * Returns: self
  
  --- depth
      Gets the depth of this Gdk::Drawable, in bits per pixel, that is, the number of bits that make up a pixel in the visual of the Gdk::Drawable.
      * Returns: a number representing how many bits are used for each pixel
  
  --- size
      Gets the size of this Gdk::Drawable, as a 2-element array. On the X11 platform, if drawable is a Gdk::Window, the returned size is the size reported in the most-recently-processed configure event, rather than the current size on the X server.
      * Returns: [width, height] or nil
        * width: the width of this Gdk::Drawable
        * height: the height of this Gdk::Drawable
  
  --- clip_region
      Gets the Gdk::Region used for clipping (restricting drawing to a box). This region will not take into account the clip region for the GC, and may also not take into account other factors such as if the window is obscured by other windows, but no area outside of this region will be affected by drawing primitives.
      * Returns: the currently active clipping rectangle as a Gdk::Region
  
  --- visible_region
      Gets the Gdk::Region that is visible. This does not necessarily take into account if the window is obscured by other windows, but no area outside of this region is visible.
      * Returns: the visible region as a Gdk::Region
  
  --- draw_point(gc, x, y)
-     Draws a point, using the foreground color and other attributes of the Gdk::GC.
-     * gc: a Gdk::GC graphics context to control the drawing style
+     Draws a point, using the foreground color and other attributes of the ((<Gdk::GC>)).
+     * gc: a ((<Gdk::GC>)) graphics context to control the drawing style
      * x: X coordinate of point
      * y: Y coordinate of point
      * Returns: self
  
  --- draw_points(gc, points)
-     Draws a sequence of points, using the foreground color and other attributes of the Gdk::GC
-     * gc: a Gdk::GC graphics context to control the drawing style
+     Draws a sequence of points, using the foreground color and other attributes of the ((<Gdk::GC>)).
+     * gc: a ((<Gdk::GC>)) graphics context to control the drawing style
      * points: [[x1, y1], [x2, y2], [x3, y3], ... ] : an array of points to draw.  
        Each point is represented as an array of two elements, which correspond to the x and y coordinates.
      * Returns: self
  
  --- draw_line(gc, x1, y1, x2, y2)
-     Draws a line, using the foreground color and other attributes of the Gdk::GC.
-     * gc: a Gdk::GC graphics context to control the drawing style
+     Draws a line, using the foreground color and other attributes of the ((<Gdk::GC>)).
+     * gc: a ((<Gdk::GC>)) graphics context to control the drawing style
      * x1: the X coordinate of first endpoint of line
      * y1: the Y coordinate of first endpoint of line
      * x2: the X coordinate of second endpoint of line
      * y2: the Y coordinate of second endpoint of line
      * Returns: self
  
  --- draw_lines(gc, points)
-     Draws a connected sequence of lines. The way in which joins between lines are draw is determined by the ((<GdkCapStyle|Gdk::GC#GdkCapStyle>)) value in the Gdk::GC. This can be set with Gdk::GC#set_line_attributes.
-     * gc: a Gdk::GC graphics context to control the drawing style
+     Draws a connected sequence of lines. The way in which joins between lines are draw is determined by the ((<GdkCapStyle|Gdk::GC#GdkCapStyle>)) value in the ((<Gdk::GC>)). This can be set with ((<Gdk::GC#set_line_attributes>)).
+     * gc: a ((<Gdk::GC>)) graphics context to control the drawing style
      * points: [[x1, y1], [x2, y2], [x3, y3], ... ] : an array of points to draw.  
        Each point is represented as an array of two elements, which correspond to the x and y coordinates.
      * Returns: self
  
  --- draw_pixbuf(gc, pixbuf, src_x, src_y, dest_x, dest_y, width, height, dither, x_dither, y_dither)
      Renders a rectangular portion of a pixbuf to a drawable. The destination drawable must have a colormap. All windows have a colormap, however, pixmaps only have colormap by default if they were created with a non-nil window argument. Otherwise a colormap must be set on them with Gdk::Drawable#colormap=.
      On older X servers, rendering pixbufs with an alpha channel involves round trips to the X server, and may be somewhat slow. ((* Since 2.2 *))
-     * gc: a Gdk::GC, used for clipping, or nil
+     * gc: a ((<Gdk::GC>)), used for clipping, or nil
      * pixbuf: a Gdk::Pixbuf
      * src_x: Source X coordinate within pixbuf.
      * src_y: Source Y coordinates within pixbuf.
      * dest_x: Destination X coordinate within drawable.
      * dest_y: Destination Y coordinate within drawable.
      * width: Width of region to render, in pixels, or -1 to use pixbuf width.
      * height: Height of region to render, in pixels, or -1 to use pixbuf height.
      * dither: Dithering mode(((<GdkRgbDither|Gdk::RGB#GdkRgbDither>))) for Gdk::RGB.
      * x_dither: X offset for dither.
      * y_dither: Y offset for dither.
  
  --- draw_segments(gc, segments)
      Draws an arbitrary set of segments.
-     * gc: a Gdk::GC graphics context to control the drawing style
+     * gc: a ((<Gdk::GC>)) graphics context to control the drawing style
      * segments: [[x11, y11, x12, y12], [x21, y21, x22, y22], ...] :an array of segments to connect.  
      * Returns: self
  
  --- draw_rectangle(gc, filled, x, y, width, height)
-     Draws a rectangular outline or filled rectangle, using the foreground color and other attributes of the Gdk::GC.
+     Draws a rectangular outline or filled rectangle, using the foreground color and other attributes of the ((<Gdk::GC>)).
      A rectangle drawn filled is 1 pixel smaller in both dimensions than a rectangle outlined. Calling Gdk::Drawable#draw_rectangle(gc, true, 0, 0, 20, 20) results in a filled rectangle 20 pixels wide and 20 pixels high. Calling Gdk::Drawable#draw_rectangle(gc, false, 0, 0, 20, 20) results in an outlined rectangle with corners at (0, 0), (0, 20), (20, 20), and (20, 0), which makes it 21 pixels wide and 21 pixels high.
-     * gc: a Gdk::GC graphics context to control the drawing style
+     * gc: a ((<Gdk::GC>)) graphics context to control the drawing style
      * filled: true if this rectangle should be filled or outline
      * x: X coordinate of the top left corner of the rectangle
      * y: Y coordinate of the top left corner of the rectangle
      * width: The width, in pixels, of the rectangle, or -1 for the whole region
      * height: The height, in pixels, of the rectangle, or -1 for the whole region
      * Returns: self
  
  --- draw_arc(gc, filled, x, y, width, height, angle1, angle2)
      Draws a partial or full arc of an elipse.
-     * gc: a Gdk::GC graphics context to control the drawing style
+     * gc: a ((<Gdk::GC>)) graphics context to control the drawing style
      * filled: true if this arc should be filled, producing a 'pie slice'
      * x: X coordinate of the left edge of the bounding rectangle
      * y: Y coordinate of the top edge of the bouding rectangle
      * width: The width, in pixels, of the ellipse, or -1 for the whole region
      * height: The height, in pixels, of the ellipse, or -1 for the whole region
      * angle1: The start of the arc, relative to the 3 o'clock position, counter-clockwise, in 1/64ths of a degree
      * angle2: The end angle of the arc, relative to the 3 o'clock position, in 1/64ths of a degree
      * Returns: self
  
  --- draw_polygon(gc, filled, points)
      Draws an outlined or filled polygon.
-     * gc: a Gdk::GC graphics context to control the drawing style
+     * gc: a ((<Gdk::GC>)) graphics context to control the drawing style
      * filled: true if the polygon should be filled. The polygon is closed automatically, connecting the last point to the first point if necessary.
      * points: [[x1, y1], [x2, y2], [x3, y3], ... ] : an array of points specifying the points making up the polygon
      * Returns: self
  
  --- draw_glyphs(gc, font, x, y, glyphs)
      This is a low-level method; 99% of text rendering should be done using Gdk::Drawable#draw_layout instead.
      A glyph is a character in a font. This method draws a sequence of glyphs. To obtain a sequence of glyphs you have to understand a lot about internationalized text handling, which you don't want to understand; thus, use Gdk::Drawable#draw_layout instead of this method, Gdk::Drawable#draw_layout handles the details.
-     * gc: a Gdk::GC graphics context to control the drawing style
+     * gc: a ((<Gdk::GC>)) graphics context to control the drawing style
      * font: a Pango::Font to be used
      * x: X coordinate of baseline origin
      * y: Y coordinate of baseline origin
      * glyphs: Pango::GlyphString to render
      * Returns: self
  
  --- draw_layout_line(gc, x, y, line, fg = nil, bg = nil)
      Render a Pango::LayoutLine (line of rendered text) onto an Gdk::Drawable.
-     * gc: a Gdk::GC graphics context to control the drawing style
+     * gc: a ((<Gdk::GC>)) graphics context to control the drawing style
      * x: the x position of start of string (in pixels)
      * y: the y position of baseline (in pixels)
      * line: a Pango::LayoutLine containing the rendered single line of text
      * fg: the foreground Gdk::Color, nil for none
      * bg: the foreground Gdk::Color, nil for none
      * Returns: self
  
  --- draw_layout(gc, x, y, layout, fg = nil, bg = nil)
      Render a Pango::Layout onto a Gdk::Drawable, overriding the layout's normal colors with foreground and/or background. foreground and background need not be allocated.
-     * gc: a Gdk::GC graphics context to control the drawing style
+     * gc: a ((<Gdk::GC>)) graphics context to control the drawing style
      * x: the X position of the left of the layout (in pixels)
      * y: the Y position of the top of the layout (in pixels)
      * layout: a Pango::Layout containing the rendered single line of text
      * fg: the foreground Gdk::Color
      * bg: the foreground Gdk::Color
      * Returns: self
  
  --- draw_drawable(gc, src, xsrc, ysrc, xdest, ydest, width, height)
      Copies the width x height region of src at coordinates (xsrc, ysrc) to coordinates (xdest, ydest) in drawable. width and/or height may be given as -1, in which case the entire src drawable will be copied.
      Most fields in gc are not used for this operation, but notably the clip mask or clip region will be honored.
      The source and destination drawables must have the same visual and colormap, or errors will result. (On X11, failure to match visual/colormap results in a BadMatch error from the X server.) A common cause of this problem is an attempt to draw a bitmap to a color drawable. The way to draw a bitmap is to set the bitmap as a clip mask on your Gdk::GC, then use Gdk::Drawable#draw_rectangle to draw a rectangle clipped to the bitmap.
-     * gc: a GdkGC sharing the drawable's visual and colormap
-     * src: another GdkDrawable
+     * gc: a ((<Gdk::GC>)) sharing the drawable's visual and colormap
+     * src: another Gdk::Drawable
      * xsrc: X position in src of rectangle to draw
      * ysrc: Y position in src of rectangle to draw
      * xdest: X position in drawable where the rectangle should be drawn
      * ydest: Y position in drawable where the rectangle should be drawn
      * width: width of rectangle to draw, or -1 for entire src width
      * height: height of rectangle to draw, or -1 for entire src height
  
  --- draw_image(gc, image, xsrc, ysrc, xdest, ydest, width, height)
      Draws a (rectangular part or whole) Gdk::Image onto a Gdk::Drawable. The depth of the Gdk::Image must match the depth of the Gdk::Drawable.
      * image: a Gdk::Image to draw
      * xsrc: the left edge of the source rectangle within the Gdk::Image.
      * ysrc: the top of the source rectangle within the Gdk::Image.
      * xdest: the x coordinate of the destination within this Gdk::Drawable.
      * ydest: the y coordinate of the destination within this Gdk::Drawable.
      * width: the width of the area to be copied, or -1 to make the area extend to the right edge of the Gdk::Image.
      * height: the height of the area to be copied, or -1 to make the area extend to the bottom edge of the Gdk::Image.
      * Returns: self
  
  --- get_image(x, y, width, height)
      A Gdk::Image stores client-side image data (pixels). In contrast, Gdk::Pixmap and Gdk::Window are server-side objects. Gdk::Drawable#get_image obtains the pixels from a server-side drawable as a client-side Gdk::Image. The format of a Gdk::Image depends on the Gdk::Visual of the current display, which makes manipulating Gdk::Image extremely difficult; therefore, in most cases you should use Gdk::Pixbuf.from_drawable instead of this lower-level method. A Gdk::Pixbuf contains image data in a canonicalized RGB format, rather than a display-dependent format. Of course, there's a convenience vs. speed tradeoff here, so you'll want to think about what makes sense for your application.
      x, y, width, and height define the region of the Gdk::Drawable to obtain as an image.
      You would usually copy image data to the client side if you intend to examine the values of individual pixels, for example to darken an image or add a red tint. It would be prohibitively slow to make a round-trip request to the windowing system for each pixel, so instead you get all of them at once, modify them, then copy them all back at once.
      If the X server or other windowing system backend is on the local machine, this method may use shared memory to avoid copying the image data.
      If the Gdk::Drawable is a Gdk::Window and partially offscreen or obscured, then the obscured portions of the returned image will contain undefined data.
      * x: X coordinate of the top left corner of the rectangle
      * y: Y coordinate of the top left corner of the rectangle
      * width: The width, in pixels, of the rectangle, or -1 for the whole region
      * height: The height, in pixels, of the rectangle, or -1 for the whole region
      * Returns: the Gdk::Image that was read from the rectangle
  
  --- xid
      Returns the X11 (X Window) XID of this Gdk::Drawable, as a number
      * Returns: the X11 (X Window) XID of this Gdk::Drawable, as a number
  
  * 2003-10-21: ((<Masao>)) Revised.
  * 2003-10-20: ((<cilibrar>)) (this document started by cilibrar)





ruby-gnome2-cvs メーリングリストの案内
Back to archive index