protected void paint(Graphics g) {
    g.setColor(0xFAFAFA);
    g.fillRect(0, 0, getWidth(), getHeight());
    g.setColor(0xDDDDDD);
    g.setStrokeStyle(Graphics.SOLID);
    g.drawLine(0, 0, getWidth(), 0);

    if (!pressedField) {
      g.setColor(0xE5E5E5);
    } else {
      pressedField = false;
      g.setColor(0xBCBCBC);
    }

    if (selected == Main.STATION_LIST_VIEW) {
      g.fillRect(0, 1, getWidth() / 2, getHeight() / 2);
    } else if (selected == Main.FAVORITE_LIST_VIEW) {
      g.fillRect(getWidth() / 2 + 1, 1, getWidth(), getHeight() / 2);
    } else if (selected == Main.MAP_SEARCH_VIEW) {
      g.fillRect(0, getHeight() / 2 + 1, getWidth() / 2, getHeight());
    } else if (selected == Main.GEOCODING_SEARCH_VIEW) {
      g.fillRect(getWidth() / 2 + 1, getHeight() / 2 + 1, getWidth(), getHeight());
    }

    g.setColor(0x000000);
    g.setFont(Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_SMALL));
    g.drawImage(imageStationListView, 60, 40, Graphics.HCENTER | Graphics.VCENTER);
    g.drawString(Main.STATION_LIST_VIEW_TITLE, 60, 80, Graphics.HCENTER | Graphics.TOP);
    g.drawImage(imageFavoriteListView, 180, 40, Graphics.HCENTER | Graphics.VCENTER);
    g.drawString(Main.FAVORITE_LIST_VIEW_TITLE, 180, 80, Graphics.HCENTER | Graphics.TOP);
    g.drawImage(imageMapSearchView, 60, 160, Graphics.HCENTER | Graphics.VCENTER);
    g.drawString(Main.MAP_SEARCH_VIEW_TITLE, 60, 200, Graphics.HCENTER | Graphics.TOP);
    g.drawImage(imageGeocodingSearchView, 180, 160, Graphics.HCENTER | Graphics.VCENTER);
    g.drawString(Main.GEOCODING_SEARCH_VIEW_TITLE, 180, 200, Graphics.HCENTER | Graphics.TOP);
  }
Example #2
0
  private static final boolean Tiger_Paint_Small(Graphics g) {
    // #if !(TIGER=="TRUE")
    return true;
    // #else
    if (logo == null) {

      logo = new Image[PicIdx.length];
      for (int i = PicIdx.length - 1; i >= 0; i--) logo[i] = GetImage(PicIdx[i]);
      if (SoundOn != 0) Tiger_Sound_Play();
    }

    if (++runTime >= TIGER_DURING / FRAME_DT) {
      logo = null;
      FreeAllImage();
      // #if ENABLE_TOUCH=="TRUE"
      cTouch.ClearBtns();
      // #endif
      Tiger_Finished = true;
      Tiger_Sound_Final();
      return true;
    } else {
      cCPdrawCleanScreen(g, 0x0); // 清屏
      if (runTime < (TIGER_DURING / 3) / FRAME_DT) {
        g.drawImage(logo[0], (SCR_W >> 1), (SCR_H >> 1), Graphics.HCENTER | Graphics.VCENTER);
      } else if (runTime < (TIGER_DURING * 2 / 3) / FRAME_DT) {
        g.drawImage(logo[1], (SCR_W >> 1), (SCR_H >> 1), Graphics.HCENTER | Graphics.VCENTER);
      } else if (runTime < TIGER_DURING / FRAME_DT) {
        g.drawImage(logo[2], (SCR_W >> 1), (SCR_H >> 1), Graphics.HCENTER | Graphics.VCENTER);
      }
      return false;
    }
    // #endif
  }
Example #3
0
  private void render() {
    g.setColor(0xffffffff);
    g.fillRect(0, 0, getWidth(), getHeight());
    g.drawImage(
        background, -kinetic.getWindowX(), -kinetic.getWindowY(), Graphics.LEFT | Graphics.TOP);
    g.drawImage(
        background,
        -kinetic.getWindowX(),
        background.getHeight() - kinetic.getWindowY(),
        Graphics.LEFT | Graphics.TOP);
    closeButton.render(g);

    kinetic.renderDebugData(g);
  }
Example #4
0
  protected void paint(Graphics g) {

    g.setColor(COLOR_WHITE);
    g.fillRect(0, 0, getWidth(), getHeight());

    Font f1 = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_LARGE);
    Font f2 = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_SMALL);

    int px = getWidth() / 2;

    g.setColor(COLOR_BLUE);
    g.setFont(f1);
    g.drawString(
        Locale.getInst().getStr(Locale.SPLASH_TOP), px, 0, Graphics.TOP | Graphics.HCENTER);

    g.setFont(f2);
    g.drawString(
        Locale.getInst().getStr(Locale.SPLASH_BOTTOM),
        px,
        getHeight(),
        Graphics.BOTTOM | Graphics.HCENTER);

    if (logo != null) {
      g.drawImage(logo, getWidth() / 2, getHeight() / 2, Graphics.HCENTER | Graphics.VCENTER);
    }
  }
Example #5
0
 private void drawPlayer(Graphics g) {
   g.drawImage(
       gd.player.getCurCharImg(),
       gd.player.x - gd.curMap.x,
       gd.player.y - gd.curMap.y,
       Graphics.TOP | Graphics.LEFT);
 }
Example #6
0
  public static Image createThumbnail(Image image, int width, int height) {
    int sourceWidth = image.getWidth();
    int sourceHeight = image.getHeight();

    if ((width > sourceWidth) && (height > sourceHeight)) {
      return image;
    }
    int thumbWidth = width;
    int thumbHeight = thumbWidth * sourceHeight / sourceWidth;
    if (thumbHeight > height) {
      thumbHeight = height;
      thumbWidth = thumbHeight * sourceWidth / sourceHeight;
    }
    // #sijapp cond.if modules_ANDROID is "true"#
    Image scaled = image.scale(thumbWidth, thumbHeight);
    if (null != scaled) return scaled;
    // #sijapp cond.end#

    Image thumb = Image.createImage(thumbWidth, thumbHeight);
    Graphics g = thumb.getGraphics();

    for (int y = 0; y < thumbHeight; ++y) {
      for (int x = 0; x < thumbWidth; ++x) {
        g.setClip(x, y, 1, 1);
        int dx = x * sourceWidth / thumbWidth;
        int dy = y * sourceHeight / thumbHeight;
        g.drawImage(image, x - dx, y - dy, Graphics.LEFT | Graphics.TOP);
      }
    }
    return thumb;
  }
Example #7
0
 protected void paint(Graphics g) {
   int w = getWidth(), h = getHeight();
   g.setClip(0, 0, w, h);
   g.setColor(bgColor);
   g.fillRect(0, 0, w, h);
   g.setColor(fgColor);
   String msg = null;
   switch (state) {
     case INITIALIZING:
       msg = "Initializing...";
       break;
     case FAILED:
       msg = "Failed";
       break;
     case PAUSED:
       msg = "Paused";
       break;
     case LOADING:
       msg = "Loading...";
       break;
   }
   if (msg != null) {
     g.drawString(msg, w >> 1, h >> 1, Graphics.HCENTER | Graphics.BASELINE);
   } else {
     int x = 0, col = 0, y = 0, row = 0, di = curLine;
     while (di < data.length) {
       char c = (char) data[di++];
       if (c == 0) {
         y += charHeight;
         row++;
         x = 0;
         col = 0;
         if (row == screenRows) return;
         continue;
       }
       if (col++ < curColumn) continue;
       boolean longline = false;
       if (col == curColumn + screenColumns) {
         while (di < data.length)
           if (data[di++] == 0) {
             di--;
             break;
           } else {
             longline = true;
           }
       }
       int cx = (c & 15) * charWidth;
       int cy = ((c >> 4) - 2) * charHeight;
       g.setClip(x, y, charWidth, charHeight);
       if (longline) {
         g.setColor(llColor);
         g.fillRect(x, y, charWidth, charHeight);
         g.setColor(fgColor);
       }
       g.drawImage(font, x - cx, y - cy, Graphics.TOP | Graphics.LEFT);
       x += charWidth;
     }
   }
 }
Example #8
0
 /*
  * 图片上添加字符
  */
 public static Image effect_image_add_str(Image src, String str, int x_pos, int y_pos) {
   Image temp = Image.createImage(src.getWidth(), src.getHeight());
   Graphics g = temp.getGraphics();
   g.drawImage(src, 0, 0, Graphics.LEFT | Graphics.TOP);
   g.setColor(0x000000);
   g.drawString(str, x_pos, y_pos, Graphics.LEFT | Graphics.TOP);
   return temp;
 }
  private void showMenu(Graphics g) {
    Image bgImg = Resource.loadImage(Resource.PIC_ID_MAIN_BG);
    g.drawImage(bgImg, 0, 0, 0);
    if (mainMenu == null) {
      initMenuRes();
    }
    mainMenu.show(g);

    if (!Configurations.getInstance().isFavorWayNonsupport()) {
      Image collect = Resource.loadImage(Resource.PIC_ID_COLLECT);
      int sx = 12, sy = 405;
      if (collect != null) {
        g.drawImage(collect, sx, sy, 20);
      }
      if (groupIndex == 1) {
        DrawUtil.drawRect(g, sx, sy, collect.getWidth(), collect.getHeight(), 3, 0XFFFF00);
      }
    }
  }
  private void printObjects(Graphics g) {
    // g.drawImage(invaderpic,s.getX(),s.getY(),Graphics.TOP | Graphics.LEFT);
    if (lastdraw > 5) lastdraw = 0;

    g.drawImage(
        i_invaders_a[InvadersSettings.I_INVADER_A_EXPL][lastdraw++],
        0,
        0,
        Graphics.TOP | Graphics.LEFT);
  }
Example #11
0
  public void paint(Graphics g) {
    int w = getWidth();
    int h = getHeight();

    try {
      g.drawImage(img, w / 2, h / 2, Graphics.VCENTER | Graphics.HCENTER);
    } catch (Exception e) {
      g.drawString(e.getMessage(), w / 2, h / 2, Graphics.BASELINE | Graphics.HCENTER);
    }
  }
Example #12
0
  public static final boolean SoundOnOff_paint_small(Graphics g) {
    cCPdrawCleanScreen(g, 0);
    Image Img_firstLogo = GetImage(IDX_FIRSTLOGO);
    Image Img_CNM = GetImage(IDX_CNM);
    g.drawImage(
        Img_firstLogo,
        DevConfig.SCR_W >> 1,
        Img_firstLogo.getHeight() >> 1,
        Graphics.HCENTER | Graphics.VCENTER);
    g.drawImage(
        Img_CNM, cCP.SCR_W >> 1, Img_firstLogo.getHeight(), Graphics.HCENTER | Graphics.TOP);
    //		TotalTime += GLLib.s_Tick_Paint_FrameDT;

    if (TotalTime++ > 20) {
      GameMIDlet.SetSoundOnOff(false);
      return true;
    } else {
      return false;
    }
  }
Example #13
0
  private void showRankBg(Graphics g) {
    Image title = Resource.loadImage(Resource.PIC_ID_RANK_TITLE);
    Image item = Resource.loadImage(Resource.PIC_ID_RANK_ITEM);
    Image foot = Resource.loadImage(Resource.PIC_ID_RANK_FOOT);

    int titleX = (engine.getScreenWidth() - title.getWidth()) >> 1;
    int titleY = 30;
    g.drawImage(title, titleX, titleY, 20);

    int itemX = titleX + ((title.getWidth() - item.getWidth()) >> 1);
    int itemY = titleY + title.getHeight();
    for (int i = 0; i < 11; ++i) {
      g.drawImage(item, itemX, itemY, 20);
      itemY += item.getHeight();
    }

    int footX = titleX + ((title.getWidth() - foot.getWidth()) >> 1);
    int footY = itemY;
    g.drawImage(foot, footX, footY, 20);
  }
Example #14
0
  /*--------------------------------------------------
   * Paint the text representing the key code
   *-------------------------------------------------*/
  protected void paint(Graphics g) {
    // Clear the background (to white)
    g.setColor(255, 255, 255);
    g.fillRect(0, 0, getWidth(), getHeight());

    // Set color and draw text
    // Draw with black pen
    g.setColor(0, 0, 0);
    // Close to the center
    g.drawImage(image, mX, mY, Graphics.HCENTER | Graphics.VCENTER);
  }
Example #15
0
  protected void paint(Graphics g) {
    int width = this.getWidth();

    // Fill in the background White
    g.setColor(0xFFFFFF); // White
    g.fillRect(0, 0, width, this.getHeight());

    int y = yPos;
    y += MARGIN;

    if (this.logo != null) {
      g.drawImage(this.logo, width / 2, y, Graphics.TOP | Graphics.HCENTER);
      y += logo.getHeight() + MARGIN;
    }

    g.setColor(0x0); // Black

    // Write the title "About"
    final Font titleFont =
        Font.getFont(Font.FACE_SYSTEM, Font.STYLE_BOLD | Font.STYLE_UNDERLINED, Font.SIZE_LARGE);

    /*
     * TODO: currently paints ALL the text, even if there is (a lot) more
     * than can fit on the screen. (must do this first time to assess
     * 'height', but shouldn't need to do it for any other repaint
     */
    for (int i = 0; i < TITLES.length; i++) {
      final int basicFontHeight = DEFAULT_SIMPLE_FONT.getHeight();
      final int titleFontHeight = titleFont.getHeight();
      // Write out the 'message' heading
      g.setFont(titleFont);
      final String title = TITLES[i];
      int stringWidth = g.getFont().stringWidth(title);
      g.drawString(title, (width - stringWidth) / 2, y, 0);
      y += titleFontHeight;

      // Write out the 'message' text.
      g.setFont(DEFAULT_SIMPLE_FONT);
      for (int j = 0; j < this.formattedMessages[i].length; j++) {
        final String message = this.formattedMessages[i][j];
        stringWidth = g.getFont().stringWidth(message);
        g.drawString(message, (width - stringWidth) / 2, y, 0);
        y += basicFontHeight;
      }
      y += basicFontHeight;
    }

    // Set the total-Height the first time
    if (firstTime) {
      totalHeight = y + MARGIN;
      firstTime = false;
    }
  }
  /*
   *  (non-Javadoc)
   * @see javax.microedition.lcdui.Canvas#paint(javax.microedition.lcdui.Graphics)
   */
  protected void paint(Graphics g) {

    g.setGrayScale(255);

    // Draw the image - for now start drawing in top left corner of screen
    g.fillRect(0, 0, Constants.SCREEN_WIDTH, Constants.SCREEN_HEIGHT);
    System.out.println("Screen size:" + Constants.SCREEN_WIDTH + ":" + Constants.SCREEN_HEIGHT);

    if (image == null) System.out.println("PhotoViewScreen::paint(): Image object was null.");

    g.drawImage(image, 0, 0, Graphics.TOP | Graphics.LEFT);
  }
Example #17
0
  protected void paintCache(
      Graphics g, int x, int y, int width, int height, int heading, Cache cache) {

    g.setClip(x, y, width, height);
    g.setColor(COLOR_CACHELIST_BG);
    g.fillRect(x, y, width, height);

    g.drawImage(
        viewResources.getIcon(IC_CACHES_OFFS + cache.type), x, y, Graphics.TOP | Graphics.LEFT);
    g.drawImage(
        viewResources.getIcon(IC_COMPASS_OFFS + heading), width, y, Graphics.TOP | Graphics.RIGHT);

    // Draws a set of squares to indicate cache health based on latest logs
    for (int i = 0; i < cache.lastLogsType.length; i++) {
      g.setColor(COLOR_LOG[cache.lastLogsType[i]]);
      g.fillRect(x + 16, y + (i << 2), 4, 4);
    }

    g.setColor(COLOR_TEXT);
    g.drawString(cache.name, x + 20, y, Graphics.LEFT | Graphics.TOP);
  }
Example #18
0
  /**
   * Scale an image to the given width and height.
   *
   * <p><b>Be aware that resizing an image is very CPU intensive, therefore use this method with
   * care. </b>
   *
   * @param src the source image that needs to be resized
   * @return a new image object that contains the resized image
   */
  public static final Image resizeImage(Image src, int width, int height) {
    // check if it is absolutely necessary to resize the image
    if (src.getWidth() != width && src.getHeight() != height) {
      int srcW = src.getWidth();
      int srcH = src.getHeight();
      // create temporary image object
      Image tmp = Image.createImage(width, srcH);
      Graphics g = tmp.getGraphics();

      // calculate new width
      int delta = (srcW << 16) / width;
      int pos = delta / 2;

      // perform resize operation (horizontally)
      for (int x = 0; x < width; x++) {
        g.setClip(x, 0, 1, srcH);
        g.drawImage(src, x - (pos >> 16), 0, Graphics.LEFT | Graphics.TOP);
        pos += delta;
      }

      // create temporary image object
      Image dst = Image.createImage(width, height);
      g = dst.getGraphics();

      // calculate new height
      delta = (srcH << 16) / height;
      pos = delta / 2;

      // perform resize operation (vertically)
      for (int y = 0; y < height; y++) {
        g.setClip(0, y, width, 1);
        g.drawImage(tmp, 0, y - (pos >> 16), Graphics.LEFT | Graphics.TOP);
        pos += delta;
      }
      return dst;
    } else {
      return src;
    }
  }
  /**
   * Render the string onto the Graphics, built from individual character images.
   *
   * <p>The anchor paramater can contain the following values TOP, BOTTOM, VCENTER, LEFT, RIGHT or
   * CENTER.
   *
   * <p>To use a combination value do a boolean OR - e.g. TOP | CENTER
   *
   * <p>This method throws runtime exceptions when arguments are invalid or when a required image
   * representing a character can't be found
   *
   * @param g The graphics instance to draw on
   * @param string The string to draw
   * @param x The x anchor point
   * @param y The y anchor point
   * @param anchor The anchor types: TOP, BOTTOM, VCENTER, LEFT, RIGHT or CENTER.
   * @throws IllegalArgumentException If the anchor contains an invalid number and exception wil be
   *     thrown
   * @throws NullPointerException If a null Graphics or String object is passed in as a parameter
   * @throws RuntimeException If the string contains a character for which there is no corresponding
   *     image
   * @see ImageStringDrawer#draw(Graphics g, int number, int x, int y, int anchor)
   */
  public final void draw(Graphics g, String string, int x, int y, int anchor) {

    if (g == null) {
      throw new NullPointerException("Graphics may not be null");
    }
    if (string == null) {
      throw new NullPointerException("String may not be null");
    }

    char[] stringChars = getChars(string);

    int width = getWidth(stringChars);
    int height = getHeight(stringChars);

    int xPos;
    int yPos;

    if ((anchor & TOP) != 0) {
      xPos = x;
    } else if ((anchor & BOTTOM) != 0) {
      xPos = x - height;
    } else if ((anchor & VCENTER) != 0) {
      xPos = x - height / 2;
    } else {
      throw new IllegalArgumentException("Invalid vertical anchor");
    }

    if ((anchor & LEFT) != 0) {
      yPos = y;
    } else if ((anchor & RIGHT) != 0) {
      yPos = y - width;
    } else if ((anchor & CENTER) != 0) {
      yPos = y - width / 2;
    } else {
      throw new IllegalArgumentException("Invalid horizontal anchor");
    }

    for (int i = 0; i < stringChars.length; i++) {
      String drawChar = String.valueOf(stringChars[i]);
      Image drawImage = (Image) images.get(drawChar);
      if (drawImage == null) {
        throw new RuntimeException("Missing character: " + drawChar);
      }

      g.drawImage(drawImage, xPos, yPos, Graphics.LEFT | Graphics.TOP);

      xPos += drawImage.getWidth();
    }
  }
Example #20
0
 private void showStartChoice(Graphics g) {
   g.drawImage(Resource.loadImage(Resource.PIC_ID_CHOICE_BG), 0, 0, 0);
   choiceCursor.show(
       g,
       Resource.POS_SEIGNEUR_CHOICE[choiceIndex][0],
       Resource.POS_SEIGNEUR_CHOICE[choiceIndex][1]);
   String info =
       Resource.STR_SEIGNEUR_NAME[choiceIndex]
           + "  城池X"
           + Resource.NUM_SEIGNEUR_CITYS[choiceIndex]
           + "  武将X"
           + Resource.NUM_SEIGNEUR_GENERALS[choiceIndex];
   g.setColor(0XFFFFFF);
   Font font = g.getFont();
   g.drawString(info, (engine.getScreenWidth() - font.stringWidth(info)) >> 1, 456, 0);
 }
Example #21
0
  public void drawMainMenu(Graphics g, int menu) {

    for (int i = 0; i < 5; i++) {
      if (menu == i)
        g.drawImage(btn_hover, 240 / 2, 130 + (i * 38), Graphics.HCENTER | Graphics.VCENTER);
      else g.drawImage(btn_normal, 240 / 2, 130 + (i * 38), Graphics.HCENTER | Graphics.VCENTER);
    }

    g.drawImage(txt_story, 240 / 2, 130, Graphics.HCENTER | Graphics.VCENTER);
    g.drawImage(txt_free, 240 / 2, 168, Graphics.HCENTER | Graphics.VCENTER);
    g.drawImage(txt_option, 240 / 2, 206, Graphics.HCENTER | Graphics.VCENTER);
    g.drawImage(txt_credits, 240 / 2, 244, Graphics.HCENTER | Graphics.VCENTER);
    g.drawImage(txt_exit, 240 / 2, 281, Graphics.HCENTER | Graphics.VCENTER);
  }
  public void paint(Graphics g) {
    // image vorher erzeugen um damit den gc aufruf zu sparen
    Image i_buff = Image.createImage(getWidth(), getHeight());
    Graphics g_buff = i_buff.getGraphics();

    g_buff.setColor(0, 0, 0);
    g_buff.fillRect(0, 0, getWidth(), getHeight());
    g_buff.setColor(255, 255, 255);

    if (g_buff != null) {
      // INVADERS
      printObjects(g_buff);
    }

    System.gc();

    g.drawImage(i_buff, 0, 0, Graphics.TOP | Graphics.LEFT);
  }
  /**
   * Draw images, starting at the specified Y
   *
   * @param startY
   */
  public void drawGrid(final Graphics g, final int startY) {
    g.setColor(0x000000);
    g.fillRect(0, startY, getWidth(), getHeight() - startY);

    for (int i = 0; i < imageObjectModel.size(); i++) {
      int xPosition = i % 2 * (getWidth() / 2);
      int yPosition = startY + scrollY + ((i - i % 2) / 2) * imageSide;

      if (yPosition > getHeight()) {
        break;
      }

      // If image is in RAM
      if (images.containsKey(imageObjectModel.elementAt(i))) {
        g.drawImage(
            (Image) (images.get(imageObjectModel.elementAt(i))),
            xPosition,
            yPosition,
            Graphics.LEFT | Graphics.TOP);
      } else {
        // If there were no results
        PicasaImageObject picasaImageObject = (PicasaImageObject) imageObjectModel.elementAt(i);

        if (picasaImageObject.thumbUrl.length() == 0) {
          g.setColor(0xFFFFFF);
          g.drawString("No Result.", 0, headerHeight, Graphics.TOP | Graphics.LEFT);

        } else {
          // Start loading the image, draw a placeholder
          PicasaStorage.imageCache.getAsync(
              picasaImageObject.thumbUrl,
              Task.NORMAL_PRIORITY,
              StaticWebCache.GET_ANYWHERE,
              new ImageResult(picasaImageObject));

          g.setColor(0x111111);
          g.fillRect(xPosition, yPosition, imageSide, imageSide);
        }
      }
    }

    drawSpinner(g);
  }
  public void paintAnimation(int x, int y, Displayable displayable, Image image, Graphics g) {
    // draw next as image
    g.drawImage(image, 0, 0, Graphics.TOP | Graphics.LEFT);

    // draw last as a translated screen
    Screen screen = (Screen) displayable;

    // #if polish.css.repaint-previous-screen
    this.overlay.paint(0, 0, this.screenWidth, this.screenHeight, g);
    screen.repaintPreviousScreen = false;
    // #endif

    g.translate(0, this.screenHeight - this.currentY);
    screen.paint(g);
    g.translate(0, -g.getTranslateY());

    // #if polish.css.repaint-previous-screen
    screen.repaintPreviousScreen = true;
    // #endif
  }
Example #25
0
    public void update(Graphics g) {
      if (view == null) {
        return;
      }

      if (!view.hasBuffers()) {
        hiddenImage = Image.createImage(WIDTH, HEIGHT);

        view.setBuffers(g, hiddenImage.getGraphics());

        zoom();
      }

      synchronized (view) {
        view.clearBackBuffer();

        text1.drawToBackBuffer(view);
        text2.drawToBackBuffer(view);
      }

      g.drawImage(hiddenImage, 0, 0, Graphics.TOP | Graphics.LEFT);
    }
Example #26
0
 public static final boolean MoreGame_Paint(Graphics g) {
   if (GameMIDlet.GetInstance() != null) {
     GameMIDlet.GetInstance().notifyDestroyed();
     return true;
   }
   // #if MOREGAME=="TRUE" && MODEL!="D608" && MODEL!="D508"
   Image last = cCP.GetImage(IDX_LAST);
   if (Info == null) {
     // #if SCREENWIDTH>=176
     Info = new String[] {"更多精彩游戏", "尽在游戏频道", "Wap.xjoys.com", "确定", "退出"};
     // #else
     Info = new String[] {"更多精彩游戏", "尽在游戏频道", "Wap.xjoys.com", "确定", "退出"};
     // #endif
   }
   if (last != null) {
     g.drawImage(last, SCR_W >> 1, SCR_H >> 1, Graphics.VCENTER | Graphics.HCENTER);
   }
   if (Info != null) {
     g.setFont(MyFont);
     g.setColor(0xFFFFFF);
     /** 去掉 确定 退出 所占的2 */
     int ContextHeight = MyFont.getHeight() * ((Info.length - 2));
     int Y = (SCR_H - MyFont.getHeight() - ContextHeight) >> 1;
     int i = 0, loop_end = Info.length - 2;
     while (i < loop_end) {
       g.drawString(
           Info[i], SCR_W >> 1, Y + (i * MyFont.getHeight()), Graphics.HCENTER | Graphics.TOP);
       i++;
     }
     /** 左右软键,可以用宏,处理那些对调的机型,-3 为让基线下的文字显示出来 */
     g.drawString(Info[Info.length - 2], 0, SCR_H - 3, Graphics.LEFT | Graphics.BOTTOM);
     g.drawString(Info[Info.length - 1], SCR_W, SCR_H - 3, Graphics.RIGHT | Graphics.BOTTOM);
   }
   return false;
   // #else
   return true;
   // #endif
 }
Example #27
0
  public void paint(Graphics g) {
    // g.setClip(0, 0, this.ui.xWForm.getWidth(), this.ui.xWForm.getWidth());
    if (inBox) {
      posX = (ui.xmlForm.frm_Width - width) / 2;
      posY = (ui.xmlForm.frm_Height - height) / 2;
    } else {
      posX = x + ui.offsetX;
      posY = y + ui.offsetY;
      /*
      if(focus){
      	if(height<=ui.xWForm.frm_Height-60)
      		if(posY+height+itemHeight-10>ui.xWForm.frm_Height-30){
      			ui.offsetY=ui.offsetY-(ui.xWForm.frm_Height/2);
      			ui.xWForm.repaint();
      		}
      }*/
      if (title != null) {
        //				System.out.println("title==="+title);
        if (posX + smallHeavryFont.stringWidth(title) > ui.xmlForm.frm_Width) {
          x = 0;
          y = posY + smallHeavryFont.getHeight() + 5;
        }
        posY = y + ui.offsetY + smallHeavryFont.getHeight() + 5;
        posX = x + ui.offsetX + 10;
      }
    }
    if (title != null) {

      g.setColor(0);
      g.setFont(smallHeavryFont);
      g.drawString(title + ":", x + ui.offsetX, y + ui.offsetY, 0);
    }
    //		if (focus) {

    /*if(items.size()==0){
    	height=0;
    }
    if(height!=0)*/
    /*int h=0;
    if(richmode){
    	h=title!=null?height-smallFont.getHeight()+5:0;
    }else{
    	h=height+smallFont.getHeight()-10;
    }*/
    ImageDiv.drawJiuGong(
        g,
        UIManager.select_bright,
        posX - 3,
        posY - 3,
        width + 10,
        title != null ? height - smallFont.getHeight() + 5 : height);

    //
    //		}
    //		g.setColor(bgTricolorR, bgTricolorG, bgTricolorB);
    //			g.setColor(125);
    //		g.fillRect(posX, posY, width, height-(title!=null?smallFont.getHeight()-5:0));
    g.setFont(DisplaySetting.TEXT_FONT);
    if ((onShowSelectedItemNum + 2) * itemHeight > height) {
      offsetY = (onShowSelectedItemNum + 2) * itemHeight - height;
    } else {
      offsetY = 0;
    }
    /*if(focus)
    if (onShowSelectedItemNum + 1 >= 0) {
    	ImageDiv.drawJiuGong(g, UIManager.connect_bg, posX, posY
    			+ (onShowSelectedItemNum + 1) * itemHeight - offsetY,
    			width, itemHeight);
    }*/
    int clipx = g.getClipX();
    int clipy = g.getClipY();
    int clipwidth = g.getClipWidth();
    int clipheight = g.getClipHeight();
    g.setClip(posX, posY, width, height);
    //		g.setColor(Attribute.);
    // g.setFont(font);
    g.setFont(smallFont);
    g.setColor(ColorAttribute.label_context);
    int length = items.size();
    for (int i = 0; i < length; i++) {
      g.setClip(posX, posY, width, height);
      if (i == onShowSelectedItemNum + 1 && focus) {
        g.setColor(0, 220, 247);
        if (posY + (onShowSelectedItemNum + 1) * itemHeight - offsetY
            > ui.xmlForm.frm_Height - 40) {
          ui.offsetY -= 20;
          ui.xmlForm.repaint();
          System.out.println("draw it");
        } else if (posY + (onShowSelectedItemNum + 1) * itemHeight - offsetY < 20) {
          ui.offsetY += 20;
          ui.xmlForm.repaint();
          System.out.println("draw it");
        }
        //				System.out.println("draw it");
      } else {
        g.setColor(0);
      }
      if (items.elementAt(i) != null) {
        g.drawString(
            items.elementAt(i).toString(),
            posX + 5 + (UIManager.select_block.getWidth() >> 2) + 2,
            posY + i * itemHeight - offsetY,
            Graphics.LEFT | Graphics.TOP);
      }
      if (!hasNonItem)
        ImageBuilder.drawSmallImage(
            g,
            UIManager.select_block,
            posX + 5,
            posY + i * itemHeight - offsetY + 2,
            (UIManager.select_block.getWidth() >> 2),
            UIManager.select_block.getHeight(),
            selector.elementAt(i).equals(new Integer(1))
                ? (UIManager.select_block.getWidth() >> 2) * 0
                : (UIManager.select_block.getWidth() >> 2) * 1,
            0);
    }
    if (inBox) {
      g.drawImage(
          UIManager.select_bright,
          posX + width - 1,
          posY + (height * (onShowSelectedItemNum + 1) / length),
          Graphics.RIGHT | Graphics.TOP);
    }
    g.setClip(clipx, clipy, clipwidth, clipheight);
    /*if(posY+ (onShowSelectedItemNum + 1)* itemHeight - offsetY>ui.xWForm.frm_Height-40){
    	ui.offsetY-=20;
    	ui.xWForm.repaint();
    }else if(posY+ (onShowSelectedItemNum + 1)* itemHeight - offsetY<20){
    	ui.offsetY+=20;
    }*/

  }
Example #28
0
  public static final boolean Tiger_Paint_Big(Graphics g) {
    // #if !(TIGER=="TRUE")
    return true;
    // #else
    if (logo == null) {
      logo = new Image[PicIdx.length];
      for (int i = PicIdx.length - 1; i >= 0; i--) logo[i] = GetImage(PicIdx[i]);
      if (SoundOn != 0) Tiger_Sound_Play();
    }
    if (++runTime >= TIGER_DURING / FRAME_DT) {
      // #if MODEL=="N73"
      if (SoundPlayer == null || SoundPlayer.getMediaTime() == 0) { // 不播放声音或者判断声音播放完毕时
        // #endif
        logo = null;
        FreeAllImage();
        // #if ENABLE_TOUCH=="TRUE"
        cTouch.ClearBtns();
        // #endif
        Tiger_Finished = true;
        Tiger_Sound_Final();
        return true;
        // #if MODEL=="N73"
      } else {
        return false;
      }
      // #endif
    } else {
      //			System.out.println("程序执行到此处");
      // cCPdrawCleanScreen(g, 0x0);//清屏
      g.drawImage(logo[0], SCR_W >> 1, SCR_H >> 1, Graphics.HCENTER | Graphics.VCENTER);

      if (runTime < (TIGER_DURING * 1 / 8) / FRAME_DT) {
        g.drawImage(
            logo[2], (SCR_W >> 1) - 2, (SCR_H >> 1) - 12, Graphics.HCENTER | Graphics.VCENTER);
        g.drawImage(
            logo[1],
            (SCR_W >> 1) - logo[2].getWidth() - 2,
            (SCR_H >> 1) - 12,
            Graphics.HCENTER | Graphics.VCENTER);
        g.drawImage(
            logo[3],
            (SCR_W >> 1) - 4 + logo[2].getWidth() + 2,
            (SCR_H >> 1) - 12 + 1,
            Graphics.HCENTER | Graphics.VCENTER);
      } else if (runTime < (TIGER_DURING * 2 / 8) / FRAME_DT) {
        g.drawImage(
            logo[4 + runTime % 3],
            SCR_W >> 1,
            (SCR_H >> 1) - 10,
            Graphics.HCENTER | Graphics.VCENTER);
      } else if (runTime < (TIGER_DURING * 3 / 8) / FRAME_DT) {
        g.drawImage(
            logo[4 + runTime % 3],
            SCR_W >> 1,
            (SCR_H >> 1) - 10,
            Graphics.HCENTER | Graphics.VCENTER);
        g.drawImage(
            logo[4 + (runTime + 2) % 3],
            (SCR_W >> 1) - logo[2].getWidth() - 2,
            (SCR_H >> 1) - 10,
            Graphics.HCENTER | Graphics.VCENTER);
      } else if (runTime < (TIGER_DURING * 4 / 8) / FRAME_DT) {
        g.drawImage(
            logo[4 + runTime % 3],
            SCR_W >> 1,
            (SCR_H >> 1) - 10,
            Graphics.HCENTER | Graphics.VCENTER);
        g.drawImage(
            logo[4 + (runTime + 2) % 3],
            (SCR_W >> 1) - logo[2].getWidth() - 2,
            (SCR_H >> 1) - 10,
            Graphics.HCENTER | Graphics.VCENTER);
        g.drawImage(
            logo[4 + (runTime + 2) % 3],
            (SCR_W >> 1) + logo[2].getWidth(),
            (SCR_H >> 1) - 10,
            Graphics.HCENTER | Graphics.VCENTER);
      } else if (runTime < (TIGER_DURING * 5 / 8) / FRAME_DT) {
        g.drawImage(logo[1], SCR_W >> 1, (SCR_H >> 1) - 10, Graphics.HCENTER | Graphics.VCENTER);
        g.drawImage(
            logo[4 + (runTime + 2) % 3],
            (SCR_W >> 1) - logo[2].getWidth() - 2,
            (SCR_H >> 1) - 10,
            Graphics.HCENTER | Graphics.VCENTER);
        g.drawImage(
            logo[4 + (runTime + 2) % 3],
            (SCR_W >> 1) + logo[2].getWidth(),
            (SCR_H >> 1) - 10,
            Graphics.HCENTER | Graphics.VCENTER);
      } else if (runTime < (TIGER_DURING * 6 / 8) / FRAME_DT) {
        g.drawImage(logo[1], SCR_W >> 1, (SCR_H >> 1) - 10, Graphics.HCENTER | Graphics.VCENTER);
        g.drawImage(
            logo[7],
            (SCR_W >> 1) + 1 - logo[2].getWidth() - 2,
            (SCR_H >> 1) - 12,
            Graphics.HCENTER | Graphics.VCENTER);
        g.drawImage(
            logo[4 + (runTime + 2) % 3],
            (SCR_W >> 1) + logo[2].getWidth(),
            (SCR_H >> 1) - 10,
            Graphics.HCENTER | Graphics.VCENTER);
      } else if (runTime < (TIGER_DURING * 8 / 8) / FRAME_DT) {
        g.drawImage(logo[1], SCR_W >> 1, (SCR_H >> 1) - 10, Graphics.HCENTER | Graphics.VCENTER);
        g.drawImage(
            logo[7],
            (SCR_W >> 1) + 1 - logo[2].getWidth() - 2,
            (SCR_H >> 1) - 12,
            Graphics.HCENTER | Graphics.VCENTER);
        g.drawImage(
            logo[8],
            (SCR_W >> 1) - 1 + logo[2].getWidth(),
            (SCR_H >> 1) - 12,
            Graphics.HCENTER | Graphics.VCENTER);
      }
      return false;
    }
    // #endif
  }
Example #29
0
  private void showRank(Graphics g) {

    Image title = Resource.loadImage(Resource.PIC_ID_RANK_TITLE);
    Image item = Resource.loadImage(Resource.PIC_ID_RANK_ITEM);
    Image foot = Resource.loadImage(Resource.PIC_ID_RANK_FOOT);

    int titleX = (engine.getScreenWidth() - title.getWidth()) >> 1;
    int titleY = 30;
    g.drawImage(title, titleX, titleY, 20);

    Font font = g.getFont();
    int itemX = titleX + ((title.getWidth() - item.getWidth()) >> 1);
    int itemY = titleY + title.getHeight();
    int deltaH = (item.getHeight() - font.getHeight()) >> 1;
    int sx = 0, sy = 0;
    String ss = null;
    int rankX = 43 - 20, idX = 43 + 80, scoresX = 188 + 50, seiX = 309 + 30, timeX = 467 + 10;
    for (int i = 0; i < 11; ++i) {
      g.drawImage(item, itemX, itemY, 20);
      sy = itemY + deltaH;
      itemY += item.getHeight();
      if (i == 0) {
        /*显示表头*/
        rankX += itemX;
        idX += itemX;
        scoresX += itemX;
        seiX += itemX;
        timeX += itemX;

        g.setColor(165, 173, 64);
        g.drawString("游戏排名", rankX, sy, 20);
        g.drawString("用户ID", idX, sy, 20);
        g.drawString("积分", scoresX, sy, 20);
        g.drawString("所用主公", seiX, sy, 20);
        g.drawString("统一时间", timeX, sy, 20);

        /*计算表数据坐标*/
        rankX += font.stringWidth("游戏") - 2;
        idX += ((font.stringWidth("用户ID") - font.stringWidth("0234**98")) >> 1);
        scoresX += ((font.stringWidth("积分") - font.stringWidth("34567")) >> 1);
        seiX += ((font.stringWidth("所用主公") - font.stringWidth("曹操")) >> 1);
        timeX += ((font.stringWidth("统一时间") - font.stringWidth("2012-03-24 23:58")) >> 1);
      } else {
        if (rankingList != null) {
          if (i <= rankingList.length) {
            g.setColor(0XFFFF00);
            g.drawString(Integer.toString(rankingList[i - 1].getRanking()), rankX, sy, 20);
            g.setColor(0XFFFFFF);
            String userId = rankingList[i - 1].getUserId();
            int userIdLen = userId.length();
            g.drawString(
                userId.substring(0, 4) + "**" + userId.substring(userIdLen - 2), idX, sy, 20);
            g.drawString(Integer.toString(rankingList[i - 1].getScores()), scoresX, sy, 20);
            String remark = rankingList[i - 1].getRemark();
            g.drawString(remark.substring(0, remark.indexOf(";")), seiX, sy, 20);
            String time = rankingList[i - 1].getTime();
            g.drawString(time.substring(0, time.length() - 3), timeX, sy, 20);
          }
        }
      }
    }

    int footX = titleX + ((title.getWidth() - foot.getWidth()) >> 1);
    int footY = itemY;
    g.drawImage(foot, footX, footY, 20);
    g.setColor(0XFFFF00);
    if (attainment != null) {
      ss = Integer.toString(attainment.getRanking());
    } else {
      ss = "榜上无名";
    }
    sx = footX + 175 + ((98 - font.stringWidth(ss)) >> 1);
    sy = footY + 9 + ((33 - font.getHeight()) >> 1);
    g.drawString(ss, sx, sy, 20);

    sx = footX + 508;
    sy = footY + 6;
    DrawUtil.drawRect(g, sx, sy, 89, 39, 3);
  }
Example #30
0
  public static final boolean SoundOnOff_paint_big(Graphics g) {
    cCPdrawCleanScreen(g, 0);
    if (!BtnSoundOnOffInited) {
      // #if MODEL != "G12_Review"
      // #if ENABLE_TOUCH=="TRUE"
      cTouch.InitVirtualKeysForLRSK(SCR_W, SCR_H);
      // #endif
      // #endif
      BtnSoundOnOffInited = true;
    }
    int FontHeight = g.getFont().getHeight();
    if (!HasSound) {
      if ((++SoundOnOffPaintCount) > SoundOnOffTotalFrame) {
        FreeAllImage();
        // #if ENABLE_TOUCH=="TRUE"
        cTouch.ClearBtns();
        cTouch.TargetCanvas = null;
        // #endif
        SoundOnOffisFinished = true;
        return true;
      }
    }
    // 读取资源
    // #if SOUNDONOFF=="TRUE"
    Image Img_firstLogo = GetImage(IDX_FIRSTLOGO);
    // #endif
    Image Img_sound = GetImage(IDX_SOUND);
    Image Img_line = GetImage(IDX_LINE);
    Image Img_yes = GetImage(IDX_YES);
    Image Img_no = GetImage(IDX_NO);
    Image Img_cp = GetImage(IDX_CP);

    Image Img_CNM = GetImage(IDX_CNM);
    // #if CHANNEL_NAME=="SHYL"
    Image Img_CPYL = GetImage(IDX_CPYL);
    // #endif
    // 开始绘制
    int height = SCR_H;
    if (HasSound) {
      // 绘制左右软键
      g.drawImage(Img_yes, 0, height, Graphics.LEFT | Graphics.BOTTOM);
      g.drawImage(Img_no, SCR_W, height, Graphics.RIGHT | Graphics.BOTTOM);
      height -= Img_yes.getHeight();
      height -= LINESPACE;
      // 绘制线条
      height -= Img_line.getHeight();
      g.drawImage(Img_line, SCR_W >> 1, height, Graphics.HCENTER | Graphics.TOP);
      height -= LINESPACE;

      // 绘制  是否开启声音
      height -= Img_sound.getHeight();
      g.drawImage(Img_sound, SCR_W >> 1, height, Graphics.HCENTER | Graphics.TOP);
      height -= LINESPACE;
    }
    // #if CHANNEL_NAME=="SHYL"
    g.drawImage(Img_CPYL, SCR_W >> 1, height >> 1, Graphics.VCENTER | Graphics.HCENTER);
    // #endif
    // #if SOUNDONOFF=="TRUE"
    // #if LOGO=="TRUE"
    // 绘制CNM Logo
    height -= Img_CNM.getHeight();
    g.drawImage(Img_CNM, SCR_W >> 1, height, Graphics.HCENTER | Graphics.TOP);
    height -= LINESPACE;
    // #endif

    // 绘制  游戏 Logo
    // 这正是剩余的高度,将FirstLogo 放到正中
    g.drawImage(Img_firstLogo, SCR_W >> 1, height >> 1, Graphics.HCENTER | Graphics.VCENTER);
    // #endif
    // #if SHOWGAMENAME=="TRUE"
    // 画游戏名字
    // #endif
    return false;
  };