Class: Wx::SVGFileDC

Inherits:
DC show all
Defined in:
lib/wx/doc/gen/svg_file_dc.rb,
lib/wx/doc/svg_file_dc.rb

Overview

Note:

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

A SVGFileDC is a device context onto which graphics and text can be drawn, and the output produced as a vector file, in SVG format.

This format can be read by a range of programs, including a Netscape plugin (Adobe) and the open source Inkscape program (inkscape.org/). Full details are given in the W3C SVG recommendation (www.w3.org/TR/SVG/). The intention behind SVGFileDC is that it can be used to produce a file corresponding to the screen display context, SVGFileDC, by passing the SVGFileDC as a parameter instead of a DC. Thus the SVGFileDC is a write-only class. As the SVGFileDC is a vector format, raster operations like DC#get_pixel are unlikely to be supported. However, the SVG specification allows for raster files to be embedded in the SVG, and so bitmaps, icons and blit operations in SVGFileDC are supported. By default only PNG format bitmaps are supported and these are saved as separate files in the same folder as the SVG file, however it is possible to change this behaviour by replacing the built in bitmap handler using #set_bitmap_handler. More substantial SVG libraries (for reading and writing) are available at Art2D and SVG.

Category: Device Contexts

Requires:

  • USE_SVG

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from DC

#blit, #calc_bounding_box, #can_draw_bitmap, #can_get_text_extent, #can_use_transform_matrix, #copy_attributes, #cross_hair, #destroy_clipping_region, #device_to_logical, #device_to_logical_rel, #device_to_logical_x, #device_to_logical_x_rel, #device_to_logical_y, #device_to_logical_y_rel, #draw_arc, #draw_bitmap, #draw_check_mark, #draw_circle, #draw_ellipse, #draw_elliptic_arc, #draw_icon, #draw_label, #draw_line, #draw_lines, #draw_point, #draw_poly_polygon, #draw_polygon, #draw_rectangle, #draw_rotated_text, #draw_rounded_rectangle, #draw_spline, #draw_text, #end_doc, #end_page, #flood_fill, #from_dip, #get_as_bitmap, #get_background, #get_background_mode, #get_brush, #get_char_height, #get_char_width, #get_clipping_box, #get_content_scale_factor, #get_depth, #get_device_origin, #get_dimensions, #get_dimensions_mm, #get_font, #get_font_metrics, #get_graphics_context, #get_layout_direction, #get_logical_function, #get_logical_origin, #get_logical_scale, #get_map_mode, #get_multi_line_text_extent, #get_multi_line_text_size, #get_pen, #get_pixel, #get_ppi, #get_size, #get_size_mm, #get_text_background, #get_text_extent, #get_text_foreground, #get_text_size, #get_transform_matrix, #get_user_scale, #gradient_fill_concentric, #gradient_fill_linear, #is_ok, #logical_to_device, #logical_to_device_rel, #logical_to_device_x, #logical_to_device_x_rel, #logical_to_device_y, #logical_to_device_y_rel, #max_x, #max_y, #min_x, #min_y, #reset_bounding_box, #reset_transform_matrix, #set_axis_orientation, #set_background, #set_background_mode, #set_brush, #set_clipping_region, #set_device_clipping_region, #set_device_origin, #set_font, #set_graphics_context, #set_layout_direction, #set_logical_function, #set_logical_origin, #set_logical_scale, #set_map_mode, #set_palette, #set_pen, #set_text_background, #set_text_foreground, #set_transform_matrix, #set_user_scale, #start_doc, #start_page, #stretch_blit, #to_dip, #with_background_mode, #with_brush, #with_font, #with_pen, #with_text_background, #with_text_foreground

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

.draw_on(filename, width = 320, height = 240, dpi = 72, title = '') {|dc| ... } ⇒ ::Object

Executes the given block providing a temporary dc as it’s single argument. Initializes a wxSVGFileDC with the given filename, width and height at dpi resolution, and an optional title. The title provides a readable name for the SVG document.

Parameters:

  • filename (String)

    name of file to create

  • width (Integer) (defaults to: 320)

    width for SVG image

  • height (Integer) (defaults to: 240)

    height for SVG image

  • dpi (Float) (defaults to: 72)

    resolution for SVG image

  • title (String) (defaults to: '')

    readable name for the SVG document

Yield Parameters:

Returns:

  • (::Object)

    result of the block



22
# File 'lib/wx/doc/svg_file_dc.rb', line 22

def self.draw_on(filename, width=320, height=240, dpi=72, title='') end

Instance Method Details

#clearvoid

This method returns an undefined value.

Draws a rectangle the size of the SVG using the DC#set_background brush.



54
# File 'lib/wx/doc/gen/svg_file_dc.rb', line 54

def clear; end

#set_bitmap_handler(handler) ⇒ void Also known as: bitmap_handler=

This method returns an undefined value.

Replaces the default bitmap handler with handler.

By default, an object of Wx::SVGBitmapFileHandler class is used as bitmap handler. You may want to replace it with an object of predefined Wx::SVGBitmapEmbedHandler class to embed the bitmaps in the generated SVG instead of storing them in separate files like this:

mySVGFileDC.set_bitmap_handler(Wx::SVGBitmapEmbedHandler.new)

or derive your own bitmap handler class and use it if you need to customize the bitmap handling further.

Parameters:

  • handler (Wx::SVGBitmapHandler)

    The new bitmap handler. If non-NULL, this object takes ownership of this handler and will delete it when it is not needed any more.



66
# File 'lib/wx/doc/gen/svg_file_dc.rb', line 66

def set_bitmap_handler(handler) end

#set_shape_rendering_mode(renderingMode) ⇒ void Also known as: shape_rendering_mode=

This method returns an undefined value.

Set the shape rendering mode of the generated SVG.

All subsequent drawing calls will have this rendering mode set in the SVG file. The default mode is Wx::SVGShapeRenderingMode::SVG_SHAPE_RENDERING_AUTO.

Parameters:



75
# File 'lib/wx/doc/gen/svg_file_dc.rb', line 75

def set_shape_rendering_mode(renderingMode) end