Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: GDIplus refreshing image



Permlink Replies: 1 - Last Post: Sep 15, 2016 9:32 PM Last Post By: Arkady Semylio
Mario Sassone

Posts: 12
Registered: 10/28/06
GDIplus refreshing image
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 14, 2016 6:30 AM
I started to use Gdiplus inside my application, to make some animated visual effect, including rotation of drawing.
I want to redraw an area of the window as it was a sequence of frames.
But I cant obtain what i wan because the graphic output is refreshed only one time at the end of the function.
How can I refresh the image inside the function? I tried to use Invalidate(), Update(), refresh() and so on, but I can only get a single refresh at the end of the function.

void __fastcall TForm1::Button2Click(TObject *Sender)
{
	// ---- Initializing ----
	Gdiplus::GdiplusStartupInput gdiplusStartupInput;
	ULONG_PTR gdiplusToken;
	GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
 
	// ---- Reading image from file ----
	Gdiplus::Graphics graphics(Image1->Canvas->Handle);
	const WCHAR *filename = L"c:\\Bitmap.jpg";
	Gdiplus::Image image(filename);
 
	// ---- Drawing first time ----
	graphics.DrawImage(&image,0, 0, image.GetWidth(), image.GetWidth());
 
	// ---- Delay ----
	for (int i = 0; i < 400000000; i++) {}
 
	// ---- Drawing first time in new position----
	graphics.DrawImage(&image,100, 0, image.GetWidth(), image.GetWidth());
}
Arkady Semylio

Posts: 87
Registered: 9/18/15
Re: GDIplus refreshing image
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 15, 2016 9:32 PM   in response to: Mario Sassone in response to: Mario Sassone
How can I refresh the image inside the function? I tried to use Invalidate(), Update(), refresh() and so on, but I can only get a single refresh at the end of the function.

Have you tried with the Flush method?

https://msdn.microsoft.com/en-us/library/windows/desktop/ms535692(v=vs.85).aspx

Bye bye
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02