Hello
Is it possible to include a in-image picture in Pillar which I get by evaluating myMorph imageForm? Or do I need to write the instance of Form I get by evaluating the expression above first as a PNG file to disk and get it from there. PNGReadWriter putForm: myMorph imageForm onFileNamed: aString If yes what is the default directory where does Pillar expects pictures -- The Pillar cheat sheet [1] and the Pillar chapter in the Pharo enterprise book no 3 [2] have an example +Caption>file://image.png|width=50|label=label+ Regards Hannes [1] http://pillarhub.pharocloud.com/hub/pillarhub/pillarcheatsheet [2] Section 3.8 of https://ci.inria.fr/pharo-contribution/job/EnterprisePharoBook/lastSuccessfulBuild/artifact/book-result/PillarChap/Pillar.html |
The answer (second option by writing the image to disk) is
| myMorph myForm myPillarSource myPillarDOM | myMorph := AlignmentMorph newRow addMorph: (EllipseMorph new color: Color red); addMorph: (EllipseMorph new color: Color yellow); addMorph: (EllipseMorph new color: Color green); openInWorld. myForm := myMorph imageForm. myMorph delete. PNGReadWriter putForm: myForm onFileNamed: 'myImage.png'. myPillarSource := ' !The title Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. +The caption of my image>file://myImage.png|label=myLabel+ Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. '. myPillarDOM := PRPillarParser parse: myPillarSource. (PRHTMLWriter write: myPillarDOM) contents inspect HH. On 8/28/17, H. Hirzel <[hidden email]> wrote: > Hello > > Is it possible to include a in-image picture in Pillar which I get by > evaluating > > myMorph imageForm? > > Or do I need to write the instance of Form I get by evaluating the > expression above first as a PNG file to disk and get it from there. > > > PNGReadWriter > putForm: myMorph imageForm > onFileNamed: aString > > If yes what is the default directory where does Pillar expects pictures -- > > > The Pillar cheat sheet [1] and the Pillar chapter in the Pharo > enterprise book no 3 [2] have an example > > +Caption>file://image.png|width=50|label=label+ > > > Regards > > Hannes > > > > [1] > http://pillarhub.pharocloud.com/hub/pillarhub/pillarcheatsheet > > [2] Section 3.8 of > https://ci.inria.fr/pharo-contribution/job/EnterprisePharoBook/lastSuccessfulBuild/artifact/book-result/PillarChap/Pillar.html > |
I will keep your idea for a student lectures we will have in second semester
+Caption>file://image.png|width=50|label=label+ => +Caption>inMemory: [| myMorph myForm myPillarSource myPillarDOM | myMorph := AlignmentMorph newRow addMorph: (EllipseMorph new color: Color red); addMorph: (EllipseMorph new color: Color yellow); addMorph: (EllipseMorph new color: Color green); openInWorld. myForm := myMorph imageForm. myMorph delete. PNGReadWriter putForm: myForm onFileNamed: 'myImage.png'. ]|width=50|label=label+ On Mon, Aug 28, 2017 at 6:22 PM, H. Hirzel <[hidden email]> wrote: > The answer (second option by writing the image to disk) is > > | myMorph myForm myPillarSource myPillarDOM | > > myMorph := AlignmentMorph newRow > addMorph: (EllipseMorph new color: Color red); > addMorph: (EllipseMorph new color: Color yellow); > addMorph: (EllipseMorph new color: Color green); > openInWorld. > > myForm := myMorph imageForm. > myMorph delete. > > PNGReadWriter > putForm: myForm > onFileNamed: 'myImage.png'. > > > > myPillarSource := ' > > !The title > Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do > eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad > minim veniam, quis nostrud exercitation ullamco laboris nisi ut > aliquip ex ea commodo consequat. Duis aute irure dolor in > reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla > pariatur. > > +The caption of my image>file://myImage.png|label=myLabel+ > > Excepteur sint occaecat cupidatat non proident, sunt in culpa qui > officia deserunt mollit anim id est laborum. > '. > > > myPillarDOM := PRPillarParser parse: myPillarSource. > > > (PRHTMLWriter write: myPillarDOM) contents inspect > > > > > > HH. > > > On 8/28/17, H. Hirzel <[hidden email]> wrote: >> Hello >> >> Is it possible to include a in-image picture in Pillar which I get by >> evaluating >> >> myMorph imageForm? >> >> Or do I need to write the instance of Form I get by evaluating the >> expression above first as a PNG file to disk and get it from there. >> >> >> PNGReadWriter >> putForm: myMorph imageForm >> onFileNamed: aString >> >> If yes what is the default directory where does Pillar expects pictures -- >> >> >> The Pillar cheat sheet [1] and the Pillar chapter in the Pharo >> enterprise book no 3 [2] have an example >> >> +Caption>file://image.png|width=50|label=label+ >> >> >> Regards >> >> Hannes >> >> >> >> [1] >> http://pillarhub.pharocloud.com/hub/pillarhub/pillarcheatsheet >> >> [2] Section 3.8 of >> https://ci.inria.fr/pharo-contribution/job/EnterprisePharoBook/lastSuccessfulBuild/artifact/book-result/PillarChap/Pillar.html >> > |
"There is no need to open the morph in the world and delete it. #imageForm uses its own form and renders the morph onto it."
| image |
image := AlignmentMorph newRow
hResizing: #shrinkWrap;
vResizing: #shrinkWrap;
color: Color gray;
addMorph: (EllipseMorph new color: Color red);
addMorph: (EllipseMorph new color: Color yellow);
addMorph: (EllipseMorph new color: Color green);
imageForm.
image writePNGFileNamed: 'myImage.png'
"there are some export methods in morph which can be used instead of #imageForm and then #writePngFileNamed (#exportAsPNG), which will then prompt you for the file name and location".
Best regards,
Henrik
Fra: Pharo-users <[hidden email]> på vegne av Stephane Ducasse <[hidden email]>
Sendt: 31. august 2017 20:23:24 Til: Any question about pharo is welcome Emne: Re: [Pharo-users] [Pillar] How do I include a picture which I get from aMorph imageFrom? I will keep your idea for a student lectures we will have in second semester
+Caption>file://image.png|width=50|label=label+ => +Caption>inMemory: [| myMorph myForm myPillarSource myPillarDOM | myMorph := AlignmentMorph newRow addMorph: (EllipseMorph new color: Color red); addMorph: (EllipseMorph new color: Color yellow); addMorph: (EllipseMorph new color: Color green); openInWorld. myForm := myMorph imageForm. myMorph delete. PNGReadWriter putForm: myForm onFileNamed: 'myImage.png'. ]|width=50|label=label+ On Mon, Aug 28, 2017 at 6:22 PM, H. Hirzel <[hidden email]> wrote: > The answer (second option by writing the image to disk) is > > | myMorph myForm myPillarSource myPillarDOM | > > myMorph := AlignmentMorph newRow > addMorph: (EllipseMorph new color: Color red); > addMorph: (EllipseMorph new color: Color yellow); > addMorph: (EllipseMorph new color: Color green); > openInWorld. > > myForm := myMorph imageForm. > myMorph delete. > > PNGReadWriter > putForm: myForm > onFileNamed: 'myImage.png'. > > > > myPillarSource := ' > > !The title > Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do > eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad > minim veniam, quis nostrud exercitation ullamco laboris nisi ut > aliquip ex ea commodo consequat. Duis aute irure dolor in > reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla > pariatur. > > +The caption of my image>file://myImage.png|label=myLabel+ > > Excepteur sint occaecat cupidatat non proident, sunt in culpa qui > officia deserunt mollit anim id est laborum. > '. > > > myPillarDOM := PRPillarParser parse: myPillarSource. > > > (PRHTMLWriter write: myPillarDOM) contents inspect > > > > > > HH. > > > On 8/28/17, H. Hirzel <[hidden email]> wrote: >> Hello >> >> Is it possible to include a in-image picture in Pillar which I get by >> evaluating >> >> myMorph imageForm? >> >> Or do I need to write the instance of Form I get by evaluating the >> expression above first as a PNG file to disk and get it from there. >> >> >> PNGReadWriter >> putForm: myMorph imageForm >> onFileNamed: aString >> >> If yes what is the default directory where does Pillar expects pictures -- >> >> >> The Pillar cheat sheet [1] and the Pillar chapter in the Pharo >> enterprise book no 3 [2] have an example >> >> +Caption>file://image.png|width=50|label=label+ >> >> >> Regards >> >> Hannes >> >> >> >> [1] >> http://pillarhub.pharocloud.com/hub/pillarhub/pillarcheatsheet >> >> [2] Section 3.8 of >> https://ci.inria.fr/pharo-contribution/job/EnterprisePharoBook/lastSuccessfulBuild/artifact/book-result/PillarChap/Pillar.html >> > |
Free forum by Nabble | Edit this page |