Skip to content

Commit

Permalink
Make demos work in Pharo 6 + add image export to demos (they where no…
Browse files Browse the repository at this point in the history
…t run by the #runAllDemos)

Fixes #5
  • Loading branch information
jecisc committed Oct 12, 2018
1 parent 5d2391e commit 7cf7aa9
Show file tree
Hide file tree
Showing 5 changed files with 1,890 additions and 1,883 deletions.
212 changes: 106 additions & 106 deletions src/Artefact-Examples/PDFClockElement.class.st
Original file line number Diff line number Diff line change
@@ -1,106 +1,106 @@
"
A PDFClockElement is a basic tutorial element about how to create composite.
Instance Variables
time: <Object>
time
- xxxxx
"
Class {
#name : #PDFClockElement,
#superclass : #PDFComposite,
#instVars : [
'time'
],
#category : #'Artefact-Examples-Tutorial'
}

{ #category : #steps }
PDFClockElement class >> clockTutorialStep1 [
"PDFClockElement clockTutorialStep1"

| doc |
doc := PDFDocument new.
doc add: (PDFPage new add: ((PDFClockElement from: 2 cm @ 2 cm to: 10 cm @ 10 cm) time: Time current)).
doc exportTo: 'clockTutorialStep1.pdf' asFileReference writeStream
]

{ #category : #steps }
PDFClockElement class >> clockTutorialStep2 [
"PDFClockElement clockTutorialStep2"

| doc |
doc := PDFDocument new.
doc add: (PDFPage new add: ((PDFClockElement from: 2 cm @ 2 cm to: 10 cm @ 10 cm) time: Time current)).
doc styleSheet > #clock drawColor: (PDFColor r:180 g: 24 b:24); fillColor: (PDFColor r:230 g: 230 b:10).
doc exportTo: 'clockTutorialStep2.pdf' asFileReference writeStream
]

{ #category : #steps }
PDFClockElement class >> clockTutorialStep3 [
"PDFClockElement clockTutorialStep3"

| doc |
doc := PDFDocument new.
doc add: (PDFPage new add: ((PDFClockElement from: 2 cm @ 2 cm to: 10 cm @ 10 cm) time: Time current)).
doc styleSheet > #clock drawColor: (PDFColor r:180 g: 24 b:24); fillColor: (PDFColor r:230 g: 230 b:10).
doc styleSheet > #clock > #arrow drawColor: (PDFColor r:0 g: 45 b:200).
doc exportTo: 'clockTutorialStep3.pdf' asFileReference writeStream
]

{ #category : #steps }
PDFClockElement class >> clockTutorialStep4 [
"PDFClockElement clockTutorialStep4"

| doc |
doc := PDFDocument new.
doc add: (PDFPage new add: ((PDFClockElement from: 2 cm @ 2 cm to: 10 cm @ 10 cm) time: Time current)).
doc styleSheet > #clock drawColor: (PDFColor r:180 g: 24 b:24); fillColor: (PDFColor r:230 g: 230 b:10).
doc styleSheet > #clock > #hourHand drawColor: (PDFColor r:0 g: 45 b:200).
doc styleSheet > #clock > #minuteHand drawColor: (PDFColor r:0 g: 200 b:45).
doc exportTo: 'clockTutorialStep4.pdf' asFileReference writeStream
]

{ #category : #steps }
PDFClockElement class >> clockTutorialStep5 [
"PDFClockElement clockTutorialStep5"

| doc |
doc := PDFDocument new.
doc add: (PDFPage new add: ((PDFClockElement from: 2 cm @ 2 cm to: 10 cm @ 10 cm) time: Time current);
add: ((PDFClockElement from: 12 cm @ 2 cm to: 20 cm @ 10 cm) time: Time current; style: #apocalypseClock)).
doc styleSheet > #clock drawColor: (PDFColor r:180 g: 24 b:24); fillColor: (PDFColor r:230 g: 230 b:10).
doc styleSheet > #clock > #hourHand drawColor: (PDFColor r:0 g: 45 b:200).
doc styleSheet > #clock > #minuteHand drawColor: (PDFColor r:0 g: 200 b:45).
doc styleSheet > #apocalypseClock fillColor: (PDFColor r:244 g: 221 b:25); thickness: 2mm; roundCap: true.
doc styleSheet > #apocalypseClock > #minuteHand drawColor: (PDFColor r:240 g: 6 b: 7); thickness: 1 mm.
doc exportTo: 'clockTutorialStep5.pdf' asFileReference writeStream
]

{ #category : #style }
PDFClockElement >> defaultStyle [
^ #clock
]

{ #category : #render }
PDFClockElement >> getSubElementsWith: aGenerator styleSheet: aStyleSheet [
| hourAngle minuteAngle |
hourAngle := Float pi / 2 - (time hour12 * 2 * Float pi / 12).
minuteAngle := Float pi / 2 - (time minute * 2 * Float pi / 60).
^ {(PDFCircleElement from: self from to: self to).
(PDFCircleElement center: self center radius: self dimension min * 0.05).
((PDFArrowElement from: self center angle: hourAngle length: dimension min * 0.25) style: #hourHand).
((PDFArrowElement from: self center angle: minuteAngle length: dimension min * 0.45) style: #minuteHand)}
]

{ #category : #accessing }
PDFClockElement >> time [
^ time
]

{ #category : #accessing }
PDFClockElement >> time: anObject [
time := anObject
]
"
A PDFClockElement is a basic tutorial element about how to create composite.
Instance Variables
time: <Object>
time
- xxxxx
"
Class {
#name : #PDFClockElement,
#superclass : #PDFComposite,
#instVars : [
'time'
],
#category : #'Artefact-Examples-Tutorial'
}

{ #category : #steps }
PDFClockElement class >> clockTutorialStep1 [
"PDFClockElement clockTutorialStep1"

| doc |
doc := PDFDocument new.
doc add: (PDFPage new add: ((PDFClockElement from: 2 cm @ 2 cm to: 10 cm @ 10 cm) time: Time current)).
doc exportTo: 'clockTutorialStep1.pdf' asFileReference writeStream
]

{ #category : #steps }
PDFClockElement class >> clockTutorialStep2 [
"PDFClockElement clockTutorialStep2"

| doc |
doc := PDFDocument new.
doc add: (PDFPage new add: ((PDFClockElement from: 2 cm @ 2 cm to: 10 cm @ 10 cm) time: Time current)).
doc styleSheet > #clock drawColor: (PDFColor r:180 g: 24 b:24); fillColor: (PDFColor r:230 g: 230 b:10).
doc exportTo: 'clockTutorialStep2.pdf' asFileReference writeStream
]

{ #category : #steps }
PDFClockElement class >> clockTutorialStep3 [
"PDFClockElement clockTutorialStep3"

| doc |
doc := PDFDocument new.
doc add: (PDFPage new add: ((PDFClockElement from: 2 cm @ 2 cm to: 10 cm @ 10 cm) time: Time current)).
doc styleSheet > #clock drawColor: (PDFColor r:180 g: 24 b:24); fillColor: (PDFColor r:230 g: 230 b:10).
doc styleSheet > #clock > #arrow drawColor: (PDFColor r:0 g: 45 b:200).
doc exportTo: 'clockTutorialStep3.pdf' asFileReference writeStream
]

{ #category : #steps }
PDFClockElement class >> clockTutorialStep4 [
"PDFClockElement clockTutorialStep4"

| doc |
doc := PDFDocument new.
doc add: (PDFPage new add: ((PDFClockElement from: 2 cm @ 2 cm to: 10 cm @ 10 cm) time: Time current)).
doc styleSheet > #clock drawColor: (PDFColor r:180 g: 24 b:24); fillColor: (PDFColor r:230 g: 230 b:10).
doc styleSheet > #clock > #hourHand drawColor: (PDFColor r:0 g: 45 b:200).
doc styleSheet > #clock > #minuteHand drawColor: (PDFColor r:0 g: 200 b:45).
doc exportTo: 'clockTutorialStep4.pdf' asFileReference writeStream
]

{ #category : #steps }
PDFClockElement class >> clockTutorialStep5 [
"PDFClockElement clockTutorialStep5"

| doc |
doc := PDFDocument new.
doc add: (PDFPage new add: ((PDFClockElement from: 2 cm @ 2 cm to: 10 cm @ 10 cm) time: Time current);
add: ((PDFClockElement from: 12 cm @ 2 cm to: 20 cm @ 10 cm) time: Time current; style: #apocalypseClock)).
doc styleSheet > #clock drawColor: (PDFColor r:180 g: 24 b:24); fillColor: (PDFColor r:230 g: 230 b:10).
doc styleSheet > #clock > #hourHand drawColor: (PDFColor r:0 g: 45 b:200).
doc styleSheet > #clock > #minuteHand drawColor: (PDFColor r:0 g: 200 b:45).
doc styleSheet > #apocalypseClock fillColor: (PDFColor r:244 g: 221 b:25); thickness: 2mm; roundCap: true.
doc styleSheet > #apocalypseClock > #minuteHand drawColor: (PDFColor r:240 g: 6 b: 7); thickness: 1 mm.
doc exportTo: 'clockTutorialStep5.pdf' asFileReference writeStream
]

{ #category : #style }
PDFClockElement >> defaultStyle [
^ #clock
]

{ #category : #render }
PDFClockElement >> getSubElementsWith: aGenerator styleSheet: aStyleSheet [
| hourAngle minuteAngle |
hourAngle := Float pi / 2 - (time hour12 * 2 * Float pi / 12).
minuteAngle := Float pi / 2 - (time minute * 2 * Float pi / 60).
^ {(PDFCircleElement from: self from to: self to).
(PDFCircleElement center: self center radius: self dimension min * 0.05).
((PDFArrowElement from: self center angle: hourAngle length: dimension min * 0.25) style: #hourHand).
((PDFArrowElement from: self center angle: minuteAngle length: dimension min * 0.45) style: #minuteHand)}
]

{ #category : #accessing }
PDFClockElement >> time [
^ time
]

{ #category : #accessing }
PDFClockElement >> time: anObject [
time := anObject
]
56 changes: 28 additions & 28 deletions src/Artefact-Examples/PDFCompactDiscTemplate.class.st
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
"
A cover for compact disc
"
Class {
#name : #PDFCompactDiscTemplate,
#superclass : #PDFTemplate,
#category : #'Artefact-Examples-Demos-Templates'
}

{ #category : #accessing }
PDFCompactDiscTemplate class >> recommendedPageFormat [
^(PDFA4Format new setLandscape)
]

{ #category : #action }
PDFCompactDiscTemplate >> drawTemplate [
self add: ((PDFRectElement
from: 10 mm @ 10 mm
dimension: 240 mm @ 120 mm)
dotted: self dotted
).
self add: ((PDFLineElement
from: 130mm @ 10mm
to: 130mm @ 130mm)
dotted: self dotted
).
]
"
A cover for compact disc
"
Class {
#name : #PDFCompactDiscTemplate,
#superclass : #PDFTemplate,
#category : #'Artefact-Examples-Demos-Templates'
}

{ #category : #accessing }
PDFCompactDiscTemplate class >> recommendedPageFormat [
^(PDFA4Format new setLandscape)
]

{ #category : #action }
PDFCompactDiscTemplate >> drawTemplate [
self add: ((PDFRectElement
from: 10 mm @ 10 mm
dimension: 240 mm @ 120 mm)
dotted: self dotted
).
self add: ((PDFLineElement
from: 130mm @ 10mm
to: 130mm @ 130mm)
dotted: self dotted
).
]
66 changes: 33 additions & 33 deletions src/Artefact-Examples/PDFDVDCoverTemplate.class.st
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
"
A cover for DVD
"
Class {
#name : #PDFDVDCoverTemplate,
#superclass : #PDFTemplate,
#category : #'Artefact-Examples-Demos-Templates'
}

{ #category : #accessing }
PDFDVDCoverTemplate class >> recommendedPageFormat [
^(PDFA4Format new setLandscape)
]

{ #category : #action }
PDFDVDCoverTemplate >> drawTemplate [
self add: ((PDFRectElement
from: 10 mm @ 10 mm
dimension: 272 mm @ 182 mm)
dotted: self dotted
).
self add: ((PDFLineElement
from:139mm @ 10mm
to: 139mm @ 192mm)
dotted: self dotted
).
self add: ((PDFLineElement
from:153mm @ 10mm
to: 153mm @ 192mm)
dotted: self dotted
).
]
"
A cover for DVD
"
Class {
#name : #PDFDVDCoverTemplate,
#superclass : #PDFTemplate,
#category : #'Artefact-Examples-Demos-Templates'
}

{ #category : #accessing }
PDFDVDCoverTemplate class >> recommendedPageFormat [
^(PDFA4Format new setLandscape)
]

{ #category : #action }
PDFDVDCoverTemplate >> drawTemplate [
self add: ((PDFRectElement
from: 10 mm @ 10 mm
dimension: 272 mm @ 182 mm)
dotted: self dotted
).
self add: ((PDFLineElement
from:139mm @ 10mm
to: 139mm @ 192mm)
dotted: self dotted
).
self add: ((PDFLineElement
from:153mm @ 10mm
to: 153mm @ 192mm)
dotted: self dotted
).
]
Loading

0 comments on commit 7cf7aa9

Please sign in to comment.