Re: [問題] 請問PIXEL繪圖的METHOD
※ 引述《calais007 (淺水中)》之銘言:
: ※ 引述《mussinaa (rea)》之銘言:
: : 請問
: : 給定座標和顏色之後
: : 在該座標上繪出該顏色的METHOD
: : 我查了很久都查不到
: : 謝謝各位
: 有幾個方法
: 1.用Graphics直接畫
: 先setColor(Color);
: 再用fillOval(int x,int y,int width,int height);
: 但我覺得不是好方法
: 2.用Component來createImage(int width,int height);來得到Image
: 再用以下這個Method來得到BufferedImage
: public BufferedImage convert(Image im)
: {
: BufferedImage bi = new
: BufferedImage(im.getWidth(null),im.getHeight(null),BufferedImage.TYPE_INT_RGB);
: Graphics bg = bi.getGraphics();
: bg.drawImage(im, 0, 0, null);
: bg.dispose();
: return bi;
: }
: 接著直接在BufferdImage上操作吧
: BufferedImage有setRGB(int x,int y,int rgb);
: 相信你應該會了解怎麼用
相當感謝您的指教
我已經弄出來了
又多學了一個BufferdImage
謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 211.74.66.194
推
06/24 00:45, , 1F
06/24 00:45, 1F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 3 之 3 篇):