aboutsummaryrefslogtreecommitdiffstats
path: root/include/litehtml/background.h
blob: c56443d548cc3bc03202765017a70aed2e4d9e96 (plain)
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
#ifndef LH_BACKGROUND_H
#define LH_BACKGROUND_H

#include "types.h"
#include "css_length.h"
#include "css_position.h"
#include "web_color.h"
#include "borders.h"

namespace litehtml
{
	class background
	{
	public:
		string_vector			m_image;
		string					m_baseurl;
		web_color				m_color;
		int_vector				m_attachment;
		length_vector			m_position_x;
		length_vector			m_position_y;
		size_vector				m_size;
		int_vector				m_repeat;
		int_vector				m_clip;
		int_vector				m_origin;

		bool is_empty() const
		{
			if(m_color.alpha != 0) return false;
			if(m_image.empty()) return true;
			for(const auto& img : m_image)
			{
				if(!img.empty()) return false;
			}
			return true;
		}
	};

	class background_paint
	{
	public:
		string					image;
		string					baseurl;
		background_attachment	attachment;
		background_repeat		repeat;
		web_color				color;
		position				clip_box;
		position				origin_box;
		position				border_box;
		border_radiuses			border_radius;
		size					image_size;
		int						position_x;
		int						position_y;
		bool					is_root;

	public:
		background_paint()
		{
			attachment		= background_attachment_scroll;
			repeat			= background_repeat_repeat;
			color			= web_color::transparent;
			position_x		= 0;
			position_y		= 0;
			is_root			= false;
		}
	};

}

#endif  // LH_BACKGROUND_H