CHDK_DE Vorschauversion  Trunk Rev. 5216
 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_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 149 der Datei gui_draw.h.

150 {
151  IA_END,
152  IA_HLINE,
153  IA_VLINE,
154  IA_LINE,
155  IA_RECT,
159 };

Dokumentation der Funktionen

color chdkColorToCanonColor ( chdkColor  c)

Definiert in Zeile 1384 der Datei gui_draw.c.

1385 {
1386  if (col.type)
1387  return chdk_colors[col.col];
1388  return col.col;
1389 }
unsigned int color_to_rawpx ( color  cl,
unsigned int *  op 
)

Definiert in Zeile 141 der Datei gui_draw.c.

142 {
143  return 0;
144 }
void draw_button ( int  x,
int  y,
int  w,
int  str_id,
int  active 
)

Definiert in Zeile 1295 der Datei gui_draw.c.

1296 {
1298  w = w * FONT_WIDTH;
1299 
1300  draw_rectangle(x-2, y-2, x+w+2, y+FONT_HEIGHT+2, cl, RECT_BORDER1|DRAW_FILLED|RECT_SHADOW1); // main box
1301  draw_string(x+((w-(strlen(lang_str(str_id))*FONT_WIDTH))>>1), y, lang_str(str_id), cl);
1302 }
void draw_char ( coord  x,
coord  y,
const char  ch,
twoColors  cl 
)

Definiert in Zeile 631 der Datei gui_draw.c.

632 {
633  int i, ii;
634 
635  unsigned int offset, size;
636  unsigned char *sym = get_cdata(&offset, &size, ch);
637 
638  // First draw blank lines at top
639  for (i=0; i<offset; i++)
641 
642  // Now draw character data
643 
644  int j;
645  for (j=i; i<size;)
646  {
647  unsigned int dsym;
648  int rep;
649 #ifdef BUILTIN_FONT_RLE_COMPRESSED
650  dsym = fontdata_lookup[sym[j] & 0x7f];
651  rep = sym[j] & 0x80;
652 #else
653  dsym = sym[j];
654  rep = 0;
655 #endif
656  for (ii=0; ii<FONT_WIDTH; ii++)
657  {
658  draw_pixel(x+ii, y+i, (dsym & (0x80>>ii))? FG_COLOR(cl) : BG_COLOR(cl));
659  }
660  if (rep)
661  {
662  i++;
663  for (ii=0; ii<FONT_WIDTH; ii++)
664  {
665  draw_pixel(x+ii, y+i, (dsym & (0x80>>ii))? FG_COLOR(cl) : BG_COLOR(cl));
666  }
667  }
668  i++;
669  j++;
670  }
671 
672  // Last draw blank lines at bottom
673  for (; i<FONT_HEIGHT; i++)
674  draw_hline(x, y+i, FONT_WIDTH, BG_COLOR(cl));
675 }
void draw_dblpixel_raw ( unsigned int  offset,
unsigned int  px,
unsigned int  op 
)

Definiert in Zeile 145 der Datei gui_draw.c.

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

Definiert in Zeile 1209 der Datei gui_draw.c.

1210 {
1211  // Bresenham fast ellipse algorithm - http://homepage.smc.edu/kennedy_john/BELIPSE.PDF
1212  int X, Y;
1213  int XChange, YChange;
1214  int EllipseError;
1215  int TwoASquare, TwoBSquare;
1216  int StoppingX, StoppingY;
1217  TwoASquare = 2*XRadius*XRadius;
1218  TwoBSquare = 2*YRadius*YRadius;
1219  X = XRadius;
1220  Y = 0;
1221  XChange = YRadius*YRadius*(1-2*XRadius);
1222  YChange = XRadius*XRadius;
1223  EllipseError = 0;
1224  StoppingX = TwoBSquare*XRadius;
1225  StoppingY = 0;
1226  while ( StoppingX >= StoppingY )
1227  {
1228  if (flags & DRAW_FILLED)
1229  {
1230  draw_hline(CX-X,CY-Y,X*2+1,cl);
1231  draw_hline(CX-X,CY+Y,X*2+1,cl);
1232  }
1233  else
1234  {
1235  draw_pixel(CX-X,CY-Y,cl);
1236  draw_pixel(CX-X,CY+Y,cl);
1237  draw_pixel(CX+X,CY-Y,cl);
1238  draw_pixel(CX+X,CY+Y,cl);
1239  }
1240  Y++;
1241  StoppingY += TwoASquare;
1242  EllipseError += YChange;
1243  YChange += TwoASquare;
1244  if ((2*EllipseError + XChange) > 0 )
1245  {
1246  X--;
1247  StoppingX -= TwoBSquare;
1248  EllipseError += XChange;
1249  XChange += TwoBSquare;
1250  }
1251  }
1252  X = 0;
1253  Y = YRadius;
1254  XChange = YRadius*YRadius;
1255  YChange = XRadius*XRadius*(1-2*YRadius);
1256  EllipseError = 0;
1257  StoppingX = 0;
1258  StoppingY = TwoASquare*YRadius;
1259  int lastY = Y + 1;
1260  while ( StoppingX <= StoppingY )
1261  {
1262  if (flags & DRAW_FILLED)
1263  {
1264  // Only draw lines if Y has changed
1265  if (lastY != Y)
1266  {
1267  draw_hline(CX-X,CY-Y,X*2+1,cl);
1268  draw_hline(CX-X,CY+Y,X*2+1,cl);
1269  lastY = Y;
1270  }
1271  }
1272  else
1273  {
1274  draw_pixel(CX-X,CY-Y,cl);
1275  draw_pixel(CX-X,CY+Y,cl);
1276  draw_pixel(CX+X,CY-Y,cl);
1277  draw_pixel(CX+X,CY+Y,cl);
1278  }
1279  X++;
1280  StoppingX += TwoBSquare;
1281  EllipseError += XChange;
1282  XChange += TwoBSquare;
1283  if ((2*EllipseError + YChange) > 0 )
1284  {
1285  Y--;
1286  StoppingY -= TwoASquare;
1287  EllipseError += YChange;
1288  YChange += TwoASquare;
1289  }
1290  }
1291 }
color draw_get_pixel ( coord  x,
coord  y 
)

Definiert in Zeile 442 der Datei gui_draw.c.

443 {
444 #ifndef THUMB_FW
445  if ((x < 0) || (y < 0) || (x >= camera_screen.width) || (y >= camera_screen.height)) return 0;
446  if (conf.rotate_osd)
447  {
448 #ifdef DRAW_ON_ACTIVE_BITMAP_BUFFER_ONLY
450 #else
452 #endif
453  }
454  else
455  {
456 #ifdef DRAW_ON_ACTIVE_BITMAP_BUFFER_ONLY
458 #else
460 #endif
461  }
462 #else
463  // DIGIC 6 not supported
464  return 0;
465 #endif
466 }
color draw_get_pixel_unrotated ( coord  x,
coord  y 
)

Definiert in Zeile 468 der Datei gui_draw.c.

469 {
470 #ifndef THUMB_FW
471  if ((x < 0) || (y < 0) || (x >= camera_screen.width) || (y >= camera_screen.height)) return 0;
472 #ifdef DRAW_ON_ACTIVE_BITMAP_BUFFER_ONLY
474 #else
476 #endif
477 #else
478  // DIGIC 6 not supported
479  return 0;
480 #endif
481 }
void draw_hline ( coord  x,
coord  y,
int  len,
color  cl 
)

Definiert in Zeile 519 der Datei gui_draw.c.

520 {
521  if ((y < 0) || (x >= camera_screen.width) || (y >= camera_screen.height)) return;
522  if (x < 0) { len += x; x = 0; }
523  if ((x + len) > camera_screen.width) len = camera_screen.width - x;
524  if (conf.rotate_osd)
525  {
526  if ((y == camera_screen.height-1) && ((x+len) >= camera_screen.width-1)) { x--; len--; } // Skip guard pixel
527  }
528  else
529  {
530  if ((y == 0) && (x == 0)) { x++; len--; } // Skip guard pixel
531  }
532  register unsigned int offset = y * camera_screen.buffer_width + ASPECT_XCORRECTION(x);
533  len = ASPECT_XCORRECTION(len); // Scale the line length if needed
534  for (; len>0; len--, offset++)
535  draw_pixel_proc(offset, cl);
536 }
void draw_icon_cmds ( coord  x,
coord  y,
icon_cmd cmds 
)

Definiert in Zeile 1306 der Datei gui_draw.c.

1307 {
1308  int x1, y1, x2, y2;
1309  while (1)
1310  {
1311  if (FONT_HEIGHT > 16)
1312  {
1313  x1 = cmds->x1<<1;
1314  y1 = cmds->y1<<1;
1315  x2 = cmds->x2<<1;
1316  y2 = cmds->y2<<1;
1317  }
1318  else
1319  {
1320  x1 = cmds->x1;
1321  y1 = cmds->y1;
1322  x2 = cmds->x2;
1323  y2 = cmds->y2;
1324  }
1325  color cf = chdk_colors[cmds->cf]; // Convert color indexes to actual colors
1326  color cb = chdk_colors[cmds->cb];
1327  switch (cmds->action)
1328  {
1329  default:
1330  case IA_END:
1331  return;
1332  case IA_HLINE:
1333  draw_hline(x+x1, y+y1, x2, cb);
1334  break;
1335  case IA_VLINE:
1336  draw_vline(x+x1, y+y1, y2, cb);
1337  break;
1338  case IA_LINE:
1339  draw_line(x+x1, y+y1, x+x2, y+y2, cb);
1340  break;
1341  case IA_RECT:
1342  draw_rectangle(x+x1, y+y1, x+x2, y+y2, MAKE_COLOR(cb,cf), RECT_BORDER1);
1343  break;
1344  case IA_FILLED_RECT:
1345  draw_rectangle(x+x1, y+y1, x+x2, y+y2, MAKE_COLOR(cb,cf), RECT_BORDER1|DRAW_FILLED);
1346  break;
1347  case IA_ROUND_RECT:
1348  draw_rectangle(x+x1, y+y1, x+x2, y+y2, MAKE_COLOR(cb,cf), RECT_BORDER1|RECT_ROUND_CORNERS);
1349  break;
1350  case IA_FILLED_ROUND_RECT:
1352  break;
1353  }
1354  cmds++;
1355  }
1356 }
void draw_init ( )

Definiert in Zeile 389 der Datei gui_draw.c.

390 {
391 #ifndef DRAW_ON_ACTIVE_BITMAP_BUFFER_ONLY
394 #endif
396 
397  draw_set_guard();
398 }
void draw_line ( coord  x1,
coord  y1,
coord  x2,
coord  y2,
color  cl 
)

Definiert in Zeile 486 der Datei gui_draw.c.

487 {
488  unsigned char steep = abs(y2 - y1) > abs(x2 - x1);
489  if (steep)
490  {
491  swap(x1, y1);
492  swap(x2, y2);
493  }
494  if (x1 > x2)
495  {
496  swap(x1, x2);
497  swap(y1, y2);
498  }
499  int deltax = x2 - x1;
500  int deltay = abs(y2 - y1);
501  int error = 0;
502  int y = y1;
503  int ystep = (y1 < y2)?1:-1;
504  int x;
505  for (x=x1; x<=x2; ++x)
506  {
507  if (steep) draw_pixel(y, x, cl);
508  else draw_pixel(x, y, cl);
509  error += deltay;
510  if ((error<<1) >= deltax)
511  {
512  y += ystep;
513  error -= deltax;
514  }
515  }
516 }
void draw_osd_string ( OSD_pos  pos,
int  xo,
int  yo,
char *  s,
twoColors  c,
OSD_scale  scale 
)

Definiert in Zeile 1144 der Datei gui_draw.c.

1145 {
1146  if ((scale.x == 0) || (scale.y == 0) || ((scale.x == 1) && (scale.y == 1)))
1147  draw_string(pos.x+xo, pos.y+yo, s, c);
1148  else
1149  draw_string_scaled(pos.x+(xo*scale.x), pos.y+(yo*scale.y), s, c, scale.x, scale.y);
1150 }
void draw_pixel ( coord  x,
coord  y,
color  cl 
)

Definiert in Zeile 413 der Datei gui_draw.c.

414 {
415  // Make sure pixel is on screen. Skip top left pixel if screen erase detection is on to avoid triggering the detector.
416  if ((x < 0) || (y < 0) || (x >= camera_screen.width) || (y >= camera_screen.height) || ((x == 0) && (y == 0))) return;
417  else
418  {
419  register unsigned int offset = y * camera_screen.buffer_width + ASPECT_XCORRECTION(x);
420  draw_pixel_proc(offset, cl);
421 #if CAM_USES_ASPECT_CORRECTION
422  draw_pixel_proc(offset+1, cl); // Draw second pixel if screen scaling is needed
423 #endif
424  }
425 }
void draw_pixel_unrotated ( coord  x,
coord  y,
color  cl 
)

Definiert in Zeile 427 der Datei gui_draw.c.

428 {
429  // Make sure pixel is on screen. Skip top left pixel if screen erase detection is on to avoid triggering the detector.
430  if ((x < 0) || (y < 0) || (x >= camera_screen.width) || (y >= camera_screen.height) || ((x == 0) && (y == 0))) return;
431  else
432  {
433  register unsigned int offset = y * camera_screen.buffer_width + ASPECT_XCORRECTION(x);
434  draw_pixel_proc_norm(offset, cl);
435 #if CAM_USES_ASPECT_CORRECTION
436  draw_pixel_proc_norm(offset+1, cl); // Draw second pixel if screen scaling is needed
437 #endif
438  }
439 }
void draw_rectangle ( coord  x1,
coord  y1,
coord  x2,
coord  y2,
twoColors  cl,
int  flags 
)

Definiert in Zeile 550 der Datei gui_draw.c.

551 {
552  // Normalise values
553  if (x1 > x2)
554  swap(x1, x2);
555  if (y1 > y2)
556  swap(y1, y2);
557 
558  // Check if completely off screen
559  if ((x2 < 0) || (y2 < 0) || (x1 >= camera_screen.width) || (y1 >= camera_screen.height))
560  return;
561 
562  int round = (flags & RECT_ROUND_CORNERS) ? 1 : 0;
563  int thickness;
564  int i;
565 
566  // Shadow (do this first, as edge draw shrinks rectangle for fill)
567  if (flags & RECT_SHADOW_MASK)
568  {
569  thickness = ((flags & RECT_SHADOW_MASK) >> 4);
570  for (i=1; i<=thickness; i++)
571  {
572  draw_vline(x2+i, y1+1, y2 - y1, COLOR_BLACK);
573  draw_hline(x1+1, y2+i, x2 - x1 + thickness, COLOR_BLACK);
574  }
575  }
576 
577  // Edge
578  thickness = flags & RECT_BORDER_MASK;
579  for (i=0; i<thickness; i++)
580  {
581  // Clipping done in draw_hline and draw_vline
582  draw_vline(x1, y1 + round * 2, y2 - y1 - round * 4 + 1, FG_COLOR(cl));
583  draw_vline(x2, y1 + round * 2, y2 - y1 - round * 4 + 1, FG_COLOR(cl));
584  draw_hline(x1 + 1 + round, y1, x2 - x1 - round * 2 - 1, FG_COLOR(cl));
585  draw_hline(x1 + 1 + round, y2, x2 - x1 - round * 2 - 1, FG_COLOR(cl));
586 
587  x1++; x2--;
588  y1++; y2--;
589 
590  round = 0;
591  }
592 
593  // Fill
594  if (flags & DRAW_FILLED)
595  {
596  // Clip values
597  if (x1 < 0) x1 = 0;
598  if (y1 < 0) y1 = 0;
599  if (x2 >= camera_screen.width) x2 = camera_screen.width - 1;
600  if (y2 >= camera_screen.height) y2 = camera_screen.height - 1;
601 
602  coord y;
603  for (y = y1; y <= y2; ++y)
604  draw_hline(x1, y, x2 - x1 + 1, BG_COLOR(cl));
605  }
606 }
void draw_restore ( )

Definiert in Zeile 402 der Datei gui_draw.c.

403 {
405 
406  draw_set_guard();
407 #ifdef CAM_TOUCHSCREEN_UI
408  redraw_buttons = 1;
409 #endif
410 }
void draw_set_draw_proc ( void(*)(unsigned int offset, color cl pixel_proc)

Definiert in Zeile 161 der Datei gui_draw.c.

162 {
163  draw_pixel_proc_norm = (pixel_proc)?pixel_proc:draw_pixel_std;
164  if (conf.rotate_osd)
165  {
168  }
169  else
170  {
172  }
173 }
void draw_set_guard ( )

Definiert in Zeile 352 der Datei gui_draw.c.

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

Definiert in Zeile 990 der Datei gui_draw.c.

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

Definiert in Zeile 972 der Datei gui_draw.c.

973 {
974  while (*s && (*s != '\n') && (max_width >= FONT_WIDTH))
975  {
976  draw_char(x, y, *s, cl);
977  s++;
978  max_width -= FONT_WIDTH;
979  x += FONT_WIDTH;
980  if ((x>=camera_screen.width) && (*s))
981  {
982  draw_char(x-FONT_WIDTH,y, '>', cl);
983  break;
984  }
985  }
986  return x;
987 }
int draw_string_justified ( coord  x,
coord  y,
const char *  s,
twoColors  cl,
int  xo,
int  max_width,
int  justification 
)

Definiert in Zeile 1000 der Datei gui_draw.c.

1001 {
1002  // Get length in pixels
1003  const char *e = strchr(s, '\n');
1004  int l;
1005  if (e)
1006  l = (e - s) * FONT_WIDTH;
1007  else
1008  l = strlen(s) * FONT_WIDTH;
1009  if (l > max_width) l = max_width;
1010 
1011  // Calculate justification offset
1012  switch (justification & 0xF)
1013  {
1014  case TEXT_RIGHT:
1015  xo = (max_width - l);
1016  break;
1017  case TEXT_CENTER:
1018  xo = ((max_width - l) >> 1);
1019  break;
1020  }
1021 
1022  // Fill left side
1023  if ((justification & TEXT_FILL) && (xo > 0))
1025 
1026  // Draw string (get length drawn in pixels)
1027  l = draw_string_clipped(x+xo, y, s, cl, max_width - xo) - x;
1028 
1029  // Fill right side
1030  if ((justification & TEXT_FILL) && (l < max_width))
1031  draw_rectangle(x+l, y, x+max_width-1, y+FONT_HEIGHT-1, cl, RECT_BORDER0|DRAW_FILLED);
1032 
1033  // Return start of first character
1034  return x+xo;
1035 }
void draw_string_scaled ( coord  x,
coord  y,
const char *  s,
twoColors  cl,
int  xsize,
int  ysize 
)

Definiert in Zeile 1092 der Datei gui_draw.c.

1093 {
1094  while (*s && (*s != '\n'))
1095  {
1096  draw_char_scaled(x, y, *s, cl, xsize, ysize);
1097  s++;
1098  x+=FONT_WIDTH*xsize;
1099  if ((x>=camera_screen.width) && (*s))
1100  {
1101  draw_char_scaled(x-FONT_WIDTH*xsize,y, '>', cl, xsize, ysize);
1102  break;
1103  }
1104  }
1105 }
int draw_test_guard ( )

Definiert in Zeile 363 der Datei gui_draw.c.

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

Definiert in Zeile 1073 der Datei gui_draw.c.

1074 {
1075  int rx = 0;
1076  while (s && *s && (max_lines > 0))
1077  {
1078  const char *e = strchr(s, '\n');
1079  if (e) e++;
1080 
1081  rx = draw_string_justified(x, y, s, cl, 0, max_chars*FONT_WIDTH, justification);
1082 
1083  s = e;
1084  y += FONT_HEIGHT;
1085  max_lines--;
1086  }
1087  return rx;
1088 }
void draw_txt_string ( coord  col,
coord  row,
const char *  str,
twoColors  cl 
)

Definiert in Zeile 1174 der Datei gui_draw.c.

1175 {
1177 }
void draw_vline ( coord  x,
coord  y,
int  len,
color  cl 
)

Definiert in Zeile 538 der Datei gui_draw.c.

539 {
540  if ((x < 0) || (x >= camera_screen.width) || (y >= camera_screen.height)) return;
541  if (y < 0) { len += y; y = 0; }
543  for (; len>0; len--, y++)
544  draw_pixel(x, y, cl);
545 }
color get_script_color ( int  cl)

Definiert in Zeile 1375 der Datei gui_draw.c.

1376 {
1377  if (cl < 256)
1378  return cl;
1379  else
1380  return chdk_colors[cl-256];
1381 }
void set_transparent ( unsigned int  offset,
int  n_pixel 
)

Definiert in Zeile 148 der Datei gui_draw.c.

149 {
150 }
int text_dimensions ( const char *  s,
int  width,
int  max_chars,
int *  max_lines 
)

Definiert in Zeile 1042 der Datei gui_draw.c.

1043 {
1044  int l = 0, n;
1045  while (s && *s && (l < *max_lines))
1046  {
1047  const char *e = strchr(s, '\n');
1048  if (e)
1049  {
1050  n = e - s;
1051  e++;
1052  }
1053  else
1054  {
1055  n = strlen(s);
1056  }
1057 
1058  if (n > width) width = n;
1059 
1060  s = e;
1061  l++;
1062  }
1063  *max_lines = l;
1064  if (width > max_chars) width = max_chars;
1065  return width;
1066 }
void update_draw_proc ( )

Definiert in Zeile 175 der Datei gui_draw.c.

twoColors user_color ( confColor  c)

Definiert in Zeile 1391 der Datei gui_draw.c.

1392 {
1393  color fg = chdkColorToCanonColor(cc.fg);
1394  color bg = chdkColorToCanonColor(cc.bg);
1395 
1396  return MAKE_COLOR(bg,fg);
1397 }

Variablen-Dokumentation

unsigned char* chdk_colors

Definiert in Zeile 1363 der Datei gui_draw.c.