Package javax.microedition.lcdui

Examples of javax.microedition.lcdui.Graphics


    }

    public void repaint() {

        int numberOfCards = player.getNumberOfCards();
        Graphics gRender = null;
       
        switch(player.getPos()) {

            case DOWN:

                    int maxCardX = screenWX / WIDTH;
                    int width = (numberOfCards < maxCardX)?(numberOfCards + 1) * WIDTH
                                :maxCardX * WIDTH;
                    rendered = Image.createImage(width, HEIGHT * 3);
                    gRender = rendered.getGraphics();
                    //Fill background with black color.
                    gRender.fillRect(0, 0, rendered.getWidth(), rendered.getHeight());

                    int card = 0;
                    int end = numberOfCards - 1;
                    int spacer = 0;
                    int atual = player.getAtualCardP();
                    //counting starts in 0
                    if (player.getNumberOfCards() >= maxCardX) {

                        if ((atual >= maxCardX - 4)
                            && (atual < numberOfCards - 3)) {

                            card = atual - (maxCardX - 4);
                        } else if (atual >= numberOfCards - 3) {

                            card = numberOfCards - maxCardX;
                            if (atual == numberOfCards - 1) {

                                spacer = -1;
                            }
                        }

                        end = card + maxCardX - 1;
                    }
                   
                    //Draw cards
                    for(; card <= end; card++, spacer++) {

                        Image render = player.getCard(card).getGraphic().getRender();
                        int posy = (card == atual)?0:HEIGHT;
                        gRender.drawRegion(render, 0, 0, render.getWidth(),
                                           render.getHeight(), Sprite.TRANS_NONE,
                                           spacer * WIDTH, posy,
                                           Graphics.TOP|Graphics.LEFT);
                    }
            break;

            case UP: {

                int width2 = (numberOfCards < 15)?(numberOfCards + 1) * WIDTH
                                :15 * WIDTH;
                rendered = Image.createImage(width2, HEIGHT*2);
                gRender = rendered.getGraphics();
                //Fill background with black color.
                gRender.fillRect(0, 0, rendered.getWidth(), rendered.getHeight());

                int max = (numberOfCards < 15)?numberOfCards:14;
                //Draw player
                for(int n = 0; n < max; n++) {

                    Image render = ((showFace)
                                    ?player.getCard(n).getGraphic()
                                    :BACK).getRender();
                    gRender.drawRegion(render, 0, 0, render.getWidth(),
                                       render.getHeight(), Sprite.TRANS_NONE,
                                       n*WIDTH, 0, Graphics.TOP|Graphics.LEFT);
                }
            }
            break;
           
            case LEFT:
            case RIGHT:

                int capacity = (screenWY - 136) / 15;
                int height = (numberOfCards < capacity)?(numberOfCards + 1) * WIDTH
                                                     : (capacity - 1) * WIDTH;
                rendered = Image.createImage(HEIGHT * 2, height);
                gRender = rendered.getGraphics();
                //Fill background with black color.
                gRender.fillRect(0, 0, rendered.getWidth(), rendered.getHeight());
               
                int max = (numberOfCards < capacity - 2)?numberOfCards:capacity - 2;
                for(int n = 0; n < max; n++) {

                    Image render = ((showFace)
                                    ?player.getCard(n).getGraphic()
                                    :BACK).getRender();
                    gRender.drawRegion(render, 0, 0, render.getWidth(),
                                       render.getHeight(),
                                       (player.getPos() == LEFT)
                                       ?Sprite.TRANS_ROT270
                                       :Sprite.TRANS_ROT90,
                                       0, n*WIDTH, Graphics.TOP|Graphics.LEFT);
View Full Code Here


        gTable = new GraphicTable(bgame.getTable(), width, height);
    }

   public void refresh() {
      
       Graphics g = getGraphics();
       g.fillRect(0, 0, getWidth(), getHeight());

       drawTable(g);
       drawDirection(g);
       drawArrowAtualPlayer(g);
        //Refresh players
       Player[] players = null;
       if ((getWidth() < 220) && (getHeight() < 300)) {

           players = new Player[1];
           players[0] = bgame.getLocalPlayer();
           //Draw number of cards for atual player in small screens
           if (!bgame.getAtualPlayer().isLocalPlayer()) {

               //Choose red color
               g.setColor(255, 0, 0);
               g.setFont(Font.getFont(Font.FACE_MONOSPACE, Font.STYLE_BOLD, Font.SIZE_LARGE));
               g.drawString(String.valueOf(bgame.getAtualPlayer().getNumberOfCards()),
                            DIRECTION_POSX + 10, DIRECTION_POSY + 35, 0); //Anchor 0 is default
           }
       } else {
      
           players = bgame.getAllPlayers();
       }
       //Draw players
       for(int n = 0; n < players.length; n++) {

           gPlayers[n].repaint();

           int anchor = Graphics.LEFT | Graphics.VCENTER;

           if ((players[n].getPos() == GraphicPlayer.DOWN)
                   || (players[n].getPos() == GraphicPlayer.UP)) {

               anchor = Graphics.TOP | Graphics.HCENTER;
           }

           int[] pos = getPlayerPos(players[n].getPos());
           g.drawImage(gPlayers[n].getRendered(), pos[0], pos[1], anchor);
       }

       paint(g);
       flushGraphics();
    }
View Full Code Here

                        Graphics.HCENTER | Graphics.TOP);
    }

    public void chooseColor()  {

        Graphics g = getGraphics();

        try {

            Image chooser = Image.createImage("/res/chooser.png");
            g.drawImage(chooser, getWidth() / 2, getHeight() / 2,
                        Graphics.HCENTER | Graphics.VCENTER);

        } catch (IOException io) {

            //#ifdef DEBUG
View Full Code Here

      }
  }

  public void drawCallUno() {

      Graphics g = getGraphics();
      showingxUno = true;
     
      try {

            Image UNO = Image.createImage("/res/xuno.png");
            g.drawImage(UNO, getWidth()/2, getHeight()/2, Graphics.HCENTER|Graphics.VCENTER);
            paint(g);
            flushGraphics();
            Thread.sleep(3000);
       } catch(IOException io) {
View Full Code Here

  if (!(win instanceof Graphics)) {
      throwIAE(Errors.EGL_BAD_WINDOW_SURFACE);
  }

        Graphics winGraphics = (Graphics)win;
       
        Object[] result = new Object[1];
        _getGraphicsSource(winGraphics,result);
        Object source = result[0];
View Full Code Here

  }
        if (!(pixmap instanceof Graphics)) {
      throwIAE(Errors.EGL_BAD_PIXMAP);
  }

        Graphics imageGraphics = (Graphics)pixmap;
        int width = _getGraphicsWidth(imageGraphics);
        int height = _getGraphicsHeight(imageGraphics);

        int displayId = ((EGLDisplayImpl)display).nativeId();
        int configId = ((EGLConfigImpl)config).nativeId();
View Full Code Here

  }
  if (!(native_pixmap instanceof Graphics)) {
      throwIAE(Errors.EGL_BAD_PIXMAP);
  }
       
        Graphics imageGraphics = (Graphics)native_pixmap;

        GL10Impl.grabContext();
       
        EGLSurfaceImpl surf = (EGLSurfaceImpl)surface;
  boolean retval = EGL_TRUE ==
View Full Code Here

        if ((bits & WIT.DIMMED) != 0)
            tiles.addElement(tilePainter.getTile(tileW, tileW, bits & WIT.DIMMED, false, null));

        int anchorX = (x - zoomX) * gridStep;
        int anchorY = (y - zoomY) * gridStep;
        Graphics g = gobanTile.getGraphics();
        for (int i = 0; i < tiles.size(); i++) {
            Tile tile = (Tile)tiles.elementAt(i);
            g.drawRGB(tile.pixels32, 0, tileW, anchorX, anchorY, tileW, tileW, true);
        }

        //repaint(gobanViewDevX + anchorX, gobanViewDevY + anchorY, tileW, tileW);
        //repaint();
        return true;
View Full Code Here

        if ((bits & WIT.DIMMED) != 0)
            tiles.addElement(tilePainter.getTile(tileW, tileW, bits & WIT.DIMMED, false, null));

        int anchorX = (x - zoomX) * gridStep;
        int anchorY = (y - zoomY) * gridStep;
        Graphics g = gobanTile.getGraphics();
        for (int i = 0; i < tiles.size(); i++) {
            Tile tile = (Tile)tiles.elementAt(i);
            g.drawRGB(tile.pixels32, 0, tileW, anchorX, anchorY, tileW, tileW, true);
        }

        //repaint(gobanViewDevX + anchorX, gobanViewDevY + anchorY, tileW, tileW);
        //repaint();
        return true;
View Full Code Here

        final int color_bg = cp.colors[ColorScheme.COLOR_BACKGROUND];

        final Image img = (BUFFER == null ? canvas : BUFFER);

        final Graphics g = img.getGraphics();
        final int w = img.getWidth();
        final int h = img.getHeight();

        g.setColor(color_bg);
        g.fillRect(0, 0, w, h);

        //#debug
        AlbiteMIDlet.LOGGER.log("Drawing background on " + (BUFFER == null ? "canvas" : "BUFFER") + " from (0, 0) to (" + w + ", " + h + ") " + "using the colour " + Integer.toHexString(color_bg));

        page.draw(g, cp);
View Full Code Here

TOP

Related Classes of javax.microedition.lcdui.Graphics

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.