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
permalink #color ⇒ Object
Returns the value of attribute color.
15 16 17 |
# File 'lib/zebra/zpl/graphic.rb', line 15 def color @color end |
permalink #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 |
permalink #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 |
permalink #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 |
permalink #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 |
permalink #orientation ⇒ Object
Returns the value of attribute orientation.
15 16 17 |
# File 'lib/zebra/zpl/graphic.rb', line 15 def orientation @orientation end |
permalink #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 |
permalink #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
permalink #to_zpl ⇒ Object
[View source]
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/zebra/zpl/graphic.rb', line 61 def to_zpl check_attributes graphic = case graphic_type when "B" "B#{graphic_width},#{graphic_height},#{line_thickness},#{color},#{rounding_degree}" when "C" "C#{graphic_width},#{line_thickness},#{color}" when "D" "D#{graphic_width},#{graphic_height},#{line_thickness},#{color},#{orientation}" when "E" "E#{graphic_width},#{graphic_height},#{line_thickness},#{color}" when "S" sym = !symbol_type.nil? ? "^FD#{symbol_type}" : '' "S,#{graphic_height},#{graphic_width}#{sym}" end "^FW#{rotation}^FO#{x},#{y}^G#{graphic}^FS" end |