Will you? The image is not correct. The angle is random.

Source: Internet
Author: User
Will you? The image is not correct. The angle is random Delphi/Windows SDK/API.
Http://www.delphi2007.net/DelphiMultimedia/html/delphi_2006120616581283.html
For example, yes ~~~ Please provide the information for you later ~~
My score is exhausted.

What controls are used to display graphs? Timage? Tpaintbox? Or any canvas?

RoughAlgorithmThis is a basic algorithm that allows a graph to multiply A Rotation Transformation Matrix.

Xiexie !! Any canvas

Post the source code snippets in digital image processing and advanced applications for your reference:

Procedure tform1.bmp _ rotate (srcbmp, destbmp: tbitmap; angle: Extended );
VaR
C1x, c1y, c2x, c2y: integer;
P1x, p1y, P2x, p2y: integer;
Radius, N: integer;
ALPHA: extended;
C0, C1, C2, C3: tcolor;
Begin
If srcbmp. width> srcbmp. Height then
Begin
Destbmp. Width: = srcbmp. width;
Destbmp. Height: = srcbmp. width;
End
Else
Destbmp. Width: = srcbmp. height;
Destbmp. Height: = srcbmp. height;
// Convert the angle to the PI value
Angle: = (angle/180) * PI;
// Calculate the center point. You can modify it.
C1x: = srcbmp. Width Div 2;
C1y: = srcbmp. Height Div 2;
C2x: = destbmp. Width Div 2;
C2y: = destbmp. Height Div 2;
// Step number
If c2x <c2y then
N: = c2y
Else
N: = c2x;
Dec (n, 1 );
// Start Rotation
For P2x: = 0 to n do
Begin
For p2y: = 0 to n do
Begin
If P2x = 0 then
ALPHA: = PI/2
Else
ALPHA: = arctan2 (p2y, P2x );
RADIUS: = round (SQRT (P2x * P2x) + (p2y * p2y )));
P1x: = round (radius * Cos (angle + alpha ));
P1y: = round (radius * sin (angle + alpha ));

C0: = srcbmp. Canvas. pixels [c1x + p1x, c1y + p1y];
C1: = srcbmp. Canvas. pixels [c1x-p1x, c1y-p1y];
C2: = srcbmp. Canvas. pixels [c1x + p1y, c1y-p1x];
C3: = srcbmp. Canvas. pixels [c1x-p1y, c1y + p1x];

Destbmp. Canvas. pixels [c2x + P2x, c2y + p2y]: = C0;
Destbmp. Canvas. pixels [c2x-P2x, c2y-p2y]: = C1;
Destbmp. Canvas. pixels [c2x + p2y, c2y-P2x]: = c2;
Destbmp. Canvas. pixels [c2x-p2y, c2y + P2x]: = C3;
End;
Application. processmessages
End;
End;

Posted upstairsCodeAlgorithm is acceptable,
However, because destbmp. Canvas. pixels is used for point-by-point access, the speed should be quite slow and the effect is not satisfactory.
It is faster to change to scanline.

3ks

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.