×

Discussion Board

Page 2 of 2 FirstFirst 12
Results 16 to 18 of 18
  1. #16
    Regular Contributor
    Join Date
    Jun 2003
    Location
    Hungary
    Posts
    414
    7650 have this problem too.

  2. #17
    Registered User
    Join Date
    Mar 2003
    Posts
    1

    Any workaround?

    Has anyone found a workaround for this problem?

    Sasa

  3. #18
    Registered User
    Join Date
    Mar 2003
    Posts
    1
    Bit of an old topic, but I stumbled upon the problem again today. This is what I did. Won't work if your background contains any black pixels, but that wasn't a problem for me.

    final int imageWidth = 100;
    final int imageHeight = 15;
    final int textColor = 0x0000ff;
    final int bgColor = 0xff0000;

    Image myImage = Image.createImage(imageWidth, imageHeight);
    Graphics g = myImage.getGraphics();

    g.setColor(bgColor);
    g.fillRect(0, 0, imageWidth, imageHeight);

    g.setFont(Font.getFont(Font.FACE_PROPORTIONAL, Font.STYLE_PLAIN, Font.SIZE_MEDIUM));

    g.setColor(textColor);

    g.drawString("TEST", 0, 0, Graphics.TOP | Graphics.LEFT);

    fixNokiaBug(g, imageWidth, imageHeight, textColor);


    //-----------------------------------------------------------------------------------------------
    private void fixNokiaBug(Graphics aGraphics, int aWidth, int aHeight, int aColor)
    {
    try
    {
    short wrongColor = (short) 0xf000;
    short rightColor = (short) (0xf000 | ((aColor >> 12) & 0xf00) | ((aColor >> 8) & 0xf0) | ((aColor >> 4) & 0xf));

    com.nokia.mid.ui.DirectGraphics dg = com.nokia.mid.ui.DirectUtils.getDirectGraphics(aGraphics);

    short[] pixels = new short[aWidth * aHeight];
    dg.getPixels(pixels, 0, aWidth, 0, 0, aWidth, aHeight, com.nokia.mid.ui.DirectGraphics.TYPE_USHORT_4444_ARGB);

    for (int i = aWidth*aHeight-1; i >= 0; i--)
    {
    if (pixels[i] == wrongColor)
    {
    pixels[i] = rightColor;
    }
    }

    dg.drawPixels(pixels, true, 0, aWidth, 0, 0, aWidth, aHeight, 0, com.nokia.mid.ui.DirectGraphics.TYPE_USHORT_4444_ARGB);
    }
    catch (Exception e)
    {
    }
    }

    //-----------------------------------------------------------------------------------------------

Posting Permissions

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