gdi+

Smallcaps / multiple fonts and bolding using 'DrawString' in GDI+

I want to write out some text using smallcaps in combination with different fonts for different words. To clarify I might want the message 'Welcome to our New Website' which is generated into a PNG file for the header of a page. The text will be smallcaps - everything is capitalized but the 'W', 'N' and 'W' are slightly larger. The 'N...

How to draw rounded rectangle with variable width border inside of specific bounds.

I have a method that draws a rounded rectangle with a border. The border can be any width, so the problem I'm having is the border is extending past the given bounds when it's thick because it's drawn from the center of a path. How would I include the width of the border so that it fits perfectly in the given bounds? Here's the code I'...

Need help to display Japanese Text using GDI+ without installing East Asian Language pack in Windows XP

I am writing a Japanese language quiz program and I don't want to require people to install the East Asian language pack for Windows XP. I am using GDI+ for drawing text. I tried downloading a free Unicode font and using that to draw text. I tested it on my computer (with East asian pack installed) and it displayed the Japanese charac...

Resizing an image with alpha channel

I am writing some code to generate images - essentially I have a source image that is large and includes transparent regions. I use GDI+ to open that image and add additional objects. What I want to do next is to save this new image much smaller, so I used the Bitmap constructor that takes a source Image object and a height and width, ...

Shouldn't Gdiplus::Image::GetWidth() and a bunch of other getters be "const"?

Why aren't they const? I believe that's flawed API design. Or am I missing something? UINT GetWidth(); UINT GetHeight(); ... vs. UINT GetWidth() const; UINT GetHeight() const; ... ...

How do I change the colours of a shape drawn by a VisualStyleRenderer?

I have an application that dynamically draws a chart onto a winform. Both the chart background and the individual chart bars are drawn using a VisualStyleRenderer object: For Each rect As Rectangle In barRectangles Dim renderer As New VisualStyleRenderer (VisualStyleElement.StartPanel.UserPane.Normal) renderer.DrawBackground(e....

gdiplus construct Image from string

I am extracting images from a MySQL database using the MySQL++ API. I get the images as mysqlpp::sql_mediumblob which is representation of string. Now I want to rotate some pictures using GDI+, but I am not sure how to use this constructor: Image::Image(IStream*,BOOL) - Creates an Image object based on a stream. with the image that is...

Converting from a Format8bppIndexed to a Format24bppRgb in C#/GDI+

Alright, I have an image coming through from an external application in an 8-bit indexed format. I need this image converted to a 24-bit format of the exact same size. I've tried creating a new Bitmap of the same size and of type Format24bppRgb and then using a Graphics object to draw the 8-bit image over it before saving it as a Bmp...

How to save an EXIF format image file in .NET 3.5

I want to save an image in EXIF format using System.Drawing.Image.Save or a similar method in a C# application using .NET framework v3.5. The MSDN documentation lists EXIF as an option for ImageFormat. However, it does not seem to be supported - at least not without some configuration unknown to me. When I enumerate the built-in encode...

GDI+ resizing for Pixel zoom

I want to resize an image with the GDI library so that when I resize it to be larger than before there is no blending. (Like when you zoom in on an image in a paint program) EG: If my image is 2px wide, and 2px tall (white, white, white, black) , and I resize it to be 100% larger, it is 4px by 4px tall (white, white, white, white, white...

Drawing over all windows on multiple monitors.

I am using the following code to draw on a single monitor: Point cursorLocation; NativeMethods.GetCursorPos(out cursorLocation); Screen screen = Screen.FromPoint(cursorLocation); Point h1 = new Point(screen.Bounds.Left, cursorLocation.Y); Point h2 = new Point(screen.Bounds.Right, cursorLocation.Y); Point v1 = new Point(cursorLocation.X...

Changing TextRenderingHint in a C# COM control causes all forms to stop using hinting

My application C# IDeskBand COM component. I'm drawing a custom control to a transparent Bitmap and then the IDeskBand control draws that Bitmap. ClearType doesn't render properly on a transparent background (logically), so I use g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit; The problem is that after ...

Does windows xp contain GdiPlus.dll?

I have a question about deploying application, my application need gdiplus.dll for load images. Does windows xp contain GdiPlus.dll as default? Many Thanks! ...

Create image with transparent background using GDI+ ?

I'm trying to create an image with a transparent background to display on a web page. I've tried several techniques but the background is always black. How can I create a transparent image and then draw some lines on it ? ...

Any way to get a BITMAPV5HEADER out of a Bitmap object in C#

Is there any way to get a BITMAPV5HEADER out of a Bitmap object in C#? Or just get the values that are in their? I need to get some ColorSpace information out of a bitmap and can't see a way to do this in C#. ...

How do I draw an annulus (doughnut) using GDI+?

I have been trying to draw an annulus (ring with thickness) with a transparent hole and a gradient rim in C# with very little success. Does anyone have any suggestions on how to do this? here's a nice Blend Utility Here's the Final result - thanks to BlueMonkMN Rectangle GetSquareRec(double radius, int x, int y) { double ...

GDI+ Offscreen Buffered Scrolling

Hello, I am creating a custom control using C# GDI+. Quick explanation...the control will be say 500 pixels on screen but will contain perhaps 500000 pixels of information. So although i'm only showing 500px at a time i need to obviously scroll in the horizontal plane (left & right). The tricky part is that each 500px chunk of bitmap t...

Convert a 24 bit in memory image to indexed color

I have an image that I have created in memory as Format24bppRgb. I save this as a PNG and it is 24kb. If I save the same image with photoshop as a 24bit PNG it comes to about the same size, but if i save it as an 8bit PNG with only 32 colors it goes down to 5kb. How can I create an indexed version of a PNG file using C# / GDI+ / Syste...

How do I adjust the brightness of a color?

I would like to darken an existing color for use in a gradient brush. Could somebody tell me how to do this please? C#, .net 2.0, GDI+ Color AdjustBrightness(Color c1, float factor) { float r = ((c1.R * factor) > 255) ? 255 : (c1.R * factor); float g = ((c1.G * factor) > 255) ? 255 : (c1.G * factor); floa...

Possible to make a managed (non-GDI) Bitmap ?

Is it possible to make a fully managed code Bitmap object? My understanding is the Bitmap object is a wrapper around a GDI object - which is unmanaged code. I am interesting in doing this to (hopefully) increase performance when dealing with thousands of images. ...