Lines Matching defs:SkRegion
16 /** \class SkRegion
17 SkRegion describes the set of pixels used to clip SkCanvas. SkRegion is compact,
19 of rectangles. SkRegion may reduce the current SkCanvas clip, or may be drawn as
20 one or more integer rectangles. SkRegion iterator returns the scan lines or
23 class SK_API SkRegion {
27 /** Constructs an empty SkRegion. SkRegion is set to empty bounds
30 @return empty SkRegion
34 SkRegion();
41 Creating a SkRegion copy is very efficient and never allocates memory.
42 SkRegion are always copied by value from the interface; the underlying shared
45 @param region SkRegion to copy by value
46 @return copy of SkRegion
50 SkRegion(const SkRegion& region);
52 /** Constructs a rectangular SkRegion matching the bounds of rect.
54 @param rect bounds of constructed SkRegion
55 @return rectangular SkRegion
59 explicit SkRegion(const SkIRect& rect);
61 /** Releases ownership of any shared data and deletes data if SkRegion is sole owner.
65 ~SkRegion();
72 Creating a SkRegion copy is very efficient and never allocates memory.
73 SkRegion are always copied by value from the interface; the underlying shared
76 @param region SkRegion to copy by value
77 @return SkRegion to copy by value
81 SkRegion& operator=(const SkRegion& region);
83 /** Compares SkRegion and other; returns true if they enclose exactly
86 @param other SkRegion to compare
87 @return true if SkRegion pair are equivalent
91 bool operator==(const SkRegion& other) const;
93 /** Compares SkRegion and other; returns true if they do not enclose the same area.
95 @param other SkRegion to compare
96 @return true if SkRegion pair are not equivalent
98 bool operator!=(const SkRegion& other) const {
102 /** Sets SkRegion to src, and returns true if src bounds is not empty.
103 This makes SkRegion and src identical by value. Internally,
104 SkRegion and src share pointer values. The underlying SkRect array is
107 Creating a SkRegion copy is very efficient and never allocates memory.
108 SkRegion are always copied by value from the interface; the underlying shared
111 @param src SkRegion to copy
114 bool set(const SkRegion& src) {
119 /** Exchanges SkIRect array of SkRegion and other. swap() internally exchanges pointers,
122 swap() usage has largely been replaced by operator=(const SkRegion& region).
126 @param other operator=(const SkRegion& region) set
130 void swap(SkRegion& other);
132 /** Returns true if SkRegion is empty.
133 Empty SkRegion has bounds width or height less than or equal to zero.
134 SkRegion() constructs empty SkRegion; setEmpty()
135 and setRect() with dimensionless data make SkRegion empty.
141 /** Returns true if SkRegion is one SkIRect with positive dimensions.
143 @return true if SkRegion contains one SkIRect
147 /** Returns true if SkRegion is described by more than one rectangle.
149 @return true if SkRegion contains more than one SkIRect
154 Returns (0, 0, 0, 0) if SkRegion is empty.
161 elements in SkRegion. Returns zero if SkRegion is empty.
162 Returns one if SkRegion equals SkIRect; otherwise, returns
163 value greater than one indicating that SkRegion is complex.
165 Call to compare SkRegion for relative complexity.
173 /** Appends outline of SkRegion to path.
174 Returns true if SkRegion is not empty; otherwise, returns false, and leaves path
184 /** Constructs an empty SkRegion. SkRegion is set to empty bounds
193 /** Constructs a rectangular SkRegion matching the bounds of rect.
196 @param rect bounds of constructed SkRegion
203 /** Constructs SkRegion as the union of SkIRect in rects array. If count is
204 zero, constructs empty SkRegion. Returns false if constructed SkRegion is empty.
210 @return true if constructed SkRegion is not empty
221 Creating a SkRegion copy is very efficient and never allocates memory.
222 SkRegion are always copied by value from the interface; the underlying shared
225 @param region SkRegion to copy by value
226 @return SkRegion to copy by value
230 bool setRegion(const SkRegion& region);
232 /** Constructs SkRegion to match outline of path within clip.
233 Returns false if constructed SkRegion is empty.
235 Constructed SkRegion draws the same pixels as path through clip when
239 @param clip SkRegion containing path
240 @return true if constructed SkRegion is not empty
244 bool setPath(const SkPath& path, const SkRegion& clip);
246 /** Returns true if SkRegion intersects rect.
247 Returns false if either rect or SkRegion is empty, or do not intersect.
250 @return true if rect and SkRegion have area in common
256 /** Returns true if SkRegion intersects other.
257 Returns false if either other or SkRegion is empty, or do not intersect.
259 @param other SkRegion to intersect
260 @return true if other and SkRegion have area in common
264 bool intersects(const SkRegion& other) const;
266 /** Returns true if SkIPoint (x, y) is inside SkRegion.
267 Returns false if SkRegion is empty.
271 @return true if (x, y) is inside SkRegion
277 /** Returns true if other is completely inside SkRegion.
278 Returns false if SkRegion or other is empty.
281 @return true if other is inside SkRegion
287 /** Returns true if other is completely inside SkRegion.
288 Returns false if SkRegion or other is empty.
290 @param other SkRegion to contain
291 @return true if other is inside SkRegion
295 bool contains(const SkRegion& other) const;
297 /** Returns true if SkRegion is a single rectangle and contains r.
298 May return false even though SkRegion contains r.
313 /** Returns true if SkRegion does not intersect rect.
314 Returns true if rect is empty or SkRegion is empty.
315 May return false even though SkRegion does not intersect rect.
325 /** Returns true if SkRegion does not intersect rgn.
326 Returns true if rgn is empty or SkRegion is empty.
327 May return false even though SkRegion does not intersect rgn.
329 @param rgn SkRegion to intersect
332 bool quickReject(const SkRegion& rgn) const {
337 /** Offsets SkRegion by ivector (dx, dy). Has no effect if SkRegion is empty.
344 /** Offsets SkRegion by ivector (dx, dy), writing result to dst. SkRegion may be passed
345 as dst parameter, translating SkRegion in place. Has no effect if dst is nullptr.
346 If SkRegion is empty, sets dst to empty.
354 void translate(int dx, int dy, SkRegion* dst) const;
356 /** \enum SkRegion::Op
357 The logical operations that can be performed when combining two SkRegion.
371 /** Replaces SkRegion with the result of SkRegion op rect.
372 Returns true if replaced SkRegion is not empty.
387 /** Replaces SkRegion with the result of SkRegion op rgn.
388 Returns true if replaced SkRegion is not empty.
390 @param rgn SkRegion operand
393 bool op(const SkRegion& rgn, Op op) { return this->op(*this, rgn, op); }
395 /** Replaces SkRegion with the result of rect op rgn.
396 Returns true if replaced SkRegion is not empty.
399 @param rgn SkRegion operand
404 bool op(const SkIRect& rect, const SkRegion& rgn, Op op);
406 /** Replaces SkRegion with the result of rgn op rect.
407 Returns true if replaced SkRegion is not empty.
409 @param rgn SkRegion operand
415 bool op(const SkRegion& rgn, const SkIRect& rect, Op op);
417 /** Replaces SkRegion with the result of rgna op rgnb.
418 Returns true if replaced SkRegion is not empty.
420 @param rgna SkRegion operand
421 @param rgnb SkRegion operand
426 bool op(const SkRegion& rgna, const SkRegion& rgnb, Op op);
431 @return string representation of SkRegion
436 /** \class SkRegion::Iterator
438 up SkRegion.
443 /** Initializes SkRegion::Iterator with an empty SkRegion. done() on SkRegion::Iterator
445 Call reset() to initialized SkRegion::Iterator at a later time.
447 @return empty SkRegion iterator
451 /** Sets SkRegion::Iterator to return elements of SkIRect array in region.
453 @param region SkRegion to iterate
454 @return SkRegion iterator
458 Iterator(const SkRegion& region);
460 /** SkPoint SkRegion::Iterator to start of SkRegion.
461 Returns true if SkRegion was set; otherwise, returns false.
463 @return true if SkRegion was set
469 /** Resets iterator, using the new SkRegion.
471 @param region SkRegion to iterate
475 void reset(const SkRegion& region);
477 /** Returns true if SkRegion::Iterator is pointing to final SkIRect in SkRegion.
483 /** Advances SkRegion::Iterator to next SkIRect in SkRegion if it is not done.
489 /** Returns SkIRect element in SkRegion. Does not return predictable results if SkRegion
492 @return part of SkRegion as SkIRect
496 /** Returns SkRegion if set; otherwise, returns nullptr.
498 @return iterated SkRegion
500 const SkRegion* rgn() const { return fRgn; }
503 const SkRegion* fRgn;
504 const SkRegion::RunType* fRuns;
509 /** \class SkRegion::Cliperator
511 up SkRegion intersected with the specified clip rectangle.
516 /** Sets SkRegion::Cliperator to return elements of SkIRect array in SkRegion within clip.
518 @param region SkRegion to iterate
520 @return SkRegion iterator
524 Cliperator(const SkRegion& region, const SkIRect& clip);
526 /** Returns true if SkRegion::Cliperator is pointing to final SkIRect in SkRegion.
532 /** Advances iterator to next SkIRect in SkRegion contained by clip.
538 /** Returns SkIRect element in SkRegion, intersected with clip passed to
539 SkRegion::Cliperator constructor. Does not return predictable results if SkRegion
542 @return part of SkRegion inside clip as SkIRect
553 /** \class SkRegion::Spanerator
554 Returns the line segment ends within SkRegion that intersect a horizontal line.
559 /** Sets SkRegion::Spanerator to return line segments in SkRegion on scan line.
561 @param region SkRegion to iterate
565 @return SkRegion iterator
569 Spanerator(const SkRegion& region, int y, int left, int right);
571 /** Advances iterator to next span intersecting SkRegion within line segment provided
583 const SkRegion::RunType* fRuns;
588 /** Writes SkRegion to buffer, and returns number of bytes written.
592 @return size of SkRegion
598 /** Constructs SkRegion from buffer of size length. Returns bytes read.
609 /** Writes text representation of SkRegion to string.
626 static RunHead* emptyRunHeadPtr() { return (SkRegion::RunHead*) -1; }
662 static bool RunsAreARect(const SkRegion::RunType runs[], int count,
669 static bool Oper(const SkRegion&, const SkRegion&, SkRegion::Op, SkRegion*);