CHDK_DE Vorschauversion  Trunk Rev. 5632
 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 1405 der Datei gui_draw.c.

1406 {
1407  if (col.type)
1408  return chdk_colors[col.col];
1409  return col.col;
1410 }
unsigned int color_to_rawpx ( color  cl,
unsigned int *  op 
)

Definiert in Zeile 145 der Datei gui_draw.c.

146 {
147  return 0;
148 }
void draw_button ( int  x,
int  y,
int  w,
int  str_id,
int  active 
)

Definiert in Zeile 1316 der Datei gui_draw.c.

1317 {
1319  w = w * FONT_WIDTH;
1320 
1321  draw_rectangle(x-2, y-2, x+w+2, y+FONT_HEIGHT+2, cl, RECT_BORDER1|DRAW_FILLED|RECT_SHADOW1); // main box
1322  draw_string(x+((w-(strlen(lang_str(str_id))*FONT_WIDTH))>>1), y, lang_str(str_id), cl);
1323 }
void draw_char ( coord  x,
coord  y,
const char  ch,
twoColors  cl 
)

Definiert in Zeile 652 der Datei gui_draw.c.

653 {
654  int i, ii;
655 
656  unsigned int offset, size;
657  unsigned char *sym = get_cdata(&offset, &size, ch);
658 
659  // First draw blank lines at top
660  for (i=0; i<offset; i++)
662 
663  // Now draw character data
664 
665  int j;
666  for (j=i; i<size;)
667  {
668  unsigned int dsym;
669  int rep;
670 #ifdef BUILTIN_FONT_RLE_COMPRESSED
671  dsym = fontdata_lookup[sym[j] & 0x7f];
672  rep = sym[j] & 0x80;
673 #else
674  dsym = sym[j];
675  rep = 0;
676 #endif
677  for (ii=0; ii<FONT_WIDTH; ii++)
678  {
679  draw_pixel(x+ii, y+i, (dsym & (0x80>>ii))? FG_COLOR(cl) : BG_COLOR(cl));
680  }
681  if (rep)
682  {
683  i++;
684  for (ii=0; ii<FONT_WIDTH; ii++)
685  {
686  draw_pixel(x+ii, y+i, (dsym & (0x80>>ii))? FG_COLOR(cl) : BG_COLOR(cl));
687  }
688  }
689  i++;
690  j++;
691  }
692 
693  // Last draw blank lines at bottom
694  for (; i<FONT_HEIGHT; i++)
695  draw_hline(x, y+i, FONT_WIDTH, BG_COLOR(cl));
696 }
void draw_dblpixel_raw ( unsigned int  offset,
unsigned int  px,
unsigned int  op 
)

Definiert in Zeile 149 der Datei gui_draw.c.

150 {
151 }
void draw_ellipse ( coord  xc,
coord  yc,
unsigned int  a,
unsigned int  b,
color  cl,
int  flags 
)

Definiert in Zeile 1230 der Datei gui_draw.c.

1231 {
1232  // Bresenham fast ellipse algorithm - http://homepage.smc.edu/kennedy_john/BELIPSE.PDF
1233  int X, Y;
1234  int XChange, YChange;
1235  int EllipseError;
1236  int TwoASquare, TwoBSquare;
1237  int StoppingX, StoppingY;
1238  TwoASquare = 2*XRadius*XRadius;
1239  TwoBSquare = 2*YRadius*YRadius;
1240  X = XRadius;
1241  Y = 0;
1242  XChange = YRadius*YRadius*(1-2*XRadius);
1243  YChange = XRadius*XRadius;
1244  EllipseError = 0;
1245  StoppingX = TwoBSquare*XRadius;
1246  StoppingY = 0;
1247  while ( StoppingX >= StoppingY )
1248  {
1249  if (flags & DRAW_FILLED)
1250  {
1251  draw_hline(CX-X,CY-Y,X*2+1,cl);
1252  draw_hline(CX-X,CY+Y,X*2+1,cl);
1253  }
1254  else
1255  {
1256  draw_pixel(CX-X,CY-Y,cl);
1257  draw_pixel(CX-X,CY+Y,cl);
1258  draw_pixel(CX+X,CY-Y,cl);
1259  draw_pixel(CX+X,CY+Y,cl);
1260  }
1261  Y++;
1262  StoppingY += TwoASquare;
1263  EllipseError += YChange;
1264  YChange += TwoASquare;
1265  if ((2*EllipseError + XChange) > 0 )
1266  {
1267  X--;
1268  StoppingX -= TwoBSquare;
1269  EllipseError += XChange;
1270  XChange += TwoBSquare;
1271  }
1272  }
1273  X = 0;
1274  Y = YRadius;
1275  XChange = YRadius*YRadius;
1276  YChange = XRadius*XRadius*(1-2*YRadius);
1277  EllipseError = 0;
1278  StoppingX = 0;
1279  StoppingY = TwoASquare*YRadius;
1280  int lastY = Y + 1;
1281  while ( StoppingX <= StoppingY )
1282  {
1283  if (flags & DRAW_FILLED)
1284  {
1285  // Only draw lines if Y has changed
1286  if (lastY != Y)
1287  {
1288  draw_hline(CX-X,CY-Y,X*2+1,cl);
1289  draw_hline(CX-X,CY+Y,X*2+1,cl);
1290  lastY = Y;
1291  }
1292  }
1293  else
1294  {
1295  draw_pixel(CX-X,CY-Y,cl);
1296  draw_pixel(CX-X,CY+Y,cl);
1297  draw_pixel(CX+X,CY-Y,cl);
1298  draw_pixel(CX+X,CY+Y,cl);
1299  }
1300  X++;
1301  StoppingX += TwoBSquare;
1302  EllipseError += XChange;
1303  XChange += TwoBSquare;
1304  if ((2*EllipseError + YChange) > 0 )
1305  {
1306  Y--;
1307  StoppingY -= TwoASquare;
1308  EllipseError += YChange;
1309  YChange += TwoASquare;
1310  }
1311  }
1312 }
color draw_get_pixel ( coord  x,
coord  y 
)

Definiert in Zeile 463 der Datei gui_draw.c.

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

Definiert in Zeile 489 der Datei gui_draw.c.

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

Definiert in Zeile 540 der Datei gui_draw.c.

541 {
542  if ((y < 0) || (x >= camera_screen.width) || (y >= camera_screen.height)) return;
543  if (x < 0) { len += x; x = 0; }
544  if ((x + len) > camera_screen.width) len = camera_screen.width - x;
545  if (conf.rotate_osd)
546  {
547  if ((y == camera_screen.height-1) && ((x+len) >= camera_screen.width-1)) { x--; len--; } // Skip guard pixel
548  }
549  else
550  {
551  if ((y == 0) && (x == 0)) { x++; len--; } // Skip guard pixel
552  }
553  register unsigned int offset = y * camera_screen.buffer_width + ASPECT_XCORRECTION(x);
554  len = ASPECT_XCORRECTION(len); // Scale the line length if needed
555  for (; len>0; len--, offset++)
556  draw_pixel_proc(offset, cl);
557 }
void draw_icon_cmds ( coord  x,
coord  y,
icon_cmd cmds 
)

Definiert in Zeile 1327 der Datei gui_draw.c.

1328 {
1329  int x1, y1, x2, y2;
1330  while (1)
1331  {
1332  if (FONT_HEIGHT > 16)
1333  {
1334  x1 = cmds->x1<<1;
1335  y1 = cmds->y1<<1;
1336  x2 = cmds->x2<<1;
1337  y2 = cmds->y2<<1;
1338  }
1339  else
1340  {
1341  x1 = cmds->x1;
1342  y1 = cmds->y1;
1343  x2 = cmds->x2;
1344  y2 = cmds->y2;
1345  }
1346  color cf = chdk_colors[cmds->cf]; // Convert color indexes to actual colors
1347  color cb = chdk_colors[cmds->cb];
1348  switch (cmds->action)
1349  {
1350  default:
1351  case IA_END:
1352  return;
1353  case IA_HLINE:
1354  draw_hline(x+x1, y+y1, x2, cb);
1355  break;
1356  case IA_VLINE:
1357  draw_vline(x+x1, y+y1, y2, cb);
1358  break;
1359  case IA_LINE:
1360  draw_line(x+x1, y+y1, x+x2, y+y2, cb);
1361  break;
1362  case IA_RECT:
1363  draw_rectangle(x+x1, y+y1, x+x2, y+y2, MAKE_COLOR(cb,cf), RECT_BORDER1);
1364  break;
1365  case IA_FILLED_RECT:
1366  draw_rectangle(x+x1, y+y1, x+x2, y+y2, MAKE_COLOR(cb,cf), RECT_BORDER1|DRAW_FILLED);
1367  break;
1368  case IA_ROUND_RECT:
1369  draw_rectangle(x+x1, y+y1, x+x2, y+y2, MAKE_COLOR(cb,cf), RECT_BORDER1|RECT_ROUND_CORNERS);
1370  break;
1371  case IA_FILLED_ROUND_RECT:
1373  break;
1374  }
1375  cmds++;
1376  }
1377 }
void draw_init ( )

Definiert in Zeile 393 der Datei gui_draw.c.

394 {
395 #ifndef DRAW_ON_ACTIVE_BITMAP_BUFFER_ONLY
398 #endif
400 
401  draw_set_guard();
402 }
int draw_is_suspended ( void  )

Definiert in Zeile 414 der Datei gui_draw.c.

415 {
417 }
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 1165 der Datei gui_draw.c.

1166 {
1167  if ((scale.x == 0) || (scale.y == 0) || ((scale.x == 1) && (scale.y == 1)))
1168  draw_string(pos.x+xo, pos.y+yo, s, c);
1169  else
1170  draw_string_scaled(pos.x+(xo*scale.x), pos.y+(yo*scale.y), s, c, scale.x, scale.y);
1171 }
void draw_pixel ( coord  x,
coord  y,
color  cl 
)

Definiert in Zeile 434 der Datei gui_draw.c.

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

Definiert in Zeile 448 der Datei gui_draw.c.

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

Definiert in Zeile 571 der Datei gui_draw.c.

572 {
573  // Normalise values
574  if (x1 > x2)
575  swap(x1, x2);
576  if (y1 > y2)
577  swap(y1, y2);
578 
579  // Check if completely off screen
580  if ((x2 < 0) || (y2 < 0) || (x1 >= camera_screen.width) || (y1 >= camera_screen.height))
581  return;
582 
583  int round = (flags & RECT_ROUND_CORNERS) ? 1 : 0;
584  int thickness;
585  int i;
586 
587  // Shadow (do this first, as edge draw shrinks rectangle for fill)
588  if (flags & RECT_SHADOW_MASK)
589  {
590  thickness = ((flags & RECT_SHADOW_MASK) >> 4);
591  for (i=1; i<=thickness; i++)
592  {
593  draw_vline(x2+i, y1+1, y2 - y1, COLOR_BLACK);
594  draw_hline(x1+1, y2+i, x2 - x1 + thickness, COLOR_BLACK);
595  }
596  }
597 
598  // Edge
599  thickness = flags & RECT_BORDER_MASK;
600  for (i=0; i<thickness; i++)
601  {
602  // Clipping done in draw_hline and draw_vline
603  draw_vline(x1, y1 + round * 2, y2 - y1 - round * 4 + 1, FG_COLOR(cl));
604  draw_vline(x2, y1 + round * 2, y2 - y1 - round * 4 + 1, FG_COLOR(cl));
605  draw_hline(x1 + 1 + round, y1, x2 - x1 - round * 2 - 1, FG_COLOR(cl));
606  draw_hline(x1 + 1 + round, y2, x2 - x1 - round * 2 - 1, FG_COLOR(cl));
607 
608  x1++; x2--;
609  y1++; y2--;
610 
611  round = 0;
612  }
613 
614  // Fill
615  if (flags & DRAW_FILLED)
616  {
617  // Clip values
618  if (x1 < 0) x1 = 0;
619  if (y1 < 0) y1 = 0;
620  if (x2 >= camera_screen.width) x2 = camera_screen.width - 1;
621  if (y2 >= camera_screen.height) y2 = camera_screen.height - 1;
622 
623  coord y;
624  for (y = y1; y <= y2; ++y)
625  draw_hline(x1, y, x2 - x1 + 1, BG_COLOR(cl));
626  }
627 }
void draw_restore ( )

Definiert in Zeile 420 der Datei gui_draw.c.

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

Definiert in Zeile 165 der Datei gui_draw.c.

166 {
167  draw_pixel_proc_norm = (pixel_proc)?pixel_proc:draw_pixel_std;
168  if (conf.rotate_osd)
169  {
172  }
173  else
174  {
176  }
177 }
void draw_set_guard ( )

Definiert in Zeile 356 der Datei gui_draw.c.

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

Definiert in Zeile 1011 der Datei gui_draw.c.

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

Definiert in Zeile 993 der Datei gui_draw.c.

994 {
995  while (*s && (*s != '\n') && (max_width >= FONT_WIDTH))
996  {
997  draw_char(x, y, *s, cl);
998  s++;
999  max_width -= FONT_WIDTH;
1000  x += FONT_WIDTH;
1001  if ((x>=camera_screen.width) && (*s))
1002  {
1003  draw_char(x-FONT_WIDTH,y, '>', cl);
1004  break;
1005  }
1006  }
1007  return x;
1008 }
int draw_string_justified ( coord  x,
coord  y,
const char *  s,
twoColors  cl,
int  xo,
int  max_width,
int  justification 
)

Definiert in Zeile 1021 der Datei gui_draw.c.

1022 {
1023  // Get length in pixels
1024  const char *e = strchr(s, '\n');
1025  int l;
1026  if (e)
1027  l = (e - s) * FONT_WIDTH;
1028  else
1029  l = strlen(s) * FONT_WIDTH;
1030  if (l > max_width) l = max_width;
1031 
1032  // Calculate justification offset
1033  switch (justification & 0xF)
1034  {
1035  case TEXT_RIGHT:
1036  xo = (max_width - l);
1037  break;
1038  case TEXT_CENTER:
1039  xo = ((max_width - l) >> 1);
1040  break;
1041  }
1042 
1043  // Fill left side
1044  if ((justification & TEXT_FILL) && (xo > 0))
1046 
1047  // Draw string (get length drawn in pixels)
1048  l = draw_string_clipped(x+xo, y, s, cl, max_width - xo) - x;
1049 
1050  // Fill right side
1051  if ((justification & TEXT_FILL) && (l < max_width))
1052  draw_rectangle(x+l, y, x+max_width-1, y+FONT_HEIGHT-1, cl, RECT_BORDER0|DRAW_FILLED);
1053 
1054  // Return start of first character
1055  return x+xo;
1056 }
void draw_string_scaled ( coord  x,
coord  y,
const char *  s,
twoColors  cl,
int  xsize,
int  ysize 
)

Definiert in Zeile 1113 der Datei gui_draw.c.

1114 {
1115  while (*s && (*s != '\n'))
1116  {
1117  draw_char_scaled(x, y, *s, cl, xsize, ysize);
1118  s++;
1119  x+=FONT_WIDTH*xsize;
1120  if ((x>=camera_screen.width) && (*s))
1121  {
1122  draw_char_scaled(x-FONT_WIDTH*xsize,y, '>', cl, xsize, ysize);
1123  break;
1124  }
1125  }
1126 }
void draw_suspend ( int  ms)

Definiert in Zeile 405 der Datei gui_draw.c.

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

Definiert in Zeile 367 der Datei gui_draw.c.

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

Definiert in Zeile 1094 der Datei gui_draw.c.

1095 {
1096  int rx = 0;
1097  while (s && *s && (max_lines > 0))
1098  {
1099  const char *e = strchr(s, '\n');
1100  if (e) e++;
1101 
1102  rx = draw_string_justified(x, y, s, cl, 0, max_chars*FONT_WIDTH, justification);
1103 
1104  s = e;
1105  y += FONT_HEIGHT;
1106  max_lines--;
1107  }
1108  return rx;
1109 }
void draw_txt_string ( coord  col,
coord  row,
const char *  str,
twoColors  cl 
)

Definiert in Zeile 1195 der Datei gui_draw.c.

1196 {
1198 }
void draw_vline ( coord  x,
coord  y,
int  len,
color  cl 
)

Definiert in Zeile 559 der Datei gui_draw.c.

560 {
561  if ((x < 0) || (x >= camera_screen.width) || (y >= camera_screen.height)) return;
562  if (y < 0) { len += y; y = 0; }
564  for (; len>0; len--, y++)
565  draw_pixel(x, y, cl);
566 }
color get_script_color ( int  cl)

Definiert in Zeile 1396 der Datei gui_draw.c.

1397 {
1398  if (cl < 256)
1399  return cl;
1400  else
1401  return chdk_colors[cl-256];
1402 }
void set_transparent ( unsigned int  offset,
int  n_pixel 
)

Definiert in Zeile 152 der Datei gui_draw.c.

153 {
154 }
int text_dimensions ( const char *  s,
int  width,
int  max_chars,
int *  max_lines 
)

Definiert in Zeile 1063 der Datei gui_draw.c.

1064 {
1065  int l = 0, n;
1066  while (s && *s && (l < *max_lines))
1067  {
1068  const char *e = strchr(s, '\n');
1069  if (e)
1070  {
1071  n = e - s;
1072  e++;
1073  }
1074  else
1075  {
1076  n = strlen(s);
1077  }
1078 
1079  if (n > width) width = n;
1080 
1081  s = e;
1082  l++;
1083  }
1084  *max_lines = l;
1085  if (width > max_chars) width = max_chars;
1086  return width;
1087 }
void update_draw_proc ( )

Definiert in Zeile 179 der Datei gui_draw.c.

twoColors user_color ( confColor  c)

Definiert in Zeile 1412 der Datei gui_draw.c.

1413 {
1414  color fg = chdkColorToCanonColor(cc.fg);
1415  color bg = chdkColorToCanonColor(cc.bg);
1416 
1417  return MAKE_COLOR(bg,fg);
1418 }

Variablen-Dokumentation

unsigned char* chdk_colors

Definiert in Zeile 1384 der Datei gui_draw.c.