Class: Zebra::Zpl::Graphic
- Inherits:
-
Object
- Object
- Zebra::Zpl::Graphic
- Includes:
- Printable
- Defined in:
- lib/zebra/zpl/graphic.rb
Defined Under Namespace
Classes: InvalidColorError, InvalidGraphicType, InvalidLineThickness, InvalidOrientationError, InvalidRoundingDegree, InvalidSymbolType
Constant Summary collapse
- BOX =
"B"- CIRCLE =
"C"- DIAGONAL =
"D"- ELLIPSE =
"E"- SYMBOL =
"S"
Instance Attribute Summary collapse
-
#color ⇒ Object
Returns the value of attribute color.
-
#graphic_height ⇒ Object
Returns the value of attribute graphic_height.
-
#graphic_type ⇒ Object
Returns the value of attribute graphic_type.
-
#graphic_width ⇒ Object
Returns the value of attribute graphic_width.
-
#line_thickness ⇒ Object
Returns the value of attribute line_thickness.
-
#orientation ⇒ Object
Returns the value of attribute orientation.
-
#rounding_degree ⇒ Object
Returns the value of attribute rounding_degree.
-
#symbol_type ⇒ Object
Returns the value of attribute symbol_type.
Attributes included from Printable
#data, #margin, #position, #x, #y
Instance Method Summary collapse
Methods included from Printable
#initialize, #justification, #justification=, #rotation, #rotation=
Instance Attribute Details
#color ⇒ Object
Returns the value of attribute color.
15 16 17 |
# File 'lib/zebra/zpl/graphic.rb', line 15 def color @color end |
#graphic_height ⇒ Object
Returns the value of attribute graphic_height.
15 16 17 |
# File 'lib/zebra/zpl/graphic.rb', line 15 def graphic_height @graphic_height end |
#graphic_type ⇒ Object
Returns the value of attribute graphic_type.
15 16 17 |
# File 'lib/zebra/zpl/graphic.rb', line 15 def graphic_type @graphic_type end |
#graphic_width ⇒ Object
Returns the value of attribute graphic_width.
15 16 17 |
# File 'lib/zebra/zpl/graphic.rb', line 15 def graphic_width @graphic_width end |
#line_thickness ⇒ Object
Returns the value of attribute line_thickness.
15 16 17 |
# File 'lib/zebra/zpl/graphic.rb', line 15 def line_thickness @line_thickness end |
#orientation ⇒ Object
Returns the value of attribute orientation.
15 16 17 |
# File 'lib/zebra/zpl/graphic.rb', line 15 def orientation @orientation end |
#rounding_degree ⇒ Object
Returns the value of attribute rounding_degree.
15 16 17 |
# File 'lib/zebra/zpl/graphic.rb', line 15 def rounding_degree @rounding_degree end |
#symbol_type ⇒ Object
Returns the value of attribute symbol_type.
15 16 17 |
# File 'lib/zebra/zpl/graphic.rb', line 15 def symbol_type @symbol_type end |
Instance Method Details
#to_zpl ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/zebra/zpl/graphic.rb', line 61 def to_zpl check_attributes graphic = case graphic_type when BOX "^GB#{graphic_width},#{graphic_height},#{line_thickness},#{color},#{rounding_degree}" when CIRCLE "^GC#{graphic_width},#{line_thickness},#{color}" when DIAGONAL "^GD#{graphic_width},#{graphic_height},#{line_thickness},#{color},#{orientation}" when ELLIPSE "^GE#{graphic_width},#{graphic_height},#{line_thickness},#{color}" when SYMBOL sym = !symbol_type.nil? ? "^FD#{symbol_type}" : '' "^GS,#{graphic_height},#{graphic_width}#{sym}" else raise InvalidGraphicType end "^FW#{rotation}^FO#{x},#{y}#{graphic}^FS" end |