-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
executable file
·99 lines (84 loc) · 2.21 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <png.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <linux/fb.h>
#include <display_manager.h>
#include <formats_manager.h>
#include <operate_manager.h>
/* PicPrc <format><file><size 0-10 of zoom><angle 0-360 of rotate> */
int main(int argc, char **argv)
{
int iError;
float fZoomSize;
float fRotateAngle;
PT_Picture2RGB ptPicPar;
PT_DispOpr ptDispOpr;
T_PictureData tPictureData;
if (argc != 5){
printf("Usage:\n");
printf("%s <format><file><size 0-10 of zoom><angle 0-360 of rotate>\n", argv[0]);
printf("Example:%s png2rgb test.png 2.2 222.2",argv[0]);
return 0;
}
fZoomSize = atof(argv[3]);
fRotateAngle = atof( argv[4]);
if((fZoomSize<0||fZoomSize>10)||(fRotateAngle<0||fRotateAngle>360)){
printf("Usage:\n");
printf("%s <format><file><size 0-10 of zoom><angle 0-360 of rotate>\n", argv[0]);
printf("Example:%s png2rgb test.png 2.2 222.2",argv[0]);
return 0;
}
/* 注册显示设备 */
iError = DisplayInit();
if(iError != 0){
printf("DisplayInit fault\n");
return -1;
}
/* 注册图像解析模块 */
iError = PicParseInit();
if(iError != 0){
printf("PicParseInit fault\n");
return -1;
}
/* 可能可支持多个显示设备: 选择和初始化指定的显示设备 */
SelectAndInitDefaultDispDev("fb");
ptDispOpr = GetDefaultDispDev();
if(ptDispOpr==NULL){
printf("ptDispOpr is null\n");
return -1;
}
ptPicPar = GetFmtOpr(argv[1]);
if(ptPicPar==NULL){
printf("convert format is not supported\n");
return -1;
}
ptDispOpr->CleanScreen(0);
iError = ptPicPar->PictureParsing(argv[2],&tPictureData);
if(iError != 0){
printf("Picture Parsing is fault\n");
return -1;
}
iError = PicZoom(&tPictureData,fZoomSize);
if(iError != 0){
printf("PicZoom fault\n");
return -1;
}
iError = PicRotate(&tPictureData, fRotateAngle);
if(iError != 0){
printf("PicRotate fault\n");
return -1;
}
ptDispOpr->ShowPicture(&tPictureData);
ptPicPar->PictureRelease(&tPictureData);
if(ptDispOpr->DeviceExit()!=0){
printf("display device exit fault\n");
return -1;
}
return 0;
}