paint

Android Canvas focus in selected area

北战南征 提交于 2020-01-15 10:54:23
问题 I'm trying to achieve this effect: The idea is that I want to cover an ImageView with a partial transparent layer, but not all of it. Somewhere there is an area (circle or rectangle), that should be completely transparent. I tried it using this lines of code: Paint paint = new Paint(); paint.setColor(Color.parseColor("#80000000")); canvas.drawRect(0, 0, bitmap.getWidth(), bitmap.getHeight(), paint); paint.setColor(Color.TRANSPARENT); canvas.drawCircle((int) x, (int) y, 50, paint); but it didn

Paint in JFrame not working (Java)

爷,独闯天下 提交于 2020-01-14 10:42:10
问题 So in class we are making a Java program. We are trying to use the paint(Graphics g) function in the JFrame. We have tried it in the past (weeks ago) and it used to work. But now it doesnt (or we made a mistake somewhere). We have also tried to use paintComponent(Graphics g) but nothing seems to work. Here is our code: public class MainAc { public static void main(String[] args) { JFrame frame = new JFrame("Class Paint"); JButton button = new JButton("Click for more"); frame.setSize(800, 600)

Paint in JFrame not working (Java)

為{幸葍}努か 提交于 2020-01-14 10:41:40
问题 So in class we are making a Java program. We are trying to use the paint(Graphics g) function in the JFrame. We have tried it in the past (weeks ago) and it used to work. But now it doesnt (or we made a mistake somewhere). We have also tried to use paintComponent(Graphics g) but nothing seems to work. Here is our code: public class MainAc { public static void main(String[] args) { JFrame frame = new JFrame("Class Paint"); JButton button = new JButton("Click for more"); frame.setSize(800, 600)

OSMDroid PathOverlay drawing is corrupted at high zoom levels

有些话、适合烂在心里 提交于 2020-01-14 04:40:10
问题 I'm using OSMdroid to implement a mapping application. I have implemented a custom MapTileProvider that uses a tile source that allows zoom levels up to 22. The default MAPNIK provider only allows zooms to level 18. The problem is that any PathOverlay instances draw perfectly until zoom level 19, but then are not drawn properly at zoom level 20-22. it looks like someone's rubbed out the path with an eraser over 90% of the path length (see screenshots below). I've stepped through the draw()

C# paint program flickering

99封情书 提交于 2020-01-12 08:28:57
问题 I'm trying to make a simple paint program in C#, but it keeps flickering when I'm drawing, like I need some kind of double buffering, but I don't know how to do it. I am drawing on a Panel and I'm using a Bitmap to store the graphics. Here's my code: public partial class Form1 : Form { private Bitmap drawing; private bool leftDown = false; private int prevX; private int prevY; private int currentX; private int currentY; public Form1() { InitializeComponent(); drawing = new Bitmap(panel1.Width

drawing text within a JPanel

馋奶兔 提交于 2020-01-11 02:48:29
问题 I'm looking for the most basic description of how to draw text within a JPanel. I know there are a billion tutorials out there but none of them are clicking with me and I have some specific questions which may help others who are confused. As a setup (a testing app) I have a single class which has a JLabel, a JTextField, a JButton, and a JPanel. The application reads in ints from an external file and should display their average in the panel when the JButton is pressed. I have all the

Java how and when exactly is the paint() method called?

我怕爱的太早我们不能终老 提交于 2020-01-07 06:17:57
问题 I have been told many times that the paint() method will be called as and when required when I extend my class to JFrame but for eg. in the code the paint method is not being called and I don't see any rectangle drawn. I even tried to call paint method inside the constructor (which I created) and then creating an obejct for the class in main but I got a NullPointerException import java.awt.Graphics; import javax.swing.JFrame; public class MyFirstDrawing extends JFrame { /** * */ private

how does paint() work [closed]

拈花ヽ惹草 提交于 2020-01-07 04:41:35
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . Can anyone tell me exactly how does the paint() method in java applet work, in simple words? Like, when it will be called , how it will be called? Because sometimes it gets called multiple times and I do not know

wxpython tooltip at specific coordinates

北城余情 提交于 2020-01-06 15:08:40
问题 I have seen lots of similar questions and those answers are what has gotten me this far. I have an application where all all object are created via DC, so they are all all drawn. (I have had much experience with sizers and 99% of the time sizers ROCK but in this case DC is the best answer.) So I want to have a tooltip for each element that is drawn and in the case the screen is refreshed and the element is drawn in a different location the tooltip should also move. My first attempt was with

drawString prints string over a screenshot of my current window

浪尽此生 提交于 2020-01-06 12:58:35
问题 When I run this code in Eclipse I get a the string and line printing in a new windows, but instead of a blank window it simply is a screenshot of my current window, set to the size I declare. http://i.imgur.com/nWFN9YJ.png Any suggestions on what I'm doing wrong? import java.awt.Graphics; import javax.swing.JFrame; public class EmptyFrame2 extends JFrame { public static void main(String args[]) { EmptyFrame2 JF=new EmptyFrame2(); JF.setSize(1000,500); JF.setVisible(true); } public void paint