drawing

Pygame Key Press

[亡魂溺海] 提交于 2019-12-24 19:05:20
问题 I'm writing a basic drawing program to practice Pygame, but I have a problem I'm using key press events to change the drawing color but when you let go of the key it goes back to the default color black. I'm sure there is a easy way to fix this I just don't know how! Here is my code: import pygame from pygame.locals import * import sys RED = (255,0,0) GREEN = (0,255,0) BLUE = (0,0,255) WHITE = (255,255,255) class Draw(object): def update(self, screen): color = (0,0,0) key = pygame.key.get

Java: Fastest way to draw text?

廉价感情. 提交于 2019-12-24 18:39:55
问题 I'm trying to write a program that just creates an image out of text (e.g. write "hello" on a white square and store the image), which sounds simple but it must be done quickly. I tried the Java2D library but drawing onto a BufferedImage takes ~2 seconds to just draw the image, not even save or display it. I also tried Java-based CAPTCHA generators but they take much too long (5 seconds). This seems like simple enough task to just draw text, but I'm frustrated that I can't do this faster than

Highcharts - Diagonal line X/Y axis

旧街凉风 提交于 2019-12-24 13:16:43
问题 Is there any way of showing a 1:1 diagonal line in Highcharts? I am looking for a line which X and Y values always match. I know how to render a line in Highcharts using the renderer, however, I don't want an independent line but one that reacts to the chart resizing/zooming. A series with [(0,0),(1,1)] is not really an option (it would affect zooming). Something like this except x and y axis might vary their value due to zooming. 回答1: You can do it by detecting the setExtremes() event on you

How to load 12 bit image into System.Drawing.Bitmap?

∥☆過路亽.° 提交于 2019-12-24 12:26:25
问题 I have a server serving 12bit image and I can access the image through http, but since it is 12 bit image I am not able to load into System.Drawing.Bitmap(Stream stream). Image format PNG bit depth 12 Image is here original 12 bit one This is how the image should look once you are able to Load. 回答1: You may be able to read the image when using OpenCV library, since it also supports 12bit. You may also prefer to look for an adapter/wrapper, in order to use it in c#, since it is originally a C+

C# - Need help creating program that simulates Prime Number behavior by drawing lines

六月ゝ 毕业季﹏ 提交于 2019-12-24 12:17:24
问题 I challenged myself to create a program to experiment with Prime Numbers, I already have an idea how to do it, but not the coding skills.. My plan is this: First ill create a program in C# that makes straight lines that follow some rules: rule 1: all lines have the same length. rule 2: all lines are either horizontal or vertical (no diagonals). rule 3: Every new line begins where the previous line has ended (that way all the lines are joined). Now for the tricky part: I would like to make a

ImageMagick & Pie Charts

谁说我不能喝 提交于 2019-12-24 12:15:14
问题 What is the most direct way to draw a pie chart using ImageMagick in an existing image. For example, how would I draw a single slice given the following inputs? A center point (x,y) Radius Percent 回答1: Create your pie wedge using SVG; I got my example from here: <svg> <path d="M200,200 L200,20 A180,180 0 0,1 377,231 z" style="fill:#ff0000; fill-opacity: 1; stroke:black; stroke-width: 1"/> </svg> Then, overlay that image using ImageMagick to your background image. composite.exe -background

Highlight pdf line

廉价感情. 提交于 2019-12-24 11:52:00
问题 Please can any one help me. I am really stuck I don't know how to highlight particular line of pdf. It would be better if any one can provide me sample code or pseudo code Thanks 回答1: This is not trivial. To do this, I'd render the PDF contents into one layer, and somehow get the position of the said line/object using the CoreGraphics PDF parser (or some other way). After that, you highlight the said object using your own drawing code. 回答2: Just highlighting a particular line is quite

Highlight pdf line

痞子三分冷 提交于 2019-12-24 11:48:04
问题 Please can any one help me. I am really stuck I don't know how to highlight particular line of pdf. It would be better if any one can provide me sample code or pseudo code Thanks 回答1: This is not trivial. To do this, I'd render the PDF contents into one layer, and somehow get the position of the said line/object using the CoreGraphics PDF parser (or some other way). After that, you highlight the said object using your own drawing code. 回答2: Just highlighting a particular line is quite

Drawing a circle with GDI graphics on WPF

不问归期 提交于 2019-12-24 11:37:52
问题 I need to draw with GDI graphics a circle on my form in WPF. I can't do this with windows forms, so i have added a using. I can not use the Elipse controls from WPF. My teacher told me to do this like this. This is my code: public void MakeLogo() { System.Drawing.SolidBrush myBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Green); System.Drawing.Graphics formGraphics = this.CreateGraphics(); formGraphics.FillEllipse(myBrush, new System.Drawing.Rectangle(0, 0, 200, 300)); myBrush

Delphi: draw selections and mouse-hover effects on ListViewDrawItem

醉酒当歌 提交于 2019-12-24 11:14:52
问题 I have a code from here: Delphi: Canvas.FillRect in List View to paint rows (I use OwnerDraw). Therefore I need to draw selections and mouse-hover effects. And to draw a normal column resizing effect... I have a code to move items up and down: procedure TForm1.ListViewDragDrop(Sender, Source: TObject; X, Y: Integer); var DragItem, DropItem, CurrentItem, NextItem: TListItem; begin if Sender = Source then with TListView(Sender) do begin DropItem := GetItemAt(X, Y); CurrentItem := Selected;