Issue 1089 in moose-technology: Roassal should export PNG

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

Issue 1089 in moose-technology: Roassal should export PNG

moose-technology
Status: New
Owner: ----
CC: [hidden email]
Labels: Type-Defect Priority-Medium Component-Roassal Milestone-5.0

New issue 1089 by [hidden email]: Roassal should export PNG
https://code.google.com/p/moose-technology/issues/detail?id=1089

We have a first draft of RTPNGExporter, but the problem is that it provides  
only the visible part of the morph.

The problem is here:
exportToFile
        PNGReadWriter
                putForm: view view canvas morph imageForm
                onFileNamed: self fileName

--
You received this message because this project is configured to send all  
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Issue 1089 in moose-technology: Roassal should export PNG

moose-technology

Comment #1 on issue 1089 by [hidden email]: Roassal should export PNG
https://code.google.com/p/moose-technology/issues/detail?id=1089

Ideally, we should delegate to the AthensCairoCanvas, but somehow the  
athens canvas instance from the TRCanvas is empty.

We certainly do not want to re-render the scene because some picture can be  
expensive to produce.

--
You received this message because this project is configured to send all  
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Issue 1089 in moose-technology: Roassal should export PNG

moose-technology

Comment #2 on issue 1089 by [hidden email]: Roassal should export PNG
https://code.google.com/p/moose-technology/issues/detail?id=1089

Yes, somehow your canvas in TRCanvas is only used for shape creations
(computePath). Drawing is done with TRMorphs cairo-surface.

AthensCairoSurface has a writeToPng: method for writing the current surface  
data
as a png file.

--
You received this message because this project is configured to send all  
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Issue 1089 in moose-technology: Roassal should export PNG

moose-technology

Comment #3 on issue 1089 by [hidden email]: Roassal should export PNG
https://code.google.com/p/moose-technology/issues/detail?id=1089

Indeed. However, we probably have to redraw everything again given that the  
canvas in the TRMorph is only the visible one

--
You received this message because this project is configured to send all  
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Issue 1089 in moose-technology: Roassal should export PNG

moose-technology

Comment #4 on issue 1089 by [hidden email]: Roassal should export PNG
https://code.google.com/p/moose-technology/issues/detail?id=1089

I tried this, but somehow it does not work:

exportToFile
      | completeMorph |
      completeMorph := view view canvas morphClass new
           canvas: view view canvas;
           extent: view view canvas encompassingRectangle extent.
      PNGReadWriter
           putForm: completeMorph imageForm
           onFileNamed: self fileName

Any idea why?

--
You received this message because this project is configured to send all  
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Issue 1089 in moose-technology: Roassal should export PNG

moose-technology

Comment #5 on issue 1089 by [hidden email]: Roassal should export PNG
https://code.google.com/p/moose-technology/issues/detail?id=1089

How do I render an existing trachel shape on an Athens surface?

--
You received this message because this project is configured to send all  
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Issue 1089 in moose-technology: Roassal should export PNG

moose-technology

Comment #6 on issue 1089 by [hidden email]: Roassal should export PNG
https://code.google.com/p/moose-technology/issues/detail?id=1089

Here is a script that Alex put together. It almost work, but we still need  
to extract the logic from TRMorph. Also, there still is a problem with the  
logic as the picture is shifted to the right.

b := RTMondrianViewBuilder new.
b shape rectangle
    withBorder;
    width: [ :cls | cls numberOfVariables * 5];
    height: #numberOfMethods;
    linearFillColor: #numberOfLinesOfCode within: RTObject withAllSubclasses.
b nodes: RTObject withAllSubclasses.
b edgesFrom: #superclass.
b treeLayout.
b build.

form := FormCanvas extent: (b view canvas encompassingRectangle) extent.
m := TRMorph new.
m canvas: b view canvas.
m extent: (b view canvas encompassingRectangle) extent.
m createSurface.
m drawOn: form.
m surface writeToPng: 'foo.png'

--
You received this message because this project is configured to send all  
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Issue 1089 in moose-technology: Roassal should export PNG

moose-technology

Comment #7 on issue 1089 by [hidden email]: Roassal should export PNG
https://code.google.com/p/moose-technology/issues/detail?id=1089

Can anyone else look at this?

--
You received this message because this project is configured to send all  
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Issue 1089 in moose-technology: Roassal should export PNG

moose-technology

Comment #8 on issue 1089 by [hidden email]: Roassal should export PNG
https://code.google.com/p/moose-technology/issues/detail?id=1089

Here is a standalone script that seems to almost works. There is still  
seems to be a problem with one pixel at the bottom and to the right that  
gets cut.

b := RTMondrianViewBuilder new.
b shape rectangle
    withBorder;
    width: [ :cls | cls numberOfVariables * 5];
    height: #numberOfMethods;
    linearFillColor: #numberOfLinesOfCode within: RTObject withAllSubclasses.
b nodes: RTObject withAllSubclasses.
b edgesFrom: #superclass.
b treeLayout.
b build.

trachelCanvas := b view canvas.
form := FormCanvas extent: (trachelCanvas encompassingRectangle) extent.
session := Smalltalk session.
surface := AthensCairoSurface extent: (trachelCanvas encompassingRectangle  
extent) asIntegerPoint.
form fillRectangle: trachelCanvas encompassingRectangle color:  
trachelCanvas color.
"The drawing has to be done when a change in the shapes occured or when  
there is an animation."
surface drawDuring: [:cs |
        surface clear.
        "We display the elements that are subject to the camera"
        trachelCanvas shapes do: [ :trachelShape |
                trachelShape drawOn: cs.
        ].
        "We display the elements that are _NOT_ subject to the camera"
        trachelCanvas fixedShapes do: [ :trachelShape |
                trachelShape drawOn: cs.
        ].
].
"aCanvas translucentImage: surface asForm at: self bounds origin."
"asForm creates a new Form, which is likely to be expensive. This can be  
cached"
form image: surface asForm at: trachelCanvas encompassingRectangle origin  
sourceRect: (0 @ 0 extent: surface extent) rule: 34.
surface writeToPng: 'foo.png'

--
You received this message because this project is configured to send all  
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Issue 1089 in moose-technology: Roassal should export PNG

moose-technology

Comment #9 on issue 1089 by [hidden email]: Roassal should export PNG
https://code.google.com/p/moose-technology/issues/detail?id=1089

I integrated this in RTPNGExporter, but we still have the one pixel problem.

--
You received this message because this project is configured to send all  
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Issue 1089 in moose-technology: Roassal should export PNG

moose-technology

Comment #10 on issue 1089 by [hidden email]: Roassal should export  
PNG
https://code.google.com/p/moose-technology/issues/detail?id=1089

I've tried this and it looks okay (simply adding 10 @ 10 to the extent):

b := RTMondrianViewBuilder new.
b shape rectangle
   withBorder;
   width: [ :cls | cls numberOfVariables * 5];
   height: #numberOfMethods;
   linearFillColor: #numberOfLinesOfCode within: RTObject withAllSubclasses.
b nodes: RTObject withAllSubclasses.
b edgesFrom: #superclass.
b treeLayout.
b build.

trachelCanvas := b view canvas.
form := FormCanvas extent: (trachelCanvas encompassingRectangle) extent.
session := Smalltalk session.
surface := AthensCairoSurface extent: (trachelCanvas encompassingRectangle  
extent + (10 @ 10)) asIntegerPoint.
form fillRectangle: (trachelCanvas encompassingRectangle expandBy: 10 @ 10)  
color: trachelCanvas color.
"The drawing has to be done when a change in the shapes occured or when  
there is an animation."
surface drawDuring: [:cs |
        surface clear.
        "We display the elements that are subject to the camera"
        trachelCanvas shapes do: [ :trachelShape |
                trachelShape drawOn: cs.
        ].
        "We display the elements that are _NOT_ subject to the camera"
        trachelCanvas fixedShapes do: [ :trachelShape |
                trachelShape drawOn: cs.
        ].
].
"aCanvas translucentImage: surface asForm at: self bounds origin."
"asForm creates a new Form, which is likely to be expensive. This can be  
cached"
form image: surface asForm at: trachelCanvas encompassingRectangle origin  
sourceRect: (0 @ 0 extent: surface extent) rule: 34.
surface writeToPng: '/tmp/foo.png'

--
You received this message because this project is configured to send all  
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Issue 1089 in moose-technology: Roassal should export PNG

moose-technology

Comment #11 on issue 1089 by [hidden email]: Roassal should export  
PNG
https://code.google.com/p/moose-technology/issues/detail?id=1089

How is adding 10@10 a solution?

1. asIntegerPoint rounds down.
2. encompassingRectangle does not take the strokewidth into account.

--
You received this message because this project is configured to send all  
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Issue 1089 in moose-technology: Roassal should export PNG

moose-technology

Comment #12 on issue 1089 by [hidden email]: Roassal should export  
PNG
https://code.google.com/p/moose-technology/issues/detail?id=1089

Other observiations:

- file chooser dialog has "Your title here" as title.
- cancel file chooser dialog -> MessageNotUnderstood: receiver  
of ""fullName"" is nil

--
You received this message because this project is configured to send all  
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Issue 1089 in moose-technology: Roassal should export PNG

moose-technology
Updates:
        Status: Fixed

Comment #13 on issue 1089 by [hidden email]: Roassal should export PNG
https://code.google.com/p/moose-technology/issues/detail?id=1089

@Nicolai: Thanks for finding the issues. They are fixed now.

@Alex: Looks great. Thanks!

--
You received this message because this project is configured to send all  
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev