Package org.newdawn.slick

Examples of org.newdawn.slick.Color


      throw new RuntimeException("Attribute "+attribute+" is not specified as a color:"+getAttribute(attribute));
    }
   
    int col = Integer.parseInt(getAttribute(attribute).substring(1), 16);
   
    return new Color(col);
  }
View Full Code Here


    renderer[1] = new SimpleDiagramRenderer(InkscapeLoader.load("testdata/svg/head2.svg"));
//    renderer[2] = new SimpleDiagramRenderer(InkscapeLoader.load("testdata/svg/head3.svg"));
    renderer[3] = new SimpleDiagramRenderer(InkscapeLoader.load("testdata/svg/orc.svg"));
//    renderer[4] = new SimpleDiagramRenderer(InkscapeLoader.load("testdata/svg/cow.svg"));
   
    container.getGraphics().setBackground(new Color(0.5f,0.7f,1.0f));
  }
View Full Code Here

    float offset = particle.getLife() / particle.getOriginalLife();
    float inv = 1 - offset;
    float colOffset = 0;
    float colInv = 1;

    Color startColor = null;
    Color endColor = null;
    for (int i = 0; i < colors.size() - 1; i++) {
      ColorRecord rec1 = (ColorRecord) colors.get(i);
      ColorRecord rec2 = (ColorRecord) colors.get(i + 1);

      if ((inv >= rec1.pos) && (inv <= rec2.pos)) {
View Full Code Here

  }

  public boolean hasColorAt(Image img, float x, float y) {
    int cx = (int) ((x - getX()) / getScalex());
    int cy = (int) ((y - getY()) / getScaley());
    Color c = img.getColor(cx, cy);
    return c.a > 0.1f;
  }
View Full Code Here

    for (int i = 0; i < emitters.size(); i++) {
      ((ConfigurableEmitter) emitters.get(i)).setPosition(0, ypos);
    }
    system.render();

    g.setColor(new Color(0, 0, 0, 0.5f));
    g.fillRect(-1, -5, 2, 10);
    g.fillRect(-5, -1, 10, 2);
  }
View Full Code Here

      float offset = Float.parseFloat(step.getAttribute("offset"));
      float r = Float.parseFloat(step.getAttribute("r"));
      float g = Float.parseFloat(step.getAttribute("g"));
      float b = Float.parseFloat(step.getAttribute("b"));

      emitter.addColorPoint(offset, new Color(r, g, b, 1));
    }

    // generate new random play length
    emitter.replay();
  }
View Full Code Here

   
          String colInt = Util.extractStyle(s.getAttribute("style"),"stop-color");
          String opaInt = Util.extractStyle(s.getAttribute("style"),"stop-opacity");
         
          int col = Integer.parseInt(colInt.substring(1), 16);
          Color stopColor = new Color(col);
          stopColor.a = Float.parseFloat(opaInt);
         
          gradient.addStep(offset, stopColor);
        }
       
        gradient.getImage();
      }
     
      diagram.addGradient(name, gradient);
    }
   
    NodeList radial = element.getElementsByTagName("radialGradient");
    for (int i=0;i<radial.getLength();i++) {
      Element rad = (Element) radial.item(i);
      String name = rad.getAttribute("id");
      Gradient gradient = new Gradient(name, true);
     
      gradient.setTransform(Util.getTransform(rad, "gradientTransform"));
     
      if (stringLength(rad.getAttribute("cx")) > 0) {
        gradient.setX1(Float.parseFloat(rad.getAttribute("cx")));
      }
      if (stringLength(rad.getAttribute("cy")) > 0) {
        gradient.setY1(Float.parseFloat(rad.getAttribute("cy")));
      }
      if (stringLength(rad.getAttribute("fx")) > 0) {
        gradient.setX2(Float.parseFloat(rad.getAttribute("fx")));
      }
      if (stringLength(rad.getAttribute("fy")) > 0) {
        gradient.setY2(Float.parseFloat(rad.getAttribute("fy")));
      }
      if (stringLength(rad.getAttribute("r")) > 0) {
        gradient.setR(Float.parseFloat(rad.getAttribute("r")));
      }
     
      String ref = rad.getAttributeNS("http://www.w3.org/1999/xlink", "href");
      if (stringLength(ref) > 0) {
        Gradient grad = diagram.getGradient(ref.substring(1));
        if (grad == null) {
          throw new ParsingException(rad, "Can't find referenced gradient: "+ref);
        }

        gradient.reference(ref.substring(1));
        toResolve.add(gradient);
      } else {
        NodeList steps = rad.getElementsByTagName("stop");
        for (int j=0;j<steps.getLength();j++) {
          Element s = (Element) steps.item(j);
          float offset = Float.parseFloat(s.getAttribute("offset"));
   
          String colInt = Util.extractStyle(s.getAttribute("style"),"stop-color");
          String opaInt = Util.extractStyle(s.getAttribute("style"),"stop-opacity");
         
          int col = Integer.parseInt(colInt.substring(1), 16);
          Color stopColor = new Color(col);
          stopColor.a = Float.parseFloat(opaInt);
         
          gradient.addStep(offset, stopColor);
        }
       
View Full Code Here

    }
    emitter.colors.clear();
    for (int i=0;i<grad.getControlPointCount();i++) {
      float pos = grad.getPointPos(i);
      java.awt.Color col = grad.getColor(i);
      Color slick = new Color(col.getRed() / 255.0f, col.getGreen() / 255.0f, col.getBlue() / 255.0f, 1.0f);
     
      emitter.addColorPoint(pos, slick);
    }
  }
View Full Code Here

    blockUpdates = true;
    link(emitter.startAlpha, "startAlpha");
    link(emitter.endAlpha, "endAlpha");
   
    grad.clearPoints();
    Color start = ((ColorRecord) emitter.colors.get(0)).col;
    Color end = ((ColorRecord) emitter.colors.get(emitter.colors.size()-1)).col;
   
    grad.setStart(new java.awt.Color(start.r,start.g,start.b,1.0f));
    grad.setEnd(new java.awt.Color(end.r,end.g,end.b,1.0f));
   
    for (int i=1;i<emitter.colors.size()-1;i++) {
      float pos = ((ColorRecord) emitter.colors.get(i)).pos;
      Color col = ((ColorRecord) emitter.colors.get(i)).col;
      grad.addPoint(pos, new java.awt.Color(col.r,col.g,col.b,1.0f));
    }
    blockUpdates = false;
   
    if (emitter.usePoints == Particle.INHERIT_POINTS) {
View Full Code Here

         
    NodeList list = element.getElementsByTagName("image");
    Element imageNode = (Element) list.item(0);
    String ref = imageNode.getAttribute("source");
   
    Color trans = null;
    String t = imageNode.getAttribute("trans");
    if ((t != null) && (t.length() > 0)) {
      int c = Integer.parseInt(t, 16);
     
      trans = new Color(c);
    }

    if (loadImage) {
      Image image = new Image(map.getTilesLocation()+"/"+ref,false,Image.FILTER_NEAREST,trans);
      setTileSetImage(image);
View Full Code Here

TOP

Related Classes of org.newdawn.slick.Color

Copyright © 2018 www.massapicom. 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.