Class: Wx::GraphicsContext

Inherits:
GraphicsObject show all
Defined in:
lib/wx/doc/gen/graphics_context.rb,
lib/wx/doc/graphics_context.rb

Overview

Note:

This class is untracked and should not be derived from nor instances extended!

A GraphicsContext instance is the object that is drawn upon.

It is created by a renderer using Wx::GraphicsRenderer#create_context. This can be either directly using a renderer instance, or indirectly using the static convenience GraphicsContext.create functions of GraphicsContext that always delegate the task to the default renderer.

class MyCanvas < Wx::ScrolledWindow

    def on_paint(event)
       # Create paint DC
       self.paint do |dc|
         # Create graphics context from it
         Wx::GraphicsContext.draw_on(dc) do |gc|
             # make a path that contains a circle and some lines
             gc.set_pen(Wx::RED_PEN)
             path = gc.create_path
             path.add_circle(50.0, 50.0, 50.0)
             path.move_to_point(0.0, 50.0)
             path.add_line_to_point(100.0, 50.0)
             path.move_to_point(50.0, 0.0)
             path.add_line_to_point(50.0, 100.0)
             path.close_sub_path
             path.add_rectangle(25.0, 25.0, 50.0, 50.0)
      
             gc.stroke_path(path)
          end
        end
      end
    end
  end
Remark:

For some renderers (like Direct2D or Cairo) processing of drawing operations may be deferred (Direct2D render target normally builds up a batch of rendering commands but defers processing of these commands, Cairo operates on a separate surface) so to make drawing results visible you need to update the content of the context by calling #flush or by destroying the context.

Category: Graphics Device Interface (GDI), Device Contexts

See Also:

Requires:

  • USE_GRAPHICS_CONTEXT

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from GraphicsObject

#get_renderer, #is_null

Methods inherited from Object

#clone, #dup, #initialize, #is_same_as, #un_share

Constructor Details

This class inherits a constructor from Wx::Object

Class Method Details

.self.create(window) ⇒ Wx::GraphicsContext .self.create(windowDC) ⇒ Wx::GraphicsContext .self.create(memoryDC) ⇒ Wx::GraphicsContext .self.create(printerDC) ⇒ Wx::GraphicsContext .self.create(image) ⇒ Wx::GraphicsContext .self.createWx::GraphicsContext

Overloads:



256
# File 'lib/wx/doc/gen/graphics_context.rb', line 256

def self.create(*args) end

.self.draw_on(window) {|| ... } ⇒ ::Object .self.draw_on(windowDC) {|| ... } ⇒ ::Object .self.draw_on(memoryDC) {|| ... } ⇒ ::Object .self.draw_on(printerDC) {|| ... } ⇒ ::Object .self.draw_on(image) {|| ... } ⇒ ::Object .self.draw_on {|| ... } ⇒ ::Object

Overloads:

  • .self.draw_on(window) {|| ... } ⇒ ::Object

    Creates a Wx::GraphicsContext from a Window and passes that object to the given block. Deletes the gc object after the block returns.

    Parameters:

    Yield Parameters:

    Returns:

    • (::Object)

      last result of the given block

    See Also:

  • .self.draw_on(windowDC) {|| ... } ⇒ ::Object

    Creates a Wx::GraphicsContext from a WindowDC and passes that object to the given block. Deletes the gc object after the block returns.

    Parameters:

    Yield Parameters:

    Returns:

    • (::Object)

      last result of the given block

    See Also:

  • .self.draw_on(memoryDC) {|| ... } ⇒ ::Object

    Creates a Wx::GraphicsContext from a MemoryDC and passes that object to the given block. Deletes the gc object after the block returns.

    Parameters:

    Yield Parameters:

    Returns:

    • (::Object)

      last result of the given block

    See Also:

  • .self.draw_on(printerDC) {|| ... } ⇒ ::Object

    Creates a Wx::GraphicsContext from a PrinterDC and passes that object to the given block. Deletes the gc object after the block returns. Under GTK+, this will only work when using the GtkPrint printing backend which is available since GTK+ 2.10.

    Parameters:

    • printerDC (Wx::PrinterDC)

    Yield Parameters:

    Returns:

    • (::Object)

      last result of the given block

    See Also:

    Requires:

    • USE_PRINTING_ARCHITECTURE
    • WXMSW or WXOSX or USE_GTKPRINT
  • .self.draw_on(image) {|| ... } ⇒ ::Object

    Creates a Wx::GraphicsContext associated with a Image and passes that object to the given block. Deletes the gc object after the block returns. The image specifies the size of the context as well as whether alpha is supported (if Image#has_alpha) or not and the initial contents of the context. The image object must have a life time greater than that of the new context as the context copies its contents back to the image when it is destroyed.

    Parameters:

    Yield Parameters:

    Returns:

    • (::Object)

      last result of the given block

  • .self.draw_on {|| ... } ⇒ ::Object

    Create a lightweight context that can be used only for measuring text and passes that object to the given block. Deletes the gc object after the block returns.

    Yield Parameters:

    Returns:

    • (::Object)

      last result of the given block



55
# File 'lib/wx/doc/graphics_context.rb', line 55

def self.draw_on(*args) end

Instance Method Details

#begin_layer(opacity) ⇒ void

This method returns an undefined value.

All rendering will be done into a fully transparent temporary context.

Layers can be nested by making balanced calls to #begin_layer/EndLayer().

Parameters:

  • opacity (Float)


661
# File 'lib/wx/doc/gen/graphics_context.rb', line 661

def begin_layer(opacity) end

#clip(region) ⇒ void #clip(x, y, w, h) ⇒ void

Overloads:

  • #clip(region) ⇒ void

    This method returns an undefined value.

    Sets the clipping region to the intersection of the given region and the previously set clipping region.

    The clipping region is an area to which drawing is restricted.

    Remark:

    - Clipping region should be given in logical coordinates. - Calling this function can only make the clipping region smaller, never larger. - You need to call #reset_clip first if you want to set the clipping region exactly to the region specified. - If resulting clipping region is empty, then all drawing upon the context is clipped out (all changes made by drawing operations are masked out).

    Parameters:

  • #clip(x, y, w, h) ⇒ void

    This method returns an undefined value.

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:

    • x (Float)
    • y (Float)
    • w (Float)
    • h (Float)


287
# File 'lib/wx/doc/gen/graphics_context.rb', line 287

def clip(*args) end

#concat_transform(matrix) ⇒ void

This method returns an undefined value.

Concatenates the passed in transform with the current transform of this context.

Parameters:



318
# File 'lib/wx/doc/gen/graphics_context.rb', line 318

def concat_transform(matrix) end

#create_bitmap(bitmap) ⇒ Wx::GraphicsBitmap

Creates Wx::GraphicsBitmap from an existing Bitmap.

Returns an invalid NULL_GRAPHICS_BITMAP on failure.

Parameters:

Returns:



637
# File 'lib/wx/doc/gen/graphics_context.rb', line 637

def create_bitmap(bitmap) end

#create_bitmap_from_image(image) ⇒ Wx::GraphicsBitmap

Creates Wx::GraphicsBitmap from an existing Image.

This method is more efficient than converting Image to Bitmap first and then calling #create_bitmap but otherwise has the same effect. Returns an invalid NULL_GRAPHICS_BITMAP on failure.

Parameters:

Returns:



645
# File 'lib/wx/doc/gen/graphics_context.rb', line 645

def create_bitmap_from_image(image) end

#create_brush(brush) ⇒ Wx::GraphicsBrush

Creates a native brush from a Brush.

Parameters:

Returns:



351
# File 'lib/wx/doc/gen/graphics_context.rb', line 351

def create_brush(brush) end

#create_font(font, col = Wx::BLACK) ⇒ Wx::GraphicsFont #create_font(sizeInPixels, facename, flags = Wx::FontFlag::FONTFLAG_DEFAULT, col = Wx::BLACK) ⇒ Wx::GraphicsFont

Overloads:

  • #create_font(font, col = Wx::BLACK) ⇒ Wx::GraphicsFont

    Creates a native graphics font from a Font and a text colour.

    Remark:

    For Direct2D graphics fonts can be created from TrueType fonts only.

    Parameters:

    Returns:

  • #create_font(sizeInPixels, facename, flags = Wx::FontFlag::FONTFLAG_DEFAULT, col = Wx::BLACK) ⇒ Wx::GraphicsFont

    Creates a font object with the specified attributes.

    The use of overload taking Font is preferred, see Wx::GraphicsRenderer#create_font for more details.

    Remark:

    For Direct2D graphics fonts can be created from TrueType fonts only.

    Parameters:

    • sizeInPixels (Float)
    • facename (String)
    • flags (Integer) (defaults to: Wx::FontFlag::FONTFLAG_DEFAULT)
    • col (Wx::Colour, String, Symbol) (defaults to: Wx::BLACK)

    Returns:



579
# File 'lib/wx/doc/gen/graphics_context.rb', line 579

def create_font(*args) end

#create_linear_gradient_brush(x1, y1, x2, y2, c1, c2, matrix = Wx::NULL_GRAPHICS_MATRIX) ⇒ Wx::GraphicsBrush #create_linear_gradient_brush(x1, y1, x2, y2, stops, matrix = Wx::NULL_GRAPHICS_MATRIX) ⇒ Wx::GraphicsBrush

Overloads:

  • #create_linear_gradient_brush(x1, y1, x2, y2, c1, c2, matrix = Wx::NULL_GRAPHICS_MATRIX) ⇒ Wx::GraphicsBrush

    Creates a native brush with a linear gradient.

    The brush starts at (x1, y1) and ends at (x2, y2). Either just the start and end gradient colours (c1 and c2) or full set of gradient stops can be specified. The version taking Wx::GraphicsGradientStops is new in wxWidgets 2.9.1. The matrix parameter was added in wxWidgets 3.1.3

    Parameters:

    Returns:

  • #create_linear_gradient_brush(x1, y1, x2, y2, stops, matrix = Wx::NULL_GRAPHICS_MATRIX) ⇒ Wx::GraphicsBrush

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:

    Returns:



376
# File 'lib/wx/doc/gen/graphics_context.rb', line 376

def create_linear_gradient_brush(*args) end

#create_matrix(a = 1.0, b = 0.0, c = 0.0, d = 1.0, tx = 0.0, ty = 0.0) ⇒ Wx::GraphicsMatrix

Creates a native affine transformation matrix from the passed in values.

The default parameters result in an identity matrix.

Parameters:

  • a (Float) (defaults to: 1.0)
  • b (Float) (defaults to: 0.0)
  • c (Float) (defaults to: 0.0)
  • d (Float) (defaults to: 1.0)
  • tx (Float) (defaults to: 0.0)
  • ty (Float) (defaults to: 0.0)

Returns:



313
# File 'lib/wx/doc/gen/graphics_context.rb', line 313

def create_matrix(a=1.0, b=0.0, c=0.0, d=1.0, tx=0.0, ty=0.0) end

#create_pathWx::GraphicsPath

Creates a native graphics path which is initially empty.

Returns:



532
# File 'lib/wx/doc/gen/graphics_context.rb', line 532

def create_path; end

#create_pen(pen) ⇒ Wx::GraphicsPen #create_pen(info) ⇒ Wx::GraphicsPen

Overloads:



427
# File 'lib/wx/doc/gen/graphics_context.rb', line 427

def create_pen(*args) end

#create_radial_gradient_brush(startX, startY, endX, endY, radius, oColor, cColor, matrix = Wx::NULL_GRAPHICS_MATRIX) ⇒ Wx::GraphicsBrush #create_radial_gradient_brush(startX, startY, endX, endY, radius, stops, matrix = Wx::NULL_GRAPHICS_MATRIX) ⇒ Wx::GraphicsBrush

Overloads:

  • #create_radial_gradient_brush(startX, startY, endX, endY, radius, oColor, cColor, matrix = Wx::NULL_GRAPHICS_MATRIX) ⇒ Wx::GraphicsBrush

    Creates a native brush with a radial gradient.

    The brush originates at (startX, startY) and ends on a circle around (endX, endY) with the given radius. The gradient may be specified either by its start and end colours oColor and cColor or by a full set of gradient stops. The version taking Wx::GraphicsGradientStops is new in wxWidgets 2.9.1. The ability to apply a transformation matrix to the gradient was added in 3.1.3

    Parameters:

    • startX (Float)
    • startY (Float)
    • endX (Float)
    • endY (Float)
    • radius (Float)
    • oColor (Wx::Colour, String, Symbol)
    • cColor (Wx::Colour, String, Symbol)
    • matrix (Wx::GraphicsMatrix) (defaults to: Wx::NULL_GRAPHICS_MATRIX)

    Returns:

  • #create_radial_gradient_brush(startX, startY, endX, endY, radius, stops, matrix = Wx::NULL_GRAPHICS_MATRIX) ⇒ Wx::GraphicsBrush

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:

    Returns:



404
# File 'lib/wx/doc/gen/graphics_context.rb', line 404

def create_radial_gradient_brush(*args) end

#create_sub_bitmap(bitmap, x, y, w, h) ⇒ Wx::GraphicsBitmap

Extracts a sub-bitmap from an existing bitmap.

Parameters:

Returns:



654
# File 'lib/wx/doc/gen/graphics_context.rb', line 654

def create_sub_bitmap(bitmap, x, y, w, h) end

#disable_offsetvoid

This method returns an undefined value.

Helper to determine if a 0.5 offset should be applied for the drawing operation.



755
# File 'lib/wx/doc/gen/graphics_context.rb', line 755

def disable_offset; end

#draw_bitmap(bmp, x, y, w, h) ⇒ void #draw_bitmap(bmp, x, y, w, h) ⇒ void

Overloads:

  • #draw_bitmap(bmp, x, y, w, h) ⇒ void

    This method returns an undefined value.

    Draws the bitmap.

    In case of a mono bitmap, this is treated as a mask and the current brushed is used for filling.

    Parameters:

  • #draw_bitmap(bmp, x, y, w, h) ⇒ void

    This method returns an undefined value.

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:

    • bmp (Wx::Bitmap)
    • x (Float)
    • y (Float)
    • w (Float)
    • h (Float)


458
# File 'lib/wx/doc/gen/graphics_context.rb', line 458

def draw_bitmap(*args) end

#draw_ellipse(x, y, w, h) ⇒ void

This method returns an undefined value.

Draws an ellipse.

Parameters:

  • x (Float)
  • y (Float)
  • w (Float)
  • h (Float)


466
# File 'lib/wx/doc/gen/graphics_context.rb', line 466

def draw_ellipse(x, y, w, h) end

#draw_icon(icon, x, y, w, h) ⇒ void

This method returns an undefined value.

Draws the icon.

Parameters:

  • icon (Wx::Icon)
  • x (Float)
  • y (Float)
  • w (Float)
  • h (Float)


475
# File 'lib/wx/doc/gen/graphics_context.rb', line 475

def draw_icon(icon, x, y, w, h) end

#draw_path(path, fillStyle = Wx::PolygonFillMode::ODDEVEN_RULE) ⇒ void

This method returns an undefined value.

Draws the path by first filling and then stroking.

Parameters:



481
# File 'lib/wx/doc/gen/graphics_context.rb', line 481

def draw_path(path, fillStyle=Wx::PolygonFillMode::ODDEVEN_RULE) end

#draw_rectangle(x, y, w, h) ⇒ void

This method returns an undefined value.

Draws a rectangle.

Parameters:

  • x (Float)
  • y (Float)
  • w (Float)
  • h (Float)


489
# File 'lib/wx/doc/gen/graphics_context.rb', line 489

def draw_rectangle(x, y, w, h) end

#draw_rounded_rectangle(x, y, w, h, radius) ⇒ void

This method returns an undefined value.

Draws a rounded rectangle.

Parameters:

  • x (Float)
  • y (Float)
  • w (Float)
  • h (Float)
  • radius (Float)


498
# File 'lib/wx/doc/gen/graphics_context.rb', line 498

def draw_rounded_rectangle(x, y, w, h, radius) end

#draw_text(str, x, y) ⇒ void #draw_text(str, x, y, angle) ⇒ void #draw_text(str, x, y, backgroundBrush) ⇒ void #draw_text(str, x, y, angle, backgroundBrush) ⇒ void

Overloads:

  • #draw_text(str, x, y) ⇒ void

    This method returns an undefined value.

    Draws text at the defined position.

    Parameters:

    • str (String)
    • x (Float)
    • y (Float)
  • #draw_text(str, x, y, angle) ⇒ void

    This method returns an undefined value.

    Draws text at the defined position.

    Parameters:

    • str (String)

      The text to draw.

    • x (Float)

      The x coordinate position to draw the text at.

    • y (Float)

      The y coordinate position to draw the text at.

    • angle (Float)

      The angle, in radians, relative to the (default) horizontal direction to draw the string.

  • #draw_text(str, x, y, backgroundBrush) ⇒ void

    This method returns an undefined value.

    Draws text at the defined position.

    Parameters:

    • str (String)

      The text to draw.

    • x (Float)

      The x coordinate position to draw the text at.

    • y (Float)

      The y coordinate position to draw the text at.

    • backgroundBrush (Wx::GraphicsBrush)

      Brush to fill the text with.

  • #draw_text(str, x, y, angle, backgroundBrush) ⇒ void

    This method returns an undefined value.

    Draws text at the defined position.

    Parameters:

    • str (String)

      The text to draw.

    • x (Float)

      The x coordinate position to draw the text at.

    • y (Float)

      The y coordinate position to draw the text at.

    • angle (Float)

      The angle, in radians, relative to the (default) horizontal direction to draw the string.

    • backgroundBrush (Wx::GraphicsBrush)

      Brush to fill the text with.



528
# File 'lib/wx/doc/gen/graphics_context.rb', line 528

def draw_text(*args) end

#enable_offset(enable = true) ⇒ void

This method returns an undefined value.

Indicates whether the context should try to offset for pixel boundaries.

This only makes sense on bitmap devices like screen. By default this is turned off.

Parameters:

  • enable (Boolean) (defaults to: true)


751
# File 'lib/wx/doc/gen/graphics_context.rb', line 751

def enable_offset(enable=true) end

#end_docvoid

This method returns an undefined value.

Done with that document (relevant only for printing / pdf etc.)



618
# File 'lib/wx/doc/gen/graphics_context.rb', line 618

def end_doc; end

#end_layervoid

This method returns an undefined value.

Composites back the drawings into the context with the opacity given at the #begin_layer call.



665
# File 'lib/wx/doc/gen/graphics_context.rb', line 665

def end_layer; end

#end_pagevoid

This method returns an undefined value.

Ends the current page (relevant only for printing / pdf etc.)



630
# File 'lib/wx/doc/gen/graphics_context.rb', line 630

def end_page; end

#fill_path(path, fillStyle = Wx::PolygonFillMode::ODDEVEN_RULE) ⇒ void

This method returns an undefined value.

Fills the path with the current brush.

Parameters:



538
# File 'lib/wx/doc/gen/graphics_context.rb', line 538

def fill_path(path, fillStyle=Wx::PolygonFillMode::ODDEVEN_RULE) end

#flushvoid

This method returns an undefined value.

Make sure that the current content of this context is immediately visible.



683
# File 'lib/wx/doc/gen/graphics_context.rb', line 683

def flush; end

#from_dip(sz) ⇒ Wx::Size #from_dip(pt) ⇒ Wx::Point #from_dip(d) ⇒ Integer

Overloads:

  • #from_dip(sz) ⇒ Wx::Size

    Convert DPI-independent pixel values to the value in pixels appropriate for the graphics context.

    See Window#from_dip(sz) for more info about converting device independent pixel values.

    Parameters:

    • sz (Array(Integer, Integer), Wx::Size)

    Returns:

  • #from_dip(pt) ⇒ Wx::Point

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:

    Returns:

  • #from_dip(d) ⇒ Integer

    Convert DPI-independent value in pixels to the value in pixels appropriate for the graphics context.

    This is the same as FromDIP(const Size& sz) overload, but assumes that the resolution is the same in horizontal and vertical directions.

    Parameters:

    • d (Integer)

    Returns:

    • (Integer)


777
# File 'lib/wx/doc/gen/graphics_context.rb', line 777

def from_dip(*args) end

#get_antialias_modeWx::AntialiasMode Also known as: antialias_mode

Returns the current shape antialiasing mode.

Returns:



693
# File 'lib/wx/doc/gen/graphics_context.rb', line 693

def get_antialias_mode; end

#get_clip_boxArray(Float,Float,Float,Float) Also known as: clip_box

Returns bounding box of the current clipping region.

Remark:

- If clipping region is empty, then empty rectangle is returned (x, y, w, h are set to zero).

Returns:

  • (Array(Float,Float,Float,Float))


300
# File 'lib/wx/doc/gen/graphics_context.rb', line 300

def get_clip_box; end

#get_composition_modeWx::CompositionMode Also known as: composition_mode

Returns the current compositing operator.

Returns:



721
# File 'lib/wx/doc/gen/graphics_context.rb', line 721

def get_composition_mode; end

#get_dpiArray(Float,Float) Also known as: dpi

Returns the resolution of the graphics context in device points per inch.

Returns:

  • (Array(Float,Float))


731
# File 'lib/wx/doc/gen/graphics_context.rb', line 731

def get_dpi; end

#get_interpolation_qualityWx::InterpolationQuality Also known as: interpolation_quality

Returns the current interpolation quality.



710
# File 'lib/wx/doc/gen/graphics_context.rb', line 710

def get_interpolation_quality; end

#get_partial_text_extents(text) ⇒ Array<Float> Also known as: partial_text_extents

Fills the widths array with the widths from the beginning of text to the corresponding character of text.

Parameters:

  • text (String)

Returns:

  • (Array<Float>)


602
# File 'lib/wx/doc/gen/graphics_context.rb', line 602

def get_partial_text_extents(text) end

#get_sizeArray(Float,Float) Also known as: size

Returns the size of the graphics context in device coordinates.

Returns:

  • (Array(Float,Float))


726
# File 'lib/wx/doc/gen/graphics_context.rb', line 726

def get_size; end

#get_text_extent(text) ⇒ Array(Float,Float,Float,Float) Also known as: text_extent

Gets the dimensions of the string using the currently selected font.

Parameters:

  • text (String)

    The text string to measure.

Returns:

  • (Array(Float,Float,Float,Float))


608
# File 'lib/wx/doc/gen/graphics_context.rb', line 608

def get_text_extent(text) end

#get_transformWx::GraphicsMatrix Also known as: transform

Gets the current transformation matrix of this context.

Returns:



322
# File 'lib/wx/doc/gen/graphics_context.rb', line 322

def get_transform; end

#get_windowWx::Window Also known as: window

Returns the associated window if any.

If this context was created using create overload taking Window or WindowDC, this method returns the corresponding window. Otherwise returns NULL. A possibly NULL window pointer.

Returns:



739
# File 'lib/wx/doc/gen/graphics_context.rb', line 739

def get_window; end

#offset_enabledBoolean

Helper to determine if a 0.5 offset should be applied for the drawing operation.

Returns:

  • (Boolean)


759
# File 'lib/wx/doc/gen/graphics_context.rb', line 759

def offset_enabled; end

#pop_statevoid

This method returns an undefined value.

Sets current state of the context to the state saved by a preceding call to #push_state and removes that state from the stack of saved states.

See Also:



679
# File 'lib/wx/doc/gen/graphics_context.rb', line 679

def pop_state; end

#push_statevoid

This method returns an undefined value.

Push the current state (like transformations, clipping region and quality settings) of the context on a stack.

Multiple balanced calls to #push_state and #pop_state can be nested.

See Also:



672
# File 'lib/wx/doc/gen/graphics_context.rb', line 672

def push_state; end

#reset_clipvoid

This method returns an undefined value.

Resets the clipping to original shape.



260
# File 'lib/wx/doc/gen/graphics_context.rb', line 260

def reset_clip; end

#rotate(angle) ⇒ void

This method returns an undefined value.

Rotates the current transformation matrix (in radians).

Parameters:

  • angle (Float)


328
# File 'lib/wx/doc/gen/graphics_context.rb', line 328

def rotate(angle) end

#scale(xScale, yScale) ⇒ void

This method returns an undefined value.

Scales the current transformation matrix.

Parameters:

  • xScale (Float)
  • yScale (Float)


334
# File 'lib/wx/doc/gen/graphics_context.rb', line 334

def scale(xScale, yScale) end

#set_antialias_mode(antialias) ⇒ Boolean Also known as: antialias_mode=

Sets the antialiasing mode, returns true if it supported.

Parameters:

Returns:

  • (Boolean)


688
# File 'lib/wx/doc/gen/graphics_context.rb', line 688

def set_antialias_mode(antialias) end

#set_brush(brush) ⇒ void #set_brush(brush) ⇒ void Also known as: brush=

Overloads:

  • #set_brush(brush) ⇒ void

    This method returns an undefined value.

    Sets the brush for filling paths.

    Parameters:

  • #set_brush(brush) ⇒ void

    This method returns an undefined value.

    Sets the brush for filling paths.

    Parameters:



414
# File 'lib/wx/doc/gen/graphics_context.rb', line 414

def set_brush(*args) end

#set_composition_mode(op) ⇒ Boolean Also known as: composition_mode=

Sets the compositing operator, returns true if it supported.

Parameters:

Returns:

  • (Boolean)


716
# File 'lib/wx/doc/gen/graphics_context.rb', line 716

def set_composition_mode(op) end

#set_font(font, colour) ⇒ void #set_font(font) ⇒ void Also known as: font=

Overloads:

  • #set_font(font, colour) ⇒ void

    This method returns an undefined value.

    Sets the font for drawing text.

    Remark:

    For Direct2D only TrueType fonts can be used.

    Parameters:

  • #set_font(font) ⇒ void

    This method returns an undefined value.

    Sets the font for drawing text.

    Parameters:



596
# File 'lib/wx/doc/gen/graphics_context.rb', line 596

def set_font(*args) end

#set_interpolation_quality(interpolation) ⇒ Boolean Also known as: interpolation_quality=

Sets the interpolation quality, returns true if it is supported.

Remark:

Not implemented in Cairo backend currently.

Parameters:

Returns:

  • (Boolean)


705
# File 'lib/wx/doc/gen/graphics_context.rb', line 705

def set_interpolation_quality(interpolation) end

#set_pen(pen) ⇒ void #set_pen(pen) ⇒ void Also known as: pen=

Overloads:

  • #set_pen(pen) ⇒ void

    This method returns an undefined value.

    Sets the pen used for stroking.

    Parameters:

  • #set_pen(pen) ⇒ void

    This method returns an undefined value.

    Sets the pen used for stroking.

    Parameters:



437
# File 'lib/wx/doc/gen/graphics_context.rb', line 437

def set_pen(*args) end

#set_transform(matrix) ⇒ void Also known as: transform=

This method returns an undefined value.

Sets the current transformation matrix of this context.

Parameters:



339
# File 'lib/wx/doc/gen/graphics_context.rb', line 339

def set_transform(matrix) end

#should_offsetBoolean

Helper to determine if a 0.5 offset should be applied for the drawing operation.

Returns:

  • (Boolean)


744
# File 'lib/wx/doc/gen/graphics_context.rb', line 744

def should_offset; end

#start_doc(message) ⇒ Boolean

Begin a new document (relevant only for printing / pdf etc.) If there is a progress dialog, message will be shown.

Parameters:

  • message (String)

Returns:

  • (Boolean)


614
# File 'lib/wx/doc/gen/graphics_context.rb', line 614

def start_doc(message) end

#start_page(width = 0, height = 0) ⇒ void

This method returns an undefined value.

Opens a new page (relevant only for printing / pdf etc.) with the given size in points.

(If both are null the default page size will be used.)

Parameters:

  • width (Float) (defaults to: 0)
  • height (Float) (defaults to: 0)


626
# File 'lib/wx/doc/gen/graphics_context.rb', line 626

def start_page(width=0, height=0) end

#stroke_line(x1, y1, x2, y2) ⇒ void

This method returns an undefined value.

Strokes a single line.

Parameters:

  • x1 (Float)
  • y1 (Float)
  • x2 (Float)
  • y2 (Float)


546
# File 'lib/wx/doc/gen/graphics_context.rb', line 546

def stroke_line(x1, y1, x2, y2) end

#stroke_path(path) ⇒ void

This method returns an undefined value.

Strokes along a path with the current pen.

Parameters:



551
# File 'lib/wx/doc/gen/graphics_context.rb', line 551

def stroke_path(path) end

#to_dip(sz) ⇒ Wx::Size #to_dip(pt) ⇒ Wx::Point #to_dip(d) ⇒ Integer

Overloads:

  • #to_dip(sz) ⇒ Wx::Size

    Convert pixel values of the current graphics context to DPI-independent pixel values.

    See Window#to_dip(sz) for more info about converting device independent pixel values.

    Parameters:

    • sz (Array(Integer, Integer), Wx::Size)

    Returns:

  • #to_dip(pt) ⇒ Wx::Point

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:

    Returns:

  • #to_dip(d) ⇒ Integer

    Convert pixel values of the current graphics context to DPI-independent pixel values.

    This is the same as ToDIP(const Size& sz) overload, but assumes that the resolution is the same in horizontal and vertical directions.

    Parameters:

    • d (Integer)

    Returns:

    • (Integer)


795
# File 'lib/wx/doc/gen/graphics_context.rb', line 795

def to_dip(*args) end

#translate(dx, dy) ⇒ void

This method returns an undefined value.

Translates the current transformation matrix.

Parameters:

  • dx (Float)
  • dy (Float)


346
# File 'lib/wx/doc/gen/graphics_context.rb', line 346

def translate(dx, dy) end