Home > Back-end >  BCB make a instrument background to dynamic image rotation and a high frequency
BCB make a instrument background to dynamic image rotation and a high frequency

Time:09-17




Is the background have to dial the mobile

Found a code on the net, there are two problems one is image rotation slowly turn a few times after card died after 2 it is to turn the image distortion and has white spot of
Void picturexz (Graphics: : TBitmap * Source, Graphics: : TBitmap * NewPic, int Angle)//
{
If (angle> 180) {
Angle=360 - Angle;
}
If (Angle & lt; - 180) {
Angle=360 + Angle;
}
Float radians=(2 * 3.1416 * Angle)/360;
Float cosine=(float) cos (radians).
Float going=(float) sin (radians).
Float Point1x=(Source - & gt; Height * going);
Float Point1y=(Source - & gt; Height * cosine);
Float Point2x=(Source - & gt; Width * cosine - Source - & gt; Height * going);
Float Point2y=(Source - & gt; Height * cosine + Source - & gt; Width * going);
Float Point3x=(Source - & gt; Width * cosine);
Float Point3y=(Source - & gt; Width * going);
Float minx=0, miny=0, maxx=0, maxy=0;
Minx=Point2x & lt; Point3x? Point2x: Point3x;
Minx=minxMinx=minx<0? Minx: 0;
Miny=Point2y & lt; Point3y? Point2y: Point3y;
Miny=minyMiny=miny<0? Miny: 0;
Maxx=Point2x & gt; Point3x? Point2x: Point3x;
Maxx=maxx> Point1x? Maxx: Point1x;
Maxx=maxx> 0? Maxx: 0;
Maxy=Point2y & gt; Point3y? Point2y: Point3y;
Maxy=maxy> Point1y? Maxy: Point1y;
Maxy=maxy> 0? Maxy: 0;

Int DestBitmapWidth DestBitmapHeight;
If (angle> 90 & amp; & Angle & lt; 180)
DestBitmapWidth=(int) ceil (- minx);
The else
DestBitmapWidth=(int) ceil (maxx - minx);

If (angle> - 180 & amp; & Angle & lt; - 90)
DestBitmapHeight=(int) ceil (- miny);
The else
DestBitmapHeight=(int) ceil (maxy - miny);

NewPic - & gt; Height=DestBitmapHeight;
NewPic - & gt; Width=DestBitmapWidth;
For (int x=0; X & lt; DestBitmapWidth; X++)
{
For (int y=0; Y & lt; DestBitmapHeight; Y++)
{
Int SrcBitmapx=(int) (cosine + (x + minx) * (y + miny) * going);
Int SrcBitmapy=(int) (cosine (y + miny) * - * going) (x + minx);
If (SrcBitmapx>=0 & amp; & SrcBitmapx & lt; The Source - & gt; Width& & SrcBitmapy>=0 & amp; &
SrcBitmapy & lt; The Source - & gt; Height)
{
NewPic - & gt; Canvas - & gt; Pixels [x] [y]=Source - & gt; Canvas - & gt; Pixels [SrcBitmapx] [SrcBitmapy];
}
}
}
}



Void __fastcall TForm1: : Button3Click (TObject * Sender)
{
Graphics: : TBitmap * pBmp=new Graphics: : TBitmap ();
Picturexz (this - & gt; Image1 - & gt; Picture - & gt; Bitmap, pBmp, 10);
This - & gt; Image1 - & gt; Picture - & gt; Bitmap=pBmp;
The delete pBmp;
}

CodePudding user response:

Turn the image distortion after
-
With each rotation is recalculated with original picture, rather than immediately after the last turn,

CodePudding user response:

Turn a few times after death is what reason is not jammed the along while have no reaction after receiving dozens of seconds or good

CodePudding user response:

refer to the second floor zhiaisiying response:
turn a few times after death is what reason is not jammed the along while have no reaction had dozens of seconds, nice


1. The card is dead there is a resource leaks,
2. Generally, the dashboard is made with kingview,

CodePudding user response:

The simplest method is to prepare a figure of each Angle according to need a sticker, to real-time rotation can consider to use FMX, FMX framework support rotating arbitrary components, 3 d coordinate transform (2 d components can also be attached to the 3 d layer implementation), if it is left the effect also can real-time rendering,

CodePudding user response:

To high efficiency, directly using the Windows 7 the Direct2D, convenient, in the VCL can use directly, instead of FMX

CodePudding user response:

Use GDI + can also rotate

CodePudding user response:

Rotation can not only meet the functional requirements, and pitch Angle,
Or paint it honestly:
Void the draw (origin of coordinates, horizontal rotation Angle, pitching Angle)
{...
}
  • Related