File: layoutrectangle.h

package info (click to toggle)
photoprint 0.3.3-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 4,708 kB
  • ctags: 3,996
  • sloc: cpp: 17,543; sh: 8,311; ansic: 4,299; makefile: 324
file content (52 lines) | stat: -rw-r--r-- 1,216 bytes parent folder | download | duplicates (2)
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
#ifndef LAYOUTRECTANGLE_H
#define LAYOUTRECTANGLE_H

enum PP_ROTATION
{
	PP_ROTATION_AUTO,
	PP_ROTATION_NONE,
	PP_ROTATION_90,
	PP_ROTATION_180,
	PP_ROTATION_270,
};


struct RectFit
{
	int xpos,ypos;
	int xoffset,yoffset;
	int width,height;
	int rotation;
	double scale;
	void Dump()
	{
		printf("RectFit: pos: (%d,%d), offset: (%d, %d)\n",xpos,ypos,xoffset,yoffset);
		printf(" size: (%d,%d), rotation: %d, scale: %lf\n",width,height,rotation,scale);
	}
};

#define LAYOUT_RECTANGLE_PANNING_MAX 100
enum LayoutRectangle_Alignment {START=0,CENTRE=LAYOUT_RECTANGLE_PANNING_MAX/2,END=LAYOUT_RECTANGLE_PANNING_MAX};

class LayoutRectangle
{
	public:
	LayoutRectangle(int x,int y,int w,int h);
	LayoutRectangle(int w,int h);
	LayoutRectangle(LayoutRectangle &r);
	virtual ~LayoutRectangle();
	virtual LayoutRectangle *Intersection(LayoutRectangle &r);
	virtual LayoutRectangle *UnionBoundary(LayoutRectangle &r);
	virtual RectFit *Fit(LayoutRectangle &r,bool allow_cropping,PP_ROTATION rotation,
		LayoutRectangle_Alignment halign,LayoutRectangle_Alignment valign);
	virtual void Scale(double scale);
	void Dump()
	{
		printf("LayoutRectangle at: (%d,%d), size: (%d, %d)\n",x,y,w,h);
	}
	int x,y;
	int w,h;
};


#endif