Class: Emfsvg::Brush

Inherits:
Object
  • Object
show all
Defined in:
lib/emfsvg/device_context.rb

Overview

Brush value object: style, color, hatch.

Constant Summary collapse

SOLID =
0
NULL =
1
HATCHED =
2
PATTERN =
3
MONOPATTERN =

MONOPATTERN: 8 (BS_MONOPATTERN / U_BS_MONOPATTERN in MS-WMF). Brush references a DIB image stored in the SVG ; fill becomes url(#img-N-ref). brush.image_id is the N.

8

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(style: SOLID, color: Emf::Model::Geometry::Color.black, hatch: 0, image_id: nil) ⇒ Brush

Returns a new instance of Brush.



185
186
187
188
189
190
# File 'lib/emfsvg/device_context.rb', line 185

def initialize(style: SOLID, color: Emf::Model::Geometry::Color.black, hatch: 0, image_id: nil)
  @style = style
  @color = color
  @hatch = hatch
  @image_id = image_id
end

Instance Attribute Details

#colorObject (readonly)

Returns the value of attribute color.



192
193
194
# File 'lib/emfsvg/device_context.rb', line 192

def color
  @color
end

#hatchObject (readonly)

Returns the value of attribute hatch.



192
193
194
# File 'lib/emfsvg/device_context.rb', line 192

def hatch
  @hatch
end

#image_idObject (readonly)

Returns the value of attribute image_id.



192
193
194
# File 'lib/emfsvg/device_context.rb', line 192

def image_id
  @image_id
end

#styleObject (readonly)

Returns the value of attribute style.



192
193
194
# File 'lib/emfsvg/device_context.rb', line 192

def style
  @style
end

Class Method Details

.defaultObject



194
195
196
# File 'lib/emfsvg/device_context.rb', line 194

def self.default
  new
end

Instance Method Details

#dupObject



202
203
204
# File 'lib/emfsvg/device_context.rb', line 202

def dup
  Brush.new(style: style, color: color, hatch: hatch, image_id: image_id)
end

#null?Boolean

Returns:

  • (Boolean)


198
199
200
# File 'lib/emfsvg/device_context.rb', line 198

def null?
  style == NULL
end