×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Oct 2003
    Posts
    22

    Alpha blending effect

    Hi there...
    Is there any body try the alpha blending effect on MIDPv1.1 support device such as Nokia 6610.If possible, kindly share the experience.
    Thanks alot...

  2. #2
    Regular Contributor
    Join Date
    Mar 2003
    Location
    Rotterdam, Holland
    Posts
    118
    is there such a thing as MIDP1.1?? Anyway, alpha blending isnt supported natively on any phone iirc. The algorithm is fairly easy though, once you have access to the RGB values of the image. Have a look at http:\\remon.mojomedia.at\ under Tutorials for one of my tuts on that.

  3. #3
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395
    Errrr.... don't Series 40s support alpha blending...? Either using 32bit pngs, or using the Nokia UI extensions and setColorARGB().

  4. #4
    Regular Contributor
    Join Date
    Mar 2003
    Location
    Rotterdam, Holland
    Posts
    118
    Isnt PNG a "full transparent or not at all" kinda format? Alpha blending, as the name suggests, blends background colours with foreground colours by a specified amount, which, as far as i know, isnt supported on any MIDP1.0 or series 40 device.

  5. #5
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395
    PNGs can support a full alpha channel... for example, using 32 bits per pixel, with 8 bits for each red, green, blue and alpha. Internally, most Nokias represent images using 16 bits per pixel - four bits for each R, G, B and A.

    Nokia phones (at least, Series 40s) will support alpha blending when drawing onto a Graphics context, if a partially opaque colour is set using the setARGBColor() method of the Nokia-specific DirectGraphics object.
    Code:
    class AlphaCanvas extends Canvas {
        public void paint (Graphics g) {
            g.setColor (0xffffff);
            g.fillRect (0, 0, getWidth (), getHeight ());
    		
            DirectGraphics dg = DirectUtils.getDirectGraphics (g);
    
            int d = (getHeight () / 3) * 2;
    
            dg.setARGBColor (0x80ffff00);
            g.fillArc ((getWidth () / 2) - (d / 2), 0, d, d, 0, 360);
    		
            dg.setARGBColor (0x8000ffff);
            g.fillArc (0, d / 2, d, d, 0, 360);
    		
            dg.setARGBColor (0x80ff00ff);
            g.fillArc ((getWidth () / 3), d / 2, d, d, 0, 360);
        }
    }
    If you try this code on a Series 40 (or the 7210 emu) you will see three circles, of cyan, magenta and yellow. Where they overlap, an alpha-blended colour is formed. I haven't tried blending with partially transparent PNGs, as I haven't managed to pursuade Paint Shop Pro into creating one yet!

    Graham.

Posting Permissions

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