×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Dec 2003
    Posts
    5

    Problem of drawing FLIPPED Image after clipping in Nokia 3510i handset

    Hi,
    I am facing a problem while clipping & drawing the fliped image in the specified area in Nokia 3510i handset/emulator.

    The same code is working fine when I run with series 60 emulator/Nokia 7650 handset.

    I am using a strip of images containing 4 images for drawing animation. After clipping and draw the flipped image entire image strip is drawn on the screen.

    Part of the code of my Midlet -

    Image tempImg = null;
    try
    {
    tempImg = Image.createImage("/Image/EnemyAct0.png");
    }
    catch(Exception e){}
    g.setClip(20, 25, 12, 14);
    dg.drawImage(tempImg, 20, 25, 0, dg.FLIP_HORIZONTAL);
    g.setClip(0,0,LCD_WIDTH, LCD_HEIGHT);

    I need a solution to draw the flipped image after clipping.

  2. #2
    Super Contributor
    Join Date
    Mar 2003
    Location
    Israel
    Posts
    2,280
    This is just a shot in the dark, but I guess that the call to setClip on the original Graphics object (g) is not affecting it's derived DirectGraphics object (dg). Although this doesn't comply with the docs, it could be a bug.
    If this is really the case, you could try to set the clipping region before you get the DirectGraphics object as a workaround:
    Code:
    // first set the clip on g
    g.setClip(20, 25, 12, 14);
    // then get the reference to dg
    dg = DirectUtils.getDirectGraphics(g);
    // then draw the image
    dg.drawImage(tempImg, 20, 25, 0, dg.FLIP_HORIZONTAL);
    Like I said, this is just a hunch, so I'm not sure it'll work, but good luck with it anyway

    shmoove

  3. #3
    Registered User
    Join Date
    Dec 2003
    Posts
    5
    Thank you Mr. Shmoove for your valuable suggestion, your idea worked well.
    My Midlet is working fine now.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •