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

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

本文简介:

            int[] tmpPixels = new int[destW * srcH]; // temporary buffer for the
                                                     // horizontal resampling
                                                     // step

            // variables to perform additive blending
            int argb; // color extracted from source
            int a, r, g, b; // separate channels of the color
            int count; // number of pixels sampled for calculating the average

            // the resampling will be separated into 2 steps for simplicity
            // the first step will keep the same height and just stretch the
            // picture horizontally
            // the second step will take the intermediate result and stretch it
            // vertically

            // horizontal resampling
            for (int y = 0; y < srcH; ++y)
            {
                for (int destX = 0; destX < destW; ++destX)
                {
                    count = 0;
                    a = 0;
                    r = 0;
                    b = 0;
                    g = 0; // initialize color blending vars
                    int srcX = (destX * ratioW) >> FP_SHIFT; // calculate
                                                             // beginning of
                                                             // sample
                    int srcX2 = ((destX + 1) * ratioW) >> FP_SHIFT; // calculate
                                                                    // end of
                                                                 &

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

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

go top