Update the appearance of an annotation.
342853
def update(self, fontsize=0.0, text_color=None, border_color=None, fill_color=None, rotate=-1):
        """"""

        if self.type[0] == ANNOT_WIDGET:
            print("Use updateWidget method for form fields.")
            return False

        val = _fitz.Annot_update(self, fontsize, text_color, border_color, fill_color, rotate)

        """
        The following code fixes shortcomings of MuPDF's "pdf_update_annot"
        function. Currently these are:
        1. Opacity (all annots). MuPDF ignores this proprty. This requires
           to add an ExtGState (extended graphics state) object in the
           C code as well.
        2. Dashing (all annots). MuPDF ignores this proprty.
        3. Colors and font size for FreeText annotations.
        4. Line end icons also for POLYGON and POLY_LINE annotations.
           MuPDF only honors them for LINE annotations.
        5. Always perform a "clean" for the annot, because MuPDF does not
           enclose their syntax in a string pair "q ... Q", which may cause
           Adobe and other readers not to display the annot.

        """
        if not val is True:  # skip if something went wrong
            return val

        def color_string(cs, code):
            """Return valid PDF color operator for a given color sequence.
            """
            if cs is None: return ""
            if hasattr(cs, "__float__") or len(cs) == 1:
                app = " g\n" if code == "f" else " G\n"
            elif len(cs) == 3:
                app = " rg\n" if code == "f" else " RG\n"
            else:
                app = " k\n" if code == "f" else " K\n"
            if hasattr(cs, "__len__"):
                col = " ".join(map(str, cs)) + app
            else:
                col = "%g" % cs + app
            return bytes(col, "utf8") if not fitz_py2 else col

        type   = self.type[0]               # get the annot type
        dt     = self.border["dashes"]      # get the dashes spec
        bwidth = self.border["width"]       # get border line width
        stroke = self.colors["stroke"]      # get the stroke color
        fill   = self.colors["fill"]        # get the fill color
        rect   = None                       # used if we change the rect here
        bfill  = color_string(fill, "f")
        p_ctm  = self.parent._getTransformation() # page transformation matrix
        imat   = ~p_ctm                     # inverse page transf. matrix

        line_end_le, line_end_ri = 0, 0     # line end codes
        if self.lineEnds:
            line_end_le, line_end_ri = self.lineEnds

        ap     = self._getAP()              # get the annot operator source
        ap_updated = False                  # assume we did nothing

        if type == ANNOT_FREETEXT:
            CheckColor(fill_color)
            CheckColor(border_color)
            CheckColor(text_color)

            ap_tab = ap.splitlines()        # split AP stream into lines
            idx_BT = ap_tab.index(b"BT")    # line no. of text start
        # to avoid effort, we rely on a fixed format generated by MuPDF for
        # this annot type: line 0 = fill color, line 5 border color, etc.
            if fill_color is not None:
                ap_tab[0] = color_string(fill_color, "f")
                ap_updated = True
            else:
                ap_tab[0] = ap_tab[1] = ap_tab[2] = b""
                ap_updated = True

            if idx_BT == 7:
                if bwidth > 0:
                    if border_color is not None:
                        ap_tab[4] = color_string(border_color, "s")
                        ap_updated = True
                else: # for zero border width suppress border
                    ap_tab[3] = b"0 w"
                    ap_tab[4] = ap_tab[5] = ap_tab[6] = b""
                    ap_updated = True

            if text_color is not None:
                ap_tab[idx_BT + 1] = color_string(text_color, "f")
                ap_updated = True

            if fontsize > 0.0:
                x = ap_tab[idx_BT + 2].split()
                x[1] = b"%g" % fontsize
                ap_tab[idx_BT + 2] = b" ".join(x)
                ap_updated = True

            if ap_updated:
                ap = b"\n".join(ap_tab)         # updated AP stream

        if bfill != "":
            if type == ANNOT_POLYGON:
                ap = ap[:-1] + bfill + b"b" # close, fill, and stroke
                ap_updated = True
            elif type == ANNOT_POLYLINE:
                ap = ap[:-1] + bfill + b"B" # fill and stroke
                ap_updated = True

        # Dashes not handled by MuPDF, so we do it here.
        if dt:
            dash = "[" + " ".join(map(str, dt)) + "] d\n"
            ap = dash.encode("utf-8") + ap
        # reset dashing - only applies for LINE annots with line ends given
            ap = ap.replace(b"\nS\n", b"\nS\n[] d\n", 1)
            ap_updated = True

        # Opacity not handled by MuPDF, so we do it here. The /ExtGState object
        # "Alp0" referenced here has already been added by our C code.
        if 0 <= self.opacity < 1:
            ap = b"/Alp0 gs\n" + ap
            ap_updated = True

        #----------------------------------------------------------------------
        # the following handles line end symbols for 'Polygon' and 'Polyline
        #----------------------------------------------------------------------
        if max(line_end_le, line_end_ri) > 0 and type in (ANNOT_POLYGON, ANNOT_POLYLINE):

            le_funcs = (None, TOOLS._le_square, TOOLS._le_circle,
                        TOOLS._le_diamond, TOOLS._le_openarrow,
                        TOOLS._le_closedarrow, TOOLS._le_butt,
                        TOOLS._le_ropenarrow, TOOLS._le_rclosedarrow,
                        TOOLS._le_slash)
            le_funcs_range = range(1, len(le_funcs))
            d = 4 * max(1, self.border["width"])
            rect = self.rect + (-d, -d, d, d)
            ap_updated = True
            points = self.vertices
            ap = b"q\n" + ap + b"\nQ\n"
            if line_end_le in le_funcs_range:
                p1 = Point(points[0]) * imat
                p2 = Point(points[1]) * imat
                left = le_funcs[line_end_le](self, p1, p2, False)
                ap += bytes(left, "utf8") if not fitz_py2 else left
            if line_end_ri in le_funcs_range:
                p1 = Point(points[-2]) * imat
                p2 = Point(points[-1]) * imat
                left = le_funcs[line_end_ri](self, p1, p2, True)
                ap += bytes(left, "utf8") if not fitz_py2 else left

        if ap_updated:
            if rect:                        # rect modified here?
                self.setRect(rect)
                self._setAP(ap, rect = 1)
            else:
                self._setAP(ap, rect = 0)

        # always perform a clean to wrap stream by "q" / "Q"
        self._cleanContents()

        return val
1191422
def update(self, func, **kw):
        ""
        func.__name__ = self.name
        func.__doc__ = getattr(self, 'doc', None)
        func.__dict__ = getattr(self, 'dict', {})
        func.__defaults__ = getattr(self, 'defaults', ())
        func.__kwdefaults__ = getattr(self, 'kwonlydefaults', None)
        func.__annotations__ = getattr(self, 'annotations', None)
        callermodule = sys._getframe(3).f_globals.get('__name__', '?')
        func.__module__ = getattr(self, 'module', callermodule)
        func.__dict__.update(kw)
605301
function(annotation) {
			if (!annotation) { return; }
			var annotations = this._annotations;
			var index = binarySearch(annotations, annotation.start);
			annotations.splice(index, 0, annotation);
			annotation._annotationModel = this;
			var e = {
				type: "Changed", //$NON-NLS-0$
				added: [annotation],
				removed: [],
				changed: []
			};
			this.onChanged(e);
		}
441323
function updateMarkWhenResizing() {
    const helper = getHelper();

    ml.getAll().forEach(marker => {
      helper.updateMarkerWithExtraInfo(marker);
    });

    editor.eventManager.emit('markerUpdated', ml.getAll());
  }
785569
public void update( EditorHost editor )
  {
    _editor = editor;
    _icon.setIcon( findIconForResults() );
    _feedback.repaint();
    repaint();
    editor.repaint();
  }
1352804
def update(self, name, modifiers):
        """"""
        self.update_name(name)
        self.modifiers = modifiers
1014692
def set_annotation(self):
        """"""
        assert self.pending_symbol is not None
        assert not self.value
        annotations = (_as_symbol(self.pending_symbol, is_symbol_value=False),)  # pending_symbol becomes an annotation
        self.annotations = annotations if not self.annotations else self.annotations + annotations
        self.ion_type = None
        self.pending_symbol = None  # reset pending symbol
        self.quoted_text = False
        self.line_comment = False
        self.is_self_delimiting = False
        return self
1277178
def visit_annassign(self, node):
        """"""

        target = node.target.accept(self)
        annotation = node.annotation.accept(self)
        if node.value is None:
            return "%s: %s" % (target, annotation)
        return "%s: %s = %s" % (target, annotation, node.value.accept(self))
1005110
def replace(self, src):
        ""
        for html in self.substitutions.keys():
            if src == html:
                annotation = self.annotation % self.substitutions[src][1]
                return annotation + self.substitutions[src][0]
        return src
979848
def update_looks(self):
        
        if self.state == 'active':
            style = {'color': 'red', 'linestyle': 'solid', 'fill': False}
        else:
            style = {'color': 'black', 'fill': False}
        self.poly.update(style)
641641
def update_style(self, mapping):
        """"""
        default = {
            "presentation:background-visible": "true",
            "presentation:background-objects-visible": "true",
            "draw:fill": "solid",
            "draw:fill-color": "#772953",
            "draw:fill-image-width": "0cm",
            "draw:fill-image-height": "0cm",
            "presentation:display-footer": "true",
            "presentation:display-page-number": "false",
            "presentation:display-date-time": "true",
        }
        default.update(mapping)
        style = PageStyle(**default)
        node = style.style_node()
        # add style to automatic-style
        self.preso._auto_styles.append(node)
        # update page style-name
        # found in ._page
        self._page.set(ns("draw", "style-name"), node.attrib[ns("style", "name")])
245192
def process_annotation(self, ann):
        """"""
        tmpl = self.xsl_template("@" + self.qname(ann))
        ET.SubElement(tmpl, "param", name="level", select="0")
        ct = self.xsl_calltemplate("leaf", tmpl)
        ET.SubElement(ct, "with-param", name="level", select="$level")
        self.xsl_withparam("nsid", ann.i_module.i_modulename + ":", ct)
        self.type_param(ann, ct)
1250237
def update(self, line=None):
        
        if line:
            markercolor = self.markercolor
            if markercolor is None: markercolor=self.color
            # self.set_markeredgecolor(markercolor, line=line)
            # self.set_markerfacecolor(markercolor, line=line)

            self.set_label(self.label, line=line)
            self.set_color(self.color, line=line)
            self.set_style(self.style, line=line)
            self.set_drawstyle(self.drawstyle, line=line)
            self.set_marker(self.marker,line=line)
            self.set_markersize(self.markersize, line=line)
            self.set_linewidth(self.linewidth, line=line)
326780
def updateAnnotations(self,
                          data,
                          LIMIT=25,
                          _print=True,
                          crawl=False,):
        
        url_base = self.base_url + \
            '/api/1/term/edit-annotation/{id}'  # id of annotation not term id
        annotations = self.getAnnotations_via_id([d['id'] for d in data],
                                                 LIMIT=LIMIT,
                                                 _print=_print,
                                                 crawl=crawl)

        annotations_to_update = []
        for d in data:
            annotation = annotations[int(d['id'])]
            annotation.update({**d})
            url = url_base.format(id=annotation['id'])
            annotations_to_update.append((url, annotation))
        self.post(annotations_to_update,
                  LIMIT=LIMIT,
                  action='Updating Annotations',
                  _print=_print,
                  crawl=crawl)
630117
def update_looks(self):
        
        if self.state == 'active':
            style = {'color': 'red', 'linestyle': 'solid'}
        else:
            style = {'color': 'black'}
        for artist in self.artist_list:
            artist.update(style)
1313334
private void updateForeground(Color color) {
        StyledDocument doc = (StyledDocument)getComponent().getDocument();
        Style style = doc.getStyle(StyleContext.DEFAULT_STYLE);

        if (style == null) {
            return;
        }

        if (color == null) {
            style.removeAttribute(StyleConstants.Foreground);
        } else {
            StyleConstants.setForeground(style, color);
        }
    }
906450
def set_annotations(cls, __fn, *notes, **keyword_notes):
        """"""
        if hasattr(__fn, '__func__'):
            __fn = __fn.__func__
        if hasattr(__fn, '__notes__'):
            msg = 'callable already has notes: {!r}'
            raise AttributeError(msg.format(__fn))
        __fn.__notes__ = (notes, keyword_notes)