Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions src/proc/CaptureArea.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,44 @@ export class CaptureArea {
this.top = top;
this.left = left;
}

public getId(): number {
return this.id;
}

public setId(id:number) {
this.id = id;
}

public getWidth(): number {
return this.width;
}

public setWidth(width:number) {
this.width = width;
}

public getHeight(): number {
return this.height;
}

public setHeight(height:number) {
this.height = height;
}

public getTop(): number {
return this.top;
}

public setTop(top:number) {
this.top = top;
}

public getLeft(): number {
return this.left;
}

public setLeft(left:number) {
this.left = left;
}
}
36 changes: 36 additions & 0 deletions src/proc/Vigad.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import { CaptureArea } from './CaptureArea';
import { StreamHandler } from './StreamHandler';

export class Vigad {
private static instance: Vigad;
private streamHandler: StreamHandler;
private captureAreas: CaptureArea[];

/**
* Create a private constructor to prevent multiple instances
*/
private constructor() {
this.streamHandler = StreamHandler.getInstance();
this.captureAreas = [];
}

/**
Expand All @@ -27,4 +30,37 @@ export class Vigad {
public getStreamHandlerInstance(): StreamHandler {
return this.streamHandler;
}

/**
* Add a new capture area. Returns the id of the capture area.
* @param width
* @param height
* @param top
* @param left
* @return index: number
*/
public addCaptureArea(width:number, height:number, top:number, left:number): number {
let ca = new CaptureArea(width, height, top, left);
this.captureAreas.push(ca);
ca.setId(this.captureAreas.length - 1);
return ca.getId();
}

/**
* Delete a capture area by id
* @param id
* @return void
*/
public deleteCaptureArea(id: number): void {
this.captureAreas.splice(id, 1);
}

/**
* Get a capture area by id
* @param id
* @return CaptureArea
*/
public getCaptureArea(id: number): CaptureArea {
return this.captureAreas[id];
}
}