graphics2d Questions

4

Solved

I have got class called Airplane. Inside this class i have got variable img which is a BufferedImage type. What is more i have got class WorldMap which overrides function paintComponent(Graphics g)...
Vamoose asked 28/11, 2013 at 22:7

4

Solved

I'm currently working on the menu system for my Java game, and I wonder how I can center the text from Graphics.drawString(), so that if I want to draw a text whose center point is at X: 50 and Y: ...
Aidoneus asked 30/12, 2014 at 13:15

4

Solved

I am having trouble getting a rotated BufferedImage to display. I think the rotation is working just fine, but I can't actually draw it to the screen. My code: Class extends JPanel { BufferedImag...
Tonnage asked 7/2, 2011 at 6:4

8

Solved

I need to be able to rotate images individually(in java). The only thing I have found so far is g2d.drawImage(image, affinetransform, ImageObserver ). Unfortunately, I need to draw the image at a s...
Shortening asked 26/12, 2011 at 22:31

2

I have a question concerning printing additional information on barcodes. I am using http://barbecue.sourceforge.net/ to create my barcodes. After I created my barcodes I want to add some addition...
Cervical asked 24/11, 2012 at 12:48

2

Solved

I am working on C graphics program, where I will ask for Projection Angle from end user and then will use that angle to launch the rocket from earth (circle) surface. But I am not able to do so. He...
Contagion asked 27/6, 2021 at 4:5

7

Solved

I have a Graphics2D object and I want to set up the background of the object. It has a setBackground method, which has a Color parameter. This way I can set the color of the background. My questio...
Quinquepartite asked 7/5, 2013 at 15:57

4

I am trying to rotate a buffered image in java. Here is the code I am using: public static BufferedImage rotate(BufferedImage bimg, double angle) { int w = bimg.getWidth(); int h = bimg.getHeight...
Ploss asked 10/6, 2016 at 22:37

4

So I am attempting to create an application that can black-out sections of a survey that contains sensitive information. However I've run into a bit of a problem. What I want to do is draw filled b...
Apotropaic asked 24/7, 2012 at 16:4

1

So my goal is to have a window that opens where you can draw some lines on a white background by just clicking. The problem is that when it try to save it always comes back as a png, but it comes a...
Nonlegal asked 2/11, 2019 at 21:26

4

Solved

I have created a custom shape, essentially it is a collection of four Arc2D objects. When these arcs are drawn they form what could be considered a four point rounded star shape, kind of like a cl...
Tormentil asked 26/7, 2010 at 16:50

2

Solved

Summary I am reading a large binary file which contains image data. Cumulative Count Cut analysis is performed on data [It requires another array with same size as the image]. The data is stretch...
Exterior asked 14/5, 2019 at 18:53

2

Solved

Given a 2D Space with X points, how can I efficiently find where to place a fixed-size rectangle, so that it covers the largest possible number of those X points? I need something along these line...
Chateau asked 6/9, 2015 at 23:32

5

Solved

I need to create a rectangular BufferedImage with a specified background color, draw some pattern on the background and save it to file. I don't know how to create the background. I am using a nes...
Fylfot asked 17/9, 2009 at 19:5

5

Solved

I've been trying to figure out how to flip an image for a while, but haven't figured out yet. I'm using Graphics2D to draw an Image with g2d.drawImage(image, x, y, null) I just need a way to f...
Aphonic asked 4/3, 2012 at 21:30

5

Solved

I have a little problem here. I have an applet, where user can "draw" inside it. To do that, I use the java.awt.Graphics2D. But, how can I do to save the user draw image as a JPEG image, or at lea...
Confectionary asked 4/7, 2011 at 19:56

6

Solved

I have trouble drawing a triangle with the draw(Graphics g) method in Java. I can draw a rectangle like so: public void draw(Graphics g) { g.setColor(colorFill); g.fillRect(p.x, p.y, width, heig...
Tango asked 12/8, 2012 at 4:9

3

Solved

g2 is an instance of the class Graphics2D. I'd like to be able to draw multi-line text, but that requires a newline character. The following code renders in one line. String newline = System.getPr...
Squirmy asked 10/12, 2010 at 20:43

4

I need to write text in the center of an image. The text to write is not always the same. The code I'm using is here: // Here I first draw the image g.drawImage(img, 22, 15, 280, 225, null); // I...
Careycarfare asked 6/9, 2011 at 17:6

1

Solved

I have a weird problem when drawing strings with some specific true type fonts in Java 32bit on Windows 10. Since Java 7u13, whenever a character/glyph of the font is wider than 4 times it's heigh...
Mahalia asked 27/6, 2017 at 13:20

3

Solved

How can I draw a rectangle towards the top of the application in java ? Normally the drawRect method draws towards the bottom I tried to use a negative number but this would not work Graphics g = ...
Pires asked 19/9, 2012 at 22:42

2

Solved

It seems that stroking on sub-pixel coordinates became broken in Java 8. I have three sets of cases, shown on screenshots (columns represent cases, rows represent different stroke widths) : Java ...
Vocable asked 14/4, 2016 at 15:33

4

I have a set of points on a plane. They are partitioned into subsets. I want to plot a closed curve around points that belong to the same subset, so that points that belong to a subset will be insi...
Degradable asked 27/11, 2012 at 5:28

1

Solved

I'm experiencing an unexpected interaction between system events and the window refresh rate in simple Java2D applications on Linux/XWindows. It is best demonstrated with the small example below. ...
Santasantacruz asked 17/11, 2016 at 17:43

4

Solved

I'm using Java's Graphics2D to generate a graphical representation of a graph. I'm also using ImageIO to write a PNG file. (ImageIO.write(image, "png", out);) I'm wondering how should I write JUni...
Houselights asked 3/8, 2010 at 20:48

© 2022 - 2024 — McMap. All rights reserved.