diff --git a/src/pixie.nim b/src/pixie.nim index 3b98c4b..3ce03ea 100644 --- a/src/pixie.nim +++ b/src/pixie.nim @@ -52,11 +52,13 @@ proc writeFile*(image: Image, filePath: string) = image.writeFile(filePath, fileformat) proc fillRect*(image: Image, rect: Rect, color: ColorRGBA) = + ## Fill a rectangle. var path: Path path.rect(rect) image.fillPath(path, color) proc fillRect*(mask: Mask, rect: Rect) = + ## Fill a rectangle. var path: Path path.rect(rect) mask.fillPath(path) @@ -64,11 +66,13 @@ proc fillRect*(mask: Mask, rect: Rect) = proc strokeRect*( image: Image, rect: Rect, color: ColorRGBA, strokeWidth = 1.0 ) = + ## Stroke a rounded rectangle. var path: Path path.rect(rect) image.strokePath(path, color, strokeWidth) proc strokeRect*(mask: Mask, rect: Rect, strokeWidth = 1.0) = + ## Stroke a rounded rectangle. var path: Path path.rect(rect) mask.strokePath(path, strokeWidth) @@ -79,6 +83,7 @@ proc fillRoundedRect*( nw, ne, se, sw: float32, color: ColorRGBA ) = + ## Fill a rounded rectangle. var path: Path path.roundedRect(rect, nw, ne, se, sw) image.fillPath(path, color) @@ -89,16 +94,19 @@ proc fillRoundedRect*( radius: float32, color: ColorRGBA ) = + ## Fill a rounded rectangle. var path: Path path.roundedRect(rect, radius, radius, radius, radius) image.fillPath(path, color) proc fillRoundedRect*(mask: Mask, rect: Rect, nw, ne, se, sw: float32) = + ## Fill a rounded rectangle. var path: Path path.roundedRect(rect, nw, ne, se, sw) mask.fillPath(path) proc fillRoundedRect*(mask: Mask, rect: Rect, radius: float32) = + ## Fill a rounded rectangle. var path: Path path.roundedRect(rect, radius, radius, radius, radius) mask.fillPath(path) @@ -110,6 +118,7 @@ proc strokeRoundedRect*( color: ColorRGBA, strokeWidth = 1.0 ) = + ## Stroke a rounded rectangle. var path: Path path.roundedRect(rect, nw, ne, se, sw) image.strokePath(path, color, strokeWidth) @@ -121,6 +130,7 @@ proc strokeRoundedRect*( color: ColorRGBA, strokeWidth = 1.0 ) = + ## Stroke a rounded rectangle. var path: Path path.roundedRect(rect, radius, radius, radius, radius) image.strokePath(path, color, strokeWidth) @@ -128,6 +138,7 @@ proc strokeRoundedRect*( proc strokeRoundedRect*( mask: Mask, rect: Rect, nw, ne, se, sw: float32, strokeWidth = 1.0 ) = + ## Stroke a rounded rectangle. var path: Path path.roundedRect(rect, nw, ne, se, sw) mask.strokePath(path, strokeWidth) @@ -135,6 +146,7 @@ proc strokeRoundedRect*( proc strokeRoundedRect*( mask: Mask, rect: Rect, radius: float32, strokeWidth = 1.0 ) = + ## Stroke a rounded rectangle. var path: Path path.roundedRect(rect, radius, radius, radius, radius) mask.strokePath(path, strokeWidth) @@ -145,12 +157,14 @@ proc strokeSegment*( color: ColorRGBA, strokeWidth = 1.0 ) = + ## Stroke a segment (draws a line from segment.at to segment.to). var path: Path path.moveTo(segment.at) path.lineTo(segment.to) image.strokePath(path, color, strokeWidth) proc strokeSegment*(mask: Mask, segment: Segment, strokeWidth: float32) = + ## Stroke a segment (draws a line from segment.at to segment.to). var path: Path path.moveTo(segment.at) path.lineTo(segment.to) @@ -163,6 +177,7 @@ proc fillEllipse*( color: ColorRGBA, blendMode = bmNormal ) = + ## Fill an ellipse. var path: Path path.ellipse(center, rx, ry) image.fillPath(path, color, wrNonZero, blendMode) @@ -172,6 +187,7 @@ proc fillEllipse*( center: Vec2, rx, ry: float32 ) = + ## Fill an ellipse. var path: Path path.ellipse(center, rx, ry) mask.fillPath(path) @@ -183,6 +199,7 @@ proc strokeEllipse*( color: ColorRGBA, strokeWidth = 1.0 ) = + ## Stroke an ellipse. var path: Path path.ellipse(center, rx, ry) image.strokePath(path, color, strokeWidth) @@ -193,6 +210,7 @@ proc strokeEllipse*( rx, ry: float32, strokeWidth = 1.0 ) = + ## Stroke an ellipse. var path: Path path.ellipse(center, rx, ry) mask.strokePath(path, strokeWidth) @@ -203,6 +221,7 @@ proc fillCircle*( radius: float32, color: ColorRGBA ) = + ## Fills a circle. var path: Path path.ellipse(center, radius, radius) image.fillPath(path, color) @@ -212,6 +231,7 @@ proc fillCircle*( center: Vec2, radius: float32 ) = + ## Fills a circle. var path: Path path.ellipse(center, radius, radius) mask.fillPath(path) @@ -223,6 +243,7 @@ proc strokeCircle*( color: ColorRGBA, strokeWidth = 1.0 ) = + ## Strokes a circle. var path: Path path.ellipse(center, radius, radius) image.fillPath(path, color) @@ -233,6 +254,7 @@ proc strokeCircle*( radius: float32, strokeWidth = 1.0 ) = + ## Strokes a circle. var path: Path path.ellipse(center, radius, radius) mask.fillPath(path) @@ -244,11 +266,13 @@ proc fillPolygon*( sides: int, color: ColorRGBA ) = + ## Fills a polygon. var path: Path path.polygon(pos, size, sides) image.fillPath(path, color) proc fillPolygon*(mask: Mask, pos: Vec2, size: float32, sides: int) = + ## Fills a polygon. var path: Path path.polygon(pos, size, sides) mask.fillPath(path) @@ -261,6 +285,7 @@ proc strokePolygon*( color: ColorRGBA, strokeWidth = 1.0 ) = + ## Strokes a polygon. var path: Path path.polygon(pos, size, sides) image.strokePath(path, color, strokeWidth) @@ -272,6 +297,7 @@ proc strokePolygon*( sides: int, strokeWidth = 1.0 ) = + ## Strokes a polygon. var path: Path path.polygon(pos, size, sides) mask.strokePath(path, strokeWidth)