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 etc. 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 Cairo renderer.



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

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 GDIPlus renderer, and on GTK we currently default to the Cairo renderer.



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

def self.get_default_renderer; end

Instance Method Details

#create_bitmap(bitmap) ⇒ Wx::GraphicsBitmap

Creates Wx::GraphicsBitmap from an existing Bitmap.

Returns an invalid NULL_GRAPHICS_BITMAP on failure.

Parameters:

Returns:



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

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:



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

def create_bitmap_from_image(image) end

#create_brush(brush) ⇒ Wx::GraphicsBrush

Creates a native brush from a Brush.

Parameters:

Returns:



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

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:



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

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:



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

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). Returns NULL if the DC is unsupported. 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 that the DC is e.g. WindowDC.

Parameters:

Returns:

See Also:

  • Wx::GraphicsContext.create_from_unknown_dc


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

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, i.e. normally pixels. Notice that this is different from the overload taking Font as Font 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:



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

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:



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

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:



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

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:



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

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:



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

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:



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

def create_measuring_context; end

#create_pathWx::GraphicsPath

Creates a native graphics path which is initially empty.

Returns:



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

def create_path; end

#create_pen(info) ⇒ Wx::GraphicsPen

Creates a native pen from its description.

Parameters:

Returns:



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

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:



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

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:



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

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 Windows GDI+ implementation, “direct2d” for Windows Direct2D implementation, “cairo” for Cairo implementation and “cg” for macOS CoreGraphics implementation.

Remark:

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

Returns:

  • (String)


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

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))


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

def get_version; end