gdi+

Why is my c# paint method running out of memory?

依然范特西╮ 提交于 2019-12-07 11:43:42
问题 I'm new to c#, and trying to learn by writing some simple apps to get familiar with the syntax and .NET library. The most recent miniproject I took on is a polar clock like the one found here. One of the problems I noticed early on was that the app would constantly "flicker", which really took away from the presentation, so I read online about how to implement a double buffer, which eliminated this problem, but may or may not have something to do with the problem. Here is my onPaint method;

Fast way to draw lines using different Color using GDI+?

非 Y 不嫁゛ 提交于 2019-12-07 11:25:39
问题 I have an dynamic List of Point, new Point can be added at any time. I want to draw lines to connect them using different color. Color is based on the index of those points. Here is the code: private List<Point> _points; private static Pen pen1 = new Pen(Color.Red, 10); private static Pen pen2 = new Pen(Color.Yellow, 10); private static Pen pen3 = new Pen(Color.Blue, 10); private static Pen pen4 = new Pen(Color.Green, 10); private void Init() { // use fixed 80 for simpicity _points = new List

Check If Image Is Colored Or Not

南笙酒味 提交于 2019-12-07 10:25:11
问题 I'm trying to figure out whether an image is colored or not. On this StackOverflow question, there's a reply that says that I should check the PixelFormat enum of the Image . Unfortunately, the reply isn't very clear to me. Is it safe to check whether the image.PixelFormat is different from PixelFormat.Format16bppGrayScale to consider that it is a colored image? What about the other values of the enumeration? The MSDN documentation isn't very clear... 回答1: You can improve this by avoiding

Saving a modified image to the original file using GDI+

余生长醉 提交于 2019-12-07 10:20:25
问题 I was loading a Bitmap Image from a File. When I tried to save the Image to another file I got the following error "A generic error occurred in GDI+". I believe this is because the file is locked by the image object. Ok so tried calling the Image.Clone function. This still locks the file. hmm. Next I try loading a Bitmap Image from a FileStream and load the image into memory so GDI+ doesn't lock the file. This works great except I need to generate thumbnails using Image.GetThumbnailImage

Rotate Hue in C#

[亡魂溺海] 提交于 2019-12-07 10:01:39
问题 I'm looking to replicate the CSS3 hue rotation behaviour found here original image image with hue rotated 180deg I can already accurately convert an RGB value to a HSL value and back again but I'm not sure what the mathematical function to apply to the hue component to replicate the output is. 回答1: Addition. It's that simple, just add 180 to the hue value, then make sure that it wraps around at 360: hue = (hue + 180) % 360; 回答2: I wanted to point out how to actually do this. This was the

IIS & service-based generation of web images - GDI, GDI+ or Direct2D?

旧时模样 提交于 2019-12-07 09:51:36
It is May 2017. My boss has asked me to produce some code to make some custom web images on our website based on text that the user enters into their browser. The Server environment is Windows 2012 running IIS, and I am familiar with C#. From what I read I should be able to use GDI+ to create images, draw smooth text into them etc. However, one of my colleagues suggested GDI+ may not work on Windows Server, and that GDI+ is based on older GDI which is 32-bit and will therefore be scrapped one day soon, and that I should use DirectX instead. I feel that to introduce another layer would make

Desktop screen overlay - new form flicker issue

和自甴很熟 提交于 2019-12-07 07:03:02
问题 As part of my open source DeskPins clone (two separate links, one for original, one for clone on GitHub), I need to allow user to interact with desktop. I figured the easiest way would be opening a new form and paint desktop contents on top of it. Then I should be able to easily set mouse cursor and give visual cues to user about windows that is currently in focus. A more complicated alternative would be using p/invoke to SetSystemCursor and injecting custom code in other window's WM_PAINT

Static controls slightly flicker when main window is resized

久未见 提交于 2019-12-07 06:07:24
问题 INTRODUCTION AND RELEVANT INFORMATION: I have a complex painting to implement in my main window’s WM_PAINT handler. I have submitted a picture bellow to illustrate it: Main window has static controls, instead of buttons, which have style SS_NOTIFY . When user clicks on them, certain actions occur in program. The following picture shows where static controls in the main window are: Map on the orange panel is an EMF file ,top left and right logos are PNG files, and other pictures are bitmaps.

Draw a marker like google maps with TCanvas on Delphi

[亡魂溺海] 提交于 2019-12-07 03:06:09
问题 On my application I need draw on TCanvas a "marker", like Google Maps marker (see the image). I'd like use as parameters the radius, the height and the origin: I don't have idea about algorithm to use. I can use an arc to draw the top, but how can I draw the bottom? Note: I need draw it both with GDI and GDI+ so any solution is welcome. 回答1: Here is a quick example using a 200x200 PaintBox - it should at least give you an idea for the algorithm. I trust you can draw the black dot in the

What's the relationship between WIC and GDI+?

跟風遠走 提交于 2019-12-07 02:50:44
问题 I'm fuzzy on the relationship between Windows Imaging Component (WIC) and GDI+. I've done some work in the past that showed that, for example, WIC produces visually superior GIF encodings, but I'm surprised I don't see more people using it for image processing vs. GDI+. I know it doesn't have GDI+'s draw operations, but for encoding/decoding it seems superior. So why don't we see a migration? 回答1: The relationship (or rather the difference between) WIC and GDI+ is that WIC is an extensible