Tabnine Logo
FixedPoint
Code IndexAdd Tabnine to your IDE (free)

How to use
FixedPoint
in
com.oculusinfo.tile.rendering.color

Best Java code snippets using com.oculusinfo.tile.rendering.color.FixedPoint (Showing top 16 results out of 315)

origin: unchartedsoftware/aperture-tiles

  public BRColorRamp (boolean inverted, double opacity) {
    super(inverted,
       Arrays.asList(new FixedPoint(0.25, 0.0), new FixedPoint(0.50, 0.5), new FixedPoint(1.00, 1.0)),
       Arrays.asList(new FixedPoint(0.25, 0.0), new FixedPoint(0.375, 0.25), new FixedPoint(0.625, 0.25), new FixedPoint(0.75, 0.0)),
       Arrays.asList(new FixedPoint(0.00, 0.5), new FixedPoint(0.25, 1.0), new FixedPoint(0.75, 0.0)),
       null,
       opacity);
  }
}
origin: unchartedsoftware/aperture-tiles

public static double valueFromFixedPoints(List<FixedPoint> values, double scale) {
  FixedPoint start = values.get(0);
  if (scale<start.getScale()) return start.getValue();
  for (int i=1; i<values.size(); i++) {
    FixedPoint pt = values.get(i);
    if (scale<pt.getScale()) {
      return ((scale-start.getScale())*pt.getValue() + (pt.getScale()-scale)*start.getValue())/(pt.getScale()-start.getScale());
    }
    start = pt;
  }
  return start.getValue();
}
origin: unchartedsoftware/aperture-tiles

  public WareColorRamp (boolean inverted, double opacity) {
    super(inverted,
       Arrays.asList(new FixedPoint(0, 0.25), new FixedPoint(0.25, 0.9), new FixedPoint(0.5, 0.1), new FixedPoint(0.75, 1)),
       new ArrayList<FixedPoint>(),
       Arrays.asList(new FixedPoint(0, 0.25), new FixedPoint(0.25, 0), new FixedPoint(0.85, 0), new FixedPoint(1, 1)),
       null,
       opacity);
  }
}
origin: unchartedsoftware/aperture-tiles

@Override
public String encode (FixedPoint value) {
  return String.format("%fby%f", value.getScale(), value.getValue());
}
origin: unchartedsoftware/aperture-tiles

  public GreyColorRamp (boolean inverted, double opacity) {
    super(inverted,
       Arrays.asList(new FixedPoint(0.0, 0.0), new FixedPoint(1.0, 1.0)),
       Arrays.asList(new FixedPoint(0.0, 0.0), new FixedPoint(1.0, 1.0)),
       Arrays.asList(new FixedPoint(0.0, 0.0), new FixedPoint(1.0, 1.0)),
       null,
       opacity);
  }
}
origin: unchartedsoftware/aperture-tiles

@Override
public void encodeJSON (JSONNode propertyNode, FixedPoint value) throws JSONException {
  JSONObject jsonValue = new JSONObject();
  jsonValue.put("scale", value.getScale());
  jsonValue.put("value", value.getValue());
  propertyNode.setAsJSONObject(jsonValue);
}
origin: unchartedsoftware/aperture-tiles

  public SingleGradientColorRamp (Color from, Color to) {
    super(false,
       Arrays.asList(new FixedPoint(0.0, from.getRed()/255.0),   new FixedPoint(1.0, to.getRed()/255.0)),
       Arrays.asList(new FixedPoint(0.0, from.getGreen()/255.0), new FixedPoint(1.0, to.getGreen()/255.0)),
       Arrays.asList(new FixedPoint(0.0, from.getBlue()/255.0),  new FixedPoint(1.0, to.getBlue()/255.0)),
       Arrays.asList(new FixedPoint(0.0, from.getAlpha()/255.0), new FixedPoint(1.0, to.getAlpha()/255.0)),
       255);
  }
}
origin: unchartedsoftware/aperture-tiles

public AbstractColorRamp (boolean inverted, List<FixedPoint> reds, List<FixedPoint> greens, List<FixedPoint> blues, List<FixedPoint> alphas, double opacity){
  this.isInverted = inverted;
  this.reds = reds;
  this.greens = greens;
  this.blues = blues;
  if (null == alphas) {
    //there's no alphas, so initialize them with the single opacity field
    this.alphas = new ArrayList<>();
    this.alphas.add(new FixedPoint(0, opacity));
    this.alphas.add(new FixedPoint(1, opacity));
  } else {
    this.alphas = alphas;
  }
}
origin: unchartedsoftware/aperture-tiles

@Override
public FixedPoint unencode (String string) throws ConfigurationException {
  String[] parts = string.split("by");
  return new FixedPoint(Double.parseDouble(parts[0]), Double.parseDouble(parts[1]));
}
origin: unchartedsoftware/aperture-tiles

@Override
public FixedPoint unencodeJSON (JSONNode propertyNode) throws JSONException, ConfigurationException {
  JSONObject node = propertyNode.getAsJSONObject();
  return new FixedPoint(node.getDouble("scale"), node.getDouble("value"));
}
origin: unchartedsoftware/aperture-tiles

/**
 * Creates a stepped gradient from a list of colors.
 *
 * @param colors
 *         The list of colors to step through at even intervals.
 * @return
 *         The new ramp.
 */
public static SteppedGradientColorRamp from(List<Color> colors) {
  List<FixedPoint> red = new ArrayList<>();
  List<FixedPoint> grn = new ArrayList<>();
  List<FixedPoint> blu = new ArrayList<>();
  List<FixedPoint> alp = new ArrayList<>();
  int n = colors.size()-1;
  int i = 0;
  double point = 0.0;
  double interval = 1.0/n;
  for (Color c: colors) {
    red.add(new FixedPoint(point, c.getRed()/255.0));
    grn.add(new FixedPoint(point, c.getGreen()/255.0));
    blu.add(new FixedPoint(point, c.getBlue()/255.0));
    alp.add(new FixedPoint(point, c.getAlpha()/255.0));
    i++;
    point = i < n? i*interval : 1.0;
  }
  return new SteppedGradientColorRamp(red, grn, blu, alp);
}
origin: unchartedsoftware/aperture-tiles

protected static List<FixedPoint> getFixedPointList(List<?> list) {
  int numPoints = list.size();
  List<FixedPoint> pointList = new ArrayList<FixedPoint>(numPoints);
  for (int i = 0; i < numPoints; ++i) {
    Object obj = list.get(i);
    if (obj != null) {
      FixedPoint point = null;
      if (obj instanceof List) {
        //the element is a list, so it should be 2 numbers that form a FixedPoint
        point = getFixedPointFromList((List<?>)obj);
      }
      else if (obj instanceof Map) {
        point = getFixedPointFromMap((Map<?, ?>)obj);
      }
      else {
        point = new FixedPoint(0, 0);
      }
      pointList.add(point);
    }
  }
  return pointList;
}
origin: unchartedsoftware/aperture-tiles

/**
 * Converts a list of items into a {@link FixedPoint}.
 * Uses the first element in the list as the scale, and the second element
 * as the value.
 * If the list doesn't have enough items, or the elements are not numbers,
 * then it treats them as 0.
 *
 * @param list
 *     A list of numbers.
 * @return
 *     Returns a {@link FixedPoint} based on the values in the list.
 */
protected static FixedPoint getFixedPointFromList(List<?> list) {
  double scale = 0;
  double value = 0;
  int numItems = list.size();
  if (numItems >= 1) {
    //the scale should be the first item
    scale = JsonUtilities.getNumber(list.get(0)).doubleValue();
  }
  if (numItems >= 2) {
    //the value should be the second item
    value = JsonUtilities.getNumber(list.get(1)).doubleValue();
  }
  return new FixedPoint(scale, value);
}
origin: unchartedsoftware/aperture-tiles

/**
 * Converts a map into a {@link FixedPoint}.
 * The map should contain a key labelled 'scale' or '0' for scale,
 * and 'value' or '1' for value.
 * If anything is missing, then it's considered 0.
 *
 * @param map
 *     A string->object map to pull objects from.
 * @return
 *     Returns a {@link FixedPoint} constructed from the elements of the map.
 */
protected static FixedPoint getFixedPointFromMap(Map<?, ?> map) {
  double scale = 0;
  double value = 0;
  if (map.containsKey("scale")) {
    scale = JsonUtilities.getNumber(map.get("scale")).doubleValue();
  }
  else if (map.containsKey("value")) {
    value = JsonUtilities.getNumber(map.get("value")).doubleValue();
  }
  else if (map.containsKey("0")) {
    scale = JsonUtilities.getNumber(map.get("0")).doubleValue();
  }
  else if (map.containsKey("1")) {
    value = JsonUtilities.getNumber(map.get("1")).doubleValue();
  }
  return new FixedPoint(scale, value);
}
origin: unchartedsoftware/aperture-tiles

  @Test
  public void testJSONSerialization () throws JSONException, ConfigurationException {
    FixedPointProperty prop = new FixedPointProperty("", "");
    FixedPoint pt = new FixedPoint(3.0, 4.0);
    JSONObject root = new JSONObject();
    JSONNode node = new JSONNode(root, "fixedpoint");
    prop.encodeJSON(node, pt);
    FixedPoint redux = prop.unencodeJSON(node);
    Assert.assertEquals(pt, redux);
  }
}
origin: unchartedsoftware/aperture-tiles

@Test
public void testPropertyFileSerialization () throws ConfigurationException {
  FixedPointProperty prop = new FixedPointProperty("", "");
  FixedPoint pt = new FixedPoint(3.0, 4.0);
  String encoded = prop.encode(pt);
  FixedPoint redux = prop.unencode(encoded);
  Assert.assertEquals(pt, redux);
}
com.oculusinfo.tile.rendering.colorFixedPoint

Javadoc

Describes a fixed point on a color scale.

Most used methods

  • <init>
  • getScale
  • getValue

Popular in Java

  • Reactive rest calls using spring rest template
  • putExtra (Intent)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • onCreateOptionsMenu (Activity)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now