Test program source code and resources here: https://download.csdn.net/download/DelphiGuy/15450045
Program is simple enough, in c + + Builder is a matter of a few minutes, the SDK programming should also can be completed within an hour or two, is the cycle of decoding, drawn 10 JPEG images onto the window,
Important:
1. The JPEG decoding to cycle, each time before you draw decoded into a bitmap drawing to the window again, not a one-time decoded into a bitmap, and then draw the bitmap, only as a much higher frame rate will
2. The window is maximized, image stretching to fill the entire client area
CodePudding user response:
In my current environment (i7-6700 k, 16 gb DDR4-3200, show that nuclear win10/64108 0 p32 color), c + + Builder 10.2.1, compiled for win64 program, release, the other by default, the frame rate of about 90 FPS
Windows SDK programming to write the same program, if written optimization, it should be more than this number, but may not, see you ~
CodePudding user response:
Key code is as follows:
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
# include & lt; The VCL. H>
# include & lt; The Vcl. Imaging. Jpeg. Hpp>
# pragma hdrstop
# include "Unit49_1. H"
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
# pragma package (smart_init)
# pragma resource "*. DFM
"TForm1 * Form1;
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
__fastcall TForm1: : TForm1 (TComponent * Owner)
: TForm (the Owner)
{
}
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Const String PicNames []={
"Beautifull - the Summer - Desktop - which Wallpaper. JPG",
"Cool Summer - Desktop - which Wallpaper - HD. JPG",
"Cool Summer - Backgrounds. JPG",
"Summer - the Background - HD. JPG",
"Cool - the Summer - which Wallpaper - HD - 1. JPG",
"Summer - the Beach - which - for - desktop. JPG",
"Nice - the Summer - Desktop - for - Windows. JPG",
"Summer - Time - Background. JPG",
"Summer - Blue - Sea - which Wallpaper - HD. JPG",
"Star - the Fish - Summer - Desktop - which Wallpaper - HD. JPG"};
TJPEGImage * Pics [10];
Bool Stop=true;
Void __fastcall TForm1: : Button1Click (TObject * Sender)
{
LARGE_INTEGER Freq, Ticks1 Ticks2;
if (! (=Stop! Stop))
{
QueryPerformanceFrequency (& amp; Freq);
Image1 - & gt; Picture - & gt; Bitmap - & gt; The Assign (Pics [0]);
while (! Stop)
{
The QueryPerformanceCounter (& amp; Ticks1);
For (int I=0; I & lt; 10; I++)
{
Image1 - & gt; Picture - & gt; Bitmap - & gt; The Assign (Pics [I]);
Application - & gt; ProcessMessages ();
}
The QueryPerformanceCounter (& amp; Ticks2);
Label1 - & gt; Caption=Format (" % 0.3 f FPS, "ARRAYOFCONST ((
Freq. QuadPart * 10.0/(Ticks2 QuadPart - Ticks1. QuadPart))));
}
}
}
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Void __fastcall TForm1: : FormCreate (TObject * Sender)
{
For (int I=0; I & lt; 10; I++)
{
Pics [I]=new TJPEGImage;
Pics [I] - & gt; LoadFromFile (PicNames [I]);
}
}
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Void __fastcall TForm1: : FormDestroy (TObject * Sender)
{
For (int I=0; I & lt; 10; I++) delete Pics [I];
}
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
CodePudding user response:
PS: I set resource points is zero, don't need a C CCodePudding user response:
The code is very simple! High version of the Unicode string I generally add a prefix L feel a little bit good, although the win platform do not add, too,CodePudding user response: