draw

Animate a Canvas circle to draw on load

丶灬走出姿态 提交于 2020-01-09 19:36:33
问题 OK Hello. I've decided to start using HTML canvas for a small project I have. There's no real start yet. I'm just learning the basics of Canvas and I want to Animate a circle <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>title</title> <style> body { margin: 0px; padding: 0px; background: #222; } </style> <link rel="stylesheet" href="style.css" type="text/css"> </head> <body> <canvas id="myCanvas" width="578" height="250"></canvas> <script> var canvas = document.getElementById(

Animate a Canvas circle to draw on load

女生的网名这么多〃 提交于 2020-01-09 19:35:52
问题 OK Hello. I've decided to start using HTML canvas for a small project I have. There's no real start yet. I'm just learning the basics of Canvas and I want to Animate a circle <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>title</title> <style> body { margin: 0px; padding: 0px; background: #222; } </style> <link rel="stylesheet" href="style.css" type="text/css"> </head> <body> <canvas id="myCanvas" width="578" height="250"></canvas> <script> var canvas = document.getElementById(

Android - Draw Bitmap within Canvas

别来无恙 提交于 2020-01-09 10:13:43
问题 I currently have a maze game which draws a 5 x 5 square (takes the width of screen and splits it evenly). Then for each of these boxes using x and y cordinates I user drawRect, to draw a colored background. The issue I am having is I now need to draw an image within this same location, therefore replacing the current plain background colour fill. Here is the code I am currently using to drawRect (a few example): // these are all the variation of drawRect that I use canvas.drawRect(x, y, (x +

Android - Draw Bitmap within Canvas

做~自己de王妃 提交于 2020-01-09 10:11:50
问题 I currently have a maze game which draws a 5 x 5 square (takes the width of screen and splits it evenly). Then for each of these boxes using x and y cordinates I user drawRect, to draw a colored background. The issue I am having is I now need to draw an image within this same location, therefore replacing the current plain background colour fill. Here is the code I am currently using to drawRect (a few example): // these are all the variation of drawRect that I use canvas.drawRect(x, y, (x +

Android: FrameLayout not respecting draw order

余生长醉 提交于 2020-01-07 02:01:07
问题 I have a FrameLayout with four SurfaceViews arranged in a 2x2 grid. The user can resize each of the views. I'd like the views to be drawn in order of their area, with the largest view drawn first and so on. Each time a view is resized, I order the views by their area, and update the FrameLayout: public void reorderViews() { PlotView child1; PlotView child2; boolean swap = false; for(int i = 0; i < layout.getChildCount(); i++) { child1 = (PlotView) layout.getChildAt(i); for(int j = i + 1; j <

Drawing tree not visible; maybe layout issue

落爺英雄遲暮 提交于 2020-01-07 00:33:32
问题 I want to display a tree. But the tree does not appear. What is the problem? Main: package scanner_parser; public class Main { public static void main(String[] args) { Oberflaeche gui = new Oberflaeche(); gui.setVisible(true); } } GUI: import java.awt.BorderLayout; import java.awt.Color; import java.awt.event.*; import javax.swing.*; public class Oberflaeche extends JFrame implements ActionListener { private JPanel cp, top, bottom; private JTextField eingabefeld = new JTextField(); private

Drawing fast in canvas Bitmap android ics

谁都会走 提交于 2020-01-06 04:30:20
问题 I've been developing an app to draw in ics android tablets and i've encountered an issue I can't figure out how to fix. The problem is that I draw correctly and in a real time drawing BUT when I go really really fast (tested on real tablets) the circles are not really circles, they look like pilygons of 5 or 6 sides... Here I declare the bitmap and assign it to the canvas: Display display = getWindowManager().getDefaultDisplay(); Point size = new Point(); display.getSize(size); width = size.x

Using Rect with touch coordinates

五迷三道 提交于 2020-01-06 03:46:44
问题 In my app whenever I place my second finger on the Screen. I should be able to show the center of the view shown in this post or below image at the point of touch of second finger. I am using the code shown below. The problem I face is the center of the mainarea is not at the second finger touch. public OnTouchListener mTouchlistener = new OnTouchListener() { @TargetApi(Build.VERSION_CODES.M) @Override public boolean onTouch(View v, MotionEvent event) { int pointerIndex = event.getActionIndex

UIGraphicsGetCurrentContext didn't appear inside UIView

若如初见. 提交于 2020-01-04 13:47:54
问题 I have to draw a shape and detect if user touches are inside the shape or not, so I defined a custom class inherit from UIView as follow : class ShapeView: UIView { override init(frame: CGRect) { super.init(frame: frame) } required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } override func draw(_ rect: CGRect) { drawShape() } func drawShape() { guard let ctx = UIGraphicsGetCurrentContext() else { return } let zero = CGPoint(x: frame.midX, y: frame

UIGraphicsGetCurrentContext didn't appear inside UIView

三世轮回 提交于 2020-01-04 13:47:16
问题 I have to draw a shape and detect if user touches are inside the shape or not, so I defined a custom class inherit from UIView as follow : class ShapeView: UIView { override init(frame: CGRect) { super.init(frame: frame) } required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } override func draw(_ rect: CGRect) { drawShape() } func drawShape() { guard let ctx = UIGraphicsGetCurrentContext() else { return } let zero = CGPoint(x: frame.midX, y: frame