Android Open Source - java-androidframework Android Basic Shape






From Project

Back to project page java-androidframework.

License

The source code is released under:

This project is licensed under the [CC0 1.0 Agreement](http://creativecommons.org/publicdomain/zero/1.0/). To the extent possible under law, Pete Schmitz has waived all copyright and related or neigh...

If you think the Android project java-androidframework listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.gamepatriot.androidframework.framework;
/*  w  w  w.  ja v  a2s. com*/
import android.graphics.Paint;


/**
 * An AndroidBasicShape implementation should contain basic information for a single shape draw call.
 * 
 * @author Pete Schmitz, May 10, 2013
 *
 */
public interface AndroidBasicShape {
  
  /**
   * Set this AndroidBasicShape as a line. Clears previous settings. 
   * @param $x1    The X position of point one.
   * @param $y1    The Y position of point one.
   * @param $x2    The X position of point two.
   * @param $y2    The Y position of point two.
   * @param $paint  The paint that this shape will be drawn with ({@link AndroidShape}'s default paint is used if null).
   */
  public void setAsLine(float $x1, float $y1, float $x2, float $y2, Paint $paint);
  
  /**
   * Set this AndroidBasicShape as a rectangle. Clears previous settings.
   * @param $left    The left position of this rectangle.
   * @param $top    The top position of this rectangle.
   * @param $right  The right position of this rectangle.
   * @param $bottom  The bottom position of this rectangle.
   * @param $paint  The paint that this shape will be drawn with ({@link AndroidShape}'s default paint is used if null).
   */
  public void setAsRectangle(float $left, float $top, float $right, float $bottom, Paint $paint);
  
  /**
   * Set this AndroidBasicShape as a circle. Clears previous settings.
   * @param $x    The center X position of this circle.
   * @param $y    The center Y position of this circle.
   * @param $radius  The radius of this circle.
   * @param $paint  The paint that this shape will be drawn with ({@link AndroidShape}'s default paint is used if null).
   */
  public void setAsCircle(float $x, float $y, float $radius, Paint $paint);
  
  /**
   * Set this AndroidBasicShape as a polygon. Clears previous settings.
   * @param $points  The array that contains each point of the polygon ({x1, y1, x2, y2, ...}).
   * @param $paint  The paint that this shape will be drawn with ({@link AndroidShape}'s default paint is used if null).
   */
  public void setAsPoly(float[] $points, Paint $paint);
  
  /**
   * Set this AndroidBasicShape as text. Clears previous settings.
   * @param $text    The text to be printed.
   * @param $size    The font size of the text.
   * @param $x    The X position of the text.
   * @param $y    The Y position of the text.
   * @param $paint  The paint that this shape will be drawn with ({@link AndroidShape}'s default paint is used if null).
   */
  public void setAsText(String $text, float $size, float $x, float $y, Paint $paint);
  
  /** Build a path from points supplied for a poly shape. **/
  public void buildPath();
  
  /** 
   * Build a path from points contained in this shape, modified by a provided offset. This call is to compensate when the parenting {@link AndroidShape}'s position
   * has been adjusted.
   * @param $offsetX    The offset X to apply to each point in the poly.
   * @param $offsetY    The offset Y to apply to each point in the poly.
   */
  public void buildPath(float $offsetX, float $offsetY);
  
  /**
   * Returns the paint that this shape is currently using. Note: Modifying this paint may affect other shapes that are using the same paint reference.
   */
  public Paint getPaint();
  
  /** 
   * Set the paint for this shape to draw with.
   * @param $paint    The paint to draw this shape with.
   * @return        The old paint that this shape was using.
   */
  public Paint setPaint(Paint $paint);
  
  public void setText(String $text);
  
}




Java Source Code List

com.gamepatriot.androidframework.framework.AndroidAnimationData.java
com.gamepatriot.androidframework.framework.AndroidAtlas.java
com.gamepatriot.androidframework.framework.AndroidBasicShape.java
com.gamepatriot.androidframework.framework.AndroidGameData.java
com.gamepatriot.androidframework.framework.AndroidImage.java
com.gamepatriot.androidframework.framework.AndroidInputter.java
com.gamepatriot.androidframework.framework.AndroidMain.java
com.gamepatriot.androidframework.framework.AndroidMusicHandler.java
com.gamepatriot.androidframework.framework.AndroidPool.java
com.gamepatriot.androidframework.framework.AndroidRenderer.java
com.gamepatriot.androidframework.framework.AndroidScreen.java
com.gamepatriot.androidframework.framework.AndroidShape.java
com.gamepatriot.androidframework.framework.AndroidSoundHandler.java
com.gamepatriot.framework2d.classes.FPS.java
com.gamepatriot.framework2d.implementation.AnimationData.java
com.gamepatriot.framework2d.implementation.Atlas.java
com.gamepatriot.framework2d.implementation.BasicShape.java
com.gamepatriot.framework2d.implementation.GameData.java
com.gamepatriot.framework2d.implementation.Image.java
com.gamepatriot.framework2d.implementation.Inputter.java
com.gamepatriot.framework2d.implementation.Main.java
com.gamepatriot.framework2d.implementation.MusicHandler.java
com.gamepatriot.framework2d.implementation.Pool.java
com.gamepatriot.framework2d.implementation.Renderer.java
com.gamepatriot.framework2d.implementation.Screen.java
com.gamepatriot.framework2d.implementation.Shape.java
com.gamepatriot.framework2d.implementation.SoundHandler.java
com.gamepatriot.framework2d.screens.Example.java