Class: Wx::GraphicsRenderer

Inherits:
Object
  • Object
show all
Defined in:
lib/wx/doc/gen/graphics_object.rb

Overview

A GraphicsRenderer is the instance corresponding to the rendering engine used.

There may be multiple instances on a system, if there are different rendering engines present, but there is always only one instance per engine. This instance is pointed back to by all objects created by it (GraphicsContext, GraphicsPath, etc.) and can be retrieved through their Wx::GraphicsObject#get_renderer method. Therefore, you can create an additional instance of a path (or other objects) by calling Wx::GraphicsObject#get_renderer and then using the appropriate CreateXXX() function of that renderer.

# path = Wx::GraphicsPath from somewhere
  brush = path.get_renderer.create_brush(Wx::BLACK_BRUSH)

Category: Graphics Device Interface (GDI)

Requires:

  • USE_GRAPHICS_CONTEXT

Class Method Summary collapse

Instance Method Summary collapse

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

.get_cairo_rendererWx::GraphicsRenderer

Returns the Cairo renderer.



745
# File 'lib/wx/doc/gen/graphics_object.rb', line 745

def self.get_cairo_renderer; end

.get_default_rendererWx::GraphicsRenderer

Returns the default renderer on this platform.

On macOS, this is the Core Graphics (a.k.a. Quartz 2D) renderer, on MSW the GDI+ renderer, and on GTK we currently default to the Cairo renderer.



741
# File 'lib/wx/doc/gen/graphics_object.rb', line 741

def self.get_default_renderer; end

Instance Method Details

#create_bitmap(bitmap) ⇒ Wx::GraphicsBitmap

Creates Wx::GraphicsBitmap from an existing Bitmap.

An invalid NULL_GRAPHICS_BITMAP on failure.

Parameters:

Returns:



565
# File 'lib/wx/doc/gen/graphics_object.rb', line 565

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 a Image to a Bitmap first and then calling #create_bitmap, but otherwise has the same effect. An invalid NULL_GRAPHICS_BITMAP on failure.

Parameters:

Returns:



573
# File 'lib/wx/doc/gen/graphics_object.rb', line 573

def create_bitmap_from_image(image) end

#create_brush(brush) ⇒ Wx::GraphicsBrush

Creates a native brush from a Brush.

Parameters:

Returns:



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

def create_brush(brush) end

#create_context(window) ⇒ Wx::GraphicsContext #create_context(windowDC) ⇒ Wx::GraphicsContext #create_context(memoryDC) ⇒ Wx::GraphicsContext #create_context(printerDC) ⇒ Wx::GraphicsContext

Overloads:



604
# File 'lib/wx/doc/gen/graphics_object.rb', line 604

def create_context(*args) end

#create_context_from_image(image) ⇒ Wx::GraphicsContext

Creates a Wx::GraphicsContext associated with a Image.

This function is used by Wx::Context#create_from_image and is not normally called directly.

Parameters:

Returns:



621
# File 'lib/wx/doc/gen/graphics_object.rb', line 621

def create_context_from_image(image) end

#create_context_from_unknown_dc(dc) ⇒ Wx::GraphicsContext

Creates a Wx::GraphicsContext from a DC of unknown specific type.

Creates a Wx::GraphicsContext if dc is a supported type (i.e. has a corresponding #create_context method, e.g. WindowDC or MemoryDC). This method is only useful as a helper in generic code that operates with DC and doesn’t known its exact type. Use the appropriate #create_context overload instead if you know what the DC is (e.g., WindowDC). nil if the DC is unsupported.

Parameters:

Returns:

See Also:

  • Wx::GraphicsContext.create_from_unknown_dc


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

def create_context_from_unknown_dc(dc) 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.

    Parameters:

    Returns:

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

    Creates a graphics font with the given characteristics.

    If possible, the #create_font overload taking Font should be used instead. The main advantage of this overload is that it can be used without X server connection under Unix when using Cairo.

    Parameters:

    • sizeInPixels (Float)

      Height of the font in user space units (normally pixels). Notice that this is different from the overload taking Font as Font‘s size is specified in points.

    • facename (String)

      The name of the font. The same font name might not be available under all platforms so the font name can also be empty to use the default platform font.

    • flags (Integer) (defaults to: Wx::FontFlag::FONTFLAG_DEFAULT)

      Combination of FontFlag enum elements. Currently only FontFlag::FONTFLAG_ITALIC and FontFlag::FONTFLAG_BOLD are supported. By default, the normal font version is used.

    • col (Wx::Colour, String, Symbol) (defaults to: Wx::BLACK)

      The font colour, black by default.

    Returns:



648
# File 'lib/wx/doc/gen/graphics_object.rb', line 648

def create_font(*args) end

#create_font_at_dpi(font, dpi, col = Wx::BLACK) ⇒ Wx::GraphicsFont

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

The specified DPI is used to convert the (fractional) Font point-size to a fractional pixel-size.

Parameters:

Returns:



657
# File 'lib/wx/doc/gen/graphics_object.rb', line 657

def create_font_at_dpi(font, dpi, col=Wx::BLACK) end

#create_image_from_bitmap(bmp) ⇒ Wx::Image

Creates a Image from a Wx::GraphicsBitmap.

This method is used by the more convenient Wx::GraphicsBitmap#convert_to_image.

Parameters:

Returns:



580
# File 'lib/wx/doc/gen/graphics_object.rb', line 580

def create_image_from_bitmap(bmp) end

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

Creates a native brush with a linear gradient.

Stops support is new since wxWidgets 2.9.1; previously, only the start and end colours could be specified. The ability to apply a transformation matrix to the gradient was added in 3.1.3.

Parameters:

Returns:



670
# File 'lib/wx/doc/gen/graphics_object.rb', line 670

def create_linear_gradient_brush(x1, y1, x2, y2, stops, matrix=Wx::NULL_GRAPHICS_MATRIX) 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 defaults 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:



682
# File 'lib/wx/doc/gen/graphics_object.rb', line 682

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

#create_measuring_contextWx::GraphicsContext

Creates a Wx::GraphicsContext that can be used for measuring texts only.

No drawing commands are allowed.

Returns:



632
# File 'lib/wx/doc/gen/graphics_object.rb', line 632

def create_measuring_context; end

#create_pathWx::GraphicsPath

Creates a native graphics path which is initially empty.

Returns:



686
# File 'lib/wx/doc/gen/graphics_object.rb', line 686

def create_path; end

#create_pen(info) ⇒ Wx::GraphicsPen

Creates a native pen from its description.

Parameters:

Returns:



691
# File 'lib/wx/doc/gen/graphics_object.rb', line 691

def create_pen(info) end

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

Creates a native brush with a radial gradient.

Stops support is new since wxWidgets 2.9.1; previously, only the start and end colours could be specified. The ability to apply a transformation matrix to the gradient was added in 3.1.3.

Parameters:

Returns:



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

def create_radial_gradient_brush(startX, startY, endX, endY, radius, stops, matrix=Wx::NULL_GRAPHICS_MATRIX) end

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

Extracts a sub-bitmap from an existing bitmap.

Parameters:

Returns:



714
# File 'lib/wx/doc/gen/graphics_object.rb', line 714

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

#get_nameString Also known as: name

Returns the name of the technology used by the renderer.

Currently, this function returns “gdiplus” for the Windows GDI+ implementation, “direct2d” for Windows Direct2D, “cairo” for Cairo and “cg” for macOS CoreGraphics.

Remark:

The string returned by this method is not user-readable and is expected to be used internally by the program only.

Returns:

  • (String)


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

def get_name; end

#get_versionArray(Integer,Integer,Integer) Also known as: version

Returns the version major, minor and micro/build of the technology used by the renderer.

Currently, this function returns the OS major and minor versions in the parameters with the matching names and sets micro to 0 for the GDI+ and CoreGraphics engines, which are considered to be parts of their respective OS. For Cairo, this is the major,minor,micro version of the Cairo library which is returned.

Returns:

  • (Array(Integer,Integer,Integer))


734
# File 'lib/wx/doc/gen/graphics_object.rb', line 734

def get_version; end