graphics2d

Which approach is best for creating PostScript in C#?

不想你离开。 提交于 2019-12-25 01:48:54
问题 I need to create PostScript output from our system. Our system produces highly formatted documents to numerous formats and I need to add .ps as an additional format. One bit of weirdness, our code is all written in Java and we use IKVM for the .net version of our library. We have about 5% of the code written in C# and the rest is Java converted with IKVM. I create .ps files on the Java side using a library that allows me to write to a Graphics2D object it provides. Unfortunately, in .NET (via

Draw an arc based on 2 Points and radius

自闭症网瘾萝莉.ら 提交于 2019-12-24 20:21:07
问题 I'm trying to draw an Arc2D object inside a panel. however I'm not sure how to calculate it. What I have given is starting Point2D and an end Point2D and a radius. The problem is that when the radius changes, the startAngle and AngleExtent parameters are different every time. another problem is that since the radius changes, the center of the 'to-be' circle containing the arc is in a different point every time, another parameter which changes based on input, so I can't use (or don't know how)

Flipping algorithms?

谁说我不能喝 提交于 2019-12-24 15:04:07
问题 I am new in android canvas. I was created custom shape on " L Shaped Rectangle, Rectangle and some shapes " and using android canvas. It was working fine. In my question is Flipping custom Shape? previously i was used scale canvas.scale(-1.0f, 1.0f); it's working. after flip, that shape do some action such as( rotate, resize). But i didn't get any points. So i searched flip algorithm for basic. i didn't get it. If you know pls share your comments. 回答1: Matrix is your friend. The truth is that

Java: Plotting points uniformly on a circle using Graphics2d

浪尽此生 提交于 2019-12-24 05:56:20
问题 I'm trying to draw a number of points on a circle such that each point is the same distance from the next. Eventually I'll be drawing lines between all of the points to make a little drawing. The current hurdle I am dealing with is the points don't come out on the circle uniformly. The way I am figuring the points is, for a given point with angle theta, the X coordinate and Y coordinate are calculated as follows xc = radius * (Math.cos(theta)) + horizontal center yc = radius * (Math.sin(theta

Draw lines on jpanel

ⅰ亾dé卋堺 提交于 2019-12-24 05:49:45
问题 I want to make it like Draw a ruler (line with tick marks at 90 degree angle) just not on jframe but on jpanel. So I tried: JFrame f = new JFrame(); JPanel ff = new JPanel(); ff.add(new JComponent() { ... }); f.add(ff); ... but I failed. :( How to? 回答1: You can simply override paintComponent(Graphics g){} for ff and draw your within that method. i.e. JPanel ff = new JPanel(){ public void paintComponent(Graphics g){ // Draw what you want to appear on your JPanel here. // g.drawLine(blah blah

How to draw a diamond shape in java?

最后都变了- 提交于 2019-12-24 04:22:35
问题 So i have to draw a diamond shape. Not a Static diamond but a diamond that i will myself drag and draw. I've used General Path to do it but it is drawing a diamond that is not straight; the diamond is bend to the left and it's not being drawn to where my mouse is pointed. Here is my code to create the diamond shape. Can someone please help me solve this? private GeneralPath drawDiamond(int x1, int y1, int x2, int y2){ int x = Math.min(x1, x2); int y = Math.min(y1, y2); // Gets the difference

android equivalent code for graphics2D

寵の児 提交于 2019-12-24 02:23:51
问题 I have been trying to get an android equivalent code for the following :- private BufferedImage user_space(BufferedImage image) { BufferedImage new_img = new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_3BYTE_BGR); Graphics2D graphics = new_img.createGraphics(); graphics.drawRenderedImage(image, null); graphics.dispose(); return new_img; } I want an android equivalent of Graphics2D. I have been searching for a while and found out that Canvas in android can do some

android equivalent code for graphics2D

断了今生、忘了曾经 提交于 2019-12-24 02:23:08
问题 I have been trying to get an android equivalent code for the following :- private BufferedImage user_space(BufferedImage image) { BufferedImage new_img = new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_3BYTE_BGR); Graphics2D graphics = new_img.createGraphics(); graphics.drawRenderedImage(image, null); graphics.dispose(); return new_img; } I want an android equivalent of Graphics2D. I have been searching for a while and found out that Canvas in android can do some

Add JTextField to Game Menu (graphics2d)

房东的猫 提交于 2019-12-24 01:45:31
问题 I'm developing a multiplayer game, and at the menu, I need to add a field, where the player can type the host-ip. I'm making the menu with Graphics2D, and I'm updating it in a loop: JFrame screenFrame = screen.getFullScreenWindow(); while (menuIsRunning) { Graphics2D g = screen.getGraphics(); renderer.drawMenu(g, screen.getWidth(), screen.getHeight(), menuObjects); screenFrame.getLayeredPane().paintComponents(g); g.dispose(); screen.update(); } And there I want to add a JTextField too, like

How to draw a continuous curve of repeated ovals on speedy mouse cursor dragging?

吃可爱长大的小学妹 提交于 2019-12-23 20:56:48
问题 This code is for drawing on a JPanel. In the paintComponent(Graphics) I am trying to draw curves via repeated Graphics2D#fillOval(x, y, with, height) . The app is working OK, and when I drag the mouse cursor slowly; it draws a continuous curve as I need. But when I speed up dragging the mouse cursor, the result is separated dots and not a continuous curve. So how to make it draw a continuous curve even if I speed up dragging? import java.awt.*; import java.awt.event.*; import java.util