Skip to content

Commit

Permalink
Convert class comments to Lepiter format #2
Browse files Browse the repository at this point in the history
  • Loading branch information
akgrant43 authored and tinchodias committed Sep 23, 2021
1 parent cd7a6ab commit 2760208
Show file tree
Hide file tree
Showing 30 changed files with 115 additions and 86 deletions.
1 change: 1 addition & 0 deletions src/BaselineOfSparta/BaselineOfSparta.class.st
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"
I am a Baseline of Sparta.
"
Class {
#name : #BaselineOfSparta,
Expand Down
1 change: 1 addition & 0 deletions src/BaselineOfSpartaCairo/BaselineOfSpartaCairo.class.st
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"
I am a Baseline of Sparta-Cairo backend
"
Class {
#name : #BaselineOfSpartaCairo,
Expand Down
1 change: 1 addition & 0 deletions src/Sparta-Cairo/SpartaCairoTextMetrics.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ height - height of the glyphs as drawn
advanceX - distance to advance in the X direction after drawing these glyphs
advanceY - distance to advance in the Y direction after drawing these glyphs. Will typically be zero except for vertical text layout as found in East-Asian languages.
"
Class {
#name : #SpartaCairoTextMetrics,
Expand Down
1 change: 1 addition & 0 deletions src/Sparta-Core/SpUserFontSource.class.st
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"
I represent a font face source and know how to retrieve font contents from it
"
Class {
#name : #SpUserFontSource,
Expand Down
1 change: 1 addition & 0 deletions src/Sparta-Core/SpUserFontSourceBuffer.class.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"
I am a buffer source.
Is useful if font is stored as byte array in the image
"
Class {
#name : #SpUserFontSourceBuffer,
Expand Down
1 change: 1 addition & 0 deletions src/Sparta-Core/SpUserFontSourceFile.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
I am a file source.
Can be used for fast scripting without the need to load font in the image or install.
May be useful if font are intended to be deployed outside of the image
"
Class {
#name : #SpUserFontSourceFile,
Expand Down
1 change: 1 addition & 0 deletions src/Sparta-Core/SpUserFontSourceUrl.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
I am an url source.
Useful if user wants to try a font from the web without the need to even download it.
Requires internet connection to retrieve font content.
"
Class {
#name : #SpUserFontSourceUrl,
Expand Down
1 change: 1 addition & 0 deletions src/Sparta-Core/SpartaBitmapBuilder.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ surface := canvas bitmap fromForm: (Smalltalk ui icons iconNamed: #classIcon).
Create a new surface from image file by its absolute or relative path:
surface := canvas bitmap fromFileNamed: 'images/cats/kitty.jpg'
"
Class {
#name : #SpartaBitmapBuilder,
Expand Down
25 changes: 13 additions & 12 deletions src/Sparta-Core/SpartaClipper.class.st
Original file line number Diff line number Diff line change
@@ -1,40 +1,41 @@
"
! SpartaClipper
# SpartaClipper
I provide support of clipping.
!! Overview
## Overview
My responsibility is to keep track of clipping region and allow developers to push or pop.
I support clipping by Rectangle or SpartaPath
!! Public API and Key Messages
## Public API and Key Messages
- ==by:during:== - clips by a path or rectangle while performing a closure, once done restores previous clipping region. Takes care about possible unhandled exceptions within a block.
- ==push:== clips by a path or rectangle. Every push: must be balanced with pop to restore clipping region.
- ==pop== - balances push: and restores clipping region to its previous state
- `by:during:` - clips by a path or rectangle while performing a closure, once done restores previous clipping region. Takes care about possible unhandled exceptions within a block.
- `push:` clips by a path or rectangle. Every push: must be balanced with pop to restore clipping region.
- `pop` - balances push: and restores clipping region to its previous state
!! Example:
## Example:
Error robust implementation with the help of block closures:
[[[language=smalltalk
```language=smalltalk
canvas clip
by: (0@0 extent: 100@100)
during: [ ""draw here"" ]
]]]
```
Or developers can balance push:/pop manually:
[[[language=smalltalk
```language=smalltalk
ellipse := canvas shape ellipse: (0@0 extent: 100@100).
canvas clip push: ellipse.
""draw here""
canvas clip pop.
]]]
```
!! Internal Representation and Key Implementation Points.
## Internal Representation and Key Implementation Points.
Subclasses must implement pushRectangle: pushPath: and pop
"
Class {
#name : #SpartaClipper,
Expand Down
6 changes: 3 additions & 3 deletions src/Sparta-Core/SpartaExternalForm.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ The user is responsible for both releasing the image-memory, as well as destroyi
Example usage:
| extent form ptr |
extent := 400@300.
extent form ptrextent := 400@300.
form := ExternalForm extent: extent depth: 32.
ptr := ExternalAddress gcallocate: (extent x * extent y * 4).
ptr := ExternalAddress gcallocate: (extent x 4).
form setManualSurfacePointer: ptr.
Display displayScaledOn: form.
form displayAt: 0@0.
form destroySurface.
"
Class {
#name : #SpartaExternalForm,
Expand Down
1 change: 1 addition & 0 deletions src/Sparta-Core/SpartaFillEvenOddRule.class.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"
SVG defines the even-odd rule as follows:
Even-odd rule determines the ""insideness"" of a point on the canvas by drawing a ray from that point to infinity in any direction and counting the number of path segments from the given shape that the ray crosses. If this number is odd, the point is inside; if even, the point is outside.
"
Class {
#name : #SpartaFillEvenOddRule,
Expand Down
23 changes: 12 additions & 11 deletions src/Sparta-Core/SpartaFillPainter.class.st
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
"
! SpartaFillPainter
# SpartaFillPainter
I represent a fill path operation builder - a concerete type of paint-path draw operation.
!! Overview
## Overview
I define an abstract api that all fill painters should provide. I am a final step in path-paint double dispatch and implement all fill draw related methods. As optimisation I have separate methods to fill rectangle and path with color, linear and radial gradients as also with surface. Backend may implement every method differently, add more dispatch stages or provide a single uniform method.
I am instantiated and pre-configured by *==SpartaCanvas==>../SpartaCanvas.class/README.md*. Do not create instances of me directly, instead use canvas as service provider. This way reference to my class will not be hardcoded which increases flexibility.
I am instantiated and pre-configured by `SpartaCanvas`. Do not create instances of me directly, instead use canvas as service provider. This way reference to my class will not be hardcoded which increases flexibility.
!! Public API and Key Messages
## Public API and Key Messages
- ==paint:== - set an object to be used as paint (can be ==Color==, *==SpartaCanvas==>../SpartaCanvas.class/README.md*, ==SpartaSurface==, *==TSpartaPaint==>../TSpartaPaint.trait/README.md*)
- ==path:== - set path to be filled (can be ==TSpartaPath== or ==Rectangle==)
- ==draw== - perform fill operation with previously configured parameters and options
- `paint:` - set an object to be used as paint (can be `Color`, `SpartaCanvas`, `SpartaSurface`, `TSpartaPaint`)
- `path:` - set path to be filled (can be `TSpartaPath` or `Rectangle`)
- `draw` - perform fill operation with previously configured parameters and options
!! Example:
## Example:
Fill the whole canvas with white color:
[[[language=smalltalk
```language=smalltalk
canvas fill
paint: Color white;
path: canvas bounds;
draw.
]]]
```
Fill ellipse within rectangle (0@0 extent: 400@100) with pharo logo picture:
[[[language=smalltalk
Expand All @@ -32,10 +32,11 @@ canvas fill
```
+https://github.com/syrel/Sparta/raw/master/images/SpartaFillPainter/01_pharo_logo.png|label=pharoLogo+
!! Internal Representation and Key Implementation Points.
## Internal Representation and Key Implementation Points.
Concrete backend implementations should subclass me directly, I was never ment to be an external object.
"
Class {
#name : #SpartaFillPainter,
Expand Down
1 change: 1 addition & 0 deletions src/Sparta-Core/SpartaFillRule.class.st
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"
Fill rule is an algorithm which determines how a graphical shape with more than one closed outline will be filled.
"
Class {
#name : #SpartaFillRule,
Expand Down
1 change: 1 addition & 0 deletions src/Sparta-Core/SpartaFillWindingRule.class.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"
SVG defines the non-zero winding rule as follows:
Non-zero winding rule determines the ""insideness"" of a point on the canvas by drawing a ray from that point to infinity in any direction and then examining the places where a segment of the shape crosses the ray. Starting with a count of zero, add one each time a path segment crosses the ray from left to right and subtract one each time a path segment crosses the ray from right to left. After counting the crossings, if the result is zero then the point is outside the path. Otherwise, it is inside.
"
Class {
#name : #SpartaFillWindingRule,
Expand Down
37 changes: 19 additions & 18 deletions src/Sparta-Core/SpartaFilterPainter.class.st
Original file line number Diff line number Diff line change
@@ -1,44 +1,45 @@
"
! SpartaFilterPainter
# SpartaFilterPainter
I am an abstract filter painter used to construct filter drawing operation.
!! Overview
## Overview
I am responsible for creation and execution of filter draw operation. It requires an area on which it should be applied, an offset (if not set, area origin is used instead) and actual filter primitive.
Developers should use me to create a filter drawing operation. It involves a configuration step of wanted filter and actual drawing step. I must be only created by canvas, and never directly refering my class.
!! Public API and Key Messages
## Public API and Key Messages
- ==area:== - set an area on which filter should be applied (source area)
- ==type:== - an object representing one of filter primitives. See ==filters== protocol in *SpartaCanvas>../SpartaCanvas.class/README.md*
- ==to:== - ''(optional)'' set location on canvas where result should be blended (destination). If not set, area origin is used.
- ==drawOptions:== - ''(optional)'' set additional draw parameters, such as global alpha, composition operator and antialias.
- `area:` - set an area on which filter should be applied (source area)
- `type:` - an object representing one of filter primitives. See `filters` protocol in SpartaCanvas
- `to:` - *(optional)* set location on canvas where result should be blended (destination). If not set, area origin is used.
- `drawOptions:` - *(optional)* set additional draw parameters, such as global alpha, composition operator and antialias.
!! Example:
## Example:
[[[language=smalltalk
```language=smalltalk
canvas filter
area: (100@100 extent: 200@200);
to: 150@150;
type: (canvas gaussianBlurFilter
source: canvas;
stdDeviation: 4);
draw.
]]]
```
!! Internal Representation and Key Implementation Points.
## Internal Representation and Key Implementation Points.
!!! Instance Variables
- destinationPoint: ==<Point>==
- drawOptions: ==<TSpartaDrawOptions>==
- filter: ==<TSpartaFilter>==
- sourceRectangle: ==<Rectangle>==
### Instance Variables
- destinationPoint: `<Point>`
- drawOptions: `<TSpartaDrawOptions>`
- filter: `<TSpartaFilter>`
- sourceRectangle: `<Rectangle>`
!!! Implementation Points
### Implementation Points
I am an abstract class. Concrete backends must implement `#draw`
I am an abstract class. Concrete backends must implement ==#draw==
"
Class {
Expand Down
1 change: 1 addition & 0 deletions src/Sparta-Core/SpartaFiltersFactory.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Public API and Key Messages
kitty := canvas bitmap fromFileNamed: 'images/cats/kitty.jpg'.
brannan := canvas filters brannan: kitty.
"
Class {
#name : #SpartaFiltersFactory,
Expand Down
1 change: 1 addition & 0 deletions src/Sparta-Core/SpartaFontCache.class.st
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"
I cache fonts with font style a key
"
Class {
#name : #SpartaFontCache,
Expand Down
1 change: 1 addition & 0 deletions src/Sparta-Core/SpartaFontFace.class.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"
I represent a font face.
My properties are backend specific
"
Class {
#name : #SpartaFontFace,
Expand Down
1 change: 1 addition & 0 deletions src/Sparta-Core/SpartaFormCache.class.st
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"
I cache bitmaps created from forms
"
Class {
#name : #SpartaFormCache,
Expand Down
1 change: 1 addition & 0 deletions src/Sparta-Core/SpartaLine.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Internal Representation and Key Implementation Points.
Implementation Points
"
Class {
#name : #SpartaLine,
Expand Down
1 change: 1 addition & 0 deletions src/Sparta-Core/SpartaMetrics.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
I represent a metrics request.
I hold all neccessary information that is needed by metrics provider in order to measure provided text run.
"
Class {
#name : #SpartaMetrics,
Expand Down
1 change: 1 addition & 0 deletions src/Sparta-Core/SpartaPaintProvider.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Internal Representation and Key Implementation Points.
My subclasses must provide backend specific paints
"
Class {
#name : #SpartaPaintProvider,
Expand Down
1 change: 1 addition & 0 deletions src/Sparta-Core/SpartaRectangle.class.st
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"
I am mutable implementation of Rectangle which stores coordinates as Numbers and not Points
"
Class {
#name : #SpartaRectangle,
Expand Down
1 change: 1 addition & 0 deletions src/Sparta-Core/SpartaShapeFactory.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Internal Representation and Key Implementation Points.
It makes a lot of sense to implement shape creation methods as plugin or as part of backend
"
Class {
#name : #SpartaShapeFactory,
Expand Down
Loading

0 comments on commit 2760208

Please sign in to comment.