drawing

Performance's issue when drawing dashed line in Java

我怕爱的太早我们不能终老 提交于 2020-06-27 12:00:43
问题 Using the following code, I am able to draw a dashed line: public void foo(Graphics2D g2d, Shape shape) { Stroke stroke = BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 10, new float[]{10}, 0); g2d.setStroke(stroke); g2d.draw(shape); } Once a shape is created, I want to be able to zoom on that shape (up to 20 000 time). The issue I have is that, when I zoom too much on the shape, the application start to lag and will eventually, if I continue to zoom, crash. With a plain line, I

Lines drawn on a large Bitmap are not visible when the image is saved

大兔子大兔子 提交于 2020-06-17 23:03:21
问题 I have created a program to draw square grids on a selected image. It works fine for images that has small resolution, but it doesn't work properly on large images. The all grid lines are not visible seem when the image is saved as file. The image I am testing has resolution 3600x4320 and can be shown in the link. How can I fix this problem? My code: Image drawGrid(int n, string imgPath) { Image img = Image.FromFile(imgPath); Graphics grp = Graphics.FromImage(img); grp.SmoothingMode = System

Lines drawn on a large Bitmap are not visible when the image is saved

穿精又带淫゛_ 提交于 2020-06-17 22:57:02
问题 I have created a program to draw square grids on a selected image. It works fine for images that has small resolution, but it doesn't work properly on large images. The all grid lines are not visible seem when the image is saved as file. The image I am testing has resolution 3600x4320 and can be shown in the link. How can I fix this problem? My code: Image drawGrid(int n, string imgPath) { Image img = Image.FromFile(imgPath); Graphics grp = Graphics.FromImage(img); grp.SmoothingMode = System

Right justify text using SharpDX/Direct2D

夙愿已清 提交于 2020-06-01 07:17:58
问题 I have some code to draw some text: var textFormat = new SharpDX.DirectWrite.TextFormat(fontFactory, "Arial", SharpDX.DirectWrite.FontWeight.Bold, SharpDX.DirectWrite.FontStyle.Normal, SharpDX.DirectWrite.FontStretch.Condensed, 16.0f); renderTarget.DrawText("AC", textFormat, textRect, textBrush, DrawTextOptions.NoSnap); The text is drawn starting at the top-left of the target rectangle. Is there any way to right-justify the text? 回答1: The fourth entry for the google search "right justify text

Horizontally-Drawn RowColumn Class for Motif Library (C)?

痴心易碎 提交于 2020-05-31 04:04:32
问题 I am using the Motif Library for my job. If anybody is not familiar with this library, you can find a list of files here https://packages.ubuntu.com/xenial/amd64/libmotif-dev/filelist, as well as another question here Motif 1.2 X11 on using RowColumn widget inside a ScrolledWindow. My issue is that the xmRowColumnWidgetClass is drawn vertically, which means it draws it column by column (starts at top left moving to bottom left, then moves right to the next column, etc.) Doing something like

How to create travelling wave in SpriteKit

丶灬走出姿态 提交于 2020-05-16 04:09:19
问题 How can I create a visual effect of traveling wave like this in Swift SpriteKit? I am using an extension to the SKAction that performs the oscillatory movement in the node, but I still do not know how to create the trail. I though in creating copies but it did not worked. extension SKAction { static func oscillation(scene: SKScene, amplitude a: CGFloat, timePeriod t: CGFloat, midPoint: CGPoint) -> SKAction { let action = SKAction.customAction(withDuration: Double(t)) { node, currentTime in

Drawing over screen in Java

主宰稳场 提交于 2020-04-05 12:15:23
问题 I want to create an helper application in Java.. which behaves like: whenever called through a global shortcut, it can draw some text on the screen (not onto its own application window, but on top of the screen). A similar post is here, but I want to achieve this in Java. When I search something like "java draw over screen", I can only get lots of tutorials about Java2D. I want to check: 1) is it possible to draw over other applications in Java? 2) If not possible, is there any alternatives

PorterDuffXfermode DST_IN not working as expected

落花浮王杯 提交于 2020-03-17 12:02:49
问题 So I'm trying to speed up some drawing we're doing (drawing a portion of an arc with alpha transparency) and was attempting to cache the entire arc into a separate bitmap, and show it selectively with an alpha mask. From the research I've done (the Xfermodes API demo for Android, this example, and this tool), if I have for example the following two graphics: and draw using the following: Xfermode DST_IN = new PorterDuffXfermode(PorterDuff.Mode.DST_IN); Paint paint = new Paint(Paint.ANTI_ALIAS

Is it really so difficult to draw smooth lines in Unity?

冷暖自知 提交于 2020-02-17 13:31:46
问题 I been trying for a while to draw smooth lines in Unity but with Line Renderer I obtained only jagged lines with the corners not rounded, in particular when the angle of curvature is really small . I incresed the value of antialiasing in quality settings and tried different materials but nothing changed. I also tried to instantiate a sphere every time the mouse move but it creates some gaps between the various spheres, in particular when the mouse go fast. I know there is a plugin called

Draw Shapes That User Selects

自作多情 提交于 2020-02-16 06:28:39
问题 I need to create a program to draw shapes(user chooses with radio button), and whether or not the shape is filled(user chooses with check box). This is the code I have so far: import javax.swing.*; import java.awt.*; import java.awt.event.*; public class SelectShape extends JFrame implements ItemListener{ private JRadioButton line = new JRadioButton("Line"); private JRadioButton rect = new JRadioButton("Rectangle"); private JRadioButton oval = new JRadioButton("Oval"); private JCheckBox fill