+++ /dev/null
-/* \r
- * PROJECT: NyARToolkit\r
- * --------------------------------------------------------------------------------\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 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
- * You should have received a copy of the GNU General Public License\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> or <nyatla(at)nyatla.jp>\r
- * \r
- */\r
-package jp.nyatla.utils;\r
-\r
-public class DoubleValue\r
-{\r
- public double value;\r
-}
\ No newline at end of file
+++ /dev/null
-/* \r
- * PROJECT: NyARToolkit\r
- * --------------------------------------------------------------------------------\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 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
- * You should have received a copy of the GNU General Public License\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> or <nyatla(at)nyatla.jp>\r
- * \r
- */\r
-package jp.nyatla.utils;\r
-\r
-public class IntValue\r
-{\r
- public int value;\r
-}\r
+++ /dev/null
-/* \r
- * PROJECT: NyARToolkit\r
- * --------------------------------------------------------------------------------\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 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
- * You should have received a copy of the GNU General Public License\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> or <nyatla(at)nyatla.jp>\r
- * \r
- */\r
-package jp.nyatla.utils;\r
-import java.lang.reflect.*;\r
-import jp.nyatla.nyartoolkit.NyARException;\r
-\r
-\r
-\r
-\r
-/**\r
- * オンデマンド割り当てをするオブジェクト配列。\r
- * 配列には実体を格納します。\r
- */\r
-public abstract class NyObjectStack<T>\r
-{\r
- private final static int ARRAY_APPEND_STEP = 64;\r
-\r
- protected final T[] _items;\r
-\r
- private int _allocated_size;\r
-\r
- protected int _length;\r
-\r
- /**\r
- * 最大ARRAY_MAX個の動的割り当てバッファを準備する。\r
- * \r
- * @param i_array\r
- * @param i_element_type\r
- * JavaのGenedicsの制限突破\r
- */\r
- @SuppressWarnings("unchecked")\r
- protected NyObjectStack(int i_length,Class<T> i_element_type)\r
- {\r
- // ポインタだけははじめに確保しておく\r
- this._items = (T[])Array.newInstance(i_element_type, i_length);\r
- // アロケート済サイズと、使用中個数をリセット\r
- this._allocated_size = 0;\r
- this._length = 0;\r
- return;\r
- }\r
- protected abstract T createElement();\r
- /**\r
- * ポインタを1進めて、その要素を予約し、その要素へのポインタを返します。\r
- * 特定型に依存させるときには、継承したクラスでこの関数をオーバーライドしてください。\r
- */\r
- public final T prePush() throws NyARException\r
- {\r
- // 必要に応じてアロケート\r
- if (this._length >= this._allocated_size) {\r
- // 要求されたインデクスは範囲外\r
- if (this._length >= this._items.length) {\r
- throw new NyARException();\r
- }\r
- // 追加アロケート範囲を計算\r
- int range = this._length + ARRAY_APPEND_STEP;\r
- if (range >= this._items.length) {\r
- range = this._items.length;\r
- }\r
- // アロケート\r
- this.onReservRequest(this._allocated_size, range, this._items);\r
- this._allocated_size = range;\r
- }\r
- // 使用領域を+1して、予約した領域を返す。\r
- T ret = this._items[this._length];\r
- this._length++;\r
- return ret;\r
- }\r
- /** \r
- * 見かけ上の要素数を1減らして、最後尾のアイテムを返します。\r
- * @return\r
- */\r
- public final T pop()\r
- {\r
- assert(this._length>=1);\r
- this._length--;\r
- return this._items[this._length];\r
- }\r
- /**\r
- * 見かけ上の要素数をi_count個減らします。\r
- * @param i_count\r
- * @return\r
- * NULLを返します。\r
- */\r
- public final void pops(int i_count)\r
- {\r
- assert(this._length>=i_count);\r
- this._length-=i_count;\r
- return;\r
- } \r
- \r
- /**\r
- * 0~i_number_of_item-1までの領域を予約します。\r
- * 予約済の領域よりも小さい場合には、現在の長さを調整します。\r
- * @param i_number_of_reserv\r
- */\r
- final public void reserv(int i_number_of_item) throws NyARException\r
- {\r
- // 必要に応じてアロケート\r
- if (i_number_of_item >= this._allocated_size) {\r
- // 要求されたインデクスは範囲外\r
- if (i_number_of_item >= this._items.length) {\r
- throw new NyARException();\r
- }\r
- // 追加アロケート範囲を計算\r
- int range = i_number_of_item+ARRAY_APPEND_STEP;\r
- if (range >= this._items.length) {\r
- range = this._items.length;\r
- }\r
- // アロケート\r
- this.onReservRequest(this._allocated_size, range, this._items);\r
- this._allocated_size = range;\r
- }\r
- //見かけ上の配列サイズを指定\r
- this._length=i_number_of_item;\r
- return;\r
- }\r
- /**\r
- * 必要に応じて、この関数を継承先クラスで実装して下さい。\r
- * i_bufferの配列の、i_start番目からi_end-1番目までの要素に、オブジェクトを割り当てて下さい。\r
- * @param i_start\r
- * @param i_end\r
- * @param i_buffer\r
- */ \r
- final protected void onReservRequest(int i_start, int i_end, Object[] i_buffer)\r
- {\r
- try { \r
- for (int i = i_start; i < i_end; i++){\r
- i_buffer[i] =createElement();\r
- }\r
- } catch(Exception e) { \r
- e.printStackTrace(); \r
- }\r
- return;\r
- }\r
-\r
-\r
- /**\r
- * 配列を返します。\r
- * \r
- * @return\r
- */\r
- public final T[] getArray()\r
- {\r
- return this._items;\r
- }\r
- public final T getItem(int i_index)\r
- {\r
- return this._items[i_index];\r
- }\r
- /**\r
- * 配列の見かけ上の要素数を返却します。\r
- * @return\r
- */\r
- public final int getLength()\r
- {\r
- return this._length;\r
- }\r
- /**\r
- * 見かけ上の要素数をリセットします。\r
- */\r
- public final void clear()\r
- {\r
- this._length = 0;\r
- }\r
-}\r
+++ /dev/null
-/* \r
- * PROJECT: NyARToolkit\r
- * --------------------------------------------------------------------------------\r
- * This work is based on the original ARToolKit developed by\r
- * Hirokazu Kato\r
- * Mark Billinghurst\r
- * HITLab, University of Washington, Seattle\r
- * http://www.hitl.washington.edu/artoolkit/\r
- *\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 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
- * You should have received a copy of the GNU General Public License\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> or <nyatla(at)nyatla.jp>\r
- * \r
- */\r
-package jp.nyatla.utils.j2se;\r
-\r
-import java.awt.Graphics;\r
-import java.awt.image.*;\r
-import java.awt.color.*;\r
-import java.awt.*;\r
-\r
-\r
-import jp.nyatla.nyartoolkit.NyARException;\r
-import jp.nyatla.nyartoolkit.core.types.*;\r
-import jp.nyatla.nyartoolkit.core.rasterreader.*;\r
-import jp.nyatla.nyartoolkit.core.raster.*;\r
-import jp.nyatla.nyartoolkit.core.types.stack.*;\r
-import jp.nyatla.nyartoolkit.core.labeling.*;\r
-import jp.nyatla.nyartoolkit.core.labeling.artoolkit.NyARLabelingImage;\r
-import jp.nyatla.nyartoolkit.core.labeling.artoolkit.NyARLabelingLabel;\r
-\r
-/**\r
- * bitmapとして利用可能なラベリングイメージです。\r
- * \r
- * \r
- */\r
-public class LabelingBufferdImage extends BufferedImage\r
-{\r
- public final static int COLOR_125_COLOR = 0;// 125色ラベルモード\r
-\r
- public final static int COLOR_256_MONO = 1;// 64階調モノクロモード\r
-\r
- public final static int COLOR_64_MONO = 2;// 64階調モノクロモード\r
-\r
- public final static int COLOR_32_MONO = 3;// 32階調モノクロモード\r
-\r
- public final static int COLOR_16_MONO = 4;// 16階調モノクロモード\r
-\r
- public final static int COLOR_8_MONO = 5;// 16階調モノクロモード\r
-\r
- private int[] _rgb_table_125;\r
-\r
-\r
- /**\r
- * i_width x i_heightの大きさのイメージを作成します。\r
- * \r
- * @param i_width\r
- * @param i_height\r
- */\r
- public LabelingBufferdImage(int i_width, int i_height)\r
- {\r
- super(i_width, i_height, ColorSpace.TYPE_RGB);\r
- // RGBテーブルを作成\r
- this._rgb_table_125 = new int[125];\r
- for (int i = 0; i < 5; i++) {\r
- for (int i2 = 0; i2 < 5; i2++) {\r
- for (int i3 = 0; i3 < 5; i3++) {\r
- this._rgb_table_125[((i * 5) + i2) * 5 + i3] = ((((i * 63) << 8) | (i2 * 63)) << 8) | (i3 * 63);\r
- }\r
- }\r
- }\r
-/* case COLOR_256_MONO:\r
- this._rgb_table = new int[256];\r
- this._number_of_color = 256;\r
- for (int i = 0; i < 256; i++) {\r
- this._rgb_table[i] = (i << 16) | (i << 8) | i;\r
- }\r
- break;\r
- case COLOR_64_MONO:\r
- this._rgb_table = new int[64];\r
- this._number_of_color = 64;\r
- for (int i = 0; i < 64; i++) {\r
- int m = (i * 4);\r
- this._rgb_table[i] = (m << 16) | (m << 8) | m;\r
- }\r
- break;\r
- case COLOR_32_MONO:\r
- this._rgb_table = new int[32];\r
- this._number_of_color = 32;\r
- for (int i = 0; i < 32; i++) {\r
- int m = (i * 8);\r
- this._rgb_table[i] = (m << 16) | (m << 8) | m;\r
- }\r
- break;\r
- case COLOR_16_MONO:\r
- this._rgb_table = new int[32];\r
- this._number_of_color = 16;\r
- for (int i = 0; i < 16; i++) {\r
- int m = (i * 8);\r
- this._rgb_table[i] = (m << 16) | (m << 8) | m;\r
- }\r
- break;\r
- }*/\r
- }\r
-\r
-\r
-\r
- public void drawImage(NyARGrayscaleRaster i_raster) throws NyARException\r
- {\r
- assert (i_raster.getBufferReader().getBufferType() == INyARBufferReader.BUFFERFORMAT_INT1D_GRAY_8);\r
-\r
- int w = this.getWidth();\r
- int h = this.getHeight();\r
- // サイズをチェック\r
- NyARIntSize size = i_raster.getSize();\r
- if (size.h > h || size.w > w) {\r
- throw new NyARException();\r
- }\r
-\r
- int[] limg;\r
- // イメージの描画\r
- limg = (int[]) i_raster.getBufferReader().getBuffer();\r
- for (int i = 0; i < h; i++) {\r
- for (int i2 = 0; i2 < w; i2++) {\r
- this.setRGB(i2, i,limg[i*w+i2]);\r
- }\r
- }\r
- return;\r
- }\r
- /**\r
- * バイナリラスタ\r
- * @param i_raster\r
- * @throws NyARException\r
- */\r
- public void drawImage(NyARBinRaster i_raster) throws NyARException\r
- {\r
- assert (i_raster.getBufferReader().getBufferType() == INyARBufferReader.BUFFERFORMAT_INT1D_BIN_8);\r
-\r
- int w = this.getWidth();\r
- int h = this.getHeight();\r
- // サイズをチェック\r
- NyARIntSize size = i_raster.getSize();\r
- if (size.h > h || size.w > w) {\r
- throw new NyARException();\r
- }\r
-\r
- int[] limg;\r
- // イメージの描画\r
- limg = (int[]) i_raster.getBufferReader().getBuffer();\r
- for (int i = 0; i < h; i++) {\r
- for (int i2 = 0; i2 < w; i2++) {\r
- this.setRGB(i2, i, limg[i*w+i2] > 0 ? 255 : 0);\r
- }\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * ラベリングイメージを書く\r
- * @param i_raster\r
- * @throws NyARException\r
- */\r
- public void drawLabel(NyARLabelingImage i_image) throws NyARException\r
- {\r
- int w = this.getWidth();\r
- int h = this.getHeight();\r
- // サイズをチェック\r
- NyARIntSize size = i_image.getSize();\r
- if (size.h > h || size.w > w) {\r
- throw new NyARException();\r
- }\r
- int[] index_array=i_image.getIndexArray();\r
-\r
- int[] limg;\r
- // イメージの描画\r
- limg = (int[]) i_image.getBufferReader().getBuffer();\r
- for (int i = 0; i < h; i++) {\r
- for (int i2 = 0; i2 < w; i2++) {\r
- int t=limg[i*w+i2]-1;\r
- if(t<0){\r
- t=0;\r
- }else{\r
- t=index_array[t];\r
- }\r
- this.setRGB(i2, i,_rgb_table_125[t% _rgb_table_125.length]);\r
- }\r
- }\r
- return;\r
- }\r
- /**\r
- * \r
- * @param i_stack\r
- */\r
-\r
- public void overlayData(NyARLabelingLabel i_label)\r
- {\r
- Graphics g = this.getGraphics();\r
- g.setColor(Color.red);\r
- g.drawRect(i_label.clip_l,i_label.clip_t,i_label.clip_r-i_label.clip_l,i_label.clip_b-i_label.clip_t);\r
- return;\r
- } \r
- /**\r
- * \r
- * @param i_stack\r
- */\r
-\r
- public void overlayData(NyARIntPointStack i_stack)\r
- {\r
- int count = i_stack.getLength();\r
- NyARIntPoint2d[] items = i_stack.getArray();\r
- Graphics g = this.getGraphics();\r
- for (int i = 0; i < count; i++) {\r
- int x = items[i].x;\r
- int y = items[i].y;\r
- g.setColor(Color.red);\r
- g.drawLine(x - 5, y, x + 5, y);\r
- g.drawLine(x, y + 5, x, y - 5);\r
- }\r
- return;\r
- }\r
- public void overlayData(NyARIntRectStack i_stack)\r
- {\r
- Color[] c=new Color[]{Color.cyan,Color.red,Color.green};\r
- int count = i_stack.getLength();\r
- NyARIntRect[] items = i_stack.getArray();\r
- Graphics g = this.getGraphics();\r
- for (int i = 0; i < count; i++) {\r
- int x = items[i].x;\r
- int y = items[i].y;\r
- g.setColor(c[i%1]);\r
- g.drawRect(x,y,items[i].w,items[i].h);\r
- }\r
- return;\r
- }\r
-}\r
+++ /dev/null
-/* \r
- * PROJECT: NyARToolkit\r
- * --------------------------------------------------------------------------------\r
- * This work is based on the original ARToolKit developed by\r
- * Hirokazu Kato\r
- * Mark Billinghurst\r
- * HITLab, University of Washington, Seattle\r
- * http://www.hitl.washington.edu/artoolkit/\r
- *\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 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
- * You should have received a copy of the GNU General Public License\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> or <nyatla(at)nyatla.jp>\r
- * \r
- */\r
-package jp.nyatla.utils.j2se;\r
-\r
-import java.awt.Graphics.*;\r
-import java.awt.image.*;\r
-import java.awt.*;\r
-import jp.nyatla.nyartoolkit.*;\r
-import jp.nyatla.nyartoolkit.core.raster.rgb.*;\r
-import jp.nyatla.nyartoolkit.core.raster.*;\r
-import jp.nyatla.nyartoolkit.core.rasterreader.*;\r
-import jp.nyatla.nyartoolkit.core.types.*;\r
-\r
-/**\r
- * BufferdImageとRasterイメージ間で、ビットマップをコピーします。\r
- */\r
-public class NyARRasterImageIO\r
-{\r
- /**\r
- * i_inの内容を、このイメージにコピーします。\r
- * @param i_in\r
- * @throws NyARException\r
- */\r
- public static void copy(INyARRgbRaster i_in,BufferedImage o_out) throws NyARException\r
- {\r
- assert i_in.getSize().isEqualSize(o_out.getWidth(), o_out.getHeight());\r
- \r
- //thisへ転写\r
- INyARRgbPixelReader reader=i_in.getRgbPixelReader();\r
- int[] rgb=new int[3];\r
-\r
- for(int y=o_out.getHeight()-1;y>=0;y--){\r
- for(int x=o_out.getWidth()-1;x>=0;x--){\r
- reader.getPixel(x,y,rgb);\r
- o_out.setRGB(x,y,(rgb[0]<<16)|(rgb[1]<<8)|rgb[2]);\r
- }\r
- }\r
- return;\r
- }\r
- /**\r
- * GrayScale用\r
- * @param i_in\r
- * @throws NyARException\r
- */\r
- public static void copy(NyARGrayscaleRaster i_in,BufferedImage o_out) throws NyARException\r
- {\r
- assert i_in.getSize().isEqualSize(o_out.getWidth(), o_out.getHeight());\r
- if(i_in.getBufferReader().isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_GRAY_8))\r
- {\r
- final int[] buf=(int[])i_in.getBufferReader().getBuffer();\r
- final int w=o_out.getWidth();\r
- final int h=o_out.getHeight();\r
- for(int y=h-1;y>=0;y--){\r
- for(int x=w-1;x>=0;x--){\r
- int v=buf[x+y*w];\r
- o_out.setRGB(x, y,v*(1+0x100+0x10000));\r
- }\r
- }\r
- }\r
- return;\r
- } \r
- /**\r
- * BIN_8用\r
- * @param i_in\r
- * @throws NyARException\r
- */\r
- public static void copy(INyARRaster i_in,BufferedImage o_out) throws NyARException\r
- {\r
- assert i_in.getSize().isEqualSize(o_out.getWidth(), o_out.getHeight());\r
- if(i_in.getBufferReader().isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_BIN_8))\r
- {\r
- final int[] buf=(int[])i_in.getBufferReader().getBuffer();\r
- final int w=o_out.getWidth();\r
- final int h=o_out.getHeight();\r
- for(int y=h-1;y>=0;y--){\r
- for(int x=w-1;x>=0;x--){\r
- o_out.setRGB(x, y,buf[x+y*w]==0?0:0xffffff);\r
- }\r
- }\r
- }\r
- return;\r
- } \r
- /**\r
- * ヒストグラムを書き出します。\r
- * @param i_in\r
- * @param o_out\r
- * @throws NyARException\r
- */\r
- public static void copy(NyARHistgram i_in,int i_l,int i_t,int i_h,Graphics i_g) throws NyARException\r
- {\r
- //正規化のための定数を出す。\r
- int max=0;\r
- for(int i=0;i<i_in.length;i++){\r
- max=max<i_in.data[i]?i_in.data[i]:max;\r
- }\r
- if(max==0){\r
- return;\r
- }\r
- //ヒストグラムを書く\r
- for(int i=0;i<i_in.length;i++){\r
- i_g.drawLine(i_l+i,i_t,i_l+i,i_h-i_h*i_in.data[i]/max);\r
- }\r
- return;\r
- } \r
- /**\r
- * i_outへこのイメージを出力します。\r
- * \r
- * @param i_out\r
- * @throws NyARException\r
- */\r
- public static void copy(BufferedImage i_in,INyARRgbRaster o_out) throws NyARException\r
- {\r
- assert o_out.getSize().isEqualSize(i_in.getWidth(), i_in.getHeight());\r
- \r
- //thisへ転写\r
- INyARRgbPixelReader reader=o_out.getRgbPixelReader();\r
- int[] rgb=new int[3];\r
- for(int y=i_in.getHeight()-1;y>=0;y--){\r
- for(int x=i_in.getWidth()-1;x>=0;x--){\r
- int pix=i_in.getRGB(x, y);\r
- rgb[0]=(pix>>16)&0xff;\r
- rgb[1]=(pix>>8)&0xff;\r
- rgb[2]=(pix)&0xff;\r
- reader.setPixel(x,y,rgb);\r
- }\r
- }\r
- return;\r
- }\r
- /**\r
- * BIN_8用\r
- * @param i_in\r
- * @throws NyARException\r
- */\r
- public static void copy(BufferedImage i_in,INyARRaster o_out) throws NyARException\r
- {\r
- assert o_out.getSize().isEqualSize(i_in.getWidth(), i_in.getHeight());\r
- if(o_out.getBufferReader().isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_BIN_8))\r
- {\r
- final int[] buf=(int[])o_out.getBufferReader().getBuffer();\r
- final int w=i_in.getWidth();\r
- final int h=i_in.getHeight();\r
- for(int y=h-1;y>=0;y--){\r
- for(int x=w-1;x>=0;x--){\r
- buf[x+y*w]=(i_in.getRGB(x, y)&0xffffff)>0?1:0;\r
- }\r
- }\r
- }\r
- return;\r
- }\r
- \r
-}\r