graphics2d
How to write an Image without running out of memory in Java?
final BufferedImage img = new BufferedImage(3500, 2480, BufferedImage.TYPE_BYTE_INDEXED); final Graphics2D g2D = img.createGraphics();[详细]
2023-01-20 23:42 分类:问答Testing graphics generation with JUnit
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);)[详细]
2023-01-10 06:22 分类:问答How to set AffineTransform to rotate instead of shear?
I use the AffineTransform when drawing with Graphics2D. I use it to transform a Shape before drawing it. rx and ry are supposed to be rotation but when drawing the shapes are sheared not rotated. How[详细]
2022-12-31 13:10 分类:问答Cannot get right height of text in java.awt.BufferdImage/Graphics2D
Im creating a servlet that renders a jpg/png with a given text. I want the text to be centered on the rendered image. I can get the width, but the height i\'m getting seems to be wrong[详细]
2022-12-30 22:34 分类:问答Java: Detecting image format, resize (scale) and save as JPEG
This is the code I have, it actually works, not perfectly but it does, the problem is that the resized thumbnails are not pasting on the white Drawn rectangle, breaking the images aspect ratio, here i[详细]
2022-12-28 13:41 分类:问答How can I rotate an image using Java/Swing and then set its origin to 0,0?
I\'m abl开发者_运维技巧e to rotate an image that has been added to a JLabel.The only problem is that if the height and width are not equal, the rotated image will no longer appear at the JLabel\'s ori[详细]
2022-12-28 05:48 分类:问答Using Graphics2D to overlay text on a BufferedImage and return a BufferedImage
I have checked similarly named questions, but they don\'t answer this use case. Basically, I was to overlay some text (text) at a given coordinate (x,y) I have the below function in a package;[详细]
2022-12-27 10:57 分类:问答Java Crossword Application - what package to use?
I\'m about to create a java crossword application but I am unsure of what packages to use to draw the cr开发者_StackOverflow社区ossword grid. I know you can manually draw grids with Graphics2D etc. bu[详细]
2022-12-26 02:58 分类:问答How to calculate the length of a Path2D in Java?
I have some paths represented by Path2D. The Path consist of multiple CubicCurve2D or Line2D segments that are connected to each other. I would like to calculate or get the length from the start to th[详细]
2022-12-25 18:07 分类:问答Multiple Graphics2D Objects
I have a Graphics object of JPanel and that is working fine: import java.awt.Color; import java.awt.Graphics;[详细]
2022-12-23 06:53 分类:问答