aboutsummaryrefslogtreecommitdiff
path: root/layer_box.cpp
blob: d22983326731f99887b72f74a9b8ca81d05d7152 (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
#include <math.h>

#include <SDL.h>
#include <SDL_gfxPrimitives.h>

#include "osc_graphics.h"
#include "layer_box.h"

void
LayerBox::geo(SDL_Rect geo)
{
	x1 = geo.x;
	y1 = geo.y;
	x2 = geo.x + geo.w;
	y2 = geo.y + geo.h;
}

void
LayerBox::alpha(float opacity)
{
	a = (Uint8)ceilf(opacity*SDL_ALPHA_OPAQUE);
}

void
LayerBox::frame(SDL_Surface *target)
{
	boxRGBA(target, x1, y1, x2 ? : target->w, y2 ? : target->h,
		r, g, b, a);
}