draw

Access to a single pixel in C#

╄→尐↘猪︶ㄣ 提交于 2019-12-23 21:30:20
问题 I'm working on a school project right now. It's meant to be a 3D editing software, (like a very minimized version of Maya). I have to write it in C#, using the 'Windows Application Project'. I intend to implement all the 3D stuff myself, from projections to shading. My question is, how can I get direct access to a single pixel in the C# windows application? I know I'm going to have a main view port in the window. But I haven't decided yet how it will be made. Is there a built in object that I

How to determine the colours when using matplotlib.pyplot.imshow()?

送分小仙女□ 提交于 2019-12-23 17:53:28
问题 I'm using imshow() to draw a 2D numpy array, so for example: my_array = [[ 2. 0. 5. 2. 5.] [ 3. 2. 0. 1. 4.] [ 5. 0. 5. 4. 4.] [ 0. 5. 2. 3. 4.] [ 0. 0. 3. 5. 2.]] plt.imshow(my_array, interpolation='none', vmin=0, vmax=5) which plots this image: What I want to do however, is change the colours, so that for example 0 is RED, 1 is GREEN, 2 is ORANGE, you get what I mean. Is there a way to do this, and if so, how? I've tried doing this by changing the entries in the colourmap, like so: cmap =

drawCircle vs drawBitmap

醉酒当歌 提交于 2019-12-23 17:51:04
问题 I'm planning on implementing a new set of figures in my game: plain circles. The number of drawn sprites (in this case circles) starts with 2-3, and can go up endlessly (potentially). The maximum will probably be around 60 though. In total there will have to be 5 types of circles, each with a different color and probably size too. Now seeing as I won't implement it until monday I thought I'd ask it at stackoverflow. Does anybody already know which method is faster? 回答1: Bitmaps are almost

Java: Draw a circular spiral using drawArc

强颜欢笑 提交于 2019-12-23 17:43:30
问题 I'm working on a java programming exercise where we have to draw a circular spiral using the drawArc method so that the result looks similar to this: I've been working on this for a while and this is what I have so far: import java.awt.Graphics; import javax.swing.JPanel; import javax.swing.JFrame; public class CircSpiral extends JPanel { public void paintComponent(Graphics g) { int x = 100; int y = 120; int width = 40; int height = 60; int startAngle = 20; int arcAngle = 80; for (int i = 0;

drawCircle vs drawBitmap

做~自己de王妃 提交于 2019-12-23 17:43:18
问题 I'm planning on implementing a new set of figures in my game: plain circles. The number of drawn sprites (in this case circles) starts with 2-3, and can go up endlessly (potentially). The maximum will probably be around 60 though. In total there will have to be 5 types of circles, each with a different color and probably size too. Now seeing as I won't implement it until monday I thought I'd ask it at stackoverflow. Does anybody already know which method is faster? 回答1: Bitmaps are almost

General zoom algorithm for drawing program

心不动则不痛 提交于 2019-12-23 15:46:14
问题 My GUI toolkit, wxPython provides some methods for implementing a user zoom factor, however the quality isn't too good. I'm looking for ideas on how to create a zooming feature, which I know is complicated. I have a bitmap representing my canvas which is drawn to. This is displayed inside a scrolled window. Problems I forsee: - performance when zoomed in and panning around the canvas - difficulties with "real" coordinates and zoomed in coordinates - image quality not degrading with the zoom

Java how to draw and fill a Polygon which has holes

天大地大妈咪最大 提交于 2019-12-23 12:16:11
问题 I am currently trying to draw and fill a Polygon which has a hole in it in Java. Normally this would not be a big problem, since I would draw the exterior ring and then draw the interior ring with the color of the background. But the problem is, that the polygon is displayed above a image which should be "seen" through the hole. I am writing the code in Java and am using JTS Topology Suite for my geometry data. This is my current code, which just paints the border and fills the polygon with a

How can I add a label above just the last bar in a Chart.JS bar chart?

十年热恋 提交于 2019-12-23 04:54:46
问题 I am creating a bar chart like so: var ctxForecastChart = $("#forecastLineChart").get(0).getContext("2d"); var forecastChartData = { labels: [ "Total Sales" ], datasets: [ { label: "8/28/2016 - 9/3/2016", backgroundColor: "rgba(255,0,0,0.75)", hoverBackgroundColor: "rgba(255,0,0,1)", data: [240] }, { label: "9/25/2016 - 10/2/2016", backgroundColor: "rgba(255,153,0,0.75)", hoverBackgroundColor: "rgba(255,153,0,1)", data: [272] }, { label: "9/18/2016 - 9/24/2016", backgroundColor: "rgba(255,255

Gesture automatically draws itself

自古美人都是妖i 提交于 2019-12-23 04:54:09
问题 I've seen it on Dolphin Browser. There're some gestures that're already created by default. They will redraw themselves so that users know where to begin drawing. I've noticed that in Gesture object, there's a method named toPath(). But I have no clue how to use it and I'm not sure if I'm on the right track. Can somebody tell me how to do it? Thanks. You can take a look at the picture below. 回答1: First of all I would suggest to take a look at GestureBuilder app from SDK samples. It has

Android: How to use 2 layout

旧时模样 提交于 2019-12-23 04:46:03
问题 I'm trying to do an application where there is a background, and with canvas i draw some lines. But there is a problem. Because to make background and other graphicals things i use a .xml file named "activity_main.xml" and after i do setContentView(R.layout.activity_main); to activate it. But when i draw the line i must use this: drawView = new DrawView(this) setContentView(drawView); Where drawView is the class that allow me to draw the line. So the first setContentView result useless and i