rotateimage

The function is used to rotate the contents of the drawing in image.

void rotateimage(
	IMAGE *dstimg,
	IMAGE *srcimg,
	double radian,
	COLORREF bkcolor = BLACK,
	bool autosize = false,
	bool highquality = true
);

Parameters

dstimg

Specify the target IMAGE object pointer to hold the rotated image.

srcimg

Specifies the pointer to the original IMAGE object.

radian

Specifies the radian of the rotation.

bkcolor

Specifies the color of the blank space that is created after rotation. The default is black.

autosize

Specify whether the target IMAGE object automatically resizes to fully accommodate the rotated image. The default is false.

highquality

Specify whether to use high-quality rotation. Use low-quality rotation when pursuing performance. The default is true.

Return Value

None

Examples

The following example loads the picture "C:\\test.jpg" and rotates 30 degrees (PI / 6) before displaying it in the upper left corner:

#include <graphics.h>
#include <conio.h>

#define PI 3.14159265359

int main()
{
	// Drawing window initialization
	initgraph(640, 480);

	// Defining an image
	IMAGE img1, img2;
	
	// Load images from files
	loadimage(&img1, _T("C:\\test.jpg"));

	// Rotating image 30 degrees (PI / 6)
	rotateimage(&img2, &img1, PI / 6);
	
	// Show rotated images
	putimage(0, 0, &img2);

	// Press any key to exit
	_getch();
	closegraph();
}