OSDN Git Service

[Backup]NyARToolkit for Java
[nyartoolkit-and/nyartoolkit-and.git] / trunk / src / jp / nyatla / nyartoolkit / core2 / rasterfilter / rgb2gs / NyARRasterFilter_RgbMul.java
index d0e21e2..45948bf 100644 (file)
@@ -7,26 +7,25 @@
  *   HITLab, University of Washington, Seattle\r
  * http://www.hitl.washington.edu/artoolkit/\r
  *\r
- * The NyARToolkit is Java version ARToolkit class library.\r
- * Copyright (C)2008 R.Iizuka\r
+ * The NyARToolkit is Java edition ARToolKit class library.\r
+ * Copyright (C)2008-2009 Ryo Iizuka\r
  *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
+ * This program is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
  * \r
  * This program is distributed in the hope that it will be useful,\r
  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
  * GNU General Public License for more details.\r
- * \r
+ *\r
  * You should have received a copy of the GNU General Public License\r
- * along with this framework; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.\r
  * \r
  * For further information please contact.\r
  *     http://nyatla.jp/nyatoolkit/\r
- *     <airmail(at)ebony.plala.or.jp>\r
+ *     <airmail(at)ebony.plala.or.jp> or <nyatla(at)nyatla.jp>\r
  * \r
  */\r
 package jp.nyatla.nyartoolkit.core2.rasterfilter.rgb2gs;\r
@@ -40,14 +39,14 @@ import jp.nyatla.nyartoolkit.core.types.NyARIntSize;
 \r
 public class NyARRasterFilter_RgbMul implements INyARRasterFilter_RgbToGs\r
 {\r
-       public void doFilter(INyARRgbRaster i_input, NyARGlayscaleRaster i_output) throws NyARException\r
+       public void doFilter(INyARRgbRaster i_input, NyARGrayscaleRaster i_output) throws NyARException\r
        {\r
                INyARBufferReader in_buffer_reader=i_input.getBufferReader();   \r
                INyARBufferReader out_buffer_reader=i_output.getBufferReader();                 \r
                assert (i_input.getSize().isEqualSize(i_output.getSize()) == true);\r
 \r
-               int[][] out_buf = (int[][]) in_buffer_reader.getBuffer();\r
-               byte[] in_buf = (byte[]) out_buffer_reader.getBuffer();\r
+               int[] out_buf = (int[]) out_buffer_reader.getBuffer();\r
+               byte[] in_buf = (byte[]) in_buffer_reader.getBuffer();\r
 \r
                NyARIntSize size = i_output.getSize();\r
                switch (in_buffer_reader.getBufferType()) {\r
@@ -61,12 +60,12 @@ public class NyARRasterFilter_RgbMul implements INyARRasterFilter_RgbToGs
                return;\r
        }\r
 \r
-       private void convert24BitRgb(byte[] i_in, int[][] i_out, NyARIntSize i_size)\r
+       private void convert24BitRgb(byte[] i_in, int[] i_out, NyARIntSize i_size)\r
        {\r
                int bp = 0;\r
                for (int y = 0; y < i_size.h; y++) {\r
                        for (int x = 0; x < i_size.w; x++) {\r
-                               i_out[y][x] = ((i_in[bp] & 0xff) * (i_in[bp + 1] & 0xff) * (i_in[bp + 2] & 0xff)) >> 16;\r
+                               i_out[y*i_size.w+x] = ((i_in[bp] & 0xff) * (i_in[bp + 1] & 0xff) * (i_in[bp + 2] & 0xff)) >> 16;\r
                                bp += 3;\r
                        }\r
                }\r