gdi+

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

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-08 06:19: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

Overlapping System.Drawing.Graphics objects

半腔热情 提交于 2019-12-08 05:33:48
问题 I have a WinForms control on which I want to display two things: An underlying image painstakingly loaded bit-by-bit from an external input device; and A series of DrawLine calls that create a visual pattern over that image. Thing #1, for our purposes, doesn't change, and I'd rather not have to redraw it. Thing #2 has to be redrawn relatively quickly, as it rotates when the user turns another control. In my fantasy, I want to put each Thing in its own Graphics object, give #2 a transparent

AutoHotkey-GDIp: Capture a screenshot from a hardware accelerated window

北战南征 提交于 2019-12-08 05:01:10
问题 I am currently working on a small script which captures a screenshot from a hardware accelerated window in BlueStacks. Problem is, that it appears the window must be hardware accelerated, so the screen capture is saving a black square. I am using AutoHotkey for my scripting, and have added the GDIp libraries for access to GDI+. I suspect the problem is that GDIp cannot grab the data using PrintWindow due to the software pushing the frame directly to the GPU, but there must be a way to capture

gdipluspath throws ambiguous byte for cstddef and rpcndr.h

*爱你&永不变心* 提交于 2019-12-08 03:25:34
问题 I am currently updating an ancient program which was last compiled with visual studio 2008. I am updating it (.lib project) to visual studio 2017 for the newest windows sdk (10.0.15063.0), however, the gdiplus library throws an ambiguous symbol error. More specifically: 3>c:\program files (x86)\windows kits\10\include\10.0.15063.0\um\GdiplusPath.h(145): error C2872: 'byte': ambiguous symbol 3>c:\program files (x86)\windows kits\10\include\10.0.15063.0\shared\rpcndr.h(191): note: could be

GDI+ Bug: Anti-Aliasing White On Transparency

半世苍凉 提交于 2019-12-08 03:18:44
问题 The following code will create a transparent bitmap and then draw a white ellipse on it with anti-aliasing. using(var background = new Bitmap(500, 500)) using (var graphics = Graphics.FromImage(background)) { graphics.SmoothingMode = SmoothingMode.AntiAlias; graphics.Clear(Color.Transparent); graphics.DrawEllipse(new Pen(Color.White, 50), 250, 250, 150, 150); background.Save("test.png", ImageFormat.Png); } The bug I have found is that the anti-aliased pixels around the edge of the ellipse

Create multipage Tiff with JPEG compression .NET

二次信任 提交于 2019-12-07 18:08:27
问题 Is there any way to create multipage tiff with jpeg compression using .NET? I can create tiff's with LZW compression, but files are extremely big. Looks like EncoderValue enumeration (which I use to set up compression) doesn't even have suitable member. 回答1: You can have a look at >> this post, where I explain how to wrap existing JPEGs in a simple multi-page TIFF container. But there's a variety of other possibilities. FreeImage.Net (freeimage.sourceforge.net) is a very powerful library. You

Fastest way to generate bitmap from polygons in .NET

不想你离开。 提交于 2019-12-07 15:03:50
问题 After reading this blog, I want to try writing a similar program myself. One of the subtasks is to have a source set of polygons, and use these polygons to generate the bitmap that is going to be compared with the target image. In .NET 2005 the obvious method is to use GDI+. Simply create a bitmap, get a Graphics object that interfaces to the bitmap, and call a number of the Graphics objects rendering functions. Apparently, this doesn't utilise hardware accelaration. This is why WPF doesn't

The text is too bold by DrawString on C#

元气小坏坏 提交于 2019-12-07 13:11:37
问题 I have use GDI DrawString method to draw text. When the program is running, the text on the screen seems very good, however once I saved the files to image, the font will be bolder than before. The normal will be bold, the bold will be much bolder. How to deal with this? public override void DrawTo(Graphics g, int x, int y, int flag) { if (flag == 1) { Pen dpen = new Pen(Color.FromArgb(128, 0, 0, 0), 1); dpen.DashStyle = System.Drawing.Drawing2D.DashStyle.DashDot; g.DrawRectangle(dpen, new

C# Console Application - How to draw in BMP/JPG file using GDI+?

无人久伴 提交于 2019-12-07 12:22:36
问题 I want to draw shapes like rectangles, arrows, text, lines in a BMP or JPG file, using a C# Console Application and GDI+. This is what I found on the web: c# save System.Drawing.Graphics to file c# save System.Drawing.Graphics to file GDI+ Tutorial for Beginners http://www.c-sharpcorner.com/UploadFile/mahesh/gdi_plus12092005070041AM/gdi_plus.aspx Professional C# - Graphics with GDI+ codeproject.com/Articles/1355/Professional-C-Graphics-with-GDI But this still doesn't help me. Some of these

An unclear converted image. wmf to png

天涯浪子 提交于 2019-12-07 11:45:36
问题 I'm trying to convert wmf image file into png format with c#.net. But, saved image is unclear. my code: Metafile img = new Metafile(@"test.wmf"); MetafileHeader header = img.GetMetafileHeader(); Bitmap bitmap = new Bitmap((int)(img.Width / header.DpiX * 100), (int)(img.Height / header.DpiY * 100)); using(Graphics g = Graphics.FromImage(bitmap)){ g.DrawImage(img, 0, 0); } bitmap.Save("test.png", ImageFormat.Png); How could I get it clear? 回答1: The .wmf file has extremely large values for DpiX