draw

Java BasicStroke “Fuzzy”

被刻印的时光 ゝ 提交于 2019-12-17 22:01:35
问题 I'm trying to write a simple paint applet with Java, but I'm having trouble with BasicStroke . Initially, my plan was to try to somehow draw a line with a width, but the API apparently doesn't support that. I tried using BasicStroke , but the result is just a fuzzy mess. How can I fix this fuzz problem? private void mousedrag_hook(Point point) { if(start == null) start = point; end = point; Graphics2D g2d = (Graphics2D)applInstance.buffer_g; g2d.setStroke(new BasicStroke(7)); //g2d.fillOval

ImageView with rounded corners and inner shadow

倾然丶 夕夏残阳落幕 提交于 2019-12-17 21:57:25
问题 I need to make a thumbnail view with rounded corners and inner shadow. Usually I'm making ImageView frames with 9patches, which have served me well so far, but this time the effect I need requires drawing the inner shadow on top of the image (and not just around it). This lead me to extend the ImageView class and override the onDraw() method. public class ThumbnailImageView extends ImageView { After many tutorials (thanks StackOverflow!), I ended up with this code for the onDraw() method:

How to draw multiple shapes on JComponent or Jpanel?

依然范特西╮ 提交于 2019-12-17 21:25:48
问题 I'm trying to build Paint app and I doing something wrong in DrawingArea class. The problem is when I try to draw second shape , the first shape or figure is auto deleting so I need to some idea about how to solve this.All answers acceptable. THANKS FOR HELP. There is part of DrawingArea.class codes : @Override // GETTING FIRST (STARTING) COORDINATE WHEN THE MOUSE PRESSED public void mousePressed(MouseEvent e) { oldX = e.getX(); oldY = e.getY(); repaint(); } @Override // GETTING RELEASED

Why is my line not drawing?

。_饼干妹妹 提交于 2019-12-17 21:24:04
问题 So I have defined a mouseEventlistener and mousemotionListener to define points as so. protected Point elementPosition = null; public Point endPoint = null; public Axis tempAxis; public Graphics g; class MouseButtonHandler extends MouseAdapter { public void mousePressed(MouseEvent e) { if(e.getModifiers()==InputEvent.BUTTON1_MASK) { elementPosition =new Point(e.getX(), e.getY()) ; if(addType==YLABEL) { YDialog ydia = new YDialog(anApp); ydia.setVisible(true); value =(double) ydia.getValue();

Android transparent canvas (surfaceview)

时光毁灭记忆、已成空白 提交于 2019-12-17 17:58:18
问题 I've got a panel which is placed on top of another view via a relativelayout. I would like to give this panel a transparent background, but didn't find the correct way to do this after searching for some hours. When I set the alpha back to 0 I end up with a black background. Hopefully someone here can help me with this. Thanks a lot! The panel is drawn via this code: import android.content.Context; import android.graphics.Canvas; import android.graphics.Paint; import android.util.AttributeSet

How to draw gridline on WPF Canvas?

走远了吗. 提交于 2019-12-17 17:48:16
问题 I need to build a function drawing gridline on the canvas in WPF: void DrawGridLine(double startX, double startY, double stepX, double stepY, double slop, double width, double height) { // How to implement draw gridline here? } How would I go about this? 回答1: You don't really have to "draw" anything with WPF. If you want to draw lines, use the appropriate geometries to draw them. In your case it could be simple really. You're just drawing a grid so you could just create a DrawingBrush to draw

How to draw a circle with animation in android with circle size based on a value

杀马特。学长 韩版系。学妹 提交于 2019-12-17 07:01:37
问题 I want to develop a custom component which draws part of the circle based on different values. e.g draw 1/4 cirle, 1/2 circle etc. The component needs to be animated to display drawing process. The partial circle is drawn on top of a static imageview, and I plan to use two views, animated one on top of the static one. Any suggestion how to develop this? I put the screenshot for reference. Please refer to the picture, and get a feel how it looks like. Thanks! Thanks in advance. 回答1: You have

Android: how to draw a border to a LinearLayout

孤者浪人 提交于 2019-12-17 06:21:14
问题 I have three files. The XML, the draw function and the main Activity. I have some LinearLayout in my XML file. <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1"> <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" android:background="#ef3" android:id="@+id/img01"/> <LinearLayout android:layout_width="fill_parent" android:layout_height="fill

Android - How to pause threads during another activity?

非 Y 不嫁゛ 提交于 2019-12-14 03:58:38
问题 I have a thread "reader" that reads a file and updates a list A. Another thread "drawer" reads what there is in the variable a, do something, calls ondraw and then sleeps for 500ms (during this time reader populates A). I have also a preference activity that starts if i press menu button. The problem is that if i press the button while the reader thread hasn't finished to read his file i have en error in logcat.(see below) I've seen that the problem is the reader thread that is running while

Load bitmap into canvas and draw over it

天涯浪子 提交于 2019-12-14 00:41:47
问题 I like to make an app, something like a little paint, I have to get a bitmap, draw it on a canvas and next, draw over it (with figer)... So, I actually have this code: import java.io.File; import java.io.FileOutputStream; import java.util.ArrayList; import android.content.Context; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Path; import android.os.Environment; import android.util