graphics

Drawing with Graphics class in C#

心已入冬 提交于 2019-12-12 15:10:37
问题 I would like to draw in C# with the mouse, like if the mouse were a pen. I am trying with Graphics class, using DrawLines method receiving an array of points as parameter. Do you think this is the better option, or do yo know if is there another easy way to do it? Thanks in advance Regards. 回答1: Look at this sample: http://www.codeproject.com/KB/graphics/drawtools.aspx Specifically, the Pencil tool does what you need. 回答2: You have to use a combination of the MouseMove, MouseDown, and MouseUp

How to increase ToolTip Rectangle size

孤街醉人 提交于 2019-12-12 15:00:11
问题 I am currently implementing a tooltip which has at least two sentences worth inside of it, so I need to somehow create a large rectangle which would hold it. My issue is the height of the rectangle. Snip: As you can see the green rectangle does not have the required size. Code: using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Drawing.Drawing2D; using System.Linq; using System.Text; using System.Threading.Tasks;

simple ocaml graphics progam that close before its window is displayed

て烟熏妆下的殇ゞ 提交于 2019-12-12 14:44:05
问题 My system is ArchLinux I have this simple ocaml program that should create a window and use drawing primitives. open Graphics let _ = open_graph ""; set_window_title "Graphics example"; draw_rect 50 50 300 200; set_color red; fill_rect 50 50 300 200; set_color blue; draw_rect 100 100 200 100; fill_rect 100 100 200 100 I can compile it: ocamlc graphics.cma -o graphics_exple graphics_exple.ml And launch it with: ./graphics_exple I see in my taskbar that a new window take focus then disapear

Replacing Disks by Crosses using Graphics in Mathematica

放肆的年华 提交于 2019-12-12 14:36:06
问题 Consider the following list : dalist = {{47.9913, 11.127, 208}, {47.5212, 10.3002, 208}, {49.7695, 9.96838, 160}, {48.625, 12.7042, 436}} Those are coordinatees of Eye fixations on a screen where, within each sublist, #1 is the X coordinate, #2 the Y coordinate and #3 , the duration spent at that particular location I then use the following : Disk[{#[[1]], #[[2]]}, 3N[#[[3]]/Total[dalist[[All, 3]]]]] & /@ dalist to draw disk with duration weighted diameter. I would like to draw cross instead

Is it necessary to flush write combine memory explicitly by programmer?

旧城冷巷雨未停 提交于 2019-12-12 13:23:49
问题 I know that write combine writes will be cached, and don't reach the memory directly. But is it necessary for the programmer to flush this memory explicitly before others can access? I got this question from the graphics driver code. For example, CPU fills the vertex buffer(mapped as WC). But before GPU access it, I don't see any flush operation in the code. Have the architecture(x86) already taken care of this for us? Any more detail document about this? 回答1: According to Intel® 64 and IA-32

Generating mipmaps in Vulkan

隐身守侯 提交于 2019-12-12 13:22:31
问题 I'm trying to generate mipmaps runtime (implement glGenerateMipmap() functionality) using vkCmdBlitImage but don't understand the process. Here's my code so far: VkImageCreateInfo imageCreateInfo = {}; imageCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO; imageCreateInfo.pNext = nullptr; imageCreateInfo.imageType = VK_IMAGE_TYPE_2D; imageCreateInfo.format = format; imageCreateInfo.mipLevels = mipLevels; imageCreateInfo.arrayLayers = 1; imageCreateInfo.samples = VK_SAMPLE_COUNT_1_BIT;

WebGL gl_FragColor alpha behave differently in Chrome with Firefox

杀马特。学长 韩版系。学妹 提交于 2019-12-12 13:12:05
问题 Code below draws three triangles alpha value 0.5 with {premultipliedAlpha: false} . const gl = document.querySelector('canvas').getContext('webgl', {premultipliedAlpha: false}); const canvasWidthHeight = 300; gl.clearColor(1, 0, 0, 0.4); // gl.clear(gl.COLOR_BUFFER_BIT); const vertexShaderSource = ` attribute vec2 position; uniform vec2 resolution; // All shaders have a main function void main() { vec2 glSpacePosition = (position / resolution) * 2.0 - 1.0; gl_Position = vec4(glSpacePosition *

Java Buffered Image RescaleOp Transparency Issue

青春壹個敷衍的年華 提交于 2019-12-12 12:48:36
问题 I seem to be having an issue where I create a BufferedImage which has transparent pixels like this: BufferedImage buff = new BufferedImage(i.getWidth(null), i.getHeight(null), BufferedImage.TYPE_INT_ARGB); and it works fine until I filter it through the RescaleOp to darken it. When I do this, the image disappears. Here is my complete code just so you can see how I am setting this up: BufferedImage buff = new BufferedImage(i.getWidth(null), i.getHeight(null), BufferedImage.TYPE_INT_ARGB);

How to directly access a GPU?

三世轮回 提交于 2019-12-12 12:02:07
问题 As most of you know CPUs are not well designed to do floating point calculation in contrast to GPUs. I am wondering how to use GPU's power without any abstraction layer or driver. Can I program for a GPU using assembly, C, C++ language (I mean how?). Although assembly seems to help me access the gpu directly, C/C++ are likely to need a medium library (e.g. OpenCL) to access the GPU. Let me ask you another question: How much of a modern GPU's capability will be exposed to a programmer without

Parameter is Invalid Exception when using Graphics.GetHdc

落爺英雄遲暮 提交于 2019-12-12 11:34:14
问题 I have been making an application to take snapshots of websites. Everything works well, until now: I have the application take MANY photos, and the process of the image taking is done as following: using (Graphics graphics = Graphics.FromImage(mBitmap)) { IntPtr hdc = graphics.GetHdc(); SendMessage(new HandleRef(mWebBrowser, mWebBrowser.Handle), 791, hdc, (IntPtr)30); BitBlt(new HandleRef(graphics, hdc), 0, 0, mBitmap.Width, mBitmap.Height, new HandleRef(graphics, hdc), 0, 0, 13369376);