CHDK_DE Vorschauversion  Trunk Rev. 5830
 Alle Datenstrukturen Dateien Funktionen Variablen Typdefinitionen Aufzählungen Aufzählungswerte Makrodefinitionen
gui_draw.h-Dateireferenz
#include "conf.h"
#include "palette.h"
+ Include-Abhängigkeitsdiagramm für gui_draw.h:
+ Dieser Graph zeigt, welche Datei direkt oder indirekt diese Datei enthält:

gehe zum Quellcode dieser Datei

Datenstrukturen

struct  icon_cmd
 

Makrodefinitionen

#define IDX_COLOR_TRANSPARENT   0
 
#define IDX_COLOR_BLACK   1
 
#define IDX_COLOR_WHITE   2
 
#define IDX_COLOR_RED   3
 
#define IDX_COLOR_RED_DK   4
 
#define IDX_COLOR_RED_LT   5
 
#define IDX_COLOR_GREEN   6
 
#define IDX_COLOR_GREEN_DK   7
 
#define IDX_COLOR_GREEN_LT   8
 
#define IDX_COLOR_BLUE   9
 
#define IDX_COLOR_BLUE_DK   10
 
#define IDX_COLOR_BLUE_LT   11
 
#define IDX_COLOR_GREY   12
 
#define IDX_COLOR_GREY_DK   13
 
#define IDX_COLOR_GREY_LT   14
 
#define IDX_COLOR_YELLOW   15
 
#define IDX_COLOR_YELLOW_DK   16
 
#define IDX_COLOR_YELLOW_LT   17
 
#define IDX_COLOR_GREY_DK_TRANS   18
 
#define IDX_COLOR_MAGENTA   19
 
#define IDX_COLOR_CYAN   IDX_COLOR_BLUE_LT
 
#define IDX_COLOR_MAX   19
 
#define COLOR_WHITE   (chdk_colors[IDX_COLOR_WHITE])
 
#define COLOR_RED   (chdk_colors[IDX_COLOR_RED])
 
#define COLOR_RED_DK   (chdk_colors[IDX_COLOR_RED_DK])
 
#define COLOR_RED_LT   (chdk_colors[IDX_COLOR_RED_LT])
 
#define COLOR_GREEN   (chdk_colors[IDX_COLOR_GREEN])
 
#define COLOR_GREEN_DK   (chdk_colors[IDX_COLOR_GREEN_DK])
 
#define COLOR_GREEN_LT   (chdk_colors[IDX_COLOR_GREEN_LT])
 
#define COLOR_BLUE   (chdk_colors[IDX_COLOR_BLUE])
 
#define COLOR_BLUE_DK   (chdk_colors[IDX_COLOR_BLUE_DK])
 
#define COLOR_BLUE_LT   (chdk_colors[IDX_COLOR_BLUE_LT])
 
#define COLOR_GREY   (chdk_colors[IDX_COLOR_GREY])
 
#define COLOR_GREY_DK   (chdk_colors[IDX_COLOR_GREY_DK])
 
#define COLOR_GREY_LT   (chdk_colors[IDX_COLOR_GREY_LT])
 
#define COLOR_YELLOW   (chdk_colors[IDX_COLOR_YELLOW])
 
#define COLOR_YELLOW_DK   (chdk_colors[IDX_COLOR_YELLOW_DK])
 
#define COLOR_YELLOW_LT   (chdk_colors[IDX_COLOR_YELLOW_LT])
 
#define COLOR_GREY_DK_TRANS   (chdk_colors[IDX_COLOR_GREY_DK_TRANS])
 
#define COLOR_MAGENTA   (chdk_colors[IDX_COLOR_MAGENTA])
 
#define COLOR_CYAN   (chdk_colors[IDX_COLOR_CYAN])
 
#define FONT_REAL_WIDTH   8
 
#define FONT_REAL_HEIGHT   16
 
#define FONT_WIDTH   8
 
#define FONT_HEIGHT   16
 
#define DEFAULT_SYMBOL_FILE   "A/CHDK/SYMBOLS/icon_10.rbf"
 
#define TEXT_LEFT   0
 
#define TEXT_CENTER   1
 
#define TEXT_RIGHT   2
 
#define TEXT_FILL   16
 
#define RECT_BORDER0   0
 
#define RECT_BORDER1   1
 
#define RECT_BORDER2   2
 
#define RECT_BORDER3   3
 
#define RECT_BORDER4   4
 
#define RECT_BORDER5   5
 
#define RECT_BORDER6   6
 
#define RECT_BORDER7   7
 
#define RECT_BORDER_MASK   7
 
#define DRAW_FILLED   8
 
#define RECT_SHADOW0   0
 
#define RECT_SHADOW1   0x10
 
#define RECT_SHADOW2   0x20
 
#define RECT_SHADOW3   0x30
 
#define RECT_SHADOW_MASK   0x30
 
#define RECT_ROUND_CORNERS   0x40
 

Aufzählungen

enum  icon_actions {
  IA_END, IA_HLINE, IA_VLINE, IA_LINE,
  IA_RECT, IA_FILLED_RECT, IA_ROUND_RECT, IA_FILLED_ROUND_RECT
}
 

Funktionen

void draw_init ()
 
void draw_set_draw_proc (void(*pixel_proc)(unsigned int offset, color cl))
 
void update_draw_proc ()
 
void draw_set_guard ()
 
int draw_test_guard ()
 
color draw_get_pixel (coord x, coord y)
 
color draw_get_pixel_unrotated (coord x, coord y)
 
void draw_pixel (coord x, coord y, color cl)
 
void draw_pixel_unrotated (coord x, coord y, color cl)
 
void draw_dblpixel_raw (unsigned int offset, unsigned int px, unsigned int op)
 
void set_transparent (unsigned int offset, int n_pixel)
 
unsigned int color_to_rawpx (color cl, unsigned int *op)
 
void draw_line (coord x1, coord y1, coord x2, coord y2, color cl)
 
void draw_hline (coord x, coord y, int len, color cl)
 
void draw_vline (coord x, coord y, int len, color cl)
 
void draw_rectangle (coord x1, coord y1, coord x2, coord y2, twoColors cl, int flags)
 
void draw_ellipse (coord xc, coord yc, unsigned int a, unsigned int b, color cl, int flags)
 
int text_dimensions (const char *s, int width, int max_chars, int *max_lines)
 
void draw_char (coord x, coord y, const char ch, twoColors cl)
 
int draw_string_clipped (coord x, coord y, const char *s, twoColors cl, int max_width)
 
int draw_string (coord x, coord y, const char *s, twoColors cl)
 
int draw_string_justified (coord x, coord y, const char *s, twoColors cl, int xo, int max_width, int justification)
 
int draw_text_justified (coord x, coord y, const char *s, twoColors cl, int max_chars, int max_lines, int justification)
 
void draw_string_scaled (coord x, coord y, const char *s, twoColors cl, int xsize, int ysize)
 
void draw_osd_string (OSD_pos pos, int xo, int yo, char *s, twoColors c, OSD_scale scale)
 
void draw_button (int x, int y, int w, int str_id, int active)
 
void draw_txt_string (coord col, coord row, const char *str, twoColors cl)
 
void draw_suspend (int ms)
 
int draw_is_suspended (void)
 
void draw_restore ()
 
color get_script_color (int cl)
 
color chdkColorToCanonColor (chdkColor c)
 
twoColors user_color (confColor c)
 
void draw_icon_cmds (coord x, coord y, icon_cmd *cmds)
 

Variablen

unsigned char * chdk_colors
 

Makro-Dokumentation

#define COLOR_BLUE   (chdk_colors[IDX_COLOR_BLUE])

Definiert in Zeile 42 der Datei gui_draw.h.

#define COLOR_BLUE_DK   (chdk_colors[IDX_COLOR_BLUE_DK])

Definiert in Zeile 43 der Datei gui_draw.h.

#define COLOR_BLUE_LT   (chdk_colors[IDX_COLOR_BLUE_LT])

Definiert in Zeile 44 der Datei gui_draw.h.

#define COLOR_CYAN   (chdk_colors[IDX_COLOR_CYAN])

Definiert in Zeile 53 der Datei gui_draw.h.

#define COLOR_GREEN   (chdk_colors[IDX_COLOR_GREEN])

Definiert in Zeile 39 der Datei gui_draw.h.

#define COLOR_GREEN_DK   (chdk_colors[IDX_COLOR_GREEN_DK])

Definiert in Zeile 40 der Datei gui_draw.h.

#define COLOR_GREEN_LT   (chdk_colors[IDX_COLOR_GREEN_LT])

Definiert in Zeile 41 der Datei gui_draw.h.

#define COLOR_GREY   (chdk_colors[IDX_COLOR_GREY])

Definiert in Zeile 45 der Datei gui_draw.h.

#define COLOR_GREY_DK   (chdk_colors[IDX_COLOR_GREY_DK])

Definiert in Zeile 46 der Datei gui_draw.h.

#define COLOR_GREY_DK_TRANS   (chdk_colors[IDX_COLOR_GREY_DK_TRANS])

Definiert in Zeile 51 der Datei gui_draw.h.

#define COLOR_GREY_LT   (chdk_colors[IDX_COLOR_GREY_LT])

Definiert in Zeile 47 der Datei gui_draw.h.

#define COLOR_MAGENTA   (chdk_colors[IDX_COLOR_MAGENTA])

Definiert in Zeile 52 der Datei gui_draw.h.

#define COLOR_RED   (chdk_colors[IDX_COLOR_RED])

Definiert in Zeile 36 der Datei gui_draw.h.

#define COLOR_RED_DK   (chdk_colors[IDX_COLOR_RED_DK])

Definiert in Zeile 37 der Datei gui_draw.h.

#define COLOR_RED_LT   (chdk_colors[IDX_COLOR_RED_LT])

Definiert in Zeile 38 der Datei gui_draw.h.

#define COLOR_WHITE   (chdk_colors[IDX_COLOR_WHITE])

Definiert in Zeile 35 der Datei gui_draw.h.

#define COLOR_YELLOW   (chdk_colors[IDX_COLOR_YELLOW])

Definiert in Zeile 48 der Datei gui_draw.h.

#define COLOR_YELLOW_DK   (chdk_colors[IDX_COLOR_YELLOW_DK])

Definiert in Zeile 49 der Datei gui_draw.h.

#define COLOR_YELLOW_LT   (chdk_colors[IDX_COLOR_YELLOW_LT])

Definiert in Zeile 50 der Datei gui_draw.h.

#define DEFAULT_SYMBOL_FILE   "A/CHDK/SYMBOLS/icon_10.rbf"

Definiert in Zeile 64 der Datei gui_draw.h.

#define DRAW_FILLED   8

Definiert in Zeile 91 der Datei gui_draw.h.

#define FONT_HEIGHT   16

Definiert in Zeile 62 der Datei gui_draw.h.

#define FONT_REAL_HEIGHT   16

Definiert in Zeile 57 der Datei gui_draw.h.

#define FONT_REAL_WIDTH   8

Definiert in Zeile 56 der Datei gui_draw.h.

#define FONT_WIDTH   8

Definiert in Zeile 61 der Datei gui_draw.h.

#define IDX_COLOR_BLACK   1

Definiert in Zeile 12 der Datei gui_draw.h.

#define IDX_COLOR_BLUE   9

Definiert in Zeile 20 der Datei gui_draw.h.

#define IDX_COLOR_BLUE_DK   10

Definiert in Zeile 21 der Datei gui_draw.h.

#define IDX_COLOR_BLUE_LT   11

Definiert in Zeile 22 der Datei gui_draw.h.

#define IDX_COLOR_CYAN   IDX_COLOR_BLUE_LT

Definiert in Zeile 31 der Datei gui_draw.h.

#define IDX_COLOR_GREEN   6

Definiert in Zeile 17 der Datei gui_draw.h.

#define IDX_COLOR_GREEN_DK   7

Definiert in Zeile 18 der Datei gui_draw.h.

#define IDX_COLOR_GREEN_LT   8

Definiert in Zeile 19 der Datei gui_draw.h.

#define IDX_COLOR_GREY   12

Definiert in Zeile 23 der Datei gui_draw.h.

#define IDX_COLOR_GREY_DK   13

Definiert in Zeile 24 der Datei gui_draw.h.

#define IDX_COLOR_GREY_DK_TRANS   18

Definiert in Zeile 29 der Datei gui_draw.h.

#define IDX_COLOR_GREY_LT   14

Definiert in Zeile 25 der Datei gui_draw.h.

#define IDX_COLOR_MAGENTA   19

Definiert in Zeile 30 der Datei gui_draw.h.

#define IDX_COLOR_MAX   19

Definiert in Zeile 33 der Datei gui_draw.h.

#define IDX_COLOR_RED   3

Definiert in Zeile 14 der Datei gui_draw.h.

#define IDX_COLOR_RED_DK   4

Definiert in Zeile 15 der Datei gui_draw.h.

#define IDX_COLOR_RED_LT   5

Definiert in Zeile 16 der Datei gui_draw.h.

#define IDX_COLOR_TRANSPARENT   0

Definiert in Zeile 11 der Datei gui_draw.h.

#define IDX_COLOR_WHITE   2

Definiert in Zeile 13 der Datei gui_draw.h.

#define IDX_COLOR_YELLOW   15

Definiert in Zeile 26 der Datei gui_draw.h.

#define IDX_COLOR_YELLOW_DK   16

Definiert in Zeile 27 der Datei gui_draw.h.

#define IDX_COLOR_YELLOW_LT   17

Definiert in Zeile 28 der Datei gui_draw.h.

#define RECT_BORDER0   0

Definiert in Zeile 82 der Datei gui_draw.h.

#define RECT_BORDER1   1

Definiert in Zeile 83 der Datei gui_draw.h.

#define RECT_BORDER2   2

Definiert in Zeile 84 der Datei gui_draw.h.

#define RECT_BORDER3   3

Definiert in Zeile 85 der Datei gui_draw.h.

#define RECT_BORDER4   4

Definiert in Zeile 86 der Datei gui_draw.h.

#define RECT_BORDER5   5

Definiert in Zeile 87 der Datei gui_draw.h.

#define RECT_BORDER6   6

Definiert in Zeile 88 der Datei gui_draw.h.

#define RECT_BORDER7   7

Definiert in Zeile 89 der Datei gui_draw.h.

#define RECT_BORDER_MASK   7

Definiert in Zeile 90 der Datei gui_draw.h.

#define RECT_ROUND_CORNERS   0x40

Definiert in Zeile 97 der Datei gui_draw.h.

#define RECT_SHADOW0   0

Definiert in Zeile 92 der Datei gui_draw.h.

#define RECT_SHADOW1   0x10

Definiert in Zeile 93 der Datei gui_draw.h.

#define RECT_SHADOW2   0x20

Definiert in Zeile 94 der Datei gui_draw.h.

#define RECT_SHADOW3   0x30

Definiert in Zeile 95 der Datei gui_draw.h.

#define RECT_SHADOW_MASK   0x30

Definiert in Zeile 96 der Datei gui_draw.h.

#define TEXT_CENTER   1

Definiert in Zeile 77 der Datei gui_draw.h.

#define TEXT_FILL   16

Definiert in Zeile 79 der Datei gui_draw.h.

#define TEXT_LEFT   0

Definiert in Zeile 76 der Datei gui_draw.h.

#define TEXT_RIGHT   2

Definiert in Zeile 78 der Datei gui_draw.h.

Dokumentation der Aufzählungstypen

Aufzählungswerte
IA_END 
IA_HLINE 
IA_VLINE 
IA_LINE 
IA_RECT 
IA_FILLED_RECT 
IA_ROUND_RECT 
IA_FILLED_ROUND_RECT 

Definiert in Zeile 151 der Datei gui_draw.h.

152 {
153  IA_END,
154  IA_HLINE,
155  IA_VLINE,
156  IA_LINE,
157  IA_RECT,
161 };

Dokumentation der Funktionen

color chdkColorToCanonColor ( chdkColor  c)

Definiert in Zeile 1478 der Datei gui_draw.c.

1479 {
1480  if (col.type)
1481  return chdk_colors[col.col];
1482  return col.col;
1483 }
unsigned int color_to_rawpx ( color  cl,
unsigned int *  op 
)
void draw_button ( int  x,
int  y,
int  w,
int  str_id,
int  active 
)

Definiert in Zeile 1360 der Datei gui_draw.c.

1361 {
1363  w = w * FONT_WIDTH;
1364 
1365  draw_rectangle(x-2, y-2, x+w+2, y+FONT_HEIGHT+2, cl, RECT_BORDER1|DRAW_FILLED|RECT_SHADOW1); // main box
1366  draw_string(x+((w-(strlen(lang_str(str_id))*FONT_WIDTH))>>1), y, lang_str(str_id), cl);
1367 }
void draw_char ( coord  x,
coord  y,
const char  ch,
twoColors  cl 
)

Definiert in Zeile 696 der Datei gui_draw.c.

697 {
698  unsigned i, ii;
699 
700  unsigned int offset, size;
701  unsigned char *sym = get_cdata(&offset, &size, ch);
702 
703  // First draw blank lines at top
704  for (i=0; i<offset; i++)
706 
707  // Now draw character data
708 
709  unsigned j;
710  for (j=i; i<size;)
711  {
712  unsigned int dsym;
713  int rep;
714 #ifdef BUILTIN_FONT_RLE_COMPRESSED
715  dsym = fontdata_lookup[sym[j] & 0x7f];
716  rep = sym[j] & 0x80;
717 #else
718  dsym = sym[j];
719  rep = 0;
720 #endif
721  for (ii=0; ii<FONT_WIDTH; ii++)
722  {
723  draw_pixel(x+ii, y+i, (dsym & (0x80>>ii))? FG_COLOR(cl) : BG_COLOR(cl));
724  }
725  if (rep)
726  {
727  i++;
728  for (ii=0; ii<FONT_WIDTH; ii++)
729  {
730  draw_pixel(x+ii, y+i, (dsym & (0x80>>ii))? FG_COLOR(cl) : BG_COLOR(cl));
731  }
732  }
733  i++;
734  j++;
735  }
736 
737  // Last draw blank lines at bottom
738  for (; i<FONT_HEIGHT; i++)
739  draw_hline(x, y+i, FONT_WIDTH, BG_COLOR(cl));
740 }
void draw_dblpixel_raw ( unsigned int  offset,
unsigned int  px,
unsigned int  op 
)
void draw_ellipse ( coord  xc,
coord  yc,
unsigned int  a,
unsigned int  b,
color  cl,
int  flags 
)

Definiert in Zeile 1274 der Datei gui_draw.c.

1275 {
1276  // Bresenham fast ellipse algorithm - http://homepage.smc.edu/kennedy_john/BELIPSE.PDF
1277  int X, Y;
1278  int XChange, YChange;
1279  int EllipseError;
1280  int TwoASquare, TwoBSquare;
1281  int StoppingX, StoppingY;
1282  TwoASquare = 2*XRadius*XRadius;
1283  TwoBSquare = 2*YRadius*YRadius;
1284  X = XRadius;
1285  Y = 0;
1286  XChange = YRadius*YRadius*(1-2*XRadius);
1287  YChange = XRadius*XRadius;
1288  EllipseError = 0;
1289  StoppingX = TwoBSquare*XRadius;
1290  StoppingY = 0;
1291  while ( StoppingX >= StoppingY )
1292  {
1293  if (flags & DRAW_FILLED)
1294  {
1295  draw_hline(CX-X,CY-Y,X*2+1,cl);
1296  draw_hline(CX-X,CY+Y,X*2+1,cl);
1297  }
1298  else
1299  {
1300  draw_pixel(CX-X,CY-Y,cl);
1301  draw_pixel(CX-X,CY+Y,cl);
1302  draw_pixel(CX+X,CY-Y,cl);
1303  draw_pixel(CX+X,CY+Y,cl);
1304  }
1305  Y++;
1306  StoppingY += TwoASquare;
1307  EllipseError += YChange;
1308  YChange += TwoASquare;
1309  if ((2*EllipseError + XChange) > 0 )
1310  {
1311  X--;
1312  StoppingX -= TwoBSquare;
1313  EllipseError += XChange;
1314  XChange += TwoBSquare;
1315  }
1316  }
1317  X = 0;
1318  Y = YRadius;
1319  XChange = YRadius*YRadius;
1320  YChange = XRadius*XRadius*(1-2*YRadius);
1321  EllipseError = 0;
1322  StoppingX = 0;
1323  StoppingY = TwoASquare*YRadius;
1324  int lastY = Y + 1;
1325  while ( StoppingX <= StoppingY )
1326  {
1327  if (flags & DRAW_FILLED)
1328  {
1329  // Only draw lines if Y has changed
1330  if (lastY != Y)
1331  {
1332  draw_hline(CX-X,CY-Y,X*2+1,cl);
1333  draw_hline(CX-X,CY+Y,X*2+1,cl);
1334  lastY = Y;
1335  }
1336  }
1337  else
1338  {
1339  draw_pixel(CX-X,CY-Y,cl);
1340  draw_pixel(CX-X,CY+Y,cl);
1341  draw_pixel(CX+X,CY-Y,cl);
1342  draw_pixel(CX+X,CY+Y,cl);
1343  }
1344  X++;
1345  StoppingX += TwoBSquare;
1346  EllipseError += XChange;
1347  XChange += TwoBSquare;
1348  if ((2*EllipseError + YChange) > 0 )
1349  {
1350  Y--;
1351  StoppingY -= TwoASquare;
1352  EllipseError += YChange;
1353  YChange += TwoASquare;
1354  }
1355  }
1356 }
color draw_get_pixel ( coord  x,
coord  y 
)

Definiert in Zeile 461 der Datei gui_draw.c.

462 {
463 #ifndef THUMB_FW
464  if ((x < 0) || (y < 0) || (x >= camera_screen.width) || (y >= camera_screen.height)) return 0;
465  if (conf.rotate_osd)
466  {
467 #ifdef DRAW_ON_ACTIVE_BITMAP_BUFFER_ONLY
469 #else
471 #endif
472  }
473  else
474  {
475 #ifdef DRAW_ON_ACTIVE_BITMAP_BUFFER_ONLY
477 #else
479 #endif
480  }
481 #else
482  // DIGIC 6 not supported
483  (void)x; (void)y;
484  return 0;
485 #endif
486 }
color draw_get_pixel_unrotated ( coord  x,
coord  y 
)

Definiert in Zeile 488 der Datei gui_draw.c.

489 {
490 #ifndef THUMB_FW
491  if ((x < 0) || (y < 0) || (x >= camera_screen.width) || (y >= camera_screen.height)) return 0;
492 #ifdef DRAW_ON_ACTIVE_BITMAP_BUFFER_ONLY
494 #else
496 #endif
497 #else
498  // DIGIC 6 not supported
499  (void)x; (void)y;
500  return 0;
501 #endif
502 }
void draw_hline ( coord  x,
coord  y,
int  len,
color  cl 
)

Definiert in Zeile 584 der Datei gui_draw.c.

585 {
586  if ((y < 0) || (x >= camera_screen.width) || (y >= camera_screen.height)) return;
587  if (x < 0) { len += x; x = 0; }
588  if ((x + len) > camera_screen.width) len = camera_screen.width - x;
589  if (conf.rotate_osd)
590  {
591  if ((y == camera_screen.height-1) && ((x+len) >= camera_screen.width-1)) { x--; len--; } // Skip guard pixel
592  }
593  else
594  {
595  if ((y == 0) && (x == 0)) { x++; len--; } // Skip guard pixel
596  }
597  register unsigned int offset = y * camera_screen.buffer_width + ASPECT_XCORRECTION(x);
598  len = ASPECT_XCORRECTION(len); // Scale the line length if needed
599  for (; len>0; len--, offset++)
600  draw_pixel_proc(offset, cl);
601 }
void draw_icon_cmds ( coord  x,
coord  y,
icon_cmd cmds 
)

Definiert in Zeile 1372 der Datei gui_draw.c.

1373 {
1374  int x1, y1, x2, y2;
1375 #ifdef THUMB_FW
1376  int thickness = RECT_BORDER2;
1377 #else
1378  int thickness = RECT_BORDER1;
1379 #endif
1380  while (1)
1381  {
1382 #ifdef THUMB_FW
1383  x1 = cmds->x1<<1;
1384  y1 = cmds->y1<<1;
1385  x2 = cmds->x2<<1;
1386  y2 = cmds->y2<<1;
1387 #else
1388  x1 = cmds->x1;
1389  y1 = cmds->y1;
1390  x2 = cmds->x2;
1391  y2 = cmds->y2;
1392 #endif
1393  color cf = chdk_colors[cmds->cf]; // Convert color indexes to actual colors
1394  color cb = chdk_colors[cmds->cb];
1395  switch (cmds->action)
1396  {
1397  default:
1398  case IA_END:
1399  return;
1400  case IA_HLINE:
1401  draw_hline(x+x1, y+y1, x2, cb);
1402 #ifdef THUMB_FW
1403  draw_hline(x+x1, y+y1+1, x2, cb);
1404 #endif
1405  break;
1406  case IA_VLINE:
1407  draw_vline(x+x1, y+y1, y2, cb);
1408 #ifdef THUMB_FW
1409  draw_vline(x+x1+1, y+y1, y2, cb);
1410 #endif
1411  break;
1412  case IA_LINE:
1413 #ifdef THUMB_FW
1414  draw_line_x2(x+x1, y+y1, x+x2, y+y2, cb);
1415 #else
1416  draw_line(x+x1, y+y1, x+x2, y+y2, cb);
1417 #endif
1418  break;
1419  case IA_RECT:
1420 #ifdef THUMB_FW
1421  draw_rectangle(x+x1, y+y1, x+x2+1, y+y2+1, MAKE_COLOR(cb,cf), thickness);
1422 #else
1423  draw_rectangle(x+x1, y+y1, x+x2, y+y2, MAKE_COLOR(cb,cf), thickness);
1424 #endif
1425  break;
1426  case IA_FILLED_RECT:
1427 #ifdef THUMB_FW
1428  draw_rectangle(x+x1, y+y1, x+x2+1, y+y2+1, MAKE_COLOR(cb,cf), thickness|DRAW_FILLED);
1429 #else
1430  draw_rectangle(x+x1, y+y1, x+x2, y+y2, MAKE_COLOR(cb,cf), thickness|DRAW_FILLED);
1431 #endif
1432  break;
1433  case IA_ROUND_RECT:
1434 #ifdef THUMB_FW
1435  draw_rectangle(x+x1, y+y1, x+x2+1, y+y2+1, MAKE_COLOR(cb,cf), thickness|RECT_ROUND_CORNERS);
1436 #else
1437  draw_rectangle(x+x1, y+y1, x+x2, y+y2, MAKE_COLOR(cb,cf), thickness|RECT_ROUND_CORNERS);
1438 #endif
1439  break;
1440  case IA_FILLED_ROUND_RECT:
1441 #ifdef THUMB_FW
1442  draw_rectangle(x+x1, y+y1, x+x2+1, y+y2+1, MAKE_COLOR(cb,cf), thickness|DRAW_FILLED|RECT_ROUND_CORNERS);
1443 #else
1444  draw_rectangle(x+x1, y+y1, x+x2, y+y2, MAKE_COLOR(cb,cf), thickness|DRAW_FILLED|RECT_ROUND_CORNERS);
1445 #endif
1446  break;
1447  }
1448  cmds++;
1449  }
1450 }
void draw_init ( )

Definiert in Zeile 391 der Datei gui_draw.c.

392 {
393 #ifndef DRAW_ON_ACTIVE_BITMAP_BUFFER_ONLY
396 #endif
398 
399  draw_set_guard();
400 }
int draw_is_suspended ( void  )

Definiert in Zeile 412 der Datei gui_draw.c.

413 {
415 }
void draw_line ( coord  x1,
coord  y1,
coord  x2,
coord  y2,
color  cl 
)

Definiert in Zeile 507 der Datei gui_draw.c.

508 {
509  unsigned char steep = abs(y2 - y1) > abs(x2 - x1);
510  if (steep)
511  {
512  swap(x1, y1);
513  swap(x2, y2);
514  }
515  if (x1 > x2)
516  {
517  swap(x1, x2);
518  swap(y1, y2);
519  }
520  int deltax = x2 - x1;
521  int deltay = abs(y2 - y1);
522  int error = 0;
523  int y = y1;
524  int ystep = (y1 < y2)?1:-1;
525  int x;
526  for (x=x1; x<=x2; ++x)
527  {
528  if (steep) draw_pixel(y, x, cl);
529  else draw_pixel(x, y, cl);
530  error += deltay;
531  if ((error<<1) >= deltax)
532  {
533  y += ystep;
534  error -= deltax;
535  }
536  }
537 }
void draw_osd_string ( OSD_pos  pos,
int  xo,
int  yo,
char *  s,
twoColors  c,
OSD_scale  scale 
)

Definiert in Zeile 1209 der Datei gui_draw.c.

1210 {
1211  if ((scale.x == 0) || (scale.y == 0) || ((scale.x == 1) && (scale.y == 1)))
1212  draw_string(pos.x+xo, pos.y+yo, s, c);
1213  else
1214  draw_string_scaled(pos.x+(xo*scale.x), pos.y+(yo*scale.y), s, c, scale.x, scale.y);
1215 }
void draw_pixel ( coord  x,
coord  y,
color  cl 
)

Definiert in Zeile 432 der Datei gui_draw.c.

433 {
434  // Make sure pixel is on screen. Skip top left pixel if screen erase detection is on to avoid triggering the detector.
435  if ((x < 0) || (y < 0) || (x >= camera_screen.width) || (y >= camera_screen.height) || ((x == 0) && (y == 0))) return;
436  else
437  {
438  register unsigned int offset = y * camera_screen.buffer_width + ASPECT_XCORRECTION(x);
439  draw_pixel_proc(offset, cl);
440 #if CAM_USES_ASPECT_CORRECTION
441  draw_pixel_proc(offset+1, cl); // Draw second pixel if screen scaling is needed
442 #endif
443  }
444 }
void draw_pixel_unrotated ( coord  x,
coord  y,
color  cl 
)

Definiert in Zeile 446 der Datei gui_draw.c.

447 {
448  // Make sure pixel is on screen. Skip top left pixel if screen erase detection is on to avoid triggering the detector.
449  if ((x < 0) || (y < 0) || (x >= camera_screen.width) || (y >= camera_screen.height) || ((x == 0) && (y == 0))) return;
450  else
451  {
452  register unsigned int offset = y * camera_screen.buffer_width + ASPECT_XCORRECTION(x);
453  draw_pixel_proc_norm(offset, cl);
454 #if CAM_USES_ASPECT_CORRECTION
455  draw_pixel_proc_norm(offset+1, cl); // Draw second pixel if screen scaling is needed
456 #endif
457  }
458 }
void draw_rectangle ( coord  x1,
coord  y1,
coord  x2,
coord  y2,
twoColors  cl,
int  flags 
)

Definiert in Zeile 615 der Datei gui_draw.c.

616 {
617  // Normalise values
618  if (x1 > x2)
619  swap(x1, x2);
620  if (y1 > y2)
621  swap(y1, y2);
622 
623  // Check if completely off screen
624  if ((x2 < 0) || (y2 < 0) || (x1 >= camera_screen.width) || (y1 >= camera_screen.height))
625  return;
626 
627  int round = (flags & RECT_ROUND_CORNERS) ? 1 : 0;
628  int thickness;
629  int i;
630 
631  // Shadow (do this first, as edge draw shrinks rectangle for fill)
632  if (flags & RECT_SHADOW_MASK)
633  {
634  thickness = ((flags & RECT_SHADOW_MASK) >> 4);
635  for (i=1; i<=thickness; i++)
636  {
637  draw_vline(x2+i, y1+1, y2 - y1, COLOR_BLACK);
638  draw_hline(x1+1, y2+i, x2 - x1 + thickness, COLOR_BLACK);
639  }
640  }
641 
642  // Edge
643  thickness = flags & RECT_BORDER_MASK;
644  for (i=0; i<thickness; i++)
645  {
646  // Clipping done in draw_hline and draw_vline
647  draw_vline(x1, y1 + round * 2, y2 - y1 - round * 4 + 1, FG_COLOR(cl));
648  draw_vline(x2, y1 + round * 2, y2 - y1 - round * 4 + 1, FG_COLOR(cl));
649  draw_hline(x1 + 1 + round, y1, x2 - x1 - round * 2 - 1, FG_COLOR(cl));
650  draw_hline(x1 + 1 + round, y2, x2 - x1 - round * 2 - 1, FG_COLOR(cl));
651 
652  x1++; x2--;
653  y1++; y2--;
654 
655  round = 0;
656  }
657 
658  // Fill
659  if (flags & DRAW_FILLED)
660  {
661  // Clip values
662  if (x1 < 0) x1 = 0;
663  if (y1 < 0) y1 = 0;
664  if (x2 >= camera_screen.width) x2 = camera_screen.width - 1;
665  if (y2 >= camera_screen.height) y2 = camera_screen.height - 1;
666 
667  coord y;
668  for (y = y1; y <= y2; ++y)
669  draw_hline(x1, y, x2 - x1 + 1, BG_COLOR(cl));
670  }
671 }
void draw_restore ( )

Definiert in Zeile 418 der Datei gui_draw.c.

419 {
420  if(draw_is_suspended()) {
421  return;
422  }
424 
425  draw_set_guard();
426 #ifdef CAM_TOUCHSCREEN_UI
427  redraw_buttons = 1;
428 #endif
429 }
void draw_set_draw_proc ( void(*)(unsigned int offset, color cl pixel_proc)

Definiert in Zeile 163 der Datei gui_draw.c.

164 {
165  draw_pixel_proc_norm = (pixel_proc)?pixel_proc:draw_pixel_std;
166  if (conf.rotate_osd)
167  {
170  }
171  else
172  {
174  }
175 }
void draw_set_guard ( )

Definiert in Zeile 354 der Datei gui_draw.c.

355 {
356 #ifdef DRAW_ON_ACTIVE_BITMAP_BUFFER_ONLY
357  *((unsigned char*)(bitmap_buffer[0])) = GUARD_VAL;
358  *((unsigned char*)(bitmap_buffer[1])) = GUARD_VAL;
359 #else
360  *((unsigned char*)(frame_buffer[0])) = GUARD_VAL;
361  *((unsigned char*)(frame_buffer[1])) = GUARD_VAL;
362 #endif
363 }
int draw_string ( coord  x,
coord  y,
const char *  s,
twoColors  cl 
)

Definiert in Zeile 1055 der Datei gui_draw.c.

1056 {
1058 }
int draw_string_clipped ( coord  x,
coord  y,
const char *  s,
twoColors  cl,
int  max_width 
)

Definiert in Zeile 1037 der Datei gui_draw.c.

1038 {
1039  while (*s && (*s != '\n') && (max_width >= FONT_WIDTH))
1040  {
1041  draw_char(x, y, *s, cl);
1042  s++;
1043  max_width -= FONT_WIDTH;
1044  x += FONT_WIDTH;
1045  if ((x>=camera_screen.width) && (*s))
1046  {
1047  draw_char(x-FONT_WIDTH,y, '>', cl);
1048  break;
1049  }
1050  }
1051  return x;
1052 }
int draw_string_justified ( coord  x,
coord  y,
const char *  s,
twoColors  cl,
int  xo,
int  max_width,
int  justification 
)

Definiert in Zeile 1065 der Datei gui_draw.c.

1066 {
1067  // Get length in pixels
1068  const char *e = strchr(s, '\n');
1069  int l;
1070  if (e)
1071  l = (e - s) * FONT_WIDTH;
1072  else
1073  l = strlen(s) * FONT_WIDTH;
1074  if (l > max_width) l = max_width;
1075 
1076  // Calculate justification offset
1077  switch (justification & 0xF)
1078  {
1079  case TEXT_RIGHT:
1080  xo = (max_width - l);
1081  break;
1082  case TEXT_CENTER:
1083  xo = ((max_width - l) >> 1);
1084  break;
1085  }
1086 
1087  // Fill left side
1088  if ((justification & TEXT_FILL) && (xo > 0))
1090 
1091  // Draw string (get length drawn in pixels)
1092  l = draw_string_clipped(x+xo, y, s, cl, max_width - xo) - x;
1093 
1094  // Fill right side
1095  if ((justification & TEXT_FILL) && (l < max_width))
1096  draw_rectangle(x+l, y, x+max_width-1, y+FONT_HEIGHT-1, cl, RECT_BORDER0|DRAW_FILLED);
1097 
1098  // Return start of first character
1099  return x+xo;
1100 }
void draw_string_scaled ( coord  x,
coord  y,
const char *  s,
twoColors  cl,
int  xsize,
int  ysize 
)

Definiert in Zeile 1157 der Datei gui_draw.c.

1158 {
1159  while (*s && (*s != '\n'))
1160  {
1161  draw_char_scaled(x, y, *s, cl, xsize, ysize);
1162  s++;
1163  x+=FONT_WIDTH*xsize;
1164  if ((x>=camera_screen.width) && (*s))
1165  {
1166  draw_char_scaled(x-FONT_WIDTH*xsize,y, '>', cl, xsize, ysize);
1167  break;
1168  }
1169  }
1170 }
void draw_suspend ( int  ms)

Definiert in Zeile 403 der Datei gui_draw.c.

404 {
405  int t=get_tick_count() + ms;
406  // only change if not already suspended to a later time
407  if(t > draw_restore_suspend_tick) {
409  }
410 }
int draw_test_guard ( )

Definiert in Zeile 365 der Datei gui_draw.c.

366 {
367 #ifdef DRAW_ON_ACTIVE_BITMAP_BUFFER_ONLY
368  if (*((unsigned char*)(bitmap_buffer[active_bitmap_buffer])) != GUARD_VAL) return 0;
369 #else
370  if (*((unsigned char*)(frame_buffer[0])) != GUARD_VAL) return 0;
371  if (*((unsigned char*)(frame_buffer[1])) != GUARD_VAL) return 0;
372 #endif
373  return 1;
374 }
int draw_text_justified ( coord  x,
coord  y,
const char *  s,
twoColors  cl,
int  max_chars,
int  max_lines,
int  justification 
)

Definiert in Zeile 1138 der Datei gui_draw.c.

1139 {
1140  int rx = 0;
1141  while (s && *s && (max_lines > 0))
1142  {
1143  const char *e = strchr(s, '\n');
1144  if (e) e++;
1145 
1146  rx = draw_string_justified(x, y, s, cl, 0, max_chars*FONT_WIDTH, justification);
1147 
1148  s = e;
1149  y += FONT_HEIGHT;
1150  max_lines--;
1151  }
1152  return rx;
1153 }
void draw_txt_string ( coord  col,
coord  row,
const char *  str,
twoColors  cl 
)

Definiert in Zeile 1239 der Datei gui_draw.c.

1240 {
1242 }
void draw_vline ( coord  x,
coord  y,
int  len,
color  cl 
)

Definiert in Zeile 603 der Datei gui_draw.c.

604 {
605  if ((x < 0) || (x >= camera_screen.width) || (y >= camera_screen.height)) return;
606  if (y < 0) { len += y; y = 0; }
608  for (; len>0; len--, y++)
609  draw_pixel(x, y, cl);
610 }
color get_script_color ( int  cl)

Definiert in Zeile 1469 der Datei gui_draw.c.

1470 {
1471  if (cl < 256)
1472  return cl;
1473  else
1474  return chdk_colors[cl-256];
1475 }
void set_transparent ( unsigned int  offset,
int  n_pixel 
)
int text_dimensions ( const char *  s,
int  width,
int  max_chars,
int *  max_lines 
)

Definiert in Zeile 1107 der Datei gui_draw.c.

1108 {
1109  int l = 0, n;
1110  while (s && *s && (l < *max_lines))
1111  {
1112  const char *e = strchr(s, '\n');
1113  if (e)
1114  {
1115  n = e - s;
1116  e++;
1117  }
1118  else
1119  {
1120  n = strlen(s);
1121  }
1122 
1123  if (n > width) width = n;
1124 
1125  s = e;
1126  l++;
1127  }
1128  *max_lines = l;
1129  if (width > max_chars) width = max_chars;
1130  return width;
1131 }
void update_draw_proc ( )

Definiert in Zeile 177 der Datei gui_draw.c.

twoColors user_color ( confColor  c)

Definiert in Zeile 1485 der Datei gui_draw.c.

1486 {
1487  color fg = chdkColorToCanonColor(cc.fg);
1488  color bg = chdkColorToCanonColor(cc.bg);
1489 
1490  return MAKE_COLOR(bg,fg);
1491 }

Variablen-Dokumentation

unsigned char* chdk_colors

Definiert in Zeile 1457 der Datei gui_draw.c.