def update(self, fontsize=<NUM_LIT:0.0>, text_color=None, border_color=None, fill_color=None, rotate=-<NUM_LIT:1>):
if self.type[<NUM_LIT:0>] == ANNOT_WIDGET:<EOL><INDENT>print("<STR_LIT>")<EOL>return False<EOL><DEDENT>val = _fitz.Annot_update(self, fontsize, text_color, border_color, fill_color, rotate)<EOL>"""<STR_LIT>"""<EOL>if not val is True:  <EOL><INDENT>return val<EOL><DEDENT>def color_string(cs, code):<EOL><INDENT>"""<STR_LIT>"""<EOL>if cs is None: return "<STR_LIT>"<EOL>if hasattr(cs, "<STR_LIT>") or len(cs) == <NUM_LIT:1>:<EOL><INDENT>app = "<STR_LIT>" if code == "<STR_LIT:f>" else "<STR_LIT>"<EOL><DEDENT>elif len(cs) == <NUM_LIT:3>:<EOL><INDENT>app = "<STR_LIT>" if code == "<STR_LIT:f>" else "<STR_LIT>"<EOL><DEDENT>else:<EOL><INDENT>app = "<STR_LIT>" if code == "<STR_LIT:f>" else "<STR_LIT>"<EOL><DEDENT>if hasattr(cs, "<STR_LIT>"):<EOL><INDENT>col = "<STR_LIT:U+0020>".join(map(str, cs)) + app<EOL><DEDENT>else:<EOL><INDENT>col = "<STR_LIT>" % cs + app<EOL><DEDENT>return bytes(col, "<STR_LIT:utf8>") if not fitz_py2 else col<EOL><DEDENT>type   = self.type[<NUM_LIT:0>]               <EOL>dt     = self.border["<STR_LIT>"]      <EOL>bwidth = self.border["<STR_LIT:width>"]       <EOL>stroke = self.colors["<STR_LIT>"]      <EOL>fill   = self.colors["<STR_LIT>"]        <EOL>rect   = None                       <EOL>bfill  = color_string(fill, "<STR_LIT:f>")<EOL>p_ctm  = self.parent._getTransformation() <EOL>imat   = ~p_ctm                     <EOL>line_end_le, line_end_ri = <NUM_LIT:0>, <NUM_LIT:0>     <EOL>if self.lineEnds:<EOL><INDENT>line_end_le, line_end_ri = self.lineEnds<EOL><DEDENT>ap     = self._getAP()              <EOL>ap_updated = False                  <EOL>if type == ANNOT_FREETEXT:<EOL><INDENT>CheckColor(fill_color)<EOL>CheckColor(border_color)<EOL>CheckColor(text_color)<EOL>ap_tab = ap.splitlines()        <EOL>idx_BT = ap_tab.index(b"<STR_LIT>")    <EOL>if fill_color is not None:<EOL><INDENT>ap_tab[<NUM_LIT:0>] = color_string(fill_color, "<STR_LIT:f>")<EOL>ap_updated = True<EOL><DEDENT>else:<EOL><INDENT>ap_tab[<NUM_LIT:0>] = ap_tab[<NUM_LIT:1>] = ap_tab[<NUM_LIT:2>] = b"<STR_LIT>"<EOL>ap_updated = True<EOL><DEDENT>if idx_BT == <NUM_LIT:7>:<EOL><INDENT>if bwidth > <NUM_LIT:0>:<EOL><INDENT>if border_color is not None:<EOL><INDENT>ap_tab[<NUM_LIT:4>] = color_string(border_color, "<STR_LIT:s>")<EOL>ap_updated = True<EOL><DEDENT><DEDENT>else: <EOL><INDENT>ap_tab[<NUM_LIT:3>] = b"<STR_LIT>"<EOL>ap_tab[<NUM_LIT:4>] = ap_tab[<NUM_LIT:5>] = ap_tab[<NUM_LIT:6>] = b"<STR_LIT>"<EOL>ap_updated = True<EOL><DEDENT><DEDENT>if text_color is not None:<EOL><INDENT>ap_tab[idx_BT + <NUM_LIT:1>] = color_string(text_color, "<STR_LIT:f>")<EOL>ap_updated = True<EOL><DEDENT>if fontsize > <NUM_LIT:0.0>:<EOL><INDENT>x = ap_tab[idx_BT + <NUM_LIT:2>].split()<EOL>x[<NUM_LIT:1>] = b"<STR_LIT>" % fontsize<EOL>ap_tab[idx_BT + <NUM_LIT:2>] = b"<STR_LIT:U+0020>".join(x)<EOL>ap_updated = True<EOL><DEDENT>if ap_updated:<EOL><INDENT>ap = b"<STR_LIT:\n>".join(ap_tab)         <EOL><DEDENT><DEDENT>if bfill != "<STR_LIT>":<EOL><INDENT>if type == ANNOT_POLYGON:<EOL><INDENT>ap = ap[:-<NUM_LIT:1>] + bfill + b"<STR_LIT:b>" <EOL>ap_updated = True<EOL><DEDENT>elif type == ANNOT_POLYLINE:<EOL><INDENT>ap = ap[:-<NUM_LIT:1>] + bfill + b"<STR_LIT:B>" <EOL>ap_updated = True<EOL><DEDENT><DEDENT>if dt:<EOL><INDENT>dash = "<STR_LIT:[>" + "<STR_LIT:U+0020>".join(map(str, dt)) + "<STR_LIT>"<EOL>ap = dash.encode("<STR_LIT:utf-8>") + ap<EOL>ap = ap.replace(b"<STR_LIT>", b"<STR_LIT>", <NUM_LIT:1>)<EOL>ap_updated = True<EOL><DEDENT>if <NUM_LIT:0> <= self.opacity < <NUM_LIT:1>:<EOL><INDENT>ap = b"<STR_LIT>" + ap<EOL>ap_updated = True<EOL><DEDENT>if max(line_end_le, line_end_ri) > <NUM_LIT:0> and type in (ANNOT_POLYGON, ANNOT_POLYLINE):<EOL><INDENT>le_funcs = (None, TOOLS._le_square, TOOLS._le_circle,<EOL>TOOLS._le_diamond, TOOLS._le_openarrow,<EOL>TOOLS._le_closedarrow, TOOLS._le_butt,<EOL>TOOLS._le_ropenarrow, TOOLS._le_rclosedarrow,<EOL>TOOLS._le_slash)<EOL>le_funcs_range = range(<NUM_LIT:1>, len(le_funcs))<EOL>d = <NUM_LIT:4> * max(<NUM_LIT:1>, self.border["<STR_LIT:width>"])<EOL>rect = self.rect + (-d, -d, d, d)<EOL>ap_updated = True<EOL>points = self.vertices<EOL>ap = b"<STR_LIT>" + ap + b"<STR_LIT>"<EOL>if line_end_le in le_funcs_range:<EOL><INDENT>p1 = Point(points[<NUM_LIT:0>]) * imat<EOL>p2 = Point(points[<NUM_LIT:1>]) * imat<EOL>left = le_funcs[line_end_le](self, p1, p2, False)<EOL>ap += bytes(left, "<STR_LIT:utf8>") if not fitz_py2 else left<EOL><DEDENT>if line_end_ri in le_funcs_range:<EOL><INDENT>p1 = Point(points[-<NUM_LIT:2>]) * imat<EOL>p2 = Point(points[-<NUM_LIT:1>]) * imat<EOL>left = le_funcs[line_end_ri](self, p1, p2, True)<EOL>ap += bytes(left, "<STR_LIT:utf8>") if not fitz_py2 else left<EOL><DEDENT><DEDENT>if ap_updated:<EOL><INDENT>if rect:                        <EOL><INDENT>self.setRect(rect)<EOL>self._setAP(ap, rect = <NUM_LIT:1>)<EOL><DEDENT>else:<EOL><INDENT>self._setAP(ap, rect = <NUM_LIT:0>)<EOL><DEDENT><DEDENT>self._cleanContents()<EOL>return val<EOL>
Update the appearance of an annotation.