Example #1
0
  /**
   * Construct a new CWindow given the background image and color. If the background image is null,
   * the fill color will be used instead. In the case null image and negative color are specified
   * the window is considered to be transparent.
   *
   * @param bgImage the background image to use for the window background
   * @param bgColor the background fill color in 0xrrggbbaa format to use for the window background
   *     if the background image is null.
   */
  public CWindow(Image bgImage, int bgColor, int width, int height) {
    bounds = new int[4];
    bounds[X] = 0;
    bounds[Y] = 0;
    bounds[W] = width;
    bounds[H] = height;

    layers = new CLayerList();

    /* Add the most bottom background layer */
    bgLayer = new BackgroundLayer(bgImage, bgColor);
    bgLayer.setBounds(0, 0, width, height);
    addLayer(bgLayer);
  }
Example #2
0
 /**
  * Establish a background. This method will evaluate the parameters and create a background which
  * is appropriate. If the image is non-null, the image will be used to create the background. If
  * the image is null, the values for the colors will be used and the background will be painted in
  * fill color instead. If the image is null, and the background color is a negative value, this
  * layer will become transparent and no background will be painted.
  *
  * @param bgImage the image to use for the background tile (or null)
  * @param bgColor if the image is null, use this color as a background fill color
  */
 synchronized void setBackground(Image bgImage, int bgColor) {
   bgLayer.setBackground(bgImage, bgColor);
 }
Example #3
0
 /** Resize window and its background according to updated skin values */
 public void resize(int width, int height) {
   bounds[W] = width;
   bounds[H] = height;
   bgLayer.setBounds(0, 0, width, height);
 }