MCPcopy Create free account
hub / github.com/pymupdf/PyMuPDF / set_rect

Method set_rect

src/__init__.py:14038–14051  ·  view source on GitHub ↗

Set color of all pixels in bbox.

(self, bbox, color)

Source from the content-addressed store, hash-verified

14036 pm.fz_samples_set(i + j, color[j])
14037
14038 def set_rect(self, bbox, color):
14039 """Set color of all pixels in bbox."""
14040 pm = self.this
14041 n = pm.n()
14042 c = []
14043 for j in range(n):
14044 i = color[j]
14045 if not _INRANGE(i, 0, 255):
14046 raise ValueError( MSG_BAD_COLOR_SEQ)
14047 c.append(i)
14048 bbox = JM_irect_from_py(bbox)
14049 i = JM_fill_pixmap_rect_with_color(pm, c, bbox)
14050 rc = bool(i)
14051 return rc
14052
14053 def shrink(self, factor):
14054 """Divide width and height by 2**factor.

Callers

nothing calls this directly

Calls 5

_INRANGEFunction · 0.85
JM_irect_from_pyFunction · 0.85
nMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected