gdi+

Can color cycling be achieved in GDI+?

Is "color cycling" possible in GDI+ with WinForms? I'd like the modify one or more colors in the palette of an on screen surface so that whenever the surface is repainted, GDI+ will use the modified colors. Rather than perform the transformation manually pixel-by-pixel, I hope to use GDI+'s capability to render surfaces using indexed...

How to modify properties of Bitmaps in C++

Bitmap bmp(100,100, PixelFormat32bppARGB); bmp.SetPixel(2,2,Gdiplus::Color::AliceBlue); int x = bmp.GetHeight(); int y = bmp.GetWidth(); Gdiplus::Color* ccc = new Gdiplus::Color; Gdiplus::Color* ccc2 = new Gdiplus::Color; bmp.GetPixel(2,2,ccc); bmp.GetPixel(0,0,ccc2); In the past sample code, the bitmap ...

Graphics DrawString with controlled Word Wrap

Basically my issue is that I need to word wrap a string when I want to. Not when .NET wants to. I understand that the DrawString method will automatically word wrap if I give it a rectangle to draw within. I need to control when it does word wrap it. So lets say my string I want to draw is Testing 1234. And I want to draw text on a new l...

Draw a shape in GDI+ that overlays opaque pixels with transparency

I have a mask bitmap (bmpMask) that I am drawing onto a destination bitmap (bmpDest). Both bitmaps have alpha channels but are already full of opaque content. What I want to do is produce transparent areas using GDI+ 'Draw...' methods on bmpMask so that bmpDest shows through when I draw bmpMask over it. Of course gMask.DrawLine(Pens.T...

C# GDI: Union/Outline of Overlapping Ellipses

Banging my head on the wall with this one... Google searches so far null... I have a ton of over lapping circles in a mapping program...they represent radar ranges for installations such as fixed operating bases, strategic facilities, anti-aircraft assets... Most if not all overlap one or many of their bretheren...some may stand alone...

When do you dispose GDI+ resources?

Many GDI+ classes implement IDisposable, but I'm not sure when I should call Dispose. It's clear for instances I create with new or static methods like Graphics.CreateGraphics. But what about objects that are returned by property getters? I often write code like this: var oldRgn = g.Clip; using (var rectRegion = new Region(rectangle)) {...

Have you had problems developing on a Virtual PC?

I use a virtual PC (with remote desktop connection) for my project. The project uses some GDI+ functionality. Now, apparently there is a problem when displaying graphics object on the real and virtual PC. A simple example: public class Form1 : Form { private void Form1_Paint(System.Object sender, S...

Implementing Color Filtering in C#

Hi All, I am trying to implement a Photoshop style color filtering feature in my application. I have a Bitmap, and 4 check-boxes (R,G,B,A). I wanted to know what is the fastest way of doing it Currently I am doing it as follows Byte[] rgbValues = new Byte[data.Stride * data.Height]; for (int row = 0; row < data.Height;...

Help Repainting a Line

I am doing a custom control (inherited from VisualBasic.PowerPacks.LineShape), that should be painted like as standard one, but also having a Icon displayed near it. So, I just overrided OnPaint like this: protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { e.Graphics.DrawIcon(myIcon, StartPoint.X, StartPoint.Y...

List available GDI+ fonts in Delphi 2009 win32

In Delphi 2009 using win32, how would I obtain a list of GDI+ fonts available on the system? Supplementary question: is there a font dialog available that can show just this this of fonts to the user? Bonus points if the same method can be used in Lazerous. ...

my program keeps hold of files it's written using GDI+

private void save(Rectangle src, Rectangle dest, string fName, int width, int height, Bitmap file) { Bitmap result = new Bitmap(width, height); Graphics g = Graphics.FromImage(result); g.DrawImage(file, dest, src, GraphicsUnit.Pixel); result.Save(fName); g.Dispose()...

Equivalent of ClientRectange in ASP.NET page.control

I am using a 3rd party library for some GDI+ drawing capabilities where the method to actually implement the drawing takes a Graphics object and a Rectangle object as parameters. In the Paint event of my WinForms application I can then execute: externalLibrary.Draw(e.Graphics, ClientRectangle); When implementing the same thing in ASP...

Ellipse Drawing WPF Animation

I am developing a control that is a rectangle area and will draw an ellipse in the rectangle area when a trigger occurs. This control will be able to host other controls like, textbox's, buttons, etc. so the circle will be drawn around them when triggered. I want the circle being drawn as an animation like you were circling the inner c...

ASP.NET error on Bitmap.Save "Exception (0x80004005): A generic error occurred in GDI+."

Hi, I have a function which first reads an image from disk, resizes it and then saves to another directory. when i use the Bitmap.Save(directory + theimagename) it returns the error as i stated in the question title. i checked the directory is right, and the given image name doesn't exist in that dir. what is weird, is that the same c...

GDI+ & Delphi, PNG resource, DrawImage, ColorConversion -> Out of Memory

I have started to toy around with GDI+ in Delphi 2009. Among the things that I wanted to do was to load a PNG resource and apply a Color Conversion to it when drawing it to the Graphics object. I am using the code provided in http://www.bilsen.com/gdiplus/. To do that I just added a new constructor to TGPBitmap that uses the same code fo...

GDI+ Load a jpg and save as 24bit png problem

Problem Hello all! I have this code which takes my jpg image loops through altering pixels and finally saving it as a png type. The problem is that the resulting image has a bit depth of 32 bits. I need it to be 24 bit, can any one shiny some light on the correct method of setting it? Am I along the right tracks looking at setting the ...

How to have a transparent number on top of a winform?

So I have a winform that has some winforms controls on it. But in the center of it, I want to show a transparent number on top of everything. Say 60 pixels size. I tried a label and even tried to create a custom control but the transparency didn't work. Any ideas how to do this? This number will change programmatically at runtime seve...

Resize an 8bpp bitmap in GDI+

I've just noticed that GDI+ doesn't like the Graphics.FromImage() method to be called with an image that is 1bpp, 4bpp, or 8bpp. Is there any way of resizing an 8bpp image without changing from 8bpp to 24bpp, resizing, and then changing it back to 8bpp? ...

Should I dispose GDI+ object before its creation?

Should I dispose GDI+ object before its creation? Is recommended to always Dispose GDI+ object after using it. by e.g. Pen p = new Pen(Color.Green); // use 'p' p.Dispose(); now, if I have this situation: Pen p = new Pen(Color.Green); // use green 'p' p = new Pen(Color.Red); // Should I Dispose my 'p' first? // use red 'p' p.Disp...

Strange behaviour when appying a ColorMatrix to an image in .Net, WinForms.

The method below, takes a colour matrix and applies it to the supplied image. There are a couple of things to note: (1) It is not a function (2) The same image is used to create the graphics object, and as the source of the DrawImage method. Public Sub ApplyMatrixToImage(ByVal matrix As ColorMatrix, ByVal image As Image) Using atts...