基于MIDP2.0实现图片的缩放功能[4]

[入库:2006年2月23日] [更新:2007年3月24日]

本文简介:

nbsp;  // sample

                    // now loop from srcX to srcX2 and add up the values for
                    // each channel
                    do
                    {
                        argb = srcPixels[srcX + y * srcW];
                        a += ((argb & 0xff000000) >> 24); // alpha channel
                        r += ((argb & 0x00ff0000) >> 16); // red channel
                        g += ((argb & 0x0000ff00) >> 8); // green channel
                        b += (argb & 0x000000ff); // blue channel
                        ++count; // count the pixel
                        ++srcX; // move on to the next pixel
                    } while (srcX <= srcX2
                            && srcX + y * srcW < srcPixels.length);

                    // average out the channel values
                    a /= count;
                    r /= count;
                    g /= count;
                    b /= count;

                    // recreate color from the averaged channels and place it
                    // into the temporary buffer
                    tmpPixels[destX + y * destW] = ((a << 24) | (r << 16)
                            | (g << 8) | b);
                }
            }

本文关键:基于MIDP2.0实现图片的缩放功能
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top