Skip to content

Commit 380eae9

Browse files
committed
Added documentation
Minor refactoring of codestyle
1 parent 2bfc098 commit 380eae9

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

library/src/main/java/com/ftinc/canvasscript/CanvasScript.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ public static CanvasScript create(int width, int height, @NonNull Bitmap.Config
128128
* {@link Canvas} created
129129
* @param bitmap the base drawing bitmap
130130
* @return self for chaining
131+
* @throws IllegalStateException if bitmap is not mutable or is recycled
131132
* @see Canvas
132133
*/
133134
public static CanvasScript create(@NonNull Bitmap bitmap) {
@@ -436,6 +437,7 @@ public CanvasScript circle(float cx, float cy, float radius, @NonNull Paint pain
436437
* @param ex The end-x coordinate
437438
* @param ey The end-y coordinate
438439
* @return self for chaining
440+
* @throws IllegalStateException when no previous paint method is called
439441
* @see Canvas#drawLine(float, float, float, float, Paint)
440442
*/
441443
public CanvasScript line(float sx, float sy, float ex, float ey) {
@@ -449,6 +451,7 @@ public CanvasScript line(float sx, float sy, float ex, float ey) {
449451
* Add a set of lines to the render stack
450452
* @param pts The array, in multiples of 4, of points that represent the line [x0, y0, x1, y1, ..]
451453
* @return self for chaining
454+
* @throws IllegalStateException when no previous paint method is called
452455
* @see Canvas#drawLines(float[], Paint)
453456
*/
454457
public CanvasScript lines(@Size(multiple = 4) @NonNull float[] pts) {
@@ -478,6 +481,7 @@ public CanvasScript lines(@Size(multiple = 4) @NonNull float[] pts, @NonNull Pai
478481
* @param count The number of values in the array to process, after
479482
* skipping "offset" of them.
480483
* @return self for chaining
484+
* @throws IllegalStateException when no previous paint method is called
481485
* @see Canvas#drawLines(float[], Paint)
482486
*/
483487
public CanvasScript lines(@Size(multiple = 4) @NonNull float[] pts, int offset, int count) {
@@ -510,6 +514,7 @@ public CanvasScript lines(@Size(multiple = 4) @NonNull float[] pts, int offset,
510514
* @param right The right of the bounds to draw in
511515
* @param bottom The bottom of the bounds to draw in
512516
* @return self for chaining
517+
* @throws IllegalStateException when no previous paint method is called
513518
* @see Canvas#drawOval(float, float, float, float, Paint)
514519
*/
515520
public CanvasScript oval(float left, float top, float right, float bottom) {
@@ -539,6 +544,7 @@ public CanvasScript oval(float left, float top, float right, float bottom, @NonN
539544
* Add an oval to the render stack
540545
* @param bounds The bounds of the oval to draw in
541546
* @return self for chaining
547+
* @throws IllegalStateException when no previous paint method is called
542548
* @see Canvas#drawOval(RectF, Paint)
543549
*/
544550
public CanvasScript oval(@NonNull RectF bounds) {
@@ -568,6 +574,7 @@ public CanvasScript oval(@NonNull RectF bounds, @NonNull Paint paint) {
568574
* @param right The right of the rect bounds
569575
* @param bottom The bottom of the rect bounds
570576
* @return self for chaining
577+
* @throws IllegalStateException when no previous paint method is called
571578
* @see Canvas#drawRect(float, float, float, float, Paint)
572579
*/
573580
public CanvasScript rect(float left, float top, float right, float bottom) {
@@ -581,6 +588,7 @@ public CanvasScript rect(float left, float top, float right, float bottom) {
581588
* Add a rect to the render stack
582589
* @param rect The bounds of the rectangle
583590
* @return self for chaining
591+
* @throws IllegalStateException when no previous paint method is called
584592
* @see Canvas#drawRect(Rect, Paint)
585593
*/
586594
public CanvasScript rect(@NonNull Rect rect) {
@@ -594,6 +602,7 @@ public CanvasScript rect(@NonNull Rect rect) {
594602
* Add a rect to the render stack
595603
* @param rect The bounds of the rectangle
596604
* @return self for chaining
605+
* @throws IllegalStateException when no previous paint method is called
597606
* @see Canvas#drawRect(RectF, Paint)
598607
*/
599608
public CanvasScript rect(@NonNull RectF rect) {
@@ -720,6 +729,7 @@ public CanvasScript roundedRect(@NonNull RectF bounds, float radius, @NonNull Pa
720729
* @param rx The x-radius of the oval corners
721730
* @param ry The y-radius of the oval corners
722731
* @return self for chaining
732+
* @throws IllegalStateException when no previous paint method is called
723733
* @see Canvas#drawRoundRect(float, float, float, float, float, float, Paint)
724734
*/
725735
public CanvasScript roundedRect(float left, float top, float right, float bottom, float rx, float ry) {
@@ -737,6 +747,7 @@ public CanvasScript roundedRect(float left, float top, float right, float bottom
737747
* @param bottom The bottom bound of the rect
738748
* @param radius The radius of the circle corners
739749
* @return self for chaining
750+
* @throws IllegalStateException when no previous paint method is called
740751
* @see Canvas#drawRoundRect(float, float, float, float, float, float, Paint)
741752
*/
742753
public CanvasScript roundedRect(float left, float top, float right, float bottom, float radius) {
@@ -752,6 +763,7 @@ public CanvasScript roundedRect(float left, float top, float right, float bottom
752763
* @param rx The x-radius of the oval corners
753764
* @param ry The y-radius of the oval corners
754765
* @return self for chaining
766+
* @throws IllegalStateException when no previous paint method is called
755767
* @see Canvas#drawRoundRect(float, float, float, float, float, float, Paint)
756768
*/
757769
public CanvasScript roundedRect(@NonNull RectF bounds, float rx, float ry) {
@@ -766,6 +778,7 @@ public CanvasScript roundedRect(@NonNull RectF bounds, float rx, float ry) {
766778
* @param bounds The bounds of the rect
767779
* @param radius The radius of the circle corners
768780
* @return self for chaining
781+
* @throws IllegalStateException when no previous paint method is called
769782
* @see Canvas#drawRoundRect(float, float, float, float, float, float, Paint)
770783
*/
771784
public CanvasScript roundedRect(@NonNull RectF bounds, float radius) {
@@ -786,6 +799,7 @@ public CanvasScript roundedRect(@NonNull RectF bounds, float radius) {
786799
* @param useCenter whether to include rendering the center with the arc
787800
* @param paint The paint to draw with
788801
* @return self for chaining
802+
* @throws IllegalStateException when no previous paint method is called
789803
* @see Canvas#drawArc(float, float, float, float, float, float, boolean, Paint)
790804
*/
791805
public CanvasScript arc(float left, float top, float right, float bottom, float startAngle, float sweepAngle,
@@ -821,6 +835,7 @@ public CanvasScript arc(@NonNull RectF bounds, float startAngle, float sweepAngl
821835
* @param sweepAngle The amount in degrees that the arc spans
822836
* @param useCenter whether to include rendering the center with the arc
823837
* @return self for chaining
838+
* @throws IllegalStateException when no previous paint method is called
824839
* @see Canvas#drawArc(float, float, float, float, float, float, boolean, Paint)
825840
*/
826841
public CanvasScript arc(float left, float top, float right, float bottom, float startAngle, float sweepAngle,
@@ -838,6 +853,7 @@ public CanvasScript arc(float left, float top, float right, float bottom, float
838853
* @param sweepAngle The amount in degrees that the arc spans
839854
* @param useCenter whether to include rendering the center with the arc
840855
* @return self for chaining
856+
* @throws IllegalStateException when no previous paint method is called
841857
* @see Canvas#drawArc(RectF, float, float, boolean, Paint)
842858
*/
843859
public CanvasScript arc(@NonNull RectF bounds, float startAngle, float sweepAngle, boolean useCenter) {
@@ -1067,6 +1083,7 @@ public CanvasScript points(@Size(multiple = 2) @NonNull float[] pts, int offset,
10671083
* @param x The x-coordinate of the point
10681084
* @param y The y-coordinate of the point
10691085
* @return self for chaining
1086+
* @throws IllegalStateException when no previous paint method is called
10701087
* @see Canvas#drawPoint(float, float, Paint)
10711088
*/
10721089
public CanvasScript point(float x, float y) {
@@ -1080,6 +1097,7 @@ public CanvasScript point(float x, float y) {
10801097
* Add a set of points to the render stack
10811098
* @param pts Array of points to draw [x0 y0 x1 y1 x2 y2 ...]
10821099
* @return self for chaining
1100+
* @throws IllegalStateException when no previous paint method is called
10831101
* @see Canvas#drawPoints(float[], Paint)
10841102
*/
10851103
public CanvasScript points(@Size(multiple = 2) @NonNull float[] pts) {
@@ -1096,6 +1114,7 @@ public CanvasScript points(@Size(multiple = 2) @NonNull float[] pts) {
10961114
* @param count The number of values to process, after skipping offset
10971115
* of them
10981116
* @return self for chaining
1117+
* @throws IllegalStateException when no previous paint method is called
10991118
* @see Canvas#drawPoints(float[], int, int, Paint)
11001119
*/
11011120
public CanvasScript points(@Size(multiple = 2) @NonNull float[] pts, int offset, int count) {
@@ -1122,6 +1141,7 @@ public CanvasScript path(@NonNull Path path, @NonNull Paint paint) {
11221141
* Add a path to the render stack
11231142
* @param path The path to render
11241143
* @return self for chaining
1144+
* @throws IllegalStateException when no previous paint method is called
11251145
* @see Canvas#drawPath(Path, Paint)
11261146
*/
11271147
public CanvasScript path(@NonNull Path path) {

library/src/main/java/com/ftinc/canvasscript/util/Log.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,15 @@
1515
*/
1616
package com.ftinc.canvasscript.util;
1717

18+
1819
import java.util.Locale;
1920

21+
2022
public final class Log {
2123

2224
private static boolean enabled = true;
2325

26+
2427
private Log() {
2528
// Unused
2629
}

0 commit comments

Comments
 (0)