CHDK_DE Vorschauversion  Trunk Rev. 6014
 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)
 
void draw_pixel (coord x, coord y, color cl)
 
void draw_or_erase_edge_pixel (coord x, coord y, color cl, int is_draw)
 
void draw_dblpixel_raw (unsigned int offset, unsigned int px, unsigned int op)
 
void erase_zebra ()
 
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 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 1672 der Datei gui_draw.c.

1673 {
1674  if (col.type)
1675  return chdk_colors[col.col];
1676  return col.col;
1677 }
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 1554 der Datei gui_draw.c.

1555 {
1557  w = w * FONT_WIDTH;
1558 
1559  draw_rectangle(x-2, y-2, x+w+2, y+FONT_HEIGHT+2, cl, RECT_BORDER1|DRAW_FILLED|RECT_SHADOW1); // main box
1560  draw_string(x+((w-(strlen(lang_str(str_id))*FONT_WIDTH))>>1), y, lang_str(str_id), cl);
1561 }
void draw_char ( coord  x,
coord  y,
const char  ch,
twoColors  cl 
)

Definiert in Zeile 890 der Datei gui_draw.c.

891 {
892  unsigned i, ii;
893 
894  unsigned int offset, size;
895  unsigned char *sym = get_cdata(&offset, &size, ch);
896 
897  // First draw blank lines at top
898  for (i=0; i<offset; i++)
900 
901  // Now draw character data
902 
903  unsigned j;
904  for (j=i; i<size;)
905  {
906  unsigned int dsym;
907  int rep;
908 #ifdef BUILTIN_FONT_RLE_COMPRESSED
909  dsym = fontdata_lookup[sym[j] & 0x7f];
910  rep = sym[j] & 0x80;
911 #else
912  dsym = sym[j];
913  rep = 0;
914 #endif
915  for (ii=0; ii<FONT_WIDTH; ii++)
916  {
917  draw_pixel(x+ii, y+i, (dsym & (0x80>>ii))? FG_COLOR(cl) : BG_COLOR(cl));
918  }
919  if (rep)
920  {
921  i++;
922  for (ii=0; ii<FONT_WIDTH; ii++)
923  {
924  draw_pixel(x+ii, y+i, (dsym & (0x80>>ii))? FG_COLOR(cl) : BG_COLOR(cl));
925  }
926  }
927  i++;
928  j++;
929  }
930 
931  // Last draw blank lines at bottom
932  for (; i<FONT_HEIGHT; i++)
933  draw_hline(x, y+i, FONT_WIDTH, BG_COLOR(cl));
934 }
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 1468 der Datei gui_draw.c.

1469 {
1470  // Bresenham fast ellipse algorithm - http://homepage.smc.edu/kennedy_john/BELIPSE.PDF
1471  int X, Y;
1472  int XChange, YChange;
1473  int EllipseError;
1474  int TwoASquare, TwoBSquare;
1475  int StoppingX, StoppingY;
1476  TwoASquare = 2*XRadius*XRadius;
1477  TwoBSquare = 2*YRadius*YRadius;
1478  X = XRadius;
1479  Y = 0;
1480  XChange = YRadius*YRadius*(1-2*XRadius);
1481  YChange = XRadius*XRadius;
1482  EllipseError = 0;
1483  StoppingX = TwoBSquare*XRadius;
1484  StoppingY = 0;
1485  while ( StoppingX >= StoppingY )
1486  {
1487  if (flags & DRAW_FILLED)
1488  {
1489  draw_hline(CX-X,CY-Y,X*2+1,cl);
1490  draw_hline(CX-X,CY+Y,X*2+1,cl);
1491  }
1492  else
1493  {
1494  draw_pixel(CX-X,CY-Y,cl);
1495  draw_pixel(CX-X,CY+Y,cl);
1496  draw_pixel(CX+X,CY-Y,cl);
1497  draw_pixel(CX+X,CY+Y,cl);
1498  }
1499  Y++;
1500  StoppingY += TwoASquare;
1501  EllipseError += YChange;
1502  YChange += TwoASquare;
1503  if ((2*EllipseError + XChange) > 0 )
1504  {
1505  X--;
1506  StoppingX -= TwoBSquare;
1507  EllipseError += XChange;
1508  XChange += TwoBSquare;
1509  }
1510  }
1511  X = 0;
1512  Y = YRadius;
1513  XChange = YRadius*YRadius;
1514  YChange = XRadius*XRadius*(1-2*YRadius);
1515  EllipseError = 0;
1516  StoppingX = 0;
1517  StoppingY = TwoASquare*YRadius;
1518  int lastY = Y + 1;
1519  while ( StoppingX <= StoppingY )
1520  {
1521  if (flags & DRAW_FILLED)
1522  {
1523  // Only draw lines if Y has changed
1524  if (lastY != Y)
1525  {
1526  draw_hline(CX-X,CY-Y,X*2+1,cl);
1527  draw_hline(CX-X,CY+Y,X*2+1,cl);
1528  lastY = Y;
1529  }
1530  }
1531  else
1532  {
1533  draw_pixel(CX-X,CY-Y,cl);
1534  draw_pixel(CX-X,CY+Y,cl);
1535  draw_pixel(CX+X,CY-Y,cl);
1536  draw_pixel(CX+X,CY+Y,cl);
1537  }
1538  X++;
1539  StoppingX += TwoBSquare;
1540  EllipseError += XChange;
1541  XChange += TwoBSquare;
1542  if ((2*EllipseError + YChange) > 0 )
1543  {
1544  Y--;
1545  StoppingY -= TwoASquare;
1546  EllipseError += YChange;
1547  YChange += TwoASquare;
1548  }
1549  }
1550 }
color draw_get_pixel ( coord  x,
coord  y 
)

Definiert in Zeile 669 der Datei gui_draw.c.

670 {
671 #ifndef THUMB_FW
672  if ((x < 0) || (y < 0) || (x >= camera_screen.width) || (y >= camera_screen.height)) return 0;
673  if (conf.rotate_osd)
674  {
675 #ifdef DRAW_ON_ACTIVE_BITMAP_BUFFER_ONLY
677 #else
679 #endif
680  }
681  else
682  {
683 #ifdef DRAW_ON_ACTIVE_BITMAP_BUFFER_ONLY
685 #else
687 #endif
688  }
689 #else
690  // DIGIC 6 not supported
691  (void)x; (void)y;
692  return 0;
693 #endif
694 }
void draw_hline ( coord  x,
coord  y,
int  len,
color  cl 
)

Definiert in Zeile 776 der Datei gui_draw.c.

777 {
778  if ((y < 0) || (x >= camera_screen.width) || (y >= camera_screen.height)) return;
779  if (x < 0) { len += x; x = 0; }
780  if ((x + len) > camera_screen.width) len = camera_screen.width - x;
781 #ifndef CAM_HAS_DISPLAY_REFRESH_FLAG
782  if (conf.rotate_osd)
783  {
784  if ((y == camera_screen.height-1) && ((x+len) >= camera_screen.width-1)) { x--; len--; } // Skip guard pixel
785  }
786  else
787  {
788  if ((y == 0) && (x == 0)) { x++; len--; } // Skip guard pixel
789  }
790 #endif
791  register unsigned int offset = y * camera_screen.buffer_width + ASPECT_XCORRECTION(x);
792  len = ASPECT_XCORRECTION(len); // Scale the line length if needed
793  for (; len>0; len--, offset++)
794  draw_pixel_proc(offset, cl);
795 }
void draw_icon_cmds ( coord  x,
coord  y,
icon_cmd cmds 
)

Definiert in Zeile 1566 der Datei gui_draw.c.

1567 {
1568  int x1, y1, x2, y2;
1569 #ifdef THUMB_FW
1570  int thickness = RECT_BORDER2;
1571 #else
1572  int thickness = RECT_BORDER1;
1573 #endif
1574  while (1)
1575  {
1576 #ifdef THUMB_FW
1577  x1 = cmds->x1<<1;
1578  y1 = cmds->y1<<1;
1579  x2 = cmds->x2<<1;
1580  y2 = cmds->y2<<1;
1581 #else
1582  x1 = cmds->x1;
1583  y1 = cmds->y1;
1584  x2 = cmds->x2;
1585  y2 = cmds->y2;
1586 #endif
1587  color cf = chdk_colors[cmds->cf]; // Convert color indexes to actual colors
1588  color cb = chdk_colors[cmds->cb];
1589  switch (cmds->action)
1590  {
1591  default:
1592  case IA_END:
1593  return;
1594  case IA_HLINE:
1595  draw_hline(x+x1, y+y1, x2, cb);
1596 #ifdef THUMB_FW
1597  draw_hline(x+x1, y+y1+1, x2, cb);
1598 #endif
1599  break;
1600  case IA_VLINE:
1601  draw_vline(x+x1, y+y1, y2, cb);
1602 #ifdef THUMB_FW
1603  draw_vline(x+x1+1, y+y1, y2, cb);
1604 #endif
1605  break;
1606  case IA_LINE:
1607 #ifdef THUMB_FW
1608  draw_line_x2(x+x1, y+y1, x+x2, y+y2, cb);
1609 #else
1610  draw_line(x+x1, y+y1, x+x2, y+y2, cb);
1611 #endif
1612  break;
1613  case IA_RECT:
1614 #ifdef THUMB_FW
1615  draw_rectangle(x+x1, y+y1, x+x2+1, y+y2+1, MAKE_COLOR(cb,cf), thickness);
1616 #else
1617  draw_rectangle(x+x1, y+y1, x+x2, y+y2, MAKE_COLOR(cb,cf), thickness);
1618 #endif
1619  break;
1620  case IA_FILLED_RECT:
1621 #ifdef THUMB_FW
1622  draw_rectangle(x+x1, y+y1, x+x2+1, y+y2+1, MAKE_COLOR(cb,cf), thickness|DRAW_FILLED);
1623 #else
1624  draw_rectangle(x+x1, y+y1, x+x2, y+y2, MAKE_COLOR(cb,cf), thickness|DRAW_FILLED);
1625 #endif
1626  break;
1627  case IA_ROUND_RECT:
1628 #ifdef THUMB_FW
1629  draw_rectangle(x+x1, y+y1, x+x2+1, y+y2+1, MAKE_COLOR(cb,cf), thickness|RECT_ROUND_CORNERS);
1630 #else
1631  draw_rectangle(x+x1, y+y1, x+x2, y+y2, MAKE_COLOR(cb,cf), thickness|RECT_ROUND_CORNERS);
1632 #endif
1633  break;
1634  case IA_FILLED_ROUND_RECT:
1635 #ifdef THUMB_FW
1636  draw_rectangle(x+x1, y+y1, x+x2+1, y+y2+1, MAKE_COLOR(cb,cf), thickness|DRAW_FILLED|RECT_ROUND_CORNERS);
1637 #else
1638  draw_rectangle(x+x1, y+y1, x+x2, y+y2, MAKE_COLOR(cb,cf), thickness|DRAW_FILLED|RECT_ROUND_CORNERS);
1639 #endif
1640  break;
1641  }
1642  cmds++;
1643  }
1644 }
void draw_init ( )

Definiert in Zeile 521 der Datei gui_draw.c.

522 {
523 #ifndef THUMB_FW
524 #ifndef DRAW_ON_ACTIVE_BITMAP_BUFFER_ONLY
527 #endif
528 #endif
530 
531  draw_set_guard();
532 }
int draw_is_suspended ( void  )

Definiert in Zeile 544 der Datei gui_draw.c.

545 {
547 }
void draw_line ( coord  x1,
coord  y1,
coord  x2,
coord  y2,
color  cl 
)

Definiert in Zeile 699 der Datei gui_draw.c.

700 {
701  unsigned char steep = abs(y2 - y1) > abs(x2 - x1);
702  if (steep)
703  {
704  swap(x1, y1);
705  swap(x2, y2);
706  }
707  if (x1 > x2)
708  {
709  swap(x1, x2);
710  swap(y1, y2);
711  }
712  int deltax = x2 - x1;
713  int deltay = abs(y2 - y1);
714  int error = 0;
715  int y = y1;
716  int ystep = (y1 < y2)?1:-1;
717  int x;
718  for (x=x1; x<=x2; ++x)
719  {
720  if (steep) draw_pixel(y, x, cl);
721  else draw_pixel(x, y, cl);
722  error += deltay;
723  if ((error<<1) >= deltax)
724  {
725  y += ystep;
726  error -= deltax;
727  }
728  }
729 }
void draw_or_erase_edge_pixel ( coord  x,
coord  y,
color  cl,
int  is_draw 
)

Definiert in Zeile 581 der Datei gui_draw.c.

582 {
583  // Make sure pixel is on screen. Skip top left pixel if screen erase detection is on to avoid triggering the detector.
584  if ((px < 0) || (py < 0) || (px >= camera_screen.width) || (py >= camera_screen.height) || ((px == 0) && (py == 0))) return;
585 
586  // bitmap buffer offset
587  register unsigned int offset = py * camera_screen.buffer_width + ASPECT_XCORRECTION(px);
588 
589 #ifndef THUMB_FW
590 
591  // See if we need to erase, do nothing if not drawing and current pixel is not edge pixel, otherwise set draw color to transparent.
592  if (!is_draw)
593  {
594 #ifdef DRAW_ON_ACTIVE_BITMAP_BUFFER_ONLY
595  if (bitmap_buffer[active_bitmap_buffer][offset] != cl) return;
596 #else
597  if (frame_buffer[0][offset] != cl) return;
598 #endif
599  cl = 0; // Transparent
600  }
601 
602  // Draw pixel
603  draw_pixel_proc_norm(offset, cl);
604 #if CAM_USES_ASPECT_CORRECTION
605  draw_pixel_proc_norm(offset+1, cl); // Draw second pixel if screen scaling is needed
606 #endif
607 
608 #else // THUMB_FW
609 
610  // See if we need to erase, do nothing if not drawing and current pixel is not edge pixel, otherwise set draw color to transparent.
611  if (!is_draw)
612  {
613 #ifdef DRAW_ON_ACTIVE_BITMAP_BUFFER_ONLY
614  if (opacity_buffer[active_bitmap_buffer&1][offset] != 254) return;
615 #else
616  if (opacity_buffer[0][offset] != 254) return;
617 #endif
618  cl = 0; // Transparent
619  }
620 
621  unsigned int y;
622  unsigned int o;
623  CALC_YUV_LUMA_OPACITY_FOR_COLOR(cl,y,o);
624  unsigned int u;
625  unsigned int v;
626  CALC_YUV_CHROMA_FOR_COLOR(cl,u,v);
627 
628  if (o == 255) o = 254; // Adjust opacity so we can test for erasing later
629 
630  register unsigned int offs2 = (offset>>1)<<2;
631 
632 #ifdef DRAW_ON_ACTIVE_BITMAP_BUFFER_ONLY
633  unsigned char *obu = (unsigned char *)(&opacity_buffer[active_bitmap_buffer&1][0]);
634  unsigned char *bbu = (unsigned char *)(&bitmap_buffer[active_bitmap_buffer&1][0]);
635  obu[offset] = o;
636  if (offset&1) // x is odd
637  {
638  bbu[offs2+3] = y; // Y
639  }
640  else // x is even
641  {
642  bbu[offs2+1] = y; // Y
643  }
644  bbu[offs2+0] = u; // U?
645  bbu[offs2+2] = v; // V?
646 #else
647  opacity_buffer[0][offset] = o;
648  opacity_buffer[1][offset] = o;
649  if (offset&1) // x is odd
650  {
651  (bitmap_buffer[0])[offs2+3] = y; // Y
652  (bitmap_buffer[1])[offs2+3] = y; // Y
653  }
654  else // x is even
655  {
656  (bitmap_buffer[0])[offs2+1] = y; // Y
657  (bitmap_buffer[1])[offs2+1] = y; // Y
658  }
659  (bitmap_buffer[0])[offs2+0] = u; // U?
660  (bitmap_buffer[1])[offs2+0] = u; // U?
661  (bitmap_buffer[0])[offs2+2] = v; // V?
662  (bitmap_buffer[1])[offs2+2] = v; // V?
663 #endif
664 
665 #endif // THUMB_FW
666 }
void draw_osd_string ( OSD_pos  pos,
int  xo,
int  yo,
char *  s,
twoColors  c,
OSD_scale  scale 
)

Definiert in Zeile 1403 der Datei gui_draw.c.

1404 {
1405  if ((scale.x == 0) || (scale.y == 0) || ((scale.x == 1) && (scale.y == 1)))
1406  draw_string(pos.x+xo, pos.y+yo, s, c);
1407  else
1408  draw_string_scaled(pos.x+(xo*scale.x), pos.y+(yo*scale.y), s, c, scale.x, scale.y);
1409 }
void draw_pixel ( coord  x,
coord  y,
color  cl 
)

Definiert in Zeile 564 der Datei gui_draw.c.

565 {
566  // Make sure pixel is on screen. Skip top left pixel if screen erase detection is on to avoid triggering the detector.
567  if ((x < 0) || (y < 0) || (x >= camera_screen.width) || (y >= camera_screen.height) || ((x == 0) && (y == 0))) return;
568  else
569  {
570  register unsigned int offset = y * camera_screen.buffer_width + ASPECT_XCORRECTION(x);
571  draw_pixel_proc(offset, cl);
572 #if CAM_USES_ASPECT_CORRECTION
573  draw_pixel_proc(offset+1, cl); // Draw second pixel if screen scaling is needed
574 #endif
575  }
576 }
void draw_rectangle ( coord  x1,
coord  y1,
coord  x2,
coord  y2,
twoColors  cl,
int  flags 
)

Definiert in Zeile 809 der Datei gui_draw.c.

810 {
811  // Normalise values
812  if (x1 > x2)
813  swap(x1, x2);
814  if (y1 > y2)
815  swap(y1, y2);
816 
817  // Check if completely off screen
818  if ((x2 < 0) || (y2 < 0) || (x1 >= camera_screen.width) || (y1 >= camera_screen.height))
819  return;
820 
821  int round = (flags & RECT_ROUND_CORNERS) ? 1 : 0;
822  int thickness;
823  int i;
824 
825  // Shadow (do this first, as edge draw shrinks rectangle for fill)
826  if (flags & RECT_SHADOW_MASK)
827  {
828  thickness = ((flags & RECT_SHADOW_MASK) >> 4);
829  for (i=1; i<=thickness; i++)
830  {
831  draw_vline(x2+i, y1+1, y2 - y1, COLOR_BLACK);
832  draw_hline(x1+1, y2+i, x2 - x1 + thickness, COLOR_BLACK);
833  }
834  }
835 
836  // Edge
837  thickness = flags & RECT_BORDER_MASK;
838  for (i=0; i<thickness; i++)
839  {
840  // Clipping done in draw_hline and draw_vline
841  draw_vline(x1, y1 + round * 2, y2 - y1 - round * 4 + 1, FG_COLOR(cl));
842  draw_vline(x2, y1 + round * 2, y2 - y1 - round * 4 + 1, FG_COLOR(cl));
843  draw_hline(x1 + 1 + round, y1, x2 - x1 - round * 2 - 1, FG_COLOR(cl));
844  draw_hline(x1 + 1 + round, y2, x2 - x1 - round * 2 - 1, FG_COLOR(cl));
845 
846  x1++; x2--;
847  y1++; y2--;
848 
849  round = 0;
850  }
851 
852  // Fill
853  if (flags & DRAW_FILLED)
854  {
855  // Clip values
856  if (x1 < 0) x1 = 0;
857  if (y1 < 0) y1 = 0;
858  if (x2 >= camera_screen.width) x2 = camera_screen.width - 1;
859  if (y2 >= camera_screen.height) y2 = camera_screen.height - 1;
860 
861  coord y;
862  for (y = y1; y <= y2; ++y)
863  draw_hline(x1, y, x2 - x1 + 1, BG_COLOR(cl));
864  }
865 }
void draw_restore ( )

Definiert in Zeile 550 der Datei gui_draw.c.

551 {
552  if(draw_is_suspended()) {
553  return;
554  }
556 
557  draw_set_guard();
558 #ifdef CAM_TOUCHSCREEN_UI
559  redraw_buttons = 1;
560 #endif
561 }
void draw_set_draw_proc ( void(*)(unsigned int offset, color cl pixel_proc)

Definiert in Zeile 220 der Datei gui_draw.c.

221 {
222  draw_pixel_proc_norm = (pixel_proc)?pixel_proc:draw_pixel_std;
223  if (conf.rotate_osd)
224  {
227  }
228  else
229  {
231  }
232 }
void draw_set_guard ( )

Definiert in Zeile 473 der Datei gui_draw.c.

474 {
475 #ifdef DRAW_ON_ACTIVE_BITMAP_BUFFER_ONLY
476  *((unsigned char*)(bitmap_buffer[0])) = GUARD_VAL;
477  *((unsigned char*)(bitmap_buffer[1])) = GUARD_VAL;
478 #else
479  *((unsigned char*)(frame_buffer[0])) = GUARD_VAL;
480  *((unsigned char*)(frame_buffer[1])) = GUARD_VAL;
481 #endif
482 }
int draw_string ( coord  x,
coord  y,
const char *  s,
twoColors  cl 
)

Definiert in Zeile 1249 der Datei gui_draw.c.

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

Definiert in Zeile 1231 der Datei gui_draw.c.

1232 {
1233  while (*s && (*s != '\n') && (max_width >= FONT_WIDTH))
1234  {
1235  draw_char(x, y, *s, cl);
1236  s++;
1237  max_width -= FONT_WIDTH;
1238  x += FONT_WIDTH;
1239  if ((x>=camera_screen.width) && (*s))
1240  {
1241  draw_char(x-FONT_WIDTH,y, '>', cl);
1242  break;
1243  }
1244  }
1245  return x;
1246 }
int draw_string_justified ( coord  x,
coord  y,
const char *  s,
twoColors  cl,
int  xo,
int  max_width,
int  justification 
)

Definiert in Zeile 1259 der Datei gui_draw.c.

1260 {
1261  // Get length in pixels
1262  const char *e = strchr(s, '\n');
1263  int l;
1264  if (e)
1265  l = (e - s) * FONT_WIDTH;
1266  else
1267  l = strlen(s) * FONT_WIDTH;
1268  if (l > max_width) l = max_width;
1269 
1270  // Calculate justification offset
1271  switch (justification & 0xF)
1272  {
1273  case TEXT_RIGHT:
1274  xo = (max_width - l);
1275  break;
1276  case TEXT_CENTER:
1277  xo = ((max_width - l) >> 1);
1278  break;
1279  }
1280 
1281  // Fill left side
1282  if ((justification & TEXT_FILL) && (xo > 0))
1284 
1285  // Draw string (get length drawn in pixels)
1286  l = draw_string_clipped(x+xo, y, s, cl, max_width - xo) - x;
1287 
1288  // Fill right side
1289  if ((justification & TEXT_FILL) && (l < max_width))
1290  draw_rectangle(x+l, y, x+max_width-1, y+FONT_HEIGHT-1, cl, RECT_BORDER0|DRAW_FILLED);
1291 
1292  // Return start of first character
1293  return x+xo;
1294 }
void draw_string_scaled ( coord  x,
coord  y,
const char *  s,
twoColors  cl,
int  xsize,
int  ysize 
)

Definiert in Zeile 1351 der Datei gui_draw.c.

1352 {
1353  while (*s && (*s != '\n'))
1354  {
1355  draw_char_scaled(x, y, *s, cl, xsize, ysize);
1356  s++;
1357  x+=FONT_WIDTH*xsize;
1358  if ((x>=camera_screen.width) && (*s))
1359  {
1360  draw_char_scaled(x-FONT_WIDTH*xsize,y, '>', cl, xsize, ysize);
1361  break;
1362  }
1363  }
1364 }
void draw_suspend ( int  ms)

Definiert in Zeile 535 der Datei gui_draw.c.

536 {
537  int t=get_tick_count() + ms;
538  // only change if not already suspended to a later time
539  if(t > draw_restore_suspend_tick) {
541  }
542 }
int draw_test_guard ( )

Definiert in Zeile 484 der Datei gui_draw.c.

485 {
486 #ifdef DRAW_ON_ACTIVE_BITMAP_BUFFER_ONLY
487  if (*((unsigned char*)(bitmap_buffer[active_bitmap_buffer])) != GUARD_VAL) return 0;
488 #else
489  if (*((unsigned char*)(frame_buffer[0])) != GUARD_VAL) return 0;
490  if (*((unsigned char*)(frame_buffer[1])) != GUARD_VAL) return 0;
491 #endif
492  return 1;
493 }
int draw_text_justified ( coord  x,
coord  y,
const char *  s,
twoColors  cl,
int  max_chars,
int  max_lines,
int  justification 
)

Definiert in Zeile 1332 der Datei gui_draw.c.

1333 {
1334  int rx = 0;
1335  while (s && *s && (max_lines > 0))
1336  {
1337  const char *e = strchr(s, '\n');
1338  if (e) e++;
1339 
1340  rx = draw_string_justified(x, y, s, cl, 0, max_chars*FONT_WIDTH, justification);
1341 
1342  s = e;
1343  y += FONT_HEIGHT;
1344  max_lines--;
1345  }
1346  return rx;
1347 }
void draw_txt_string ( coord  col,
coord  row,
const char *  str,
twoColors  cl 
)

Definiert in Zeile 1433 der Datei gui_draw.c.

1434 {
1436 }
void draw_vline ( coord  x,
coord  y,
int  len,
color  cl 
)

Definiert in Zeile 797 der Datei gui_draw.c.

798 {
799  if ((x < 0) || (x >= camera_screen.width) || (y >= camera_screen.height)) return;
800  if (y < 0) { len += y; y = 0; }
802  for (; len>0; len--, y++)
803  draw_pixel(x, y, cl);
804 }
void erase_zebra ( )

Definiert in Zeile 209 der Datei gui_draw.c.

209 {}
color get_script_color ( int  cl)

Definiert in Zeile 1663 der Datei gui_draw.c.

1664 {
1665  if (cl < 256)
1666  return cl;
1667  else
1668  return chdk_colors[cl-256];
1669 }
int text_dimensions ( const char *  s,
int  width,
int  max_chars,
int *  max_lines 
)

Definiert in Zeile 1301 der Datei gui_draw.c.

1302 {
1303  int l = 0, n;
1304  while (s && *s && (l < *max_lines))
1305  {
1306  const char *e = strchr(s, '\n');
1307  if (e)
1308  {
1309  n = e - s;
1310  e++;
1311  }
1312  else
1313  {
1314  n = strlen(s);
1315  }
1316 
1317  if (n > width) width = n;
1318 
1319  s = e;
1320  l++;
1321  }
1322  *max_lines = l;
1323  if (width > max_chars) width = max_chars;
1324  return width;
1325 }
void update_draw_proc ( )

Definiert in Zeile 234 der Datei gui_draw.c.

twoColors user_color ( confColor  c)

Definiert in Zeile 1679 der Datei gui_draw.c.

1680 {
1681  color fg = chdkColorToCanonColor(cc.fg);
1682  color bg = chdkColorToCanonColor(cc.bg);
1683 
1684  return MAKE_COLOR(bg,fg);
1685 }

Variablen-Dokumentation

unsigned char* chdk_colors

Definiert in Zeile 1651 der Datei gui_draw.c.