bufferedimage

drawing your own buffered image on frame

ぐ巨炮叔叔 提交于 2019-12-29 09:12:51
问题 I have a buffered image with the sizes of my frame: public BufferedImage img; public static int WIDTH = 800; public static int HEIGHT = 600; img=new BufferedImage(WIDTH, HEIGHT,BufferedImage.TYPE_INT_RGB); How can I draw it so I can see just a black image filling the frame? without using Canvas I want to use only the drawImage function from graphics without using the paint or paintComponent functions If it is possible, how can i assign an 1D array [WIDTH*HEIGHT] to that image? SIMPLY: I want

Using JavaFaces in Android

纵饮孤独 提交于 2019-12-26 15:05:55
问题 I download and test JavaFaces as a java project in Windows. but i'am tring to use it in android framework , but BufferedImage is not available in android ! how can i make this project compatible with android ? here is FaceRec.java that contain errors about BufferedImage . public class FaceRec { private FaceBundle bundle; private double[][] weights; Handler fh; Logger logger = Logger.getLogger("facerecognition.javafaces.FaceRec"); public FaceRec() { try { fh = new FileHandler("facerec.log");

Order of channels in BufferedImage?

陌路散爱 提交于 2019-12-25 13:46:30
问题 How do I find out the order of color channels in a BufferedImage (different types including alpha channels)? I need to know the order of R, G, and B parameters for operations like LookupOp (order of byte[][] in ByteLookupTable(int, byte[][])) or RescaleOp(float[], float[], hints). Is there a generic way to find the order from a given BufferedImage? I thought it should be in the ColorModel but I can't find it. I have used code like if (t == BufferedImage.TYPE_INT_ARGB) but there must be better

Order of channels in BufferedImage?

断了今生、忘了曾经 提交于 2019-12-25 13:44:09
问题 How do I find out the order of color channels in a BufferedImage (different types including alpha channels)? I need to know the order of R, G, and B parameters for operations like LookupOp (order of byte[][] in ByteLookupTable(int, byte[][])) or RescaleOp(float[], float[], hints). Is there a generic way to find the order from a given BufferedImage? I thought it should be in the ColorModel but I can't find it. I have used code like if (t == BufferedImage.TYPE_INT_ARGB) but there must be better

Why can't I erase my Sprite

那年仲夏 提交于 2019-12-25 09:26:17
问题 I've been trying for a while now to get a game working in Java, after much anguish over other peoples Sprite functions I made my own and don't understand why I can't erase it. I know it's changing the pixels of the background to display my archer sprite since it shows up but for whatever reason I can't change the pixels back to what they were before. Does anyone have an idea why that is or how I can fix it? Link to google doc with images: https://docs.google.com/document/d/1eU6faW1d7valq1yE

Issue loading a sprite sheet

≯℡__Kan透↙ 提交于 2019-12-25 06:55:09
问题 I'm trying to load this spritesheet into an array of buffered image (each sprite into one BufferedImage) : I opened this file on photoshop. The width is 500 and the height is 666. So according to my calculation, I need to loop 64 times (8 rows and 8 columns) and for each sprite, its width is 500/8 (62.5) and its height is 666/8(83.25). Since getSubImage accepts only int parameters, I was forced to put the width as 62 and the height a 83 (and I think this is why it truncates my images). Here's

Getting IllegalSrgumentException: input==null. When trying to load an image

孤人 提交于 2019-12-25 02:39:33
问题 i am trying to load an image to be used as a texture and i keep getting input==null errors; This is my code where i am trying to load the image and where most of the errors are pointing to. package com.mime.minefront.graphics; import java.awt.image.BufferedImage; import javax.imageio.ImageIO; public class Texture { public static Render floor = loadBitmap("/C:\\Users\\Danny\\Documents\\NetBeansProjects\\MyFirstgame\\src\\res\\textures\\floor.png"); public static Render loadBitmap(String

How Do I Put JLabel and JTextField on top of Image?

六月ゝ 毕业季﹏ 提交于 2019-12-25 02:24:11
问题 I am trying to create a game where I have a background image and text on top of that in the form of JLabel s. How would I go about doing that? The main reason I'm doing this is so that I can have 2 different text areas with different font sizes. Using g.drawString() will only let you use 1 text size for the whole thing. Here is my code so far: package com.cgp.buildtown; import java.awt.Font; import java.awt.FontFormatException; import java.awt.Graphics; import java.awt.Graphics2D; import java

RGB value not change correctly after saving image in JAVA

荒凉一梦 提交于 2019-12-25 02:15:00
问题 I'm trying to read an Image type JPG/JPEG to BufferedImage , change RGB value of pixel (0,0) Image file : http://i.upanh.com/rcfutp but it didn't work correctly Here is what i've try Read image public BufferedImage readImage1(String path) { BufferedImage _image = null; BufferedImage copy = null; try { _image = ImageIO.read(new File(path)); copy = new BufferedImage(_image.getWidth(), _image.getHeight(), BufferedImage.TYPE_3BYTE_BGR); copy.getGraphics().drawImage(_image, 0, 0, null); } catch

Show Multiple BufferedImage in jsp

旧巷老猫 提交于 2019-12-25 02:10:07
问题 I have 100 BufferedImage object's in ArrayList , i want to show all of these images in a jsp. <% ArrayList<BufferedImage> list = GlobalData.getImageBufferArrayList(); %> </head> <body> <ul> <li><img alt="" src=""> </li>//image1 <li><img alt="" src=""> </li>//image2 <li><img alt="" src=""> </li>//image3 ... .. ... </ul> </body> I don't know what to put in src on these images Is it possible to put image data as src of image.(Just like we get image data from canvas in html) Or is their any