Package org.mt4j.util

Examples of org.mt4j.util.MTColor


       
        //Set style infos
        if (returnComp instanceof AbstractVisibleComponent){
          AbstractVisibleComponent comp = (AbstractVisibleComponent)returnComp;
          //Set Fill
          comp.setFillColor(new MTColor(fillR, fillG, fillB, fillOpacity));
          comp.setNoFill(noFill);
          //Set Stroke
          comp.setStrokeColor(new MTColor(strokeR, strokeG, strokeB, strokeOpacity));
          //Opengl cant handle big lines well
          //So cap at width 3
          if (strokeWidth > 2.0f)
            strokeWidth = 2.0f;
          comp.setStrokeWeight(strokeWidth);
          comp.setNoStroke(noStroke);
          //Other
          comp.setDrawSmooth(true);
          comp.setPickable(false);
         
          //Hack for smoothing non stroked components with a stroke same as fillcolor
          if (comp.isNoStroke()
           && linearGradient == null
          ){ 
            comp.setStrokeColor(new MTColor(fillR, fillG, fillB, fillOpacity)); //fillOpacity
            comp.setStrokeWeight(0.6f);
            //Ellipse doesent smooth right with 0.1f strokeweight
            if (comp instanceof MTEllipse){
              comp.setStrokeWeight(1.0f);
            }
View Full Code Here


    showCaret   = false;
    enableCaret = false;
    showCaretTime = 1000;
   
    this.setStrokeWeight(1.5f);
    this.setStrokeColor(new MTColor(255, 255, 255, 255));
    this.setDrawSmooth(true);
   
    //Draw this component and its children above
    //everything previously drawn and avoid z-fighting
    this.setDepthBufferDisabled(true);
View Full Code Here

//      fingerCircle.setCustomAndGlobalCam(currentScene.getSceneCam(), defaultCenterCam);
      fingerCircle.attachCamera(defaultCenterCam);
     
      //fingerCircle.setFillColor(50, 225, 230, 200);
//      fingerCircle.setNoFill(true);
      fingerCircle.setFillColor(new MTColor(255,50,50, 190));
//      fingerCircle.setFillColor(Tools3D.getRandom(140, 255),Tools3D.getRandom(110, 255),Tools3D.getRandom(135, 255), 150);
      fingerCircle.setDrawSmooth(true);
//      fingerCircle.setStrokeWeight(2);
//      fingerCircle.setStrokeColor(100,100,100, 150);
      fingerCircle.setNoStroke(true);
View Full Code Here

    this.createScreenBorders(physicsContainer);
   
    //Createa circles
    for (int i = 0; i < 20; i++) {
      PhysicsCircle c = new PhysicsCircle(app, new Vector3D(ToolsMath.getRandom(60, mtApplication.width-60), ToolsMath.getRandom(60, mtApplication.height-60)), 50, world, 1.0f, 0.3f, 0.4f, scale);
      MTColor col = new MTColor(ToolsMath.getRandom(60, 255),ToolsMath.getRandom(60, 255),ToolsMath.getRandom(60, 255));
      c.setFillColor(col);
      c.setStrokeColor(col);
      PhysicsHelper.addDragJoint(world, c, c.getBody().isDynamic(), scale);
      physicsContainer.addChild(c);
    }
   
    //Create rectangle
    PhysicsRectangle physRect = new PhysicsRectangle(new Vector3D(100,300), 100, 50, app, world, 1f, 0.4f, 0.4f, scale);
    MTColor col = new MTColor(ToolsMath.getRandom(60, 255),ToolsMath.getRandom(60, 255),ToolsMath.getRandom(60, 255));
    physRect.setFillColor(col);
    physRect.setStrokeColor(col);
    PhysicsHelper.addDragJoint(world, physRect, physRect.getBody().isDynamic(), scale);
    physicsContainer.addChild(physRect);
   
    //Create polygon
    Vertex[] polyVertices = new Vertex[]{
        new Vertex(-10,0,0),
        new Vertex(10,0,0),
        new Vertex(10,50,0),
        new Vertex(60,50,0),
        new Vertex(60,70,0),
        new Vertex(10,70,0),
       
        new Vertex(10,120,0),
        new Vertex(-10,120,0),
        new Vertex(-10,70,0),
        new Vertex(-60,70,0),
        new Vertex(-60,50,0),
        new Vertex(-10,50,0),
        new Vertex(-10,0,0),
    };
    PhysicsPolygon physPoly = new PhysicsPolygon(polyVertices, new Vector3D(250,250), app, world, 1.0f, 0.3f, 0.4f, scale);
    MTColor polyCol = new MTColor(ToolsMath.getRandom(60, 255),ToolsMath.getRandom(60, 255),ToolsMath.getRandom(60, 255));
    physPoly.setFillColor(polyCol);
    physPoly.setStrokeColor(polyCol);
    PhysicsHelper.addDragJoint(world, physPoly, physPoly.getBody().isDynamic(), scale);
    //For an anti-aliased outline
    List<Vertex[]> contours = new ArrayList<Vertex[]>();
View Full Code Here

      //@Override
      public void processAnimationEvent(AnimationEvent ae) {
        switch (ae.getId()) {
        case AnimationEvent.ANIMATION_STARTED:
        case AnimationEvent.ANIMATION_UPDATED:
          fullScreenQuad.setFillColor(new MTColor(0,0,0, ae.getAnimation().getInterpolator().getCurrentValue()));
          break;
        case AnimationEvent.ANIMATION_ENDED:
          fullScreenQuad.setFillColor(new MTColor(0,0,0, ae.getAnimation().getInterpolator().getCurrentValue()));
          finished = true;
          break;
        default:
          break;
        }
      }});
    anim2.setResetOnFinish(true);
   
        anim = new Animation("Fade animation 1", new MultiPurposeInterpolator(0,255, this.duration/2f, 0, 1, 1) , this).addAnimationListener(new IAnimationListener(){
          //@Override
          public void processAnimationEvent(AnimationEvent ae) {
            switch (ae.getId()) {
        case AnimationEvent.ANIMATION_STARTED:
        case AnimationEvent.ANIMATION_UPDATED:
          fullScreenQuad.setFillColor(new MTColor(0,0,0, ae.getAnimation().getInterpolator().getCurrentValue()));
          break;
        case AnimationEvent.ANIMATION_ENDED:
          sceneToDraw = nextScene;
          anim2.start();
          break;
        default:
          break;
        }
          }});
       anim.setResetOnFinish(true);
      
       fullScreenQuad = new MTRectangle(0,0, app.width, app.height, app);
       fullScreenQuad.setFillColor(new MTColor(0,0,0,0));
       fullScreenQuad.setNoStroke(true);
  }
View Full Code Here

   *
   * @param app the app
   * @return the default font
   */
  public IFont getDefaultFont(PApplet app){
    return createFont(app, DEFAULT_FONT, DEFAULT_FONT_SIZE, new MTColor(DEFAULT_FONT_FILL_COLOR), new MTColor(DEFAULT_FONT_STROKE_COLOR), DEFAULT_FONT_ANTIALIASING);
  }
View Full Code Here

   * @param fontSize the font size
   * @param antiAliased the anti aliased
   * @return the i font
   */
  public IFont createFont(PApplet pa, String fontFileName, int fontSize, boolean antiAliased){
    return createFont(pa, fontFileName,fontSize, new MTColor(0,0,0,255), new MTColor(0,0,0,255), antiAliased);
  }
View Full Code Here

//    String fontAbsoultePath =  MT4jSettings.getInstance().getDefaultFontPath() + fontFileName;
//    IFont font = this.getCachedFont(fontAbsoultePath, fontSize, new MTColor(0,0,0,255), new MTColor(0,0,0,255), true);
//    if (font != null){
//      return font;
//    }
    return createFont(pa, fontFileName,fontSize, new MTColor(0,0,0,255), new MTColor(0,0,0,255));
  }
View Full Code Here

        float val = ae.getAnimation().getInterpolator().getCurrentValue();
        switch (ae.getId()) {
        case AnimationEvent.ANIMATION_STARTED:
          lastSceneRectangle.setVisible(true);
        case AnimationEvent.ANIMATION_UPDATED:
          lastSceneRectangle.setFillColor(new MTColor(255,255,255, val));
          break;
        case AnimationEvent.ANIMATION_ENDED:
          lastSceneRectangle.setVisible(false);
          lastSceneRectangle.setFillColor(new MTColor(255,255,255, val));
          finished = true;
          break;
        default:
          break;
        }
View Full Code Here

        lastSceneWindow = new MTSceneTexture(app,0, 0, Math.round(app.width/2f), Math.round(app.height/2f), lastScene);
        lastSceneRectangle = new MTRectangle(0,0, app.width, app.height, app);
       
        lastSceneRectangle.setGeometryInfo(lastSceneWindow.getGeometryInfo());
        lastSceneRectangle.setTexture(lastSceneWindow.getTexture());
        lastSceneRectangle.setStrokeColor(new MTColor(0,0,0,255));
        lastSceneRectangle.setVisible(false);
        lastSceneRectangle.setNoStroke(true);
        lastSceneRectangle.setDepthBufferDisabled(true);
        getCanvas().addChild(lastSceneRectangle);
       
View Full Code Here

TOP

Related Classes of org.mt4j.util.MTColor

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.