gdi+

Looking for a faster-than-GDI solution for rendering dynamic data plots

流过昼夜 提交于 2019-12-21 22:34:23
问题 I've written a simple GDI-based data plotter using C++/CLI but it's not particularly fast (some basic profiling indicates it's the rendering to screen that's the problem). Is there any way to enable hardware acceleration for a UserControl or is there a .net interface for direct3D? ...or are there some other options I could consider. We're using managed code so the solution really needs to be CLI compatible if at all possible. [Edit] In case it helps, I'm rending strips (128 data points) of

CSS3-like box shadow implementation / algorithm

五迷三道 提交于 2019-12-21 19:39:11
问题 I am looking for or trying to implement an algorithm to draw box shadows (as in the CSS 3 specifiction) which accepts the following parameters: Horizontal Offset Vertical Offset Inset Spread Blur Color (Optional: Opacity). Where to start. I have looked for Firefox / Chrome source code to see if I can pull an implementation from there, no such luck! I have looked into linear gradient algorithms, drawing them with a box, which kind of works, except with rounded rectangles it leaves empty pixels

Bilinear interpolation - DirectX vs. GDI+

别等时光非礼了梦想. 提交于 2019-12-21 11:34:31
问题 I have a C# app for which I've written GDI+ code that uses Bitmap/TextureBrush rendering to present 2D images, which can have various image processing functions applied. This code is a new path in an application that mimics existing DX9 code, and they share a common library to perform all vector and matrix (e.g. ViewToWorld/WorldToView) operations. My test bed consists of DX9 output images that I compare against the output of the new GDI+ code. A simple test case that renders to a viewport

How to Set this Kind of Perspective Transform in Matrix3D?

孤街浪徒 提交于 2019-12-21 09:29:00
问题 I have an image with and have a few values to make it a perspective in Silverlight, but can't quite figure out what I need to do mathmatically to make it happen. The most important thing is I have an angle called a "Field of View" ( FOV ). This is the normal picture: For example: X = 30° X = 30° X = 30° FOV = 30° FOV = 60° FOV = 120° X = 60° X = 60° X = 60° FOV = 30° FOV = 60° FOV = 120° Any help would be appreciated to walk me through the math to reproduce these in Silverlight. 回答1: I think

LinearGradientBrush Artifact Workaround?

元气小坏坏 提交于 2019-12-21 09:23:27
问题 The LinearGradientBrush in .net (or even in GDI+ as a whole?) seems to have a severe bug: Sometimes, it introduces artifacts. (See here or here - essentially, the first line of a linear gradient is drawn in the endcolor, i.e. a gradient from White to Black will start with a Black line and then with the proper White to Black gradient) I wonder if anyone found a working workaround for this? This is a really annoying bug :-( Here is a picture of the Artifacts, note that there are 2

Should I create new Pens/Brushes per Paint request or keep them throughout the application lifecycle?

久未见 提交于 2019-12-21 07:23:07
问题 I have an application that does a lot of drawing, let's pretend it's a Viso-like application. It has objects that have multiple sub-objects that are drawn, things can be connected, resized etc. Currently when I call paint on a particular sub-object or object, I do the following: using(var pen = new Pen(this.ForeColor)) { // Paint for this object. } I've read conflicting answers that this should be done for an application that is constantly drawing the same thing (maybe just resized, moved etc

Drawing a partially transparent GDI+ Bitmap to a borderless window using UpdateLayeredWindow

Deadly 提交于 2019-12-21 06:42:30
问题 I'm trying to create a non-rectangular window with semi-transparent pixels. The image does not come from a PNG but is drawn on-the-fly using GDI+ calls. I create the window as follows: WNDCLASSEX wc = WNDCLASSEX(); wc.cbSize = sizeof(wc); HINSTANCE instance = GetModuleHandle(nullptr); std::wstring classname(L"gditest ui window class"); if (!GetClassInfoEx(instance, classname.c_str(), &wc)) { //wc.cbSize; //wc.style = CS_DROPSHADOW; wc.lpfnWndProc = process_messages; //wc.cbClsExtra; //wc

ASP.NET creating thumbnails server side

微笑、不失礼 提交于 2019-12-21 05:18:10
问题 It look desceptively easy to use System.Drawing to create thumbnails in your ASP.NET application. But MSDN tells you: Classes within the System.Drawing namespace are not supported for use within a Windows or ASP.NET service. Attempting to use these classes from within one of these application types may produce unexpected problems, such as diminished service performance and run-time exceptions. I'm seeing intermittented 'out of memory' errors within this type of GDI+ code. I'm beginning to

Getting an Image object from a byte array

淺唱寂寞╮ 提交于 2019-12-20 17:41:42
问题 I've got a byte array for an image (stored in the database). I want to create an Image object, create several Images of different sizes and store them back in the database (save it back to a byte array). I'm not worried about the database part, or the resizing. But is there an easy way to load an Image object without saving the file to the file system, and then put it back in a byte array when I'm done resizing it? I'd like to do it all in memory if I can. Something like: Image myImage = new

About GDI/GDI+ coordinate compatibility?

大兔子大兔子 提交于 2019-12-20 10:28:52
问题 I have a problem while drawing with both GDI and GDI+ interchangeably. The page transformation—in particular scaling—seems to be a little bit off between the two. Which properties of the GDI context affects the scaling of the output other than SetViewportExt and SetWindowExt ? The code uses almost exclusively GDI for its drawing, but uses GDI+ in a few cases where its features (semitransparency) are needed. It uses SetViewportExt , SetWindowExt and SetViewportOrg to enable zooming and