draw

Android Canvas drawLine not drawing on MainActivity

旧时模样 提交于 2019-12-12 18:23:49
问题 I want to draw a line on the Main Activity using Canvas. The problem is, it is not drawing anything. I have the following code: Bitmap bitmap = Bitmap.createBitmap(1920, 1080, Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bitmap); Paint paint = new Paint(); paint.setColor(Color.BLACK); paint.setStyle(Paint.Style.FILL_AND_STROKE); paint.setStrokeWidth(10); float left = 20; float top = 20; float right = 50; float bottom = 100; canvas.drawLine(left, top, right, bottom, paint); 回答1: you

Programmatically draw rect and line in Highcharts with zoom

别来无恙 提交于 2019-12-12 17:23:50
问题 I'm doing some programmatic drawing in Highcharts using Highcharts.Renderer using path() and rect() . In the code below I have manually plotted the coordinates for the line and rect. In reality the are related to the main data series (dates with values). How can I programmatically draw something and make the zoom work? The main graph, with zoom: chart: { zoomType: 'x', }, xAxis: { categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] }, series: [{

Java Graphics: Each time it repaints, i get a blackflash

瘦欲@ 提交于 2019-12-12 17:11:03
问题 I'm pretty new to the java draw functions, but I have a sample histogram that I build. on button click, i have it rebuilding the histogram with random values. However, every time i hit the button to repaint, i get a black flash before it redraws. I remember hearing this was pretty common and the fix had something to do with buffering. Any advice? 回答1: The first thing you do when you draw is clear your canvas. The flash you see is the blank canvas as things get drawn. If you were to slow it

Libgdx SpriteBatch.draw() specifying 4 vertices

懵懂的女人 提交于 2019-12-12 11:17:54
问题 I'm using libGdx to create a 2d game and am trying to use this particular method to draw a simple 2d texture, specifying the 4 vertices induvidually; draw(Texture texture, float[] spriteVertices, int offset, int length) description says: Draws a rectangle using the given vertices. There must be 4 vertices, each made up of 5 elements in this order: x, y, color, u, v. Other draw methods work fine, but I can't get this one to work. What im trying is this; batch.draw(boxTexture, new float[] {-5,

How to draw a polygon from a set of unordered points

馋奶兔 提交于 2019-12-12 08:09:01
问题 Currently, I am using a convex hull algorithm to get the outer most points from a set of points randomly placed. What I aim to do is draw a polygon from the set of points returned by the convex hull however, when I try to draw the polygon it looks quite strange. My question, how do I order the points so the polygon draws correctly? Thanks. EDIT: Also, I have tried sorting using orderby(...).ThenBy(...) and I cant seem to get it working. 回答1: Have you tried the gift wrapping algorithm ( http:/

How to draw multiple shapes on JComponent or Jpanel?

孤街浪徒 提交于 2019-12-12 06:48:05
问题 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

How to remove gray border from NSButton?

十年热恋 提交于 2019-12-12 05:28:54
问题 I´m trying to make a simple colored NSButton. It seems there are two problems i don´t get solved: 1. How can I stop the button from being highlighted when clicked? I set a red background to my button: . When clicked, the color disappears: How could I keep the backgroundcolor, even when the button is clicked?. How could I remove the gray border? I tried different things: class myButton: NSButton { override func draw(_ dirtyRect: NSRect) { super.draw(dirtyRect) self.wantsLayer = true self

how draw curves lines [closed]

若如初见. 提交于 2019-12-12 04:25:36
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 years ago . Please, someone could help me draw this line in red color between point A(720,1140) the middle oof circle and point B (375,490) Bitmap bitmap = Bitmap.createBitmap((int) getWindowManager() .getDefaultDisplay().getWidth(), (int) getWindowManager() .getDefaultDisplay().getHeight(), Bitmap.Config.ARGB

XNA Menu Not Working

二次信任 提交于 2019-12-12 03:17:24
问题 I have a problem with the logic of this code, XNA's Update Method is to fast so when i am trying to icreas the value by 1 every time the down button is pressed on the keyboard, it ends up updating a more than just by 1 Have a look at the code and see if you can think of a better way to do it, public void Update(GameTime gameTime) { var now = Keyboard.GetState(); KeyboardState old = Keyboard.GetState(); if (now.IsKeyDown(Keys.Down) && !old.IsKeyUp(Keys.Down)) { properties.Menuposition++; }

Correctly implement the blocks in the drawing view

痴心易碎 提交于 2019-12-12 03:08:02
问题 How to correctly implement the blocks in the drawing view, so that when they could cut the line in two parts. Using UIImageView or UIImage? After the cut blocks should fall under the influence of physics. 回答1: First, how many cuts could happen in total? How many independent pieces of block could result? 10? 100? Before implementing any of these, test moving that number of objects around on an iPhone or iPod touch. Just because it works on the simulator does not mean it will be fast enough on