Class EmbosserTools

java.lang.Object
org.daisy.braille.embosser.EmbosserTools

public class EmbosserTools extends Object
Provides tools related to embosser communication.
Author:
Joel HÃ¥kansson
  • Field Details

  • Constructor Details

    • EmbosserTools

      public EmbosserTools()
  • Method Details

    • toBytes

      public static byte[] toBytes(int val, int size)
      Converts an integer to bytes and padding the value with zeros to the required size.
      Parameters:
      val - the value to convert
      size - the number of bytes to output
      Returns:
      returns a zero padded byte array containing the value
      Throws:
      IllegalArgumentException - if the integer value requires more bytes than specified by size.
    • getWidth

      public static int getWidth(Dimensions dim, double unit)
      Get width, in units
      Parameters:
      unit - unit in mm
      Returns:
      returns width in units
    • getHeight

      public static int getHeight(Dimensions dim, double unit)
      Get height, in units
      Parameters:
      unit - unit in mm
      Returns:
      returns width in units