drawing

How can I display a code drawn line over other apps?

不羁岁月 提交于 2020-01-02 09:28:12
问题 Details: I would like to add a code drawn line (like you draw with canvas/paint) and display it over other applications. I currently have an application that allows me to display an image over other application. See my Stackoverflow answer for my code. I have implemented the permission to do so: android.permission.SYSTEM_ALERT_WINDOW I have tried to add a canvas/paint to the WindowManager without errors, but my app crashed. I have tried searching for an answer, but have turned up empty. If

How can I display a code drawn line over other apps?

萝らか妹 提交于 2020-01-02 09:28:05
问题 Details: I would like to add a code drawn line (like you draw with canvas/paint) and display it over other applications. I currently have an application that allows me to display an image over other application. See my Stackoverflow answer for my code. I have implemented the permission to do so: android.permission.SYSTEM_ALERT_WINDOW I have tried to add a canvas/paint to the WindowManager without errors, but my app crashed. I have tried searching for an answer, but have turned up empty. If

How to draw shapes in WP7 with the finger?

心已入冬 提交于 2020-01-02 07:41:10
问题 How to draw shapes in WP7 with the finger? I am trying to implement a simple paint application but I am not sure how to make the drawing. 回答1: fingerpaint is your friend try it out on Ruby using http://script.iron7.com/#/Script/Detail?scriptId=FingerPaint&userLowerCaseName=iron7 or in C# at http://sigurdsnorteland.wordpress.com/2010/10/20/fingerpaint-a-little-wp7-paint-app/ Note that the two sets of code aren't quite the same - the C# fingerpaint had some issues about drawing new tracks on

How do I draw the outline of a collection of rectangles?

ⅰ亾dé卋堺 提交于 2020-01-02 06:38:44
问题 As part of a project I'm working on I have to store and restore magic wand regions from an image. To obtain the data for storage, I'm utilizing the GetRegionData method. As the specification specifies, this method: Returns a RegionData that represents the information that describes this Region. I store the byte[] kept in the RegionData.Data property in a base64 string, so I can retrieve the RegionData later through a somewhat unconventional method: // This "instantiates" a RegionData object

Subclassing NSScrollView drawRect: Method

六眼飞鱼酱① 提交于 2020-01-02 05:23:16
问题 I'm customizing the UI for one of my apps, and the idea is that a text area is initially bordered gray when out of focus, and when it comes into focus, the border becomes bright white. My app uses a dark theme, and for a single-lined NSTextField , this works great. I'm running into problems with a subclassed NSTextView , however. In order to alter the border properly, I ended up having to actually subclass the parent NSScrollView , but am still seeing strange behavior. (See screenshot below.)

Why does TextRenderer.MeasureText not measure text correctly using larger fonts in C#?

风流意气都作罢 提交于 2020-01-02 04:43:05
问题 What I am doing is getting the pixel size of a string and converting it to hundredths of an inch (ie. pixels/DPI = inches, inches * 100 = hundredths of an inch). Here is my code: private static SizeF TextSize(string text, Font txtFnt) { SizeF txtSize = new SizeF(); // The size returned is 'Size(int width, int height)' where width and height // are the dimensions of the string in pixels Size s = System.Windows.Forms.TextRenderer.MeasureText(text, txtFnt); // Value based on normal DPI settings

Creating a Hand-Drawn effect using .NET

杀马特。学长 韩版系。学妹 提交于 2020-01-01 19:40:52
问题 I'd like to write a piece of code which creates images similar in style to those rendered by 'Balsamiq Mockups' or 'yUML' using the .NET framework. Can anybody tell me how to achieve the hand-drawn pencil effect using GDI+? The text can obviously be done using the right font - my question is how to render the lines, boxes and circles. Thanks! 回答1: GDI+ is best suited for drawing right-angle-type graphics, but you can use it to produce an effect like this: alt text http://img7.imageshack.us

How do I draw a closed curve over a set of points?

纵饮孤独 提交于 2020-01-01 19:16:29
问题 Basically I want to draw a polygon, but I want the edges to appear soft rather than hard. Since the shape of the polygon is important, the edges have to go over the points. I've found monotone cubic splines to be accurate for open curves (i.e., curves that don't wrap around on themselves), but the algorithms I've found precalculate points 0 and N. Can I somehow change them to work with a closed curve? I am implementing this in JavaScript, but pseudo-code would just as well. 回答1: There is an

How to effectively draw on desktop in C#?

落爺英雄遲暮 提交于 2020-01-01 09:07:09
问题 I want to draw directly on the desktop in C#. From searching a bit, I ended up using a Graphics object from the Desktop HDC (null). Then, I painted normally using this Graphics object. The problem is that my shapes get lost when any part of the screen is redrawn. I tried a While loop, but it actually ends up drawing as fast as the application can, which is not the update rate of the desktop. Normally, I would need to put my drawing code in a "OnPaint" event, but such thing does not exist for

How to display raw data as an image (Visual Studio c#)

假如想象 提交于 2020-01-01 08:05:28
问题 I will be receiving some raw data that will be stored in a byte array, where each 2 bytes is a pixel value (16 bits/px). To start with, the array will contain 100x100*2 bytes (enough for a 100x100 pixel image). I would like to display this data in the Form window. Eventually, I would like to refresh the image with the new data to make it look like a video stream. No strict frame rate is required. How can this be done? Any code examples in C#? EDIT: After some suggestions and reviews of tens