public static HSBColor transform(HSBType.HSB color) throws CouldNotTransformException { try { return HSBColor.newBuilder().setHue(color.getHue()).setSaturation(color.getSaturation()).setBrightness(color.getBrightness()).build(); } catch (Exception ex) { throw new CouldNotTransformException("Could not transform " + HSBType.HSB.class.getName() + " to " + HSBColor.class.getName() + "!", ex); } }
public static HSBType.HSB transform(HSBColor color) throws CouldNotTransformException { try { return HSBType.HSB.newBuilder().setHue(color.getHue()).setSaturation(color.getSaturation()).setBrightness(color.getBrightness()).build(); } catch (Exception ex) { throw new CouldNotTransformException("Could not transform " + HSBColor.class.getName() + " to " + HSBType.class.getName() + "!", ex); } } }
public static ColorState transform(final HSBType.HSB hsbColor) throws CouldNotTransformException { try { HSBColor hsbColorBuilder = HSBColor.newBuilder().setHue(hsbColor.getHue()).setSaturation(hsbColor.getSaturation()).setBrightness(hsbColor.getBrightness()).build(); Color color = Color.newBuilder().setHsbColor(hsbColorBuilder).setType(Color.Type.HSB).build(); return ColorState.newBuilder().setColor(color).build(); } catch (Exception ex) { throw new CouldNotTransformException("Could not transform " + HSBType.HSB.class.getName() + " to " + ColorState.class.getName() + "!", ex); } }
public static HSBType.HSB transform(final ColorState colorState) throws CouldNotTransformException { try { HSBColor color = colorState.getColor().getHsbColor(); return HSBType.HSB.newBuilder().setHue(color.getHue()).setSaturation(color.getSaturation()).setBrightness(color.getBrightness()).build(); } catch (Exception ex) { throw new CouldNotTransformException("Could not transform " + HSBColor.class.getName() + " to " + HSBType.class.getName() + "!", ex); } } }