Class: Emfsvg::DeviceContext
- Inherits:
-
Object
- Object
- Emfsvg::DeviceContext
- Defined in:
- lib/emfsvg/device_context.rb
Overview
Snapshot of GDI drawing state. Pushed onto TransformStack on SaveDC, popped on RestoreDC.
Instance Attribute Summary collapse
-
#arc_direction ⇒ Object
Returns the value of attribute arc_direction.
-
#bk_color ⇒ Object
Returns the value of attribute bk_color.
-
#bk_mode ⇒ Object
Returns the value of attribute bk_mode.
-
#brush ⇒ Object
Returns the value of attribute brush.
-
#brush_origin ⇒ Object
Returns the value of attribute brush_origin.
-
#clip_id ⇒ Object
Returns the value of attribute clip_id.
-
#clip_region ⇒ Object
Returns the value of attribute clip_region.
-
#coordinate_state ⇒ Object
readonly
Returns the value of attribute coordinate_state.
-
#font ⇒ Object
Returns the value of attribute font.
-
#icm_mode ⇒ Object
Returns the value of attribute icm_mode.
-
#layout ⇒ Object
Returns the value of attribute layout.
-
#mapper_flags ⇒ Object
Returns the value of attribute mapper_flags.
-
#miter_limit ⇒ Object
Returns the value of attribute miter_limit.
-
#pen ⇒ Object
Returns the value of attribute pen.
-
#poly_fill_mode ⇒ Object
Returns the value of attribute poly_fill_mode.
-
#stretch_mode ⇒ Object
Returns the value of attribute stretch_mode.
-
#text_align ⇒ Object
Returns the value of attribute text_align.
-
#text_color ⇒ Object
Returns the value of attribute text_color.
-
#world_transform ⇒ Object
Returns the value of attribute world_transform.
Instance Method Summary collapse
- #dup ⇒ Object
-
#initialize ⇒ DeviceContext
constructor
A new instance of DeviceContext.
- #map_mode ⇒ Object
- #map_mode=(value) ⇒ Object
- #viewport_ext ⇒ Object
- #viewport_ext=(value) ⇒ Object
- #viewport_ext_set=(value) ⇒ Object
- #viewport_ext_set? ⇒ Boolean
- #viewport_org ⇒ Object
- #viewport_org=(value) ⇒ Object
- #window_ext ⇒ Object
- #window_ext=(value) ⇒ Object
- #window_ext_set=(value) ⇒ Object
- #window_ext_set? ⇒ Boolean
- #window_org ⇒ Object
- #window_org=(value) ⇒ Object
Constructor Details
#initialize ⇒ DeviceContext
Returns a new instance of DeviceContext.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/emfsvg/device_context.rb', line 32 def initialize @pen = Pen.default @brush = Brush.default @font = Font.default @text_color = Emf::Model::Geometry::Color.black @bk_color = Emf::Model::Geometry::Color.white @bk_mode = 1 # TRANSPARENT @poly_fill_mode = 1 # ALTERNATE (evenodd) @text_align = 0 @stretch_mode = 1 @miter_limit = 10.0 @world_transform = Emf::Model::Geometry::Matrix.identity @brush_origin = [0, 0] @icm_mode = 0 @layout = 0 @mapper_flags = 0 @arc_direction = 0 # default; set by SetArcDirection (1=CW, -1=CCW in C) @clip_region = nil @clip_id = nil # Coordinate state shared across all dup'd DCs (see CoordinateState). @coordinate_state = CoordinateState.new end |
Instance Attribute Details
#arc_direction ⇒ Object
Returns the value of attribute arc_direction.
55 56 57 |
# File 'lib/emfsvg/device_context.rb', line 55 def arc_direction @arc_direction end |
#bk_color ⇒ Object
Returns the value of attribute bk_color.
55 56 57 |
# File 'lib/emfsvg/device_context.rb', line 55 def bk_color @bk_color end |
#bk_mode ⇒ Object
Returns the value of attribute bk_mode.
55 56 57 |
# File 'lib/emfsvg/device_context.rb', line 55 def bk_mode @bk_mode end |
#brush ⇒ Object
Returns the value of attribute brush.
55 56 57 |
# File 'lib/emfsvg/device_context.rb', line 55 def brush @brush end |
#brush_origin ⇒ Object
Returns the value of attribute brush_origin.
55 56 57 |
# File 'lib/emfsvg/device_context.rb', line 55 def brush_origin @brush_origin end |
#clip_id ⇒ Object
Returns the value of attribute clip_id.
55 56 57 |
# File 'lib/emfsvg/device_context.rb', line 55 def clip_id @clip_id end |
#clip_region ⇒ Object
Returns the value of attribute clip_region.
55 56 57 |
# File 'lib/emfsvg/device_context.rb', line 55 def clip_region @clip_region end |
#coordinate_state ⇒ Object
Returns the value of attribute coordinate_state.
55 56 57 |
# File 'lib/emfsvg/device_context.rb', line 55 def coordinate_state @coordinate_state end |
#font ⇒ Object
Returns the value of attribute font.
55 56 57 |
# File 'lib/emfsvg/device_context.rb', line 55 def font @font end |
#icm_mode ⇒ Object
Returns the value of attribute icm_mode.
55 56 57 |
# File 'lib/emfsvg/device_context.rb', line 55 def icm_mode @icm_mode end |
#layout ⇒ Object
Returns the value of attribute layout.
55 56 57 |
# File 'lib/emfsvg/device_context.rb', line 55 def layout @layout end |
#mapper_flags ⇒ Object
Returns the value of attribute mapper_flags.
55 56 57 |
# File 'lib/emfsvg/device_context.rb', line 55 def mapper_flags @mapper_flags end |
#miter_limit ⇒ Object
Returns the value of attribute miter_limit.
55 56 57 |
# File 'lib/emfsvg/device_context.rb', line 55 def miter_limit @miter_limit end |
#pen ⇒ Object
Returns the value of attribute pen.
55 56 57 |
# File 'lib/emfsvg/device_context.rb', line 55 def pen @pen end |
#poly_fill_mode ⇒ Object
Returns the value of attribute poly_fill_mode.
55 56 57 |
# File 'lib/emfsvg/device_context.rb', line 55 def poly_fill_mode @poly_fill_mode end |
#stretch_mode ⇒ Object
Returns the value of attribute stretch_mode.
55 56 57 |
# File 'lib/emfsvg/device_context.rb', line 55 def stretch_mode @stretch_mode end |
#text_align ⇒ Object
Returns the value of attribute text_align.
55 56 57 |
# File 'lib/emfsvg/device_context.rb', line 55 def text_align @text_align end |
#text_color ⇒ Object
Returns the value of attribute text_color.
55 56 57 |
# File 'lib/emfsvg/device_context.rb', line 55 def text_color @text_color end |
#world_transform ⇒ Object
Returns the value of attribute world_transform.
55 56 57 |
# File 'lib/emfsvg/device_context.rb', line 55 def world_transform @world_transform end |
Instance Method Details
#dup ⇒ Object
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/emfsvg/device_context.rb', line 114 def dup other = DeviceContext.allocate other.pen = pen.dup other.brush = brush.dup other.font = font.dup other.text_color = text_color other.bk_color = bk_color other.bk_mode = bk_mode other.poly_fill_mode = poly_fill_mode other.text_align = text_align other.stretch_mode = stretch_mode other.miter_limit = miter_limit other.world_transform = world_transform other.brush_origin = brush_origin.dup other.icm_mode = icm_mode other.layout = layout other.mapper_flags = mapper_flags other.arc_direction = arc_direction other.clip_region = clip_region other.clip_id = clip_id # CoordinateState is shared by reference — SaveDC/RestoreDC must # not snapshot/restore the coordinate state per libemf2svg. other.coordinate_state = coordinate_state other end |
#map_mode ⇒ Object
58 59 60 |
# File 'lib/emfsvg/device_context.rb', line 58 def map_mode coordinate_state.map_mode end |
#map_mode=(value) ⇒ Object
62 63 64 |
# File 'lib/emfsvg/device_context.rb', line 62 def map_mode=(value) coordinate_state.map_mode = value end |
#viewport_ext ⇒ Object
74 75 76 |
# File 'lib/emfsvg/device_context.rb', line 74 def coordinate_state. end |
#viewport_ext=(value) ⇒ Object
78 79 80 |
# File 'lib/emfsvg/device_context.rb', line 78 def (value) coordinate_state. = value end |
#viewport_ext_set=(value) ⇒ Object
110 111 112 |
# File 'lib/emfsvg/device_context.rb', line 110 def (value) coordinate_state. = value end |
#viewport_ext_set? ⇒ Boolean
102 103 104 |
# File 'lib/emfsvg/device_context.rb', line 102 def coordinate_state. end |
#viewport_org ⇒ Object
90 91 92 |
# File 'lib/emfsvg/device_context.rb', line 90 def coordinate_state. end |
#viewport_org=(value) ⇒ Object
94 95 96 |
# File 'lib/emfsvg/device_context.rb', line 94 def (value) coordinate_state. = value end |
#window_ext ⇒ Object
66 67 68 |
# File 'lib/emfsvg/device_context.rb', line 66 def window_ext coordinate_state.window_ext end |
#window_ext=(value) ⇒ Object
70 71 72 |
# File 'lib/emfsvg/device_context.rb', line 70 def window_ext=(value) coordinate_state.window_ext = value end |
#window_ext_set=(value) ⇒ Object
106 107 108 |
# File 'lib/emfsvg/device_context.rb', line 106 def window_ext_set=(value) coordinate_state.window_ext_set = value end |
#window_ext_set? ⇒ Boolean
98 99 100 |
# File 'lib/emfsvg/device_context.rb', line 98 def window_ext_set? coordinate_state.window_ext_set end |
#window_org ⇒ Object
82 83 84 |
# File 'lib/emfsvg/device_context.rb', line 82 def window_org coordinate_state.window_org end |
#window_org=(value) ⇒ Object
86 87 88 |
# File 'lib/emfsvg/device_context.rb', line 86 def window_org=(value) coordinate_state.window_org = value end |