package AA::Background;

@ISA = ('AA');

sub new($$) {
	my ($class, $id) = @_;
	my $b = AA::new($class, $id);
	$b->DefSet('d', 0);
	$b->DefSet('color', [1, 1, 1]);
	return $b;
}

sub Draw($$) {
	my ($b, $cairo) = @_;
	$cairo->select_font_face('URW Palladio L', 'normal', 'normal');		# default for all objs
	$cairo->new_path;
	$cairo->rectangle(0, 0, 1024, 768);
	$cairo->set_source_rgb(@{$b->Get('color')});
	$cairo->fill;
}

package AA::Label;

@ISA = ('AA');

sub new($$) {
	my ($class, $id) = @_;
	my $t = AA::new($class, $id);
	$t->DefSet('d', 10);
	$t->DefSet('x', 100);
	$t->DefSet('y', 100);
	$t->DefSet('color', [0, 0, 0]);
	$t->DefSet('size', 12);
	$t->DefSet('text', '');
	return $t;
}

sub Draw($$) {
	my ($t, $cairo) = @_;
	my $text = $t->Get('text');
	$cairo->set_source_rgb(@{$t->Get('color')});
	$cairo->set_font_size($t->Get('size'));
	my $xt = $cairo->text_extents($text);
	$cairo->move_to($t->Get("x") - $xt->{'width'}/2 - $xt->{'x_bearing'},
			$t->Get("y") - $xt->{'height'}/2 - $xt->{'y_bearing'});
	$cairo->show_text($text);
}

1;
