1 package com.hammurapi.jcapture;
2 
3 import java.awt.Dimension;
4 import java.awt.Point;
5 import java.util.List;
6 
7 import com.hammurapi.jcapture.VideoEncoder.Fragment.Frame;
8 
9 class FrameImpl implements Frame {
10 
11 	private List<Shape> shapes;
12 	private Point mousePointer;
13 	private Dimension size;
14 	private boolean isActive;
15 
FrameImpl(List<Shape> shapes, Point mousePointer, Dimension size, boolean isActive)16 	FrameImpl(List<Shape> shapes, Point mousePointer, Dimension size, boolean isActive) {
17 		super();
18 		this.shapes = shapes;
19 		this.mousePointer = mousePointer;
20 		this.size = size;
21 		this.isActive = isActive;
22 	}
23 
24 	/**
25 	 * Merges frame before this frame into this frame by incorporating its shapes.
26 	 * This method is used for merging deleted frames.
27 	 * @param frame
28 	 */
merge(Frame frame)29 	void merge(Frame frame) {
30 		for (Shape shape: shapes) {
31 			if (shape.getContent().coversEverything()) {
32 				return; // No need in previous shapes.
33 			}
34 		}
35 		shapes.addAll(0, frame.getShapes());
36 	}
37 
38 	@Override
getShapes()39 	public List<Shape> getShapes() {
40 		return shapes;
41 	}
42 
43 	@Override
getMousePointer()44 	public Point getMousePointer() {
45 		return mousePointer;
46 	}
47 
48 	@Override
getSize()49 	public Dimension getSize() {
50 		return size;
51 	}
52 
53 	@Override
isActive()54 	public boolean isActive() {
55 		return isActive;
56 	}
57 }
58