Examples of OMRGBColor


Examples of org.vectomatic.dom.svg.OMRGBColor

  public OMRGBColor rgbColor(String str) {
//    GWT.log("rgbColor(" + str + ")");
    RGB255.setLastIndex(0);
    MatchResult result = RGB255.exec(str);
    if (result != null && result.getGroupCount() == 4) {
      return new OMRGBColor(
        Integer.parseInt(result.getGroup(1)),
        Integer.parseInt(result.getGroup(2)),
        Integer.parseInt(result.getGroup(3)));
    }
    RGBPCT.setLastIndex(0);
    result = RGBPCT.exec(str);
    if (result != null && result.getGroupCount() == 4) {
      return new OMRGBColor(
        255 * Integer.parseInt(result.getGroup(1)) / 100,
        255 * Integer.parseInt(result.getGroup(2)) / 100,
        255 * Integer.parseInt(result.getGroup(3)) / 100);
    }
    RGBHEX.setLastIndex(0);
    result = RGBHEX.exec(str);
    if (result != null && result.getGroupCount() == 2) {
      String hex = result.getGroup(1);
      if (hex.length() == 3) {
        return new OMRGBColor(
          Integer.parseInt(hex.substring(0, 1), 16),
          Integer.parseInt(hex.substring(1, 2), 16),
          Integer.parseInt(hex.substring(2, 3), 16));
      } else {
        return new OMRGBColor(
          Integer.parseInt(hex.substring(0, 2), 16),
          Integer.parseInt(hex.substring(2, 4), 16),
          Integer.parseInt(hex.substring(4, 6), 16));
      }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.