blob: 06bcdf09056b8a69fe6b716a0964bdbb8f5850fc [file] [log] [blame]
Cary Clarkbc5697d2017-10-04 14:31:33 -04001#Topic IRect
2#Alias IRect_Reference
3
4#Struct SkIRect
5
6SkIRect holds four 32 bit integer coordinates for a rectangle
7
8#Topic Overview
9
10#Subtopic Subtopics
11#ToDo manually add subtopics ##
12#Table
13#Legend
14# topics # description ##
15#Legend ##
16#Table ##
17##
18
19#Subtopic Operators
20#Table
21#Legend
22# description # function ##
23#Legend ##
24# friend bool operator!=(const SkIRect& a, const SkIRect& b) # ##
25# friend bool operator==(const SkIRect& a, const SkIRect& b) # ##
26#Table ##
27#Subtopic ##
28
29#Subtopic Member_Functions
30#Table
31#Legend
32# description # function ##
33#Legend ##
34# EmptyIRect # ##
35# Intersects # ##
36# IntersectsNoEmptyCheck # ##
37# MakeEmpty # ##
38# MakeLTRB # ##
39# MakeLargest # ##
40# MakeSize # ##
41# MakeWH # ##
42# MakeXYWH # ##
43# bottom # ##
44# centerX # ##
45# centerY # ##
46# contains # ##
47# containsNoEmptyCheck # ##
48# height # ##
49# inset # ##
50# intersect # ##
51# intersectNoEmptyCheck # ##
52# is16Bit # ##
53# isEmpty # ##
54# isLargest # ##
55# join # ##
56# left # ##
57# makeInset # ##
58# makeOffset # ##
59# makeOutset # ##
60# makeSorted # ##
61# offset # ##
62# offsetTo # ##
63# outset # ##
64# quickReject # ##
65# right # ##
66# set # ##
67# setEmpty # ##
68# setLTRB # ##
69# setLargest # ##
70# setLargestInverted # ##
71# setXYWH # ##
72# size # ##
73# sort # ##
74# top # ##
75# width # ##
76# x # ##
77# y # ##
78#Table ##
79#Subtopic ##
80
81#Topic ##
82
83#Member int32_t fLeft
84##
85
86#Member int32_t fTop
87##
88
89#Member int32_t fRight
90##
91
92#Member int32_t fBottom
93##
94
95# ------------------------------------------------------------------------------
96
97#Method static SkIRect SK_WARN_UNUSED_RESULT MakeEmpty()
98
99#Return incomplete ##
100
101#Example
102// incomplete
103##
104
105#ToDo incomplete ##
106
107##
108
109# ------------------------------------------------------------------------------
110
111#Method static SkIRect SK_WARN_UNUSED_RESULT MakeLargest()
112
113#Return incomplete ##
114
115#Example
116// incomplete
117##
118
119#ToDo incomplete ##
120
121##
122
123# ------------------------------------------------------------------------------
124
125#Method static SkIRect SK_WARN_UNUSED_RESULT MakeWH(int32_t w, int32_t h)
126
127#Param w incomplete ##
128#Param h incomplete ##
129
130#Return incomplete ##
131
132#Example
133// incomplete
134##
135
136#ToDo incomplete ##
137
138##
139
140# ------------------------------------------------------------------------------
141
142#Method static SkIRect SK_WARN_UNUSED_RESULT MakeSize(const SkISize& size)
143
144#Param size incomplete ##
145
146#Return incomplete ##
147
148#Example
149// incomplete
150##
151
152#ToDo incomplete ##
153
154##
155
156# ------------------------------------------------------------------------------
157
158#Method static SkIRect SK_WARN_UNUSED_RESULT MakeLTRB(int32_t l, int32_t t, int32_t r, int32_t b)
159
160#Param l incomplete ##
161#Param t incomplete ##
162#Param r incomplete ##
163#Param b incomplete ##
164
165#Return incomplete ##
166
167#Example
168// incomplete
169##
170
171#ToDo incomplete ##
172
173##
174
175# ------------------------------------------------------------------------------
176
177#Method static SkIRect SK_WARN_UNUSED_RESULT MakeXYWH(int32_t x, int32_t y, int32_t w, int32_t h)
178
179#Param x incomplete ##
180#Param y incomplete ##
181#Param w incomplete ##
182#Param h incomplete ##
183
184#Return incomplete ##
185
186#Example
187// incomplete
188##
189
190#ToDo incomplete ##
191
192##
193
194# ------------------------------------------------------------------------------
195
196#Method int left() const
197
198#Return incomplete ##
199
200#Example
201// incomplete
202##
203
204#ToDo incomplete ##
205
206##
207
208# ------------------------------------------------------------------------------
209
210#Method int top() const
211
212#Return incomplete ##
213
214#Example
215// incomplete
216##
217
218#ToDo incomplete ##
219
220##
221
222# ------------------------------------------------------------------------------
223
224#Method int right() const
225
226#Return incomplete ##
227
228#Example
229// incomplete
230##
231
232#ToDo incomplete ##
233
234##
235
236# ------------------------------------------------------------------------------
237
238#Method int bottom() const
239
240#Return incomplete ##
241
242#Example
243// incomplete
244##
245
246#ToDo incomplete ##
247
248##
249
250# ------------------------------------------------------------------------------
251
252#Method int x() const
253
254return the left edge of the rectangle
255
256#Return incomplete ##
257
258#Example
259// incomplete
260##
261
262#ToDo incomplete ##
263
264##
265
266# ------------------------------------------------------------------------------
267
268#Method int y() const
269
270return the top edge of the rectangle
271
272#Return incomplete ##
273
274#Example
275// incomplete
276##
277
278#ToDo incomplete ##
279
280##
281
282# ------------------------------------------------------------------------------
283
284#Method int width() const
285
286Returns the rectangle width. This does not check for a valid rectangle
287(i.e. left <= right) so the result may be negative.
288
289#Return incomplete ##
290
291#Example
292// incomplete
293##
294
295#ToDo incomplete ##
296
297##
298
299# ------------------------------------------------------------------------------
300
301#Method int height() const
302
303Returns the rectangle height. This does not check for a valid rectangle
304(i.e. top <= bottom) so the result may be negative.
305
306#Return incomplete ##
307
308#Example
309// incomplete
310##
311
312#ToDo incomplete ##
313
314##
315
316# ------------------------------------------------------------------------------
317
318#Method SkISize size() const
319
320#Return incomplete ##
321
322#Example
323// incomplete
324##
325
326#ToDo incomplete ##
327
328##
329
330# ------------------------------------------------------------------------------
331
332#Method int centerX() const
333
334Since the center of an integer rectangle may fall on a factional value, this
335method is defined to return (right + left) >> 1.
336This is a specific "truncation" of the average, which is different than
337(right + left) / 2 when the sum is negative.
338
339#Return incomplete ##
340
341#Example
342// incomplete
343##
344
345#ToDo incomplete ##
346
347##
348
349# ------------------------------------------------------------------------------
350
351#Method int centerY() const
352
353Since the center of an integer rectangle may fall on a factional value, this
354method is defined to return (bottom + top) >> 1.
355This is a specific "truncation" of the average, which is different than
356(bottom + top) / 2 when the sum is negative.
357
358#Return incomplete ##
359
360#Example
361// incomplete
362##
363
364#ToDo incomplete ##
365
366##
367
368# ------------------------------------------------------------------------------
369
370#Method bool isEmpty() const
371
372Return true if the rectangle width or height are <= 0
373
374#Return incomplete ##
375
376#Example
377// incomplete
378##
379
380#ToDo incomplete ##
381
382##
383
384# ------------------------------------------------------------------------------
385
386#Method bool isLargest() const
387
388#Return incomplete ##
389
390#Example
391// incomplete
392##
393
394#ToDo incomplete ##
395
396##
397
398# ------------------------------------------------------------------------------
399
400#Method friend bool operator==(const SkIRect& a, const SkIRect& b)
401
402#Param a incomplete ##
403#Param b incomplete ##
404
405#Return incomplete ##
406
407#Example
408// incomplete
409##
410
411#ToDo incomplete ##
412
413##
414
415# ------------------------------------------------------------------------------
416
417#Method friend bool operator!=(const SkIRect& a, const SkIRect& b)
418
419#Param a incomplete ##
420#Param b incomplete ##
421
422#Return incomplete ##
423
424#Example
425// incomplete
426##
427
428#ToDo incomplete ##
429
430##
431
432# ------------------------------------------------------------------------------
433
434#Method bool is16Bit() const
435
436#Return incomplete ##
437
438#Example
439// incomplete
440##
441
442#ToDo incomplete ##
443
444##
445
446# ------------------------------------------------------------------------------
447
448#Method void setEmpty()
449
450Set the rectangle to (0,0,0,0)
451
452#Example
453// incomplete
454##
455
456#ToDo incomplete ##
457
458##
459
460# ------------------------------------------------------------------------------
461
462#Method void set(int32_t left, int32_t top, int32_t right, int32_t bottom)
463
464#Param left incomplete ##
465#Param top incomplete ##
466#Param right incomplete ##
467#Param bottom incomplete ##
468
469#Example
470// incomplete
471##
472
473#ToDo incomplete ##
474
475##
476
477# ------------------------------------------------------------------------------
478
479#Method void setLTRB(int32_t left, int32_t top, int32_t right, int32_t bottom)
480
481alias for set(l, t, r, b)
482
483#Param left incomplete ##
484#Param top incomplete ##
485#Param right incomplete ##
486#Param bottom incomplete ##
487
488#Example
489// incomplete
490##
491
492#ToDo incomplete ##
493
494##
495
496# ------------------------------------------------------------------------------
497
498#Method void setXYWH(int32_t x, int32_t y, int32_t width, int32_t height)
499
500#Param x incomplete ##
501#Param y incomplete ##
502#Param width incomplete ##
503#Param height incomplete ##
504
505#Example
506// incomplete
507##
508
509#ToDo incomplete ##
510
511##
512
513# ------------------------------------------------------------------------------
514
515#Method void setLargest()
516
517Sets rectangle left and top to most negative value, and sets
518right and bottom to most positive value.
519
520#Example
521// incomplete
522##
523
524#ToDo incomplete ##
525
526##
527
528# ------------------------------------------------------------------------------
529
530#Method void setLargestInverted()
531
532Sets rectangle left and top to most positive value, and sets
533right and bottom to most negative value.
534
535#Example
536// incomplete
537##
538
539#ToDo incomplete ##
540
541##
542
543# ------------------------------------------------------------------------------
544
545#Method SkIRect makeOffset(int32_t dx, int32_t dy) const
546
547Return a new IRect, built as an offset of this rectangle.
548
549#Param dx incomplete ##
550#Param dy incomplete ##
551
552#Return incomplete ##
553
554#Example
555// incomplete
556##
557
558#ToDo incomplete ##
559
560##
561
562# ------------------------------------------------------------------------------
563
564#Method SkIRect makeInset(int32_t dx, int32_t dy) const
565
566Return a new IRect, built as an inset of this rectangle.
567
568#Param dx incomplete ##
569#Param dy incomplete ##
570
571#Return incomplete ##
572
573#Example
574// incomplete
575##
576
577#ToDo incomplete ##
578
579##
580
581# ------------------------------------------------------------------------------
582
583#Method SkIRect makeOutset(int32_t dx, int32_t dy) const
584
585Return a new Rect, built as an outset of this rectangle.
586
587#Param dx incomplete ##
588#Param dy incomplete ##
589
590#Return incomplete ##
591
592#Example
593// incomplete
594##
595
596#ToDo incomplete ##
597
598##
599
600# ------------------------------------------------------------------------------
601
602#Method void offset(int32_t dx, int32_t dy)
603
604Offset set the rectangle by adding dx to its left and right,
605and adding dy to its top and bottom.
606
607#Param dx incomplete ##
608#Param dy incomplete ##
609
610#Example
611// incomplete
612##
613
614#ToDo incomplete ##
615
616##
617
618# ------------------------------------------------------------------------------
619
620#Method void offset(const SkIPoint& delta)
621
622#Param delta incomplete ##
623
624#Example
625// incomplete
626##
627
628#ToDo incomplete ##
629
630##
631
632# ------------------------------------------------------------------------------
633
634#Method void offsetTo(int32_t newX, int32_t newY)
635
636Offset this rectangle such its new x() and y() will equal newX and newY.
637
638#Param newX incomplete ##
639#Param newY incomplete ##
640
641#Example
642// incomplete
643##
644
645#ToDo incomplete ##
646
647##
648
649# ------------------------------------------------------------------------------
650
651#Method void inset(int32_t dx, int32_t dy)
652
653Inset the rectangle by (dx,dy). If dx is positive, then the sides are moved inwards,
654making the rectangle narrower. If dx is negative, then the sides are moved outwards,
655making the rectangle wider. The same holds true for dy and the top and bottom.
656
657#Param dx incomplete ##
658#Param dy incomplete ##
659
660#Example
661// incomplete
662##
663
664#ToDo incomplete ##
665
666##
667
668# ------------------------------------------------------------------------------
669
670#Method void outset(int32_t dx, int32_t dy)
671
672Outset the rectangle by (dx,dy). If dx is positive, then the sides are
673moved outwards, making the rectangle wider. If dx is negative, then the
674sides are moved inwards, making the rectangle narrower. The same holds
675true for dy and the top and bottom.
676
677#Param dx incomplete ##
678#Param dy incomplete ##
679
680#Example
681// incomplete
682##
683
684#ToDo incomplete ##
685
686##
687
688# ------------------------------------------------------------------------------
689
690#Method bool quickReject(int l, int t, int r, int b) const
691
692#Param l incomplete ##
693#Param t incomplete ##
694#Param r incomplete ##
695#Param b incomplete ##
696
697#Return incomplete ##
698
699#Example
700// incomplete
701##
702
703#ToDo incomplete ##
704
705##
706
707# ------------------------------------------------------------------------------
708
709#Method bool contains(int32_t x, int32_t y) const
710
711Returns true if (x,y) is inside the rectangle and the rectangle is not
712empty. The left and top are considered to be inside, while the right
713and bottom are not. Thus for the rectangle (0, 0, 5, 10), the
714points (0,0) and (0,9) are inside, while (-1,0) and (5,9) are not.
715
716#Param x incomplete ##
717#Param y incomplete ##
718
719#Return incomplete ##
720
721#Example
722// incomplete
723##
724
725#ToDo incomplete ##
726
727##
728
729# ------------------------------------------------------------------------------
730
731#Method bool contains(int32_t left, int32_t top, int32_t right, int32_t bottom) const
732
733Returns true if the 4 specified sides of a rectangle are inside or equal to this rectangle.
734If either rectangle is empty, contains() returns false.
735
736#Param left incomplete ##
737#Param top incomplete ##
738#Param right incomplete ##
739#Param bottom incomplete ##
740
741#Return incomplete ##
742
743#Example
744// incomplete
745##
746
747#ToDo incomplete ##
748
749##
750
751# ------------------------------------------------------------------------------
752
753#Method bool contains(const SkIRect& r) const
754
755Returns true if the specified rectangle r is inside or equal to this rectangle.
756
757#Param r incomplete ##
758
759#Return incomplete ##
760
761#Example
762// incomplete
763##
764
765#ToDo incomplete ##
766
767##
768
769# ------------------------------------------------------------------------------
770
771#Method bool contains(const SkRect& r) const
772
773Returns true if the specified rectangle r is inside or equal to this rectangle.
774
775#Param r incomplete ##
776
777#Return incomplete ##
778
779#Example
780// incomplete
781##
782
783#ToDo incomplete ##
784
785##
786
787# ------------------------------------------------------------------------------
788
789#Method bool containsNoEmptyCheck(int32_t left, int32_t top,
790 int32_t right, int32_t bottom) const
791
792Return true if this rectangle contains the specified rectangle.
793For speed, this method does not check if either this or the specified
794rectangles are empty, and if either is, its return value is undefined.
795In the debugging build however, we assert that both this and the
796specified rectangles are non-empty.
797
798#Param left incomplete ##
799#Param top incomplete ##
800#Param right incomplete ##
801#Param bottom incomplete ##
802
803#Return incomplete ##
804
805#Example
806// incomplete
807##
808
809#ToDo incomplete ##
810
811##
812
813# ------------------------------------------------------------------------------
814
815#Method bool containsNoEmptyCheck(const SkIRect& r) const
816
817#Param r incomplete ##
818
819#Return incomplete ##
820
821#Example
822// incomplete
823##
824
825#ToDo incomplete ##
826
827##
828
829# ------------------------------------------------------------------------------
830
831#Method bool intersect(const SkIRect& r)
832
833If r intersects this rectangle, return true and set this rectangle to that
834intersection, otherwise return false and do not change this rectangle.
835If either rectangle is empty, do nothing and return false.
836
837#Param r incomplete ##
838
839#Return incomplete ##
840
841#Example
842// incomplete
843##
844
845#ToDo incomplete ##
846
847##
848
849# ------------------------------------------------------------------------------
850
851#Method bool SK_WARN_UNUSED_RESULT intersect(const SkIRect& a, const SkIRect& b)
852
853If rectangles a and b intersect, return true and set this rectangle to
854that intersection, otherwise return false and do not change this
855rectangle. If either rectangle is empty, do nothing and return false.
856
857#Param a incomplete ##
858#Param b incomplete ##
859
860#Return incomplete ##
861
862#Example
863// incomplete
864##
865
866#ToDo incomplete ##
867
868##
869
870# ------------------------------------------------------------------------------
871
872#Method bool SK_WARN_UNUSED_RESULT intersectNoEmptyCheck(const SkIRect& a, const SkIRect& b)
873
874If rectangles a and b intersect, return true and set this rectangle to
875that intersection, otherwise return false and do not change this
876rectangle. For speed, no check to see if a or b are empty is performed.
877If either is, then the return result is undefined. In the debug build,
878we assert that both rectangles are non-empty.
879
880#Param a incomplete ##
881#Param b incomplete ##
882
883#Return incomplete ##
884
885#Example
886// incomplete
887##
888
889#ToDo incomplete ##
890
891##
892
893# ------------------------------------------------------------------------------
894
895#Method bool intersect(int32_t left, int32_t top, int32_t right, int32_t bottom)
896
897If the rectangle specified by left,top,right,bottom intersects this rectangle,
898return true and set this rectangle to that intersection,
899otherwise return false and do not change this rectangle.
900If either rectangle is empty, do nothing and return false.
901
902#Param left incomplete ##
903#Param top incomplete ##
904#Param right incomplete ##
905#Param bottom incomplete ##
906
907#Return incomplete ##
908
909#Example
910// incomplete
911##
912
913#ToDo incomplete ##
914
915##
916
917# ------------------------------------------------------------------------------
918
919#Method static bool Intersects(const SkIRect& a, const SkIRect& b)
920
921Returns true if a and b are not empty, and they intersect
922
923#Param a incomplete ##
924#Param b incomplete ##
925
926#Return incomplete ##
927
928#Example
929// incomplete
930##
931
932#ToDo incomplete ##
933
934##
935
936# ------------------------------------------------------------------------------
937
938#Method static bool IntersectsNoEmptyCheck(const SkIRect& a, const SkIRect& b)
939
940Returns true if a and b intersect. debug-asserts that neither are empty.
941
942#Param a incomplete ##
943#Param b incomplete ##
944
945#Return incomplete ##
946
947#Example
948// incomplete
949##
950
951#ToDo incomplete ##
952
953##
954
955# ------------------------------------------------------------------------------
956
957#Method void join(int32_t left, int32_t top, int32_t right, int32_t bottom)
958
959Update this rectangle to enclose itself and the specified rectangle.
960If this rectangle is empty, just set it to the specified rectangle. If the specified
961rectangle is empty, do nothing.
962
963#Param left incomplete ##
964#Param top incomplete ##
965#Param right incomplete ##
966#Param bottom incomplete ##
967
968#Example
969// incomplete
970##
971
972#ToDo incomplete ##
973
974##
975
976# ------------------------------------------------------------------------------
977
978#Method void join(const SkIRect& r)
979
980Update this rectangle to enclose itself and the specified rectangle.
981If this rectangle is empty, just set it to the specified rectangle. If the specified
982rectangle is empty, do nothing.
983
984#Param r incomplete ##
985
986#Example
987// incomplete
988##
989
990#ToDo incomplete ##
991
992##
993
994# ------------------------------------------------------------------------------
995
996#Method void sort()
997
998Swap top/bottom or left/right if there are flipped.
999This can be called if the edges are computed separately,
1000and may have crossed over each other.
1001When this returns, left <= right && top <= bottom
1002
1003#Example
1004// incomplete
1005##
1006
1007#ToDo incomplete ##
1008
1009##
1010
1011# ------------------------------------------------------------------------------
1012
1013#Method SkIRect makeSorted() const
1014
1015Return a new Rect that is the sorted version of this rectangle (left <= right, top <= bottom).
1016
1017#Return incomplete ##
1018
1019#Example
1020// incomplete
1021##
1022
1023#ToDo incomplete ##
1024
1025##
1026
1027# ------------------------------------------------------------------------------
1028
1029#Method static const SkIRect& SK_WARN_UNUSED_RESULT EmptyIRect()
1030
1031#Return incomplete ##
1032
1033#Example
1034// incomplete
1035##
1036
1037#ToDo incomplete ##
1038
1039##
1040
1041#Struct SkIRect ##
1042
1043#Topic IRect ##