当前位置: 首页>>代码示例>>C#>>正文


C# Image.clone方法代码示例

本文整理汇总了C#中Image.clone方法的典型用法代码示例。如果您正苦于以下问题:C# Image.clone方法的具体用法?C# Image.clone怎么用?C# Image.clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Image的用法示例。


在下文中一共展示了Image.clone方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: process

 public Image process(Image input)
 {
     Image saturated = saturationFx.process(input.clone());
     Image blurred = blurFx.process(saturated);
     input = blender.Blend(saturated, blurred);
     Image edge = edgeDetectionFx.process(input.clone());
     return edgeBlender.Blend(input, edge);
 }
开发者ID:java02014,项目名称:ImageFilterForWindowsPhone,代码行数:8,代码来源:ComicFilter.cs

示例2: process

        public Image process(Image imageIn)
        {
            int height = imageIn.getHeight();
            int width = imageIn.getWidth();
            Image clone = imageIn.clone();
            imageIn.clearImage(0xffffff);

            //拉普拉斯模板
            int[] Laplacian = new int[] { -1, -1, -1, -1, 8 + _step, -1, -1, -1, -1 };
            for (int x = 1; x < width - 1; x++)
            {
                for (int y = 1; y < height - 1; y++)
                {
                    int r = 0, g = 0, b = 0;
                    int Index = 0;
                    for (int col = -1; col <= 1; col++)
                    {
                        for (int row = -1; row <= 1; row++)
                        {
                            int rr = clone.getRComponent(x + row, y + col);
                            int gg = clone.getGComponent(x + row, y + col);
                            int bb = clone.getBComponent(x + row, y + col);

                            r += rr * Laplacian[Index];
                            g += gg * Laplacian[Index];
                            b += bb * Laplacian[Index];
                            Index++;
                        }
                    }
                    imageIn.setPixelColor(x - 1, y - 1, Image.SAFECOLOR(r), Image.SAFECOLOR(g), Image.SAFECOLOR(b));
                }
            }
            return imageIn;
        }
开发者ID:java02014,项目名称:ImageFilterForWindowsPhone,代码行数:34,代码来源:SharpFilter.cs

示例3: process

 //@Override
 public Image process(Image imageIn)
 {
     int width = imageIn.getWidth();
     int height = imageIn.getHeight();
     Image clone = imageIn.clone();
     int r = 0, g = 0, b = 0;
     for (int x = 0; x < width; x++)
     {
         for (int y = 0; y < height; y++)
         {
             int k = NoiseFilter.getRandomInt(1, 123456);
             //像素块大小
             int dx = x + k % 19;
             int dy = y + k % 19;
             if (dx >= width)
             {
                 dx = width - 1;
             }
             if (dy >= height)
             {
                 dy = height - 1;
             }
             r = clone.getRComponent(dx, dy);
             g = clone.getGComponent(dx, dy);
             b = clone.getBComponent(dx, dy);
             imageIn.setPixelColor(x, y, r, g, b);
         }
     }
     return imageIn;
 }
开发者ID:java02014,项目名称:ImageFilterForWindowsPhone,代码行数:31,代码来源:MistFilter.cs

示例4: process

 //@Override
 public Image process(Image imageIn)
 {
     Palette palette = this.Map.CreatePalette(0x100);
     byte[] red = palette.Red;
     byte[] green = palette.Green;
     byte[] blue = palette.Blue;
     Image bitmap = imageIn.clone();
     bitmap.clearImage((255 << 24) + (255 << 16) + (255 << 8) + 255);
     int bfactor = (int)(this.BrightnessFactor * 255f);
     float cfactor = 1f + this.ContrastFactor;
     cfactor *= cfactor;
     int limit = ((int)(cfactor * 32768f)) + 1;
     for (int i = 0; i < imageIn.colorArray.Length; i++)
     {
         int r = (imageIn.colorArray[i] & 0x00FF0000) >> 16;
         int g = (imageIn.colorArray[i] & 0x0000FF00) >> 8;
         int b = imageIn.colorArray[i] & 0x000000FF;
         int index = (((r * 0x1b36) + (g * 0x5b8c)) + (b * 0x93e)) >> 15;
         if (bfactor != 0)
         {
             index += bfactor;
             index = (index > 0xff) ? 0xff : ((index < 0) ? 0 : index);
         }
         if (limit != 0x8001)
         {
             index -= 0x80;
             index = (index * limit) >> 15;
             index += 0x80;
             index = (index > 0xff) ? 0xff : ((index < 0) ? 0 : index);
         }
         bitmap.colorArray[i] = (0xff << 24) + (red[index] << 16) + (green[index] << 8) + blue[index];
     }
     return bitmap;
 }
开发者ID:java02014,项目名称:ImageFilterForWindowsPhone,代码行数:35,代码来源:GradientMapFilter.cs

示例5: ProcessColor

        private Image ProcessColor(int k00, int k01, int k02, int k20, int k21, int k22, Image imageIn, int thresholdSq)
        {
            int width = imageIn.getWidth();
            int height = imageIn.getHeight();
            int r, g, b;
            Image clone = imageIn.clone();
            for (int x = 0; x < width; x++)
            {
                for (int y = 0; y < height; y++)
                {
                    int color1 = GetPixelColor(clone, x - 1, y - 1, width, height);
                    int color2 = GetPixelColor(clone, x, y - 1, width, height);
                    int color3 = GetPixelColor(clone, x + 1, y - 1, width, height);
                    int color4 = GetPixelColor(clone, x - 1, y, width, height);
                    int color5 = GetPixelColor(clone, x + 1, y, width, height);
                    int color6 = GetPixelColor(clone, x - 1, y + 1, width, height);
                    int color7 = GetPixelColor(clone, x, y + 1, width, height);
                    int color8 = GetPixelColor(clone, x + 1, y + 1, width, height);

                    int color1RGB = (0x00FF0000 & color1) >> 16;
                    int color3RGB = (0x00FF0000 & color3) >> 16;
                    int color6RGB = (0x00FF0000 & color6) >> 16;
                    int color8RGB = (0x00FF0000 & color8) >> 16;
                    int colorSum1 = (color1RGB * k00 + color3RGB * k02 + ((0x00FF0000 & color2) >> 16) * k01 + color6RGB * k20 + ((0x00FF0000 & color7) >> 16) * k21 + color8RGB * k22) >> 8;
                    int colorSum2 = (color1RGB * k00 + color3RGB * k20 + ((0x00FF0000 & color4) >> 16) * k01 + color6RGB * k02 + ((0x00FF0000 & color5) >> 16) * k21 + color8RGB * k22) >> 8;
                    r = (((colorSum1 * colorSum1) + (colorSum2 * colorSum2)) > thresholdSq) ? 0 : 0xff;
                    if (this.DoInversion)
                    {
                        r = 255 - r;
                    }

                    color1RGB = (0x0000FF00 & color1) >> 8;
                    color3RGB = (0x0000FF00 & color3) >> 8;
                    color6RGB = (0x0000FF00 & color6) >> 8;
                    color8RGB = (0x0000FF00 & color8) >> 8;
                    colorSum1 = (color1RGB * k00 + color3RGB * k02 + ((0x0000FF00 & color2) >> 8) * k01 + color6RGB * k20 + ((0x0000FF00 & color7) >> 8) * k21 + color8RGB * k22) >> 8;
                    colorSum2 = (color1RGB * k00 + color3RGB * k20 + ((0x0000FF00 & color4) >> 8) * k01 + color6RGB * k02 + ((0x0000FF00 & color5) >> 8) * k21 + color8RGB * k22) >> 8;
                    g = (((colorSum1 * colorSum1) + (colorSum2 * colorSum2)) > thresholdSq) ? 0 : 0xff;
                    if (this.DoInversion)
                    {
                        g = 255 - g;
                    }

                    color1RGB = 0x000000FF & color1;
                    color3RGB = 0x000000FF & color3;
                    color6RGB = 0x000000FF & color6;
                    color8RGB = 0x000000FF & color8;
                    colorSum1 = (color1RGB * k00 + color3RGB * k02 + (0x000000FF & color2) * k01 + color6RGB * k20 + (0x000000FF & color7) * k21 + color8RGB * k22) >> 8;
                    colorSum2 = (color1RGB * k00 + color3RGB * k20 + (0x000000FF & color4) * k01 + color6RGB * k02 + (0x000000FF & color5) * k21 + color8RGB * k22) >> 8;
                    b = (((colorSum1 * colorSum1) + (colorSum2 * colorSum2)) > thresholdSq) ? 0 : 0xff;
                    if (DoInversion)
                    {
                        b = 255 - b;
                    }
                    imageIn.setPixelColor(x, y, r, g, b);
                }
            }
            return imageIn;
        }
开发者ID:java02014,项目名称:ImageFilterForWindowsPhone,代码行数:59,代码来源:ParamEdgeDetectFilter.cs

示例6: process

 //@Override
 public Image process(Image imageIn)
 {
     Image clone = imageIn.clone();
     imageIn = gradientFx.process(imageIn);
     ImageBlender blender = new ImageBlender();
     blender.Mode = BlendMode.ColorBurn;
     return saturationFx.process(blender.Blend(clone, imageIn));
     //return imageIn;// saturationFx.process(imageIn);
 }
开发者ID:olachan,项目名称:ImageFilterForWindowsPhone,代码行数:10,代码来源:SceneFilter.cs

示例7: process

        //@Override
        public Image process(Image imageIn)
        {
            int width = imageIn.getWidth();
            int height = imageIn.getHeight();
            Image clone = imageIn.clone();
            int r = 0, g = 0, b = 0;

            int ratio = imageIn.getWidth() > imageIn.getHeight() ? imageIn.getHeight() * 32768 / imageIn.getWidth() : imageIn.getWidth() * 32768 / imageIn.getHeight();

            // Calculate center, min and max
            int cx = imageIn.getWidth() >> 1;
            int cy = imageIn.getHeight() >> 1;
            int max = cx * cx + cy * cy;
            int min = (int)(max * (1 - Size));
            int diff = max - min;

            for (int x = 0; x < width; x++)
            {
                for (int y = 0; y < height; y++)
                {
                    // Calculate distance to center and adapt aspect ratio
                    int dx = cx - x;
                    int dy = cy - y;
                    if (imageIn.getWidth() > imageIn.getHeight())
                    {
                        dy = (dy * ratio) >> 14;
                    }
                    else
                    {
                        dx = (dx * ratio) >> 14;
                    }
                    int distSq = dx * dx + dy * dy;

                    if (distSq > min)
                    {
                        int k = NoiseFilter.getRandomInt(1, 123456);
                        //像素块大小
                        int pixeldx = x + k % 19;
                        int pixeldy = y + k % 19;
                        if (pixeldx >= width)
                        {
                            pixeldx = width - 1;
                        }
                        if (pixeldy >= height)
                        {
                            pixeldy = height - 1;
                        }
                        r = clone.getRComponent(pixeldx, pixeldy);
                        g = clone.getGComponent(pixeldx, pixeldy);
                        b = clone.getBComponent(pixeldx, pixeldy);
                        imageIn.setPixelColor(x, y, r, g, b);
                    }
                }
            }
            return imageIn;
        }
开发者ID:java02014,项目名称:ImageFilterForWindowsPhone,代码行数:57,代码来源:CleanGlassFilter.cs

示例8: process

 //@Override
 public Image process(Image imageIn)
 {
     ParamEdgeDetectFilter pde = new ParamEdgeDetectFilter();
     pde.K00 = 1;
     pde.K01 = 2;
     pde.K02 = 1;
     pde.Threshold = 0.25f;
     pde.DoGrayConversion = false;
     ImageBlender ib = new ImageBlender();
     ib.Mode = (int)BlendMode.Multiply;
     return ib.Blend(imageIn.clone(), pde.process(imageIn));
 }
开发者ID:java02014,项目名称:ImageFilterForWindowsPhone,代码行数:13,代码来源:BlockPrintFilter.cs

示例9: process

        //@Override
        public Image process(Image imageIn)
        {
            int k00 = (int)(K00 * 255f);
            int k01 = (int)(K01 * 255f);
            int k02 = (int)(K02 * 255f);
            int thresholdSqFactor = (int)(Threshold * 255f * 2f);
            int thresholdSq = thresholdSqFactor * thresholdSqFactor;

            if (!DoGrayConversion)
            {
                return ProcessColor(k00, k01, k02, -k00, -k01, -k02, imageIn.clone(), thresholdSq);
            }
            return ProcessGray(k00, k01, k02, -k00, -k01, -k02, imageIn, thresholdSq);
        }
开发者ID:java02014,项目名称:ImageFilterForWindowsPhone,代码行数:15,代码来源:ParamEdgeDetectFilter.cs

示例10: process

        //@Override
        public Image process(Image imageIn)
        {
            GradientMapFilter gmf = new GradientMapFilter(Gradient.BlackSepia());
            gmf.ContrastFactor = 0.15f;

            ImageBlender ib = new ImageBlender();
            ib.Mixture = 0.7f;
            ib.Mode = BlendMode.Overlay;
            imageIn = ib.Blend(imageIn.clone(), gmf.process(imageIn));

            VignetteFilter vigette = new VignetteFilter();
            vigette.Size = 0.7f;
            return vigette.process(imageIn);
        }
开发者ID:java02014,项目名称:ImageFilterForWindowsPhone,代码行数:15,代码来源:VintageFilter.cs

示例11: process

 //@Override
 public Image process(Image imageIn)
 {
     int width = imageIn.getWidth();
     int height = imageIn.getHeight();
     Image clone = imageIn.clone();
     int r = 0, g = 0, b = 0, avg = 0;
     for (int x = 0; x < width; x++)
     {
         for (int y = 0; y < height; y++)
         {
             r = clone.getRComponent(x, y);
             g = clone.getGComponent(x, y);
             b = clone.getBComponent(x, y);
             avg = (r + g + b) / 3;
             avg = avg >= ThreshHold ? 255 : 0;
             imageIn.setPixelColor(x, y, avg, avg, avg);
         }
     }
     return imageIn;
 }
开发者ID:java02014,项目名称:ImageFilterForWindowsPhone,代码行数:21,代码来源:BrickFilter.cs

示例12: process

        public Image process(Image imageIn)
        {
            Image clone = imageIn.clone();
            imageIn = gaussianBlurFx.process(imageIn);
            imageIn = contrastFx.process(imageIn);

            int old_r, old_g, old_b, r, g, b;
            for(int x = 0 ; x < (imageIn.getWidth() - 1) ; x++){
                for(int y = 0 ; y < (imageIn.getHeight() - 1) ; y++){
                       old_r = clone.getRComponent(x, y);
                       old_g = clone.getGComponent(x, y);
                       old_b = clone.getBComponent(x, y);

                       r = 255 - (255 - old_r)*(255 - imageIn.getRComponent(x, y))/255 ;
                       g = 255 - (255 - old_g)*(255 - imageIn.getGComponent(x, y))/255 ;
                       b = 255 - (255 - old_b)*(255 - imageIn.getBComponent(x, y))/255 ;
                       imageIn.setPixelColor(x, y, r, g, b);
                }
            }
            return imageIn;
        }
开发者ID:java02014,项目名称:ImageFilterForWindowsPhone,代码行数:21,代码来源:SoftGlowFilter.cs

示例13: process

 //@Override
 public Image process(Image imageIn)
 {
     int width = imageIn.getWidth();
     int height = imageIn.getHeight();
     Image clone = imageIn.clone();
     int r = 0, g = 0, b = 0, xx = 0, yy = 0;
     for (int x = 0; x < width; x++)
     {
         for (int y = 0; y < height; y++)
         {
             int pos = NoiseFilter.getRandomInt(1, 10000) % Model;
             xx = (x + pos) < width ? (x + pos) : (x - pos) >= 0 ? (x - pos) : x;
             yy = (y + pos) < height ? (y + pos) : (y - pos) >= 0 ? (y - pos) : y;
             r = clone.getRComponent(xx, yy);
             g = clone.getGComponent(xx, yy);
             b = clone.getBComponent(xx, yy);
             imageIn.setPixelColor(x, y, r, g, b);
         }
     }
     return imageIn;
 }
开发者ID:java02014,项目名称:ImageFilterForWindowsPhone,代码行数:22,代码来源:OilPaintFilter.cs

示例14: process

        //@Override
        public Image process(Image imageIn)
        {
            int r, g, b;
            int width = imageIn.getWidth();
            int height = imageIn.getHeight();
            int ratio = width > height ? height * 32768 / width : width * 32768 / height;

            // Calculate center, min and max
            int cx = width >> 1;
            int cy = height >> 1;
            int max = cx * cx + cy * cy;
            int min = (int)(max * (1 - Size));
            int diff = max - min;
            Image clone = imageIn.clone();
            for (int x = 0; x < width; x++)
            {
                for (int y = 0; y < height; y++)
                {
                    // Calculate distance to center and adapt aspect ratio
                    int dx = cx - x;
                    int dy = cy - y;
                    if (width > height)
                        dx = (dx * ratio) >> 15;
                    else
                        dy = (dy * ratio) >> 15;
                    int distSq = dx * dx + dy * dy;

                    r = (int)((((float)distSq / diff) * R));
                    g = (int)((((float)distSq / diff) * G));
                    b = (int)((((float)distSq / diff) * B));
                    r = (byte)(r > R ? R : (r < 0 ? 0 : r));
                    g = (byte)(g > G ? G : (g < 0 ? 0 : g));
                    b = (byte)(b > B ? B : (b < 0 ? 0 : b));
                    imageIn.setPixelColor(x, y, r, g, b);
                }
            }
            ImageBlender blender = new ImageBlender();
            blender.Mode = BlendMode.Additive;
            return blender.Blend(clone, imageIn);
        }
开发者ID:java02014,项目名称:ImageFilterForWindowsPhone,代码行数:41,代码来源:PaintBorderFilter.cs

示例15: process

        public Image process(Image imageIn)
        {
            int width = imageIn.getWidth();
             int height = imageIn.getHeight();
             m_fcx = (int)(width * m_offset_x * 32768.0) + (width * 32768) ;
             m_fcy = (int)(height * m_offset_y * 32768.0) + (height * 32768) ;

             const int ta = 255;
             Image clone = imageIn.clone();
             for(int x = 0 ; x < width ; x++){
                  for(int y = 0 ; y < height ; y++){
                      int sr=0, sg=0, sb=0, sa=0;
                       sr = clone.getRComponent(x, y) * ta;
                       sg = clone.getGComponent(x, y) * ta;
                       sb = clone.getBComponent(x, y) * ta;
                       sa += ta;
                       int   fx = (x * 65536) - m_fcx ;
                       int   fy = (y * 65536) - m_fcy ;
                       for (int i = 0 ; i < RADIUS_LENGTH ; i++)
                       {
                            fx = fx - (fx / 16) * m_length / 1024 ;
                            fy = fy - (fy / 16) * m_length / 1024 ;

                            int   u = (fx + m_fcx + 32768) / 65536 ;
                            int   v = (fy + m_fcy + 32768) / 65536 ;
                            if (u>=0 && u<width && v>=0 && v<height)
                            {
                                sr += clone.getRComponent(u, v) * ta ;
                                sg += clone.getGComponent(u, v) * ta ;
                                sb += clone.getBComponent(u, v) * ta ;
                                sa += ta ;
                            }
                       }
                       imageIn.setPixelColor(x, y, Image.SAFECOLOR(sr/sa), Image.SAFECOLOR(sg/sa), Image.SAFECOLOR(sb/sa));
                  }
             }
            return imageIn;
        }
开发者ID:java02014,项目名称:ImageFilterForWindowsPhone,代码行数:38,代码来源:ZoomBlurFilter.cs


注:本文中的Image.clone方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。