drawing

How to change x,y origin of canvas to bottom left and flip the y coordinates?

邮差的信 提交于 2019-12-17 16:34:23
问题 I have a bunch of data points that I would like to two-way bind to points on a canvas. The points assume larger y values are reflected in an upwards direction like most math graphs. How do I change the x,y origin of the canvas to the bottom left corner and reverse it's interpretation of the y coordinate? (I would like to stay in XAML) 回答1: <Canvas> <Canvas.LayoutTransform> <ScaleTransform ScaleX="1" ScaleY="-1" CenterX=".5" CenterY=".5" /> </Canvas.LayoutTransform> </Canvas> 回答2: I tried the

Clear Canvas Rect (but keep background)

北战南征 提交于 2019-12-17 16:07:05
问题 I'm trying to animate a circle and just moving it horizontally which works fine. However while the circle is moving, I have to do a clearRect over that circle so that it redraws it self in the horizontal direction. When I do a clearRect it also makes the background have white box around so effectively its going to be one white horizontal line in the direction the circle is moving. Is there a way to clear the circle without clearRect? If I have to keep redrawing the background after clearRect

How can I draw sound data from my wav file?

旧城冷巷雨未停 提交于 2019-12-17 15:37:41
问题 First off this is for homework or... project. I'm having trouble understanding the idea behind how to draw the sound data waves on to a graph in Java for a project. I have to make this assignment entirely from scratch with a UI and everything so basically making a .wav file editor. The main issue I'm having is getting the sound data into the graph to be drawn. Currently I have a randomly generated array of values just being drawn right now. So far I have a mini-program running and validating

What exactly is a canvas path, and what is the use of ctx.closePath()?

帅比萌擦擦* 提交于 2019-12-17 15:30:32
问题 I'm working on an HTML5 game. I need to draw tail lines in the canvas and check for intersections in the game, which is a Tron-style game. I'm actually using the drawLine() function from JCanvas, but JCanvas did not provide me a way to check for line intersection, I digged in the source and found the use the ctx object, and at the end of the function I'm using, I returned the object so I can use the ctx.isPointInPath() method to achieve what I need, but is not working, is returning false

draw on screen without form

半城伤御伤魂 提交于 2019-12-17 07:05:51
问题 Is it possible to create a big white rectangle on the screen with just using the C# console and not an C# Forms Application? It should cover the whole Screen if possible. I know I have to use the System.Drawing and tried several steps, but none will actually print anything on my screen! 回答1: Method 1: Call the Windows API You need System.Drawing and System.Runtime.InteropServices . You may need to add project references to them. using System.Runtime.InteropServices; using System.Drawing; Add

Android: How to overlay a bitmap and draw over a bitmap?

我怕爱的太早我们不能终老 提交于 2019-12-17 02:54:14
问题 I have three questions actually: Is it better to draw an image on a bitmap or create a bitmap as resource and then draw it over a bitmap? Performance wise, which one is better? If I want to draw something transparent over a bitmap, how would I go about doing it? If I want to overlay one transparent bitmap over another, how would I do it? Sorry for the long list, but in the interest of learning, I would like to explore both the approaches. 回答1: I can't believe no one has answered this yet! A

How To: Best way to draw table in console app (C#)

橙三吉。 提交于 2019-12-17 02:26:46
问题 I have an interesting question. Imagine I have a lot of data changing in very fast intervals. I want to display that data as a table in console app. f.ex: ------------------------------------------------------------------------- | Column 1 | Column 2 | Column 3 | Column 4 | ------------------------------------------------------------------------- | | | | | | | | | | | | | | | ------------------------------------------------------------------------- How to keep things fast and how to fix

Use System.Drawing.Color to draw a line in WPF

人盡茶涼 提交于 2019-12-14 03:24:43
问题 How can I draw a line in XAML using a System.Drawing.Color ? A solution without a converter would be nice. XAML: <Line X1="10" Y1="10" X2="20" Y2="10" Stroke="{Binding Color}" StrokeThickness="4" /> Code: System.Drawing.Color Color = System.Drawing.Color.Black; 回答1: You need to bind a Brush to the Stroke property, in particular a SolidColorBrush, which accepts a color. However, you need to convert from System.Drawing.Color to System.Windows.Media.Color, e.g. by passing the R, G, and B values

draw a layer with some color in iPhone Application

心不动则不痛 提交于 2019-12-14 00:08:00
问题 I would like to know how to draw a layer with some color [CGColorRef] in a window When i am trying to addSubLayer to my window , the application is exiting without showing any exception. 回答1: If your app is just quitting with no debug error, there still could be a message sent to some deallocated instance. Try turning on NSZombieEnabled by following the instructions here: http://www.codza.com/how-to-debug-exc_bad_access-on-iphone This will tell you when a bad message is sent. Further, if you

Getting All x and y coordinates from a motion event in android

一个人想着一个人 提交于 2019-12-13 16:46:15
问题 I'm currently working on my own basic drawing app. So far, my app is working well but I noticed that my motion event doesn't seem to get all the X and Y axis points that are touched. When I move my finger across the screen, there is noticeable spaces between the circles. Only when I move my finger slowly does it capture all the points. Is there a way I can grab all the points or is there a way i can optimize it to be able to handle all the points? Here's how I'm doing it: setOnTouchListener