{"id":640,"date":"2010-03-02T11:10:18","date_gmt":"2010-03-02T02:10:18","guid":{"rendered":"http:\/\/www.moonmile.net\/blog\/?p=640"},"modified":"2010-03-02T12:40:32","modified_gmt":"2010-03-02T03:40:32","slug":"%e5%a4%9a%e9%87%8d%e5%ae%9a%e7%be%a9%e3%81%ae%e7%bd%a0%ef%bc%88%e8%87%aa%e5%8b%95%e3%82%ad%e3%83%a3%e3%82%b9%e3%83%88%e3%81%ab%e6%b3%a8%e6%84%8f%ef%bc%89","status":"publish","type":"post","link":"http:\/\/www.moonmile.net\/blog\/archives\/640","title":{"rendered":"\u591a\u91cd\u5b9a\u7fa9\u306e\u7f60\uff08\u81ea\u52d5\u30ad\u30e3\u30b9\u30c8\u306b\u6ce8\u610f\uff09"},"content":{"rendered":"<p>\u95a2\u6570\u306e\u591a\u91cd\u5b9a\u7fa9\u3063\u3066\u306e\u306f\u3001\u975e\u5e38\u306b\u4fbf\u5229\u306a\u6a5f\u80fd\u3067\u3001\u540c\u3058\u540d\u524d\u3067\u3082\u5f15\u6570\u306e\u6570\u3084\u578b\u304c\u9055\u3046\u3068\u5225\u306e\u95a2\u6570\u3068\u3057\u3066\u5224\u5225\u3057\u3066\u304f\u308c\u308b\u3001\u3063\u3066\u3044\u3046\u6280\u3067\u3059\u3002<\/p>\n<p>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u6307\u5411\u8a00\u8a9e\u306f\u3001\u5927\u62b5\u3053\u308c\u3092\u5229\u7528\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p># \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u6307\u5411\u7684\u306b\u306f\u5fc5\u9808\u3063\u3066\u8a33\u3067\u306f\u306a\u3044\u3093\u3060\u308d\u3046\u3051\u3069\u3001\u5f15\u6570\u306e\u6570\u304c\u7570\u306a\u308b\u5ea6\u306b<br \/>\n# \u95a2\u6570\u540d\u3092\u8003\u3048\u306a\u3044\u3068\u99c4\u76ee\u3063\u3066\u306e\u3082\u30a2\u30ec\u306a\u308f\u3051\u3067\u3002<\/p>\n<p># \u3042\u3068\u3001C++\/C# \u306b\u9650\u3063\u3066\u8a00\u3048\u3070\u3001\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u306e\u591a\u91cd\u5b9a\u7fa9\u304c\u3067\u304d\u306a\u3044\u3068\u8a00\u8a9e\u7684\u306b<br \/>\n# \u6210\u308a\u7acb\u305f\u306a\u3044\u3063\u3066\u306e\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\r\nclass A\r\n{\r\nprivate:\r\n\u00a0int _x ;\r\npublic:\r\n\u00a0\/\/ \u5f15\u6570\u306e\u306a\u3044\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\r\n\u00a0A() { _x = 0; }\r\n\u00a0\/\/ \u5f15\u6570\u306e\u3042\u308b\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\r\n\u00a0A( int x ) { _x = x; }\r\n};\r\n<\/pre>\n<p>\u3053\u3053\u3067\u591a\u91cd\u5b9a\u7fa9\u304c\u3067\u304d\u306a\u3044\u3068\u3001A(x) \u3063\u3066\u306e\u304c\u3067\u304d\u307e\u305b\u3093\u3002<br \/>\n\u4ed5\u65b9\u304c\u306a\u3044\u306e\u3067\u3001A::CreateX( int x ) \u306a\u3093\u3066\u4e91\u3046\u30b9\u30bf\u30c6\u30a3\u30c3\u30af\u30af\u30e9\u30b9\u3092\u4f7f\u3046\u3088\u3046\u306a<br \/>\n\u30d5\u30a1\u30af\u30c8\u30ea\u30fc\u30d1\u30bf\u30fc\u30f3\u3092\u4f7f\u3046\u3088\u3046\u306b\u306a\u308b\u8a33\u3067\u3059\u3002Java \u306e\u5834\u5408\u306f\u3001Factory \u30d1\u30bf\u30fc\u30f3\u304c<br \/>\n\u4e3b\u6d41\u3067\u3059\u304c\u3001C++\u306e\u307b\u3046\u306f\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u306e\u591a\u91cd\u5b9a\u7fa9\u304c\u591a\u3044\u3067\u3059\u306d\u3002<\/p>\n<p># objective-c \u306e\u5834\u5408\u306f\u3001\u3053\u306e\u3042\u305f\u308a\u4e2d\u9014\u534a\u7aef\uff08\u3063\u307d\u304f\u898b\u3048\u308b\uff09\u306a\u306e\u3067\u3001<br \/>\n# A\u30af\u30e9\u30b9\u306b initWithX \u3068\u3044\u3046\u30e1\u30bd\u30c3\u30c9\u3092\u4f5c\u308a\u307e\u3059\u3002<\/p>\n<p>\u3055\u3066\u3001\u3053\u306e\u591a\u91cd\u5b9a\u7fa9\u3092\u7a81\u304d\u8a70\u3081\u3066\u3044\u304f\u3068\u3001\u51fa\u6765\u308b\u3060\u3051\u77ed\u3044\u540d\u524d\u3067\u8868\u73fe\u3057\u305f\u3044\u3068\u3044\u3046\u6b32\u671b\u306b\u99c6\u3089\u308c\u307e\u3059\u3002\u52ff\u8ad6\u4e00\u65b9\u3067\u3001elementById \u3068\u3044\u3046\u540d\u524d\u3082\u4e3b\u6d41\u3067\u3082\u3042\u308b\u308f\u3051\u3067\u3059\u304c\u3002<\/p>\n<p>\u3072\u3068\u307e\u305a\u3001\u3056\u3063\u3068\u6b21\u306e\u30b3\u30fc\u30c9\u3092\u3054\u89a7\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\r\nusing System;\r\n\r\npublic class RGB {\r\n\u00a0private double _r;\r\n\u00a0private double _g;\r\n\u00a0private double _b;\r\n\u00a0\r\n\u00a0public RGB() {\r\n\u00a0\u00a0_r = _g = _b = 0.0;\r\n\u00a0}\r\n\u00a0public RGB( double r, double g, double b ) {\r\n\u00a0\u00a0_r = r;\r\n\u00a0\u00a0_g = g;\r\n\u00a0\u00a0_b = b;\r\n\u00a0}\r\n\u00a0public RGB( byte r, byte g, byte b ) {\r\n\u00a0\u00a0_r = ((double)r)\/255.0;\r\n\u00a0\u00a0_g = ((double)g)\/255.0;\r\n\u00a0\u00a0_b = ((double)b)\/255.0;\r\n\u00a0}\r\n\u00a0public override string ToString() {\r\n\u00a0\u00a0return string.Format(&quot;r:{0} g:{1} b:{2}&quot;, _r, _g, _b );\r\n\u00a0}\r\n}\r\n\r\npublic class Test {\r\n\u00a0\r\n\u00a0public static void Main( string&#x5B;] args ) {\r\n\u00a0\u00a0Console.WriteLine(&quot;RGB check&quot;);\r\n\u00a0\u00a0\r\n\u00a0\u00a0RGB col = new RGB();\r\n\u00a0\u00a0Console.WriteLine(&quot;RGB {0}&quot;, col );\r\n\u00a0\u00a0\/\/ \u5b9f\u6570\u3067\u6307\u5b9a\r\n\u00a0\u00a0col = new RGB(1.0, 1.0, 0.0);\r\n\u00a0\u00a0Console.WriteLine(&quot;RGB {0}&quot;, col );\r\n\u00a0\u00a0\/\/ Windows\u306eRGB\u5024(0-255)\u3067\u6307\u5b9a\r\n\u00a0\u00a0col = new RGB(0,255,255);\r\n\u00a0\u00a0Console.WriteLine(&quot;RGB {0}&quot;, col );\r\n\u00a0\u00a0\/\/ \u5b9f\u6570\u3067\u6307\u5b9a\u3057\u305f\u3064\u3082\u308a\r\n\u00a0\u00a0col = new RGB(1, 1, 0);\u00a0\u00a0\/\/ byte\u578b\u3068\u307f\u306a\u3055\u308c\u3066\u3057\u307e\u3046\u3002\r\n\u00a0\u00a0Console.WriteLine(&quot;RGB {0}&quot;, col );\r\n\u00a0\u00a0col = new RGB(1.0, 1, 0);\u00a0\/\/ \u3072\u3068\u3064\u3067\u3082double\u578b\u306b\u3057\u3066\u304a\u3051\u3070ok\r\n\u00a0\u00a0Console.WriteLine(&quot;RGB {0}&quot;, col );\r\n\u00a0}\r\n}\r\n<\/pre>\n<p>RGB\u5024\u3092\u6271\u3046\u95a2\u6570\u306a\u306e\u3067\u3059\u304c\u3001Mac \u306e\u5834\u5408\u3001RGB\u5024\u306f1.0\u304b\u30890.0\u306e\u5b9f\u6570\u3092\u53d6\u308b\u3093\u3060\u3088\u306d\uff5e\u3001\u3063\u3066\u3053\u3068\u304c\u5206\u304b\u3063\u3066\u3001\u307e\u3042\u753b\u50cf\u89e3\u6790\u304c\u3066\u3089 double \u578b\u306b\u7d44\u3093\u3067\u3044\u305f\u3044\u306e\u3067\u3059\u3002<br \/>\n\uff08\u5b9f\u969b\u306f\u3001float \u578b\u306a\u306e\u3067\u3059\u304c\u3001\u30ad\u30e3\u30b9\u30c8\u304c\u9762\u5012\u306a\u306e\u3068\u8aac\u660e\u306e\u95a2\u4fc2\u3067 double \u578b\u306b\u3057\u3066\u3042\u308a\u307e\u3059\uff09<\/p>\n<p>\u3054\u5b58\u3058\u306e\u901a\u308a\u3001Windows \u306e RGB \u5024\u306f 0 \u304b\u3089 255 \u306e\u6574\u6570\u5024\u3092\u53d6\u308a\u307e\u3059\u3002\u3067\u3059\u304c\u3001\u3053\u308c\u306f\u30c7\u30a3\u30b9\u30d7\u30ec\u30a4\u306b\u8868\u793a\u3059\u308b\u3068\u304d\u306b\u306f\u4fbf\u5229\u306a\u306e\u3067\u3059\u304c\u3001\u8272\u76f8\u3092\u5909\u3048\u305f\u308a\u3059\u308b\u3068\u304d\u306f\u3001\u7d50\u5c40\u5b9f\u6570\u3067\u6271\u3046\u306e\u3067\u3001\u305d\u306e\u307e\u307e\u6271\u3046\u3068\u4e0d\u4fbf\u3067\u3059\u3002<\/p>\n<p>\u306a\u306e\u3067\u3001\u5185\u90e8\u7684\u306b\u306f double \u578b\u3067\u6271\u3046\u3002\u3051\u308c\u3069\u3082\u3001RGB \u5024\u3092\u6574\u6570\u5024(byte\u578b)\u3067\u3082\u6e21\u305b\u308b\u3088\u3001\u3068\u3044\u3046\u30af\u30e9\u30b9\u3092\u4f5c\u3063\u3066\u307f\u305f\u308f\u3051\u3067\u3059\u3002<\/p>\n<p>RGB( double r, double g, double b )<br \/>\nRGB( byte r, byte g, byte b )<\/p>\n<p>\u3053\u306e2\u3064\u306e\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\uff08\u95a2\u6570\u3067\u3082\u3044\u3044\u3051\u3069\uff09\u306f\u591a\u91cd\u5b9a\u7fa9\u3092\u4f7f\u3063\u3066\u3044\u3066\u3001\u4e00\u65b9\u306f double \u578b\u3001\u3082\u3046\u4e00\u65b9\u306f byte \u578b\u3067\u521d\u671f\u5316\u3067\u304d\u308b\u3082\u306e\u3067\u3059\u3002<\/p>\n<p>\u591a\u91cd\u5b9a\u7fa9\u304c\u3067\u304d\u306a\u3044\u3068\u3001<\/p>\n<p>RGBByDouble( double r, double g, double b )<br \/>\nRGBByByte( byte r, byte g, byte b )<\/p>\n<p>\u306a\u611f\u3058\u306b\u306a\u308b\u3093\u3067\u3059\u304c\u3001\u307e\u3042\u3001RGB \u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u306e\u307b\u3046\u304c\u30b9\u30de\u30fc\u30c8\u3067\u3057\u3087\u3046\uff1f<\/p>\n<p>\u3067\u3059\u304c\u3001\u3053\u3053\u306b\u843d\u3068\u3057\u7a74\u304c\u3042\u308b\u3093\u3067\u3059\u306d\u3047\u3002<br \/>\n\u5148\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u3053\u3093\u306a\u611f\u3058\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nRGB check\r\nRGB r:0 g:0 b:0\r\nRGB r:1 g:1 b:0\r\nRGB r:0 g:1 b:1\r\nRGB r:0.00392156862745098 g:0.00392156862745098 b:0 \u2605\r\nRGB r:1 g:1 b:0\r\n<\/pre>\n<p>\u2605\u306e\u90e8\u5206\u304c\u3001\u610f\u56f3\u3057\u306a\u304b\u3063\u305f\u52d5\u304d\u3067\u3059\u3002<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\r\n\/\/ \u5b9f\u6570\u3067\u6307\u5b9a\u3057\u305f\u3064\u3082\u308a\r\ncol = new RGB(1, 1, 0);\u00a0\u00a0\/\/ byte\u578b\u3068\u307f\u306a\u3055\u308c\u3066\u3057\u307e\u3046\u3002\r\nConsole.WriteLine(&quot;RGB {0}&quot;, col );\r\n<\/pre>\n<p>\u5b9f\u306f\u3001\u4e0a\u8a18\u306e\u3088\u3046\u306b\u5373\u5024\u3067\u6307\u5b9a\u3059\u308b\u5834\u5408\u3001\u300c1\u300d\u3084\u300c0\u300d\u306f\u6574\u6570\u3068\u307f\u306a\u3055\u308c\u308b\u305f\u3081\u306b\u3001byte \u578b\u3067\u521d\u671f\u5316\u3059\u308b\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u304c\u547c\u3073\u51fa\u3055\u308c\u307e\u3059\u3002\u52ff\u8ad6\u3001C\u8a00\u8a9e\u3092\u7fd2\u3063\u305f\u3068\u304d\u306e\u3088\u3046\u306b\u3001<\/p>\n<p>\u300c\u5b9f\u6570\u3092\u6307\u5b9a\u3059\u308b\u3068\u304d\u306f\u3001\u660e\u793a\u7684\u306b 1.0 \u3068\u3057\u306a\u3044\u3068\u99c4\u76ee\u300d<\/p>\n<p>\u3063\u3066\u3053\u3068\u3092\u5fd8\u308c\u305a\u306b\u3044\u308c\u3070\u3044\u3044\u3093\u3067\u3059\u304c\u3002<\/p>\n<p>\u305d\u3093\u306a\u8a33\u3067<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\r\ncol = new RGB(1.0, 1, 0);\u00a0\/\/ \u3072\u3068\u3064\u3067\u3082double\u578b\u306b\u3057\u3066\u304a\u3051\u3070ok\r\nConsole.WriteLine(&quot;RGB {0}&quot;, col );\r\n<\/pre>\n<p>\u3053\u3093\u306a\u98a8\u306b\u3001\u5373\u5024\u306e\u5834\u5408\u306f\u660e\u793a\u7684\u306b\u6307\u5b9a\u3059\u308b\u306e\u304c\u5409\u3067\u3059\u3002<br \/>\n\u81ea\u52d5\u30ad\u30e3\u30b9\u30c8\u306f\u3001\u30c7\u30fc\u30bf\u578b\u306e\u5c0f\u3055\u3044\u3068\u3053\u308d\u304b\u3089\u5224\u65ad\u3055\u308c\u308b\u306e\u3067\u3001<\/p>\n<p>byte -&gt; int -&gt; long -&gt; float -&gt; double<\/p>\n<p>\u306e\u9806\u756a\u306b\u30ad\u30e3\u30b9\u30c8\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u5148\u306e\u4f8b\u3067\u306f byte \u578b\u306a\u306e\u3067\u3001\u898b\u5f53\u304c\u4ed8\u304d\u305d\u3046\u3067\u3059\u304c\u3001<\/p>\n<p>int\u578b\u3068long\u578b\u306e\u6df7\u5728\u306a\u3093\u304b\u3084\u308b\u3068\u3001\u3082\u3046\u99c4\u76ee\u3067\u3059\u306d\u3002\u610f\u56f3\u901a\u308a\u306b\u52d5\u304d\u307e\u305b\u3093\u3002<br \/>\n\u306a\u306e\u3067\u3001\u305d\u3046\u3044\u3046\u98a8\u306a\u5834\u5408\u306f\u3001\u300c\u3084\u3081\u307e\u3057\u3087\u3046\u300d\u3063\u3066\u306e\u304c\u7b4b\u3067\u3059\u3002<br \/>\n\u305d\u3046\u305d\u3046\u3001C\u8a00\u8a9e\u306a\u3089\u3070 typedef\u3001C# \u306a\u3089\u3070\u578b\u3092\u7d99\u627f\u3059\u308b\u3063\u3066\u306e\u3082\u3072\u3068\u3064\u306e\u65b9\u6cd5\u3067\u3059\u3002<br \/>\n\u6a19\u6e96\u3067\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u308b typedef unsigned long size_t ; \u306e\u3088\u3046\u306b\u3001\u3057\u3066\u304a\u3051\u3070\u578b\u304c\u53b3\u5bc6\u306b\u5224\u65ad\u3055\u308c\u3066\u3001\u5148\u306e\u81ea\u52d5\u30ad\u30e3\u30b9\u30c8\u306e\u7bc4\u56f2\u5916\u306b\u306a\u308a\u3001\u6df7\u4e71\u304c\u5c11\u306a\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u95a2\u6570\u306e\u591a\u91cd\u5b9a\u7fa9\u3063\u3066\u306e\u306f\u3001\u975e\u5e38\u306b\u4fbf\u5229\u306a\u6a5f\u80fd\u3067\u3001\u540c\u3058\u540d\u524d\u3067\u3082\u5f15\u6570\u306e\u6570\u3084\u578b\u304c\u9055\u3046\u3068\u5225\u306e\u95a2\u6570\u3068\u3057\u3066\u5224\u5225\u3057\u3066\u304f\u308c\u308b\u3001\u3063\u3066\u3044\u3046\u6280\u3067\u3059\u3002 \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u6307\u5411\u8a00\u8a9e\u306f\u3001\u5927\u62b5\u3053\u308c\u3092\u5229\u7528\u3057\u3066\u3044\u307e\u3059\u3002 # \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u6307\u5411\u7684\u306b\u306f\u5fc5\u9808\u3063\u3066\u8a33\u3067\u306f\u306a\u3044 &hellip; <a href=\"http:\/\/www.moonmile.net\/blog\/archives\/640\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3],"tags":[],"class_list":["post-640","post","type-post","status-publish","format-standard","hentry","category-dev"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts\/640","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/comments?post=640"}],"version-history":[{"count":3,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts\/640\/revisions"}],"predecessor-version":[{"id":643,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts\/640\/revisions\/643"}],"wp:attachment":[{"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/media?parent=640"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/categories?post=640"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/tags?post=640"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}