七行プログラミング p ..
[
2ch
|
▼Menu
]
■コピペモード
□
スレを通常表示
□
オプションモード
□このスレッドのURL
■項目テキスト
497:デフォルトの名無しさん 07/07/10 02:01:23 なんだかなぁ 498:デフォルトの名無しさん 07/07/10 17:42:56 using System;using System.Drawing;class P{static void Main(string[]a){Bitmap m=new Bitmap(a[0]);int o,p,q,r,g,b,t,l,z=int.Parse(a[2]),w,h=0,W=m.Width,H=m. Height;Bitmap v=new Bitmap(W,H);Color c;for(;h<H;h++)for(w=0;w<W;w++){p=r=g=b= 0;for(t=-z;t<2;t++)if((o=h+t)>0&&o<H)for(l=-z;l<2;l++)if((q=w+l)>0&&q<W){c=m. GetPixel(q,o);r+=c.R;g+=c.G;b+=c.B;p++;}v.SetPixel(w,h,Color.FromArgb(r/p,g/p, b/p));}v.Save(a[1]);}} 画像ぼかし。 これならマスク使える…? 499:498 07/07/10 19:23:38 using System;using System.Drawing;class P{static void Main(string[]a){Bitmap m =new Bitmap(a[0]);int o,p,q,r,g,b,t,l,z=int.Parse(a[2]),w,h=0,W=m.Width,H=m. Height;Bitmap v=new Bitmap(W,H);Color c;for(;h<H;h++)for(w=0;w<W;w++){p=r=g=b= 0;for(t=-z;t<z;t++)if((o=h+t)>-1&&o<H)for(l=-z;l<z;l++)if((q=w+l)>-1&&q<W){c=m .GetPixel(q,o);r+=c.R;g+=c.G;b+=c.B;p++;}v.SetPixel(w,h,Color.FromArgb(r/p,g/p ,b/p));}v.Save(a[1]);}} 範囲が-指定値から2までになってたのを修正 orz using System;using System.Drawing;using System.Drawing.Imaging;using System. Runtime.InteropServices;class P{static void Main(string[]a){Bitmap m=new Bitmap(a[0]);int o,p,q,r,g,b,t,l,z=int.Parse(a[2]),w,h=0,W=m.Width,H=m.Height, y=W*H*3,e;byte[]src,dst;src=dst=new byte[y];BitmapData d=m.LockBits(new Rectangle(0,0,W,H),ImageLockMode.ReadWrite,PixelFormat.Format24bppRgb);e=d. Stride;Marshal.Copy(d.Scan0,src,0,y);for(;h<H;h++)for(w=0;w<W;w++){p=r=g=b=0; for (t=-z;t<z;t++)if((o=h+t)>-1&&o<H)for(l=-z;l<z;l++)if((q=w+l)>-1&&q<W){ r+=src[o*e+q*3];g+=src[o*e+q*3+1];b+=src[o*e+q*3+2];p++;}dst[h*e+w*3]=(byte)( r/p);dst[h*e+w*3+1]=(byte)(g/p);dst[h*e+w*3+2]=(byte)(b/p);}Marshal.Copy(dst, 0,d.Scan0,y);m.UnlockBits(d);m.Save(a[1]);}} 高速化版。誰か短くして orz
次ページ
最新レス表示
スレッドの検索
類似スレ一覧
話題のニュース
おまかせリスト
▼オプションを表示
レスジャンプ
mixiチェック!
Twitterに投稿
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch
5391日前に更新/140 KB
担当:undef