drawing

WPF, C#: Draw a line onto existing bitmap in image control

十年热恋 提交于 2019-12-30 23:33:28
问题 I have a bitmap image in an image control I need to draw a red line on the bitmap each time I click with the mouse onto it, at the place where I clicked the mouse. I first thought of creating a Line object, but found out, that I cannot add the Line. I would need a canvas. But if I put my image in a canvas, my bitmap does not stretch over the whole canvas (I found out, that the coordinates of the bitmap determine the place on the canvas, so my bitmap is wrongly displayed.) Then I tried using

How can I show a subset of data on pie pieces in Chart.JS while still displaying the superset when hovering?

▼魔方 西西 提交于 2019-12-30 13:37:12
问题 I've got a pie chart that looks like this when hovering over a piece of pie: Except for wanting the legend to the right instead of on top, I'm fairly content with this, but I want just the percentage value to display "all the time" in the pie pieces - and still have the <name> (<%val>): <data> displayed on hover. In other words, I want the pie to look something like this: How can I break that one piece of data out (the percentage) and draw that onto each piece of pie? Here is the code I'm

How to use drawRect to draw in a existing view?

自古美人都是妖i 提交于 2019-12-30 11:26:27
问题 I'm doing a GPS tracking app. Every time it receives a Latitude/Longitude it converts it to (x,y) coordinates and calls drawRect to draw a line between two (x,y) pairs. However, the drawRect method just clear all the old contents before it draw new thing. How I can make the drawRect to draw new thing on the existing canvas? Thanks in advance here is my viewController.h #import <UIKit/UIKit.h> #import <CoreLocation/CoreLocation.h> @class routetrack; @interface simpleDrawViewController :

Modifying a drawing using Google Apps Script

孤街醉人 提交于 2019-12-30 08:51:20
问题 Has anyone found support for creating or changing a drawing using Google Apps Script? I've looked through the Google documentation, but I don't see any classes for drawing. I found out how to build user interface elements, but not drawings. I'd like to have the drawing as part of a document or spreadsheet, but a stand-alone drawing would be good enough. 回答1: It's not possible to do anything related to Google Drawings, embedded on files or not, up until today. The closest thing you have is

Drawing on PictureBox

无人久伴 提交于 2019-12-29 09:22:14
问题 in a UserControl I have a PictureBox and some other controls. For the user control which contains this picturebox named as Graph I have a method to draw a curve on this picture box: //Method to draw X and Y axis on the graph private bool DrawAxis(PaintEventArgs e) { var g = e.Graphics; g.DrawLine(_penAxisMain, (float)(Graph.Bounds.Width / 2), 0, (float)(Graph.Bounds.Width / 2), (float)Bounds.Height); g.DrawLine(_penAxisMain, 0, (float)(Graph.Bounds.Height / 2), Graph.Bounds.Width, (float)

Drawing on PictureBox

▼魔方 西西 提交于 2019-12-29 09:21:28
问题 in a UserControl I have a PictureBox and some other controls. For the user control which contains this picturebox named as Graph I have a method to draw a curve on this picture box: //Method to draw X and Y axis on the graph private bool DrawAxis(PaintEventArgs e) { var g = e.Graphics; g.DrawLine(_penAxisMain, (float)(Graph.Bounds.Width / 2), 0, (float)(Graph.Bounds.Width / 2), (float)Bounds.Height); g.DrawLine(_penAxisMain, 0, (float)(Graph.Bounds.Height / 2), Graph.Bounds.Width, (float)

Saving Bitmap as 32bpp doesn't keep transparency

余生颓废 提交于 2019-12-29 08:17:05
问题 using (var bmp = new Bitmap(image.Width, image.Height, PixelFormat.Format32bppArgb)) using (var g = Graphics.FromImage(bmp)) { g.Clear(Color.Transparent); g.DrawImage(image, 0, 0); bmp.Save("image.bmp", ImageFormat.Bmp); } The question should be clear: why saving to BMP trashes transparency to black , while saving to PNG keeps it ? Just to clarify: image is in Format8bppIndexed format and its palette does contain transparent colors (e.g. it draws correctly onto form/picturebox) Edit: My bad,

How do you load a bitmap file into a BitmapData object?

谁说我不能喝 提交于 2019-12-29 05:08:49
问题 In Flash, the BitmapData object can be used to store bitmaps in RAM, you can later draw them to a MovieClip using the beginBitmapFill() method. How do you load an external bitmap file (.jpg) into a BitmapData object? Even AS3 code would be helpful. 回答1: AS3 code to load a PNG and "get" its bitmapData var bitmapData:BitmapData; var loader:Loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete); loader.load(new URLRequest("../lib/img.png")); function

Custom onDraw() method not called

六月ゝ 毕业季﹏ 提交于 2019-12-29 03:17:06
问题 <LinearLayout android:id="@+id/svLL" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent"> <ScrollView android:id="@+id/sv" android:layout_width="wrap_content" android:layout_height="wrap_content" xmlns:android="http://schemas.android.com/apk/res/android"> <!-- <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/scrollbar_2_text" /> --> <com.mypackage.MyDrawableView android:layout_width=

why is my code executing paintComponent(Graphics page) twice?

五迷三道 提交于 2019-12-29 01:58:06
问题 This is getting on my nerves and it probably something silly on my part but I can't figure out why my paintComponent is being called twice, if you run my code it outputs REPEAT? REPEAT? twice, I don't want it to do that.. So why does it do it and how can I fix it? import java.util.Random; import javax.swing.JFrame; import javax.swing.JPanel; import java.awt.*; public class Main extends JPanel { public Main() { /*code here*/ } public void paintComponent(Graphics page) { clear(page); /*code