float GetMagnification(Graphics g, int width, int height) { float r = (float)height / (float)width; if (r <= BarCode128.AspectRatio) { // height is the limiting value r = BarCode128.MmYFromPixel(g, height) / BarCode128.OptimalHeight; } else { // width is the limiting value r = BarCode128.MmXFromPixel(g, width) / BarCode128.OptimalWidth; } // Set the magnification limits // Specification says 80% to 200% magnification allowed if (r < .8f) { r = .8f; } else if (r > 2f) { r = 2; } return(r); }
internal BarCodeProperties(BarCode128 bc, XmlNode node) { _bc = bc; _node = node; }