gdi+

How do I load and save an image from an SQL Server database using GDI+ and C++?

I need specifically to load a JPG image that was saved as a blob. GDI+ makes it very easy to retrieve images from files but not from databases... ...

Is there a way to implement layers in GDI+?

My idea would be to draw several Graphics objects on memory and combine them when drawing the image. But I haven't got a precise idea of how to do that. Shall I use GraphicsContainer's? Or save the objects as Metafile's? (these are temporary objects, I would like to keep them on memory) ...

Reduce flicker with GDI+ and C++

I'm using GDI+ in a C++/MFC application and I just can't seem to avoid flickering whenever the window is resized. I have already tried these steps: returned TRUE on OnEraseBkGnd(); returned NULL on OnCtlColor(); used double buffering according to this code: void vwView::OnDraw(CDC* pDC) { CRect rcClient; GetClientRect(rcCli...

Reading RAW image files as GDI+ bitmaps

Is there a good way to read RAW image files (especially Canon CR2 and Adobe DNG files) as GDI+ bitmaps that is reasonably fast? I found an example running under WPF that would read an image using any installed image codec and then display it in an image control. And I modified this example to create a GDI+ bitmap by writing the WPF imag...

How do I maintain transparency in an image from a Http Handler when using Graphics.DrawImage?

Hi, I've got a series of GIFs that I need to crop on the fly, I'm using a HTTP Handler in C# so I can better encapsulate the code - provide caching for the result etc. Currently, when I draw the existing image to a new Image via the Graphics object all the transparency is lost. I've tried various techniques to try and maintain the tra...

Saving a modified image to the original file using GDI+

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 ...

GraphicsUnit.Point, isn't converting well to PDF... GraphicsUnit.World is, but how can I convert it to Point?

Hello, I have some code in .Net to draw some text content using GDI+. I used GraphicsUnit.Point to size the text. It's working wonderfully on-screen, and even if Print it. I've been asked to make a system that generates a PDF, and I got ComponentOne's PDF control. It has got similar interface to GDI+. The problem is: Font sizes are no...

How to convert BYTE* into a gdi+ image object?

I want to convert a BYTE* into an gdi+ Image object. How can I do this? The BYTE* seems a Dib point. I found Image has a method named Image::FromStream() which may help, But I can not find any reference about how to convert a BYTE* into a IStream object. How can I do this? Thanks in advance! Actually, it is hard to believe MS provide...

gdi+ Graphics::DrawImage really slow~~

I am using a GDI+ Graphic to draw a 4000*3000 image to screen, but it is really slow. It takes about 300ms. I wish it just occupy less than 10ms. Bitmap *bitmap = Bitmap::FromFile("XXXX",...); //-------------------------------------------- // this part takes about 300ms, terrible! int width = bitmap->GetWidth(); int height = bitmap->...

GDI+ 's Amazing decode speed, and terrible draw speed!

Thanks for answers,Actually I am not puzzled about draw 1024*768 pixels is slower than 100* 100 pixels... It is so simple a logic.. Which made me puzzled is that DrawImage's interpolation algorithm may be very slow, while there exists lots of better algorithm, and its decoder seems can decode from a jpg with a certain resolution, it is...

C# Combine GDI+ and OpenGL/DirectX

Background: I am currently using custom controls within my C# project (basic controls just drawing a custom look and feel (using gdi+?)). The majoritiy of these controls have transparent segments for irregular shapes etc. Problem: I am looking to overlay a semi-transparent (irregularly shaped) panel over a group of controls. Currently ...

C# Transition between GDI+ and WPF

Im considering migrating my c# application from using custom GDI+ drawn controls to a WPF application with custom controlls etc. I would like to know whats involved and what to expect. Are there any resources people can recommend that might help? Or indeed any personal experiences that might be benificial? ...

C#/GDI - Create 1bpp mask from image.

How do you create a 1 bit per pixel mask from an image using GDI in C#? The image I am trying to create the mask from is held in a System.Drawing.Graphics object. I have seen examples that use Get/SetPixel in a loop, which are too slow. The method that interests me is one that uses only BitBlits, like this. I just can't get it to work ...

Relative merits of GDI+ and WPF

Whar are the relative merits between GDI+ and WPF? Also does anyone know the minimum system requirements needed in order to develop/run WPF apps? ...

How to extract images from a CImageList and save them as transparent GIF files

I want to extract images from a CImageList and save them as transparent GIF files. I'm using the following GDI+ code and the transparent area comes out black. const HICON hIcon = myImageList.ExtractIcon( nImage ); Bitmap* gdiBMP = Bitmap::FromHICON( hIcon ); CLSID encoderClsid; GetEncoderClsid( T2W( "image/gif" ), &encoder...

OutOfMemoryException When Creating a Large Bitmap in CF.NET

My compact framework application creates a smooth-scrolling list by rendering all the items to a large bitmap surface, then copying that bitmap to an offset position on the screen so that only the appropriate items show. Older versions only rendered the items that should appear on screen at the time, but this approach was too slow for a...

Height of string measured with MeasureString in PrintPreviewDialog differs from that in actual printing.

Hello! I'm trying to measure height of some text for table printing purpose. Here's the code. In my case it prints different numbers in preview and on actual page. I can't try on any printers other than Microsoft Office Document Image Writer right now, but I'm pretty sure it isn't a printer issue. Perhaps somebody have found a workaro...

.NET Library to draw routed lines avoiding obstacles

I've created a workflow/flowchart style designer for something. At the moment it is using relatively simple Bezier curve lines to connect up the various end points of the "blocks" on the workflow. However I would like something a bit more intuitive for the user. I want the lines to avoid obstacles like other blocks (rectangles) and poss...

C# Mobile Game Development

I'm currently trying to implement a marble maze game for a WM 5.0 device and have been struggling with developing a working prototype. The prototype would need the user to control the ball using the directional keys and display realistic acceleration and friction. I was wondering if anyone has experience with this and can give me some ...

How to use GetHBITMAP method?

I have a gdi+ bitmap, and I want to convert bitmap into HBitmap. I write the following code. HBITMAP temp; Color color; img->GetHBITMAP(color, &temp); But It do not work, How can I get a HBitmap? ...