else if (surface) surface->drawJpeg(fileName, x, y, width, height);
}
-void Boxx::drawMonoBitmap(UCHAR* base, int dx, int dy, unsigned int height,unsigned int width, DrawStyle& nextColour)
+void Boxx::drawMonoBitmap(UCHAR* base, int dx, int dy, unsigned int height,unsigned int width, const DrawStyle& nextColour)
{
if (parent) parent->drawMonoBitmap(base, area.x +dx, area.y + dy, height, width, nextColour);
else if (surface) surface->drawMonoBitmap(base, dx,dy, height, width, nextColour);
void drawJpeg(const char *fileName,int x, int y,int *width, int *height);
void drawTTChar(int ox, int oy,int x, int y, cTeletextChar c);
- void drawMonoBitmap(UCHAR*base, int dx, int dy, unsigned int height,unsigned int width, DrawStyle& nextColour);
+ void drawMonoBitmap(UCHAR*base, int dx, int dy, unsigned int height,unsigned int width, const DrawStyle& nextColour);
/* This is for system which need a locking of the drawing surface to speed up drawing */
void startFastDraw();
#include "colour.h"
#include "defines.h"
+DrawStyle DrawStyle::TRANSPARENT(0, 0, 0, 0);
+DrawStyle DrawStyle::WHITE(255, 255, 255);
DrawStyle DrawStyle::BLACK(0, 0, 0);
DrawStyle DrawStyle::RED(255, 0, 0);
DrawStyle DrawStyle::GREEN(0, 255, 0);
{ red = Tred; green = Tgreen; blue = Tblue; alpha = 255 ; ft = Color; ct = Global; }
DrawStyle(int Tred, int Tgreen, int Tblue, int Talpha)
- { red = Tred; green = Tgreen; blue = Tblue; alpha = Talpha; ft = Color; ct = Global;}
+ { red = Tred; green = Tgreen; blue = Tblue; alpha = Talpha; ft = Color; ct = Global; }
+
DrawStyle(unsigned int color)
{
red = (color & 0x00ff0000) >> 16;
GradientLinear,
GradientRadial,
};
+
enum CoordType
{
Global,
Colour grad_col[4];
float grad_pos[3]; //Last position is alway 1.0 and first 0.0
+ static DrawStyle TRANSPARENT;
+ static DrawStyle WHITE;
static DrawStyle BLACK;
static DrawStyle RED;
static DrawStyle GREEN;
}
void Surface::drawMonoBitmap(UCHAR* base, int dx, int dy, unsigned int height,
- unsigned int width, DrawStyle& nextColour)
+ unsigned int width, const DrawStyle& nextColour)
{
startFastDraw();
unsigned int x, y;
endFastDraw();
}
-void Surface::drawPoint(int x, int y, DrawStyle& c, bool fastdraw)
+void Surface::drawPoint(int x, int y, const DrawStyle& c, bool fastdraw)
{
drawPixel(x, y, c, fastdraw);
}
virtual void drawHorzLine(int x1, int x2, int y, const DrawStyle& c) = 0;
virtual void drawVertLine(int x, int y1, int y2, const DrawStyle& c) = 0;
virtual void drawBitmap(int x, int y, const Bitmap& bm, const DisplayRegion& region) = 0;
- virtual void drawPoint(int x, int y, DrawStyle& c, bool fastdraw = false); // This draws a point, must not be a pixel
- virtual void drawMonoBitmap(UCHAR* base, int dx, int dy, unsigned int height, unsigned int width, DrawStyle& nextColour);
+ virtual void drawPoint(int x, int y, const DrawStyle& c, bool fastdraw = false); // This draws a point, must not be a pixel
+ virtual void drawMonoBitmap(UCHAR* base, int dx, int dy, unsigned int height, unsigned int width, const DrawStyle& nextColour);
virtual int updateToScreen(int sx, int sy, int w, int h, int dx, int dy) = 0;
virtual void readPixel(int x, int y, unsigned char* r, unsigned char* g, unsigned char* b) = 0;
virtual bool screenShot(const char* fileName) = 0;
#endif
virtual void drawPixel(int x, int y, unsigned int c, bool fastdraw = false) = 0; // deprecated preparation for vector based drawing, only allowed to be called inside implementation
- virtual void drawPixel(int x, int y, Colour& c, bool fastdraw = false) = 0; // deprecated preparation for vector based drawing, only allowed to be called inside implementation
+ virtual void drawPixel(int x, int y, const Colour& c, bool fastdraw = false) = 0; // deprecated preparation for vector based drawing, only allowed to be called inside implementation
private:
void initpol_tables();
command_mutex.unlock();
}
-void SurfaceVector::drawPoint(int x, int y, DrawStyle& c, bool fastdraw)
+void SurfaceVector::drawPoint(int x, int y, const DrawStyle& c, bool fastdraw)
{
if (!fastdraw) command_mutex.lock();
if (!fastdraw) command_mutex.unlock();
}
-void SurfaceVector::drawMonoBitmap(UCHAR* base, int dx, int dy, unsigned int height, unsigned int width, DrawStyle& nextColour)
+
+void SurfaceVector::drawMonoBitmap(UCHAR* base, int dx, int dy, unsigned int height, unsigned int width, const DrawStyle& nextColour)
{
command_mutex.lock();
ImageIndex image = osd->getMonoBitmapRef(base, width, height);
command_mutex.unlock();
}
-
int SurfaceVector::removeCommands(float x, float y, float width, float height)
{
// we iterate through all old commands in order to remove commands hidden by this rectangle
void drawHorzLine(int x1, int x2, int y, const DrawStyle& c);
void drawVertLine(int x, int y1, int y2, const DrawStyle& c);
void drawBitmap(int x, int y, const Bitmap& bm, const DisplayRegion& region);
- void drawPoint(int x, int y, DrawStyle& c, bool fastdraw = false); // This draws a point, must not be a pixel
- void drawMonoBitmap(UCHAR* base, int dx, int dy, unsigned int height, unsigned int width, DrawStyle& nextColour);
+ void drawPoint(int x, int y, const DrawStyle& c, bool fastdraw = false); // This draws a point, must not be a pixel
+ void drawMonoBitmap(UCHAR* base, int dx, int dy, unsigned int height, unsigned int width, const DrawStyle& nextColour);
int updateToScreen(int sx, int sy, int w, int h, int dx, int dy);
/* This is for system which need a locking of the drawing surface to speed up drawing */
OsdVector* osd;
void drawPixel(int /* x */, int /* y */, unsigned int /* c */, bool /* fastdraw */) {}; // these are not supported!
- void drawPixel(int /* x */, int /* y */, Colour& /* c */, bool /* fastdraw */) {};
+ void drawPixel(int /* x */, int /* y */, const Colour& /* c */, bool /* fastdraw */) {};
};
#endif
Log::getInstance()->log("VColourTuner",Log::DEBUG,"deleted %p",this);
}
-void VColourTuner::drawBox(int x, int y, int w, int h, DrawStyle &c) {
+void VColourTuner::drawBox(int x, int y, int w, int h, const DrawStyle& c) {
for (int row=y;row<y+h;row++)
for (int col=x;col<x+w;col++) {
surface->drawPixel(col,row,c);
int picx=picture.getX();
DrawStyle bc=DrawStyle(140,140,140);
fillColour(bc);
- bc=DrawStyle(255,255,255);
+ bc=DrawStyle::WHITE;
drawText(tr("Colour Tuning"), x+20, y+5, DrawStyle::LIGHTTEXT);
drawBox(x, y+50, bw, bh, DrawStyle::RED);
drawBox(x, y+130, bw, bh, DrawStyle::GREEN);
//amount in +/- %
void updateFactor(int color, int amount);
//draw a box with the picture drawing function
- void drawBox(int x, int y, int w, int h, DrawStyle &c);
+ void drawBox(int x, int y, int w, int h, const DrawStyle& c);
static int rfactor;
static int bfactor;
static int gfactor;
setPosition(0, 0);
// beautify
-// DrawStyle transparent = DrawStyle(0, 0, 0, 0);
-// setBackgroundColour(transparent);
+// setBackgroundColour(DrawStyle::TRANSPARENT);
// progTitle.setSurface(surface);
progTitle.setPosition(0,0);
{
// View::draw(); // draw pallet
// beautify
- DrawStyle transparent = DrawStyle(0, 0, 0, 0);
- fillColour(transparent);
+ fillColour(DrawStyle::TRANSPARENT);
// Moved all the dynamic data drawing to a seperate function
ltime = prevHour(&selTime);
updateEventList();
}
- // draw time scale
- DrawStyle white = DrawStyle(255, 255, 255, 255);
-
+ // draw time scale
t = ltime;
struct tm tms;
LOCALTIME_R(&t, &tms);
strftime(timeString, 19, "%H:%M", &tms);
drawText(timeString, timex, timey, DrawStyle::LIGHTTEXT); // print left time
- rectangle(155, timey + getFontHeight(), 2, 7, white);
+ rectangle(155, timey + getFontHeight(), 2, 7, DrawStyle::WHITE);
t = t + 3600;
LOCALTIME_R(&t, &tms);
strftime(timeString, 19, "%H:%M", &tms);
drawText(timeString, timex + 180, timey, DrawStyle::LIGHTTEXT); // print middle time
- rectangle(335, timey + getFontHeight(), 2, 7, white);
+ rectangle(335, timey + getFontHeight(), 2, 7, DrawStyle::WHITE);
t = t + 3600;
LOCALTIME_R(&t, &tms);
strftime(timeString, 19, "%H:%M", &tms);
drawText(timeString, timex + 360, timey, DrawStyle::LIGHTTEXT); // print right time
- rectangle(515, timey + getFontHeight(), 2, 7, white);
+ rectangle(515, timey + getFontHeight(), 2, 7, DrawStyle::WHITE);
// pointer to selTime
//rectangle(155 + (selTime - ltime) / 20, timey + getFontHeight(), 2, 7, DrawStyle(255, 50, 50, 255));
setSize(video->getScreenWidth(), video->getScreenHeight());
createBuffer();
- transparent.set(0, 0, 0, 0);
- setBackgroundColour(transparent);
+ setBackgroundColour(DrawStyle::TRANSPARENT);
setPosition(0, 0);
barRegion.x = 0;
void VRadioRec::draw()
{
- fillColour(transparent);
+ fillColour(DrawStyle::TRANSPARENT);
}
void VRadioRec::go(bool resume)
if (!barShowing) return;
timers->cancelTimer(this, 2);
barShowing = false;
- rectangle(barRegion, transparent);
+ rectangle(barRegion, DrawStyle::TRANSPARENT);
boxstack->update(this, &barRegion);
}
BoxStack* boxstack;
DrawStyle barBlue;
- DrawStyle transparent;
bool playing;
bool barShowing;
fx = x[0] = 50.0;
fy = y[0] = 50.0;
- DrawStyle &black=DrawStyle::BLACK;
- DrawStyle &light=DrawStyle::SELECTHIGHLIGHT;
-
while(1)
{
if (++head == h) head = 0;
if (tail == h) tail = 0;
// Undraw oldest point
- if (x[tail] != -1) surface->drawPoint(x[tail], y[tail], black);// was rgba
+ if (x[tail] != -1) surface->drawPoint(x[tail], y[tail], DrawStyle::BLACK);// was rgba
dd = ((rand() / (double)RAND_MAX) * deviation) - halfdeviation;
direction += dd;
x[head] = static_cast<int>(fx);
y[head] = static_cast<int>(fy);
- surface->drawPoint(x[head], y[head], light); // was rgba
+ surface->drawPoint(x[head], y[head], DrawStyle::SELECTHIGHLIGHT); // was rgba
if (threadReqStop) return;
MILLISLEEP(10);
setSize(video->getScreenWidth(), video->getScreenHeight());
createBuffer();
- DrawStyle transparent(0, 0, 0, 0);
- setBackgroundColour(transparent);
+ setBackgroundColour(DrawStyle::TRANSPARENT);
OsdVector* osdv = dynamic_cast<OsdVector*>(Osd::getInstance());
if (osdv)
void VVideoLiveTV::clearOSD()
{
- rectangle(area, DrawStyle(0,0,0,0));
+ rectangle(area, DrawStyle::TRANSPARENT);
boxstack->update(this, &area);
}
r.y = static_cast<UINT>(floor(scaley * static_cast<float>(r.y)));
r.w = static_cast<UINT>(ceil(scalex * static_cast<float>(r.w)) + 1.f);
r.h = static_cast<UINT>(ceil(scaley * static_cast<float>(r.h)) + 1.f);
- rectangle(r, DrawStyle(0,0,0,0));
+ rectangle(r, DrawStyle::TRANSPARENT);
boxstack->update(this, &r);
}
setSize(video->getScreenWidth(), video->getScreenHeight());
createBuffer();
- transparent.set(0, 0, 0, 0);
- setBackgroundColour(transparent);
+ setBackgroundColour(DrawStyle::TRANSPARENT);
barRegion.x = 0;
barRegion.y = video->getScreenHeight() - 58; // FIXME, need to be - 1? and below?
barGenHold = false;
barScanHold = false;
barVasHold = false;
- rectangle(barRegion, transparent);
+ rectangle(barRegion, DrawStyle::TRANSPARENT);
BoxStack::getInstance()->update(this, &barRegion);
}
VAudioSelector* vas;
- DrawStyle transparent;
DrawStyle barBlue;
UCHAR videoMode;
setSize(video->getScreenWidth(), video->getScreenHeight());
createBuffer();
- transparent.set(0, 0, 0, 0);
- setBackgroundColour(transparent);
+ setBackgroundColour(DrawStyle::TRANSPARENT);
OsdVector* osdv=dynamic_cast<OsdVector*>(Osd::getInstance());
if (osdv)
barGenHold = false;
barScanHold = false;
barVasHold = false;
- rectangle(barRegion, transparent);
+ rectangle(barRegion, DrawStyle::TRANSPARENT);
boxstack->update(this, &barRegion);
player->tellSubtitlesOSDVisible(false);
}
void VVideoRec::clearOSD()
{
- rectangle(area, transparent);
+ rectangle(area, DrawStyle::TRANSPARENT);
boxstack->update(this, &area);
}
r.w = static_cast<UINT>(ceil(scalex * static_cast<float>(r.w)) + 1.f);
r.h = static_cast<UINT>(ceil(scaley * static_cast<float>(r.h)) + 1.f);
- rectangle(r, transparent);
+ rectangle(r, DrawStyle::TRANSPARENT);
boxstack->update(this, &r);
}
VAudioSelector* vas;
- DrawStyle transparent;
DrawStyle barBlue;
int videoMode;
#ifndef __ANDROID__
-bool WJpegComplex::drawJpeg(JpegControl * ctl,Surface * sfc,JpegReader *rdr, DrawStyle & backgroundColour) {
+bool WJpegComplex::drawJpeg(JpegControl * ctl,Surface * sfc,JpegReader *rdr, const DrawStyle& backgroundColour) {
Log* logger = Log::getInstance();
if (! rdr || ! sfc) {
logger->log("BJpeg", Log::ERR, "JPEG error rdr=NULL or sfc=NULL");
#else
-bool WJpegComplex::drawJpeg(JpegControl * ctl,Surface * sfc,JpegReader *rdr, DrawStyle & backgroundColour) {
+bool WJpegComplex::drawJpeg(JpegControl * ctl,Surface * sfc,JpegReader *rdr, const DrawStyle& backgroundColour) {
return true;
}
#endif
//the reader has to be initialized before
//calling this function does not need a WJpeg being instantiated
//it simply draws into the surface
- bool static drawJpeg(JpegControl * control, Surface* sfc, JpegReader *rdr, DrawStyle & backgroundColour);
+ bool static drawJpeg(JpegControl * control, Surface* sfc, JpegReader *rdr, const DrawStyle& backgroundColour);
private:
//our drawPixel with considers rotation