gdi+

Gdiplus::Bitmap to BYTE array?

Hi, well, as so often title says it all. Here's my attempt (ugly GDI+ and GDI mix...) // ... BYTE pixels[BMP_WIDTH * BMP_HEIGHT * BMP_BPP]; HBITMAP hBitmap; Gdiplus::Bitmap cBitmap(BMP_WIDTH, BMP_HEIGHT, PixelFormat32bppRGB); Gdiplus::Graphics cGraphics(&cBitmap); Gdiplus::Pen cPen(Gdiplus::Color(255,...

Creating mosaic picture from words

Looking for a library that creates mosaic picture from words. just like ascii art but from words or sentences. cheers! ...

Access violation in Image destructor

A very simple program I might say.. #include <windows.h> #include <gdiplus.h> using namespace Gdiplus; int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR cmdLine, int nShow){ // Gdiplus variables GdiplusStartupInput mGdiplusStartupInput; ULONG_PTR mGdiplusToken; GdiplusStartup(&mGdiplusToken, &mGdiplusS...

How to draw readable tiny text quickly

In developing a flash-based memory manager, I need to be able to view large quantities of data. With my eyes and monitor resolution, I can read hand-drawn 3x5 letters on a 4x6 matrix without too much difficulty, but none of the system TrueType fonts render optimally at that size. I've tried writing code to draw font shapes to off-scree...

Stop or move the mouse

I have a graphical application in which I move a graphic object with the mouse. In some conditions, the object stops moving. I need then to stop moving the mouse cursor too. Is it possible? MousePosition property seems to be in ReadOnly. Eg. public partial class Form1 : Form { public Form1() { InitializeComponent(); ...

With C# / Winforms / GDI+, how do i do getpixel or getimage of a control?

I want to 'grab' the image of a control on my winforms dialog. I can access the 'graphics' context for the control using: MyControl.CreateGraphics() But how do i copy a rectangle from that graphics context to an image, or a bitmap, or call getpixel on it? Thanks a lot. ...

How to disable click through on transparent control?

We have a mapping form in our application that needs a Google Earth background image, and as you can't use the Google Earth plugin in a browser that is under a panel, we use a second form to show the background image. We have a transparent panel on the mapping form that the drawing is done on while Google Earth is drawn on a form held in...

HowTo: Draw a line with an arrow?

I have the following code, that draws me a line with a (very) smile arrow... private void Form1_Paint(object sender, PaintEventArgs e) { Pen p = new Pen(Color.Black); p.EndCap = System.Drawing.Drawing2D.LineCap.ArrowAnchor; e.Graphics.DrawLine(p, 10, 10, 100, 100); p.Dispose(); } I want to ...

Using a System.Drawing.Image as the centered part of a larger image?

I have a System.Drawing.Image that I would like to use as the centered portion for a new, larger image. I’m given the dimensions of the (always) larger image and the idea is to make that image all white and overlay its center with the first image. Is there a way to do this using GDI+? Some combination of TextureBrush and the Graphic c...

NotImplementedException from .NET's CustomLineCap constructor

Hi. I want to draw a custom line cap - a equilateral triangle with the radius r. Apparently I can't: Dim triangleSide As Single = CSng(3 * r / Math.Sqrt(3)) Dim triangleHeight As Single = CSng(3 * r / 2) path = New GraphicsPath() Dim points() As PointF = New PointF() { _ New PointF(-triangleSide / 2, 0), _ New Po...

Handle in a console app

I have a console app in .net that I'm doing some processing of fonts. I'm using Win32APIs for this and one of them requires a device context for loading a font - actually a IntPtr hdc = GetDC(handle of screen element). Obviously, my app doesn't have these handles as it's a console app. Is there a way to get around this? ...

Which is faster, GDI+ or libpng?

I have an HBITMAP and i would like to convert it to png format(in memory i have malloc'd)as fast as possible, so my question is should i go with GDI+ or libpng? I've tried using GDI+, but it doesn't seem as fast as i would like it to be. I've also tried FreeImage and it was way too slow. P.S. - I'm using C++ Thanks for reading ...

Way to differentiate Click from DoubleClick

I have in a panel a GDI drawing with some objects. When the user clicks on one object, this object should be selected, if doubleClicks on it, a new pop-up (properties) window should open. Now, I overrided OnMouseClick => obj.Selected = Not obj.Selected OnMouseDoubleClick => (New Properties(obj)).ShowDialog() The problem is that when t...

What are the hard bounds for drawing coordinates in GDI+?

I am rendering an interpolation curve thusly: e.Graphics.DrawLines(new Pen(Color.Red), _interpolationPoints.ToArray()); which sometimes throws an OverflowException. Examination of the _interpolationPoints array shows some very large values in scientific notation e.g. {X = 0.0 Y = -1.985174E+10} I suspect that Y = -1.985174E+10 is a...

Alpha channel transparency and resizing image files.

I'm using the following code to resize a tif. The tif has an alpha channel set for transparency. I'm trying to resize this image and honour the transparency but at the moment it's coming out with a black background. Any ideas? public static void ResizeImage(string OriginalImagePath, string NewImagePath, int Width, int Height) { ...

VB.Net WinForms Form OnPaint() Transparency Refresh

Hi All, Long story short, I'm trying to write some toast-style popup notifications (similar to Growl) which should appear next to the system tray and stack as appropriate. I can handle the instantiation/location/etc... but I want to add a capability for non-rectangular toasts. I'd also like to have Alpha transparency so a semi-transpar...

GDI+ drawing artifacts when using translate offset

I've often noticed that gdi+ draws the same object (e.g. defined by some simple DrawLine calls) a bit different when drawing the object to a different location by using the Graphics.TranslateTransform(). It looks like some artifacts e.g. the ending of a 1 Pixel thin line appears "snapped off". And other pixel artifacts like that... I'...

C++ double buffer and memory

Ok so my double buffer works fine but it seems that it use a lot of memory. i know that double buffer should store a copy of the ellipse I'm drawing than paint it on the screen but it after that it deletes the copy and makes new copy but it doesn't seem to delete it here is my code hdc=GetDC(hWnd); HDC memDC=CreateCompatibleDC(hdc); H...

Trigger event on trackbar ValueChanged, but not in code

I want to be able to modify the value property of a trackbar in code without triggering my event handler. I wish to trigger the event only when the control is changed by the user by dragging the slider or moving it with the keyboard. What's the simplest way of achieving this? I have 6 trackbars and I want to change the value of 3 of th...

c++ use new to Image gdi+

im using gdi+ to output my images. i tried to use the keyword new but it didn't work. shot(L"image name") = new Image; that didn't work any other ideas how to make it work ...