Home » Eclipse Projects » GEF » Creating an Image
Creating an Image [message #130459] |
Tue, 04 May 2004 14:04 |
Eclipse User |
|
|
|
Originally posted by: phil.williams.toadmail.com
I asked this in the past, but have gotten no responses, so let me rephrase:
I would like to be able to create an action that can capture the diagram
in a GEF editor to an image file (JPG, PNG, BMP, whatever). I am at a
loss as to how to start.
Does anyone out there have any pointers or sample code to help me get
started?
Thanks in advance,
Phil
|
|
| |
Re: Creating an Image [message #130618 is a reply to message #130459] |
Tue, 04 May 2004 20:09 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
Image image = new Image(null, width, height);
GC gc = new GC(image);
SWTGraphics g = new SWTGraphics(gc);
figure.paint(g);
"Phil Williams" <phil.williams@toadmail.com> wrote in message
news:c787he$4t8$1@eclipse.org...
> I asked this in the past, but have gotten no responses, so let me
rephrase:
>
> I would like to be able to create an action that can capture the diagram
> in a GEF editor to an image file (JPG, PNG, BMP, whatever). I am at a
> loss as to how to start.
>
> Does anyone out there have any pointers or sample code to help me get
> started?
>
> Thanks in advance,
> Phil
|
|
|
Re: Creating an Image [message #130893 is a reply to message #130618] |
Wed, 05 May 2004 17:04 |
Eclipse User |
|
|
|
Originally posted by: phil.williams.toadmail.com
This is a multi-part message in MIME format.
--------------010704040008050901050407
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Seems easy enough. The problem that I seem to be having is how to get a
handle to the figure that I want to paint. I want to have an action
that will save off an image. The action extends EditorPartAction and
will be created on my Editor. My editor has a handle to the model class
only. When getGraphicalViewer().setContents(model) is called is when
the part corresponding to the model, and hence the figure is created
(via my part factory). There does not seem to be a way to get the Part
from within the action or the editor.
How is this accomplished?
Thanks again,
Phil
Randy Hudson wrote:
>Image image = new Image(null, width, height);
>GC gc = new GC(image);
>SWTGraphics g = new SWTGraphics(gc);
>figure.paint(g);
>
>"Phil Williams" <phil.williams@toadmail.com> wrote in message
>news:c787he$4t8$1@eclipse.org...
>
>
>>I asked this in the past, but have gotten no responses, so let me
>>
>>
>rephrase:
>
>
>>I would like to be able to create an action that can capture the diagram
>>in a GEF editor to an image file (JPG, PNG, BMP, whatever). I am at a
>>loss as to how to start.
>>
>>Does anyone out there have any pointers or sample code to help me get
>>started?
>>
>>Thanks in advance,
>>Phil
>>
>>
>
>
>
>
--------------010704040008050901050407
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body>
Seems easy enough. The problem that I seem to be having is how to get
a handle to the figure that I want to paint. I want to have an action
that will save off an image. The action extends EditorPartAction and
will be created on my Editor. My editor has a handle to the model
class only. When getGraphicalViewer().setContents(model) is called is
when the part corresponding to the model, and hence the figure is
created (via my part factory). There does not seem to be a way to get
the Part from within the action or the editor.<br>
<br>
How is this accomplished?<br>
<br>
Thanks again,<br>
Phil<br>
<br>
Randy Hudson wrote:<br>
<blockquote cite="midc78stf$2jv$1@eclipse.org" type="cite">
<pre wrap="">Image image = new Image(null, width, height);
GC gc = new GC(image);
SWTGraphics g = new SWTGraphics(gc);
figure.paint(g);
"Phil Williams" <a class="moz-txt-link-rfc2396E" href="mailto:phil.williams@toadmail.com"><phil.williams@toadmail.com></a> wrote in message
<a class="moz-txt-link-freetext" href="news:c787he$4t8$1@eclipse.org">news:c787he$4t8$1@eclipse.org</a>...
</pre>
<blockquote type="cite">
<pre wrap="">I asked this in the past, but have gotten no responses, so let me
</pre>
</blockquote>
<pre wrap=""><!---->rephrase:
</pre>
<blockquote type="cite">
<pre wrap="">I would like to be able to create an action that can capture the diagram
in a GEF editor to an image file (JPG, PNG, BMP, whatever). I am at a
loss as to how to start.
Does anyone out there have any pointers or sample code to help me get
started?
Thanks in advance,
Phil
</pre>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
</body>
</html>
--------------010704040008050901050407--
|
|
|
Re: Creating an Image [message #130906 is a reply to message #130893] |
Wed, 05 May 2004 18:12 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
This is a multi-part message in MIME format.
------=_NextPart_000_006D_01C432A2.9491F260
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Your action will need to know or get the viewer, and call =
viewer.getEditPartRegistry().get(model) which should return the part, =
from which you can get the figure.
"Phil Williams" <phil.williams@toadmail.com> wrote in message =
news:c7b6e4$l6s$1@eclipse.org...
Seems easy enough. The problem that I seem to be having is how to get =
a handle to the figure that I want to paint. I want to have an action =
that will save off an image. The action extends EditorPartAction and =
will be created on my Editor. My editor has a handle to the model class =
only. When getGraphicalViewer().setContents(model) is called is when =
the part corresponding to the model, and hence the figure is created =
(via my part factory). There does not seem to be a way to get the Part =
from within the action or the editor.
How is this accomplished?
Thanks again,
Phil
Randy Hudson wrote:
Image image =3D new Image(null, width, height);
GC gc =3D new GC(image);
SWTGraphics g =3D new SWTGraphics(gc);
figure.paint(g);
"Phil Williams" <phil.williams@toadmail.com> wrote in message
news:c787he$4t8$1@eclipse.org...
I asked this in the past, but have gotten no responses, so let me
rephrase:
I would like to be able to create an action that can capture the =
diagram
in a GEF editor to an image file (JPG, PNG, BMP, whatever). I am at a
loss as to how to start.
Does anyone out there have any pointers or sample code to help me get
started?
Thanks in advance,
Phil
=20
------=_NextPart_000_006D_01C432A2.9491F260
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE></TITLE>
<META http-equiv=3DContent-Type =
content=3Dtext/html;charset=3DISO-8859-1>
<META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Your action will need to know or get =
the viewer,=20
and call viewer.getEditPartRegistry().get(model) which should return the =
part,=20
from which you can get the figure.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Phil Williams" <<A=20
=
href=3D"mailto:phil.williams@toadmail.com">phil.williams@toadmail.com</A>=
>=20
wrote in message <A=20
=
href=3D"news:c7b6e4$l6s$1@eclipse.org">news:c7b6e4$l6s$1@eclipse.org</A>.=
...</DIV>Seems=20
easy enough. The problem that I seem to be having is how to get =
a handle=20
to the figure that I want to paint. I want to have an action =
that will=20
save off an image. The action extends EditorPartAction and will =
be=20
created on my Editor. My editor has a handle to the model class=20
only. When getGraphicalViewer().setContents(model) is =
called is=20
when the part corresponding to the model, and hence the figure is =
created (via=20
my part factory). There does not seem to be a way to get the =
Part from=20
within the action or the editor.<BR><BR>How is this=20
accomplished?<BR><BR>Thanks again,<BR>Phil<BR><BR>Randy Hudson =
wrote:<BR>
<BLOCKQUOTE cite=3Dmidc78stf$2jv$1@eclipse.org type=3D"cite"><PRE =
wrap=3D"">Image image =3D new Image(null, width, height);
GC gc =3D new GC(image);
SWTGraphics g =3D new SWTGraphics(gc);
figure.paint(g);
"Phil Williams" <A class=3Dmoz-txt-link-rfc2396E =
href=3D"mailto:phil.williams@toadmail.com"><phil.williams@toadmail.com=
></A> wrote in message
<A class=3Dmoz-txt-link-freetext =
href=3D"news:c787he$4t8$1@eclipse.org">news:c787he$4t8$1@eclipse.org</A>.=
...
</PRE>
<BLOCKQUOTE type=3D"cite"><PRE wrap=3D"">I asked this in the past, =
but have gotten no responses, so let me
</PRE></BLOCKQUOTE><PRE wrap=3D""><!---->rephrase:
</PRE>
<BLOCKQUOTE type=3D"cite"><PRE wrap=3D"">I would like to be able to =
create an action that can capture the diagram
in a GEF editor to an image file (JPG, PNG, BMP, whatever). I am at a
loss as to how to start.
Does anyone out there have any pointers or sample code to help me get
started?
Thanks in advance,
Phil
</PRE></BLOCKQUOTE><PRE wrap=3D""><!---->
</PRE></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>
------=_NextPart_000_006D_01C432A2.9491F260--
|
|
|
Re: Creating an Image [message #130945 is a reply to message #130893] |
Wed, 05 May 2004 18:42 |
Pratik Shah Messages: 1077 Registered: July 2009 |
Senior Member |
|
|
Just a suggestion: you might want to capture just the printable layers, and
not all the layers. BTW, the overview does the exact same thing as you want
to do here: it gets the root figure and paints it on an image. So, you
might want to look at LogicEditor.OutlinePage.initializeOverview() if you
run into any more problems.
"Phil Williams" <phil.williams@toadmail.com> wrote in message
news:c7b6e4$l6s$1@eclipse.org...
Seems easy enough. The problem that I seem to be having is how to get a
handle to the figure that I want to paint. I want to have an action that
will save off an image. The action extends EditorPartAction and will be
created on my Editor. My editor has a handle to the model class only.
When getGraphicalViewer().setContents(model) is called is when the part
corresponding to the model, and hence the figure is created (via my part
factory). There does not seem to be a way to get the Part from within the
action or the editor.
How is this accomplished?
Thanks again,
Phil
Randy Hudson wrote:
Image image = new Image(null, width, height);
GC gc = new GC(image);
SWTGraphics g = new SWTGraphics(gc);
figure.paint(g);
"Phil Williams" <phil.williams@toadmail.com> wrote in message
news:c787he$4t8$1@eclipse.org...
I asked this in the past, but have gotten no responses, so let me
rephrase:
I would like to be able to create an action that can capture the diagram
in a GEF editor to an image file (JPG, PNG, BMP, whatever). I am at a
loss as to how to start.
Does anyone out there have any pointers or sample code to help me get
started?
Thanks in advance,
Phil
|
|
|
Re: Creating an Image [message #130996 is a reply to message #130945] |
Wed, 05 May 2004 18:36 |
Eclipse User |
|
|
|
Originally posted by: phil.williams.toadmail.com
Thanks for the pointer. I will take a look. Although, I now have the
nodes and connections painting to the image. :)
Thanks for all the help.
Phil
Pratik Shah wrote:
>Just a suggestion: you might want to capture just the printable layers, and
>not all the layers. BTW, the overview does the exact same thing as you want
>to do here: it gets the root figure and paints it on an image. So, you
>might want to look at LogicEditor.OutlinePage.initializeOverview() if you
>run into any more problems.
>
>
>"Phil Williams" <phil.williams@toadmail.com> wrote in message
>news:c7b6e4$l6s$1@eclipse.org...
>Seems easy enough. The problem that I seem to be having is how to get a
>handle to the figure that I want to paint. I want to have an action that
>will save off an image. The action extends EditorPartAction and will be
>created on my Editor. My editor has a handle to the model class only.
>When getGraphicalViewer().setContents(model) is called is when the part
>corresponding to the model, and hence the figure is created (via my part
>factory). There does not seem to be a way to get the Part from within the
>action or the editor.
>
>How is this accomplished?
>
>Thanks again,
>Phil
>
>Randy Hudson wrote:
>
>Image image = new Image(null, width, height);
>GC gc = new GC(image);
>SWTGraphics g = new SWTGraphics(gc);
>figure.paint(g);
>
>"Phil Williams" <phil.williams@toadmail.com> wrote in message
>news:c787he$4t8$1@eclipse.org...
>
>I asked this in the past, but have gotten no responses, so let me
>
>rephrase:
>
>I would like to be able to create an action that can capture the diagram
>in a GEF editor to an image file (JPG, PNG, BMP, whatever). I am at a
>loss as to how to start.
>
>Does anyone out there have any pointers or sample code to help me get
>started?
>
>Thanks in advance,
>Phil
>
>
>
>
>
>
>
>
|
|
|
Goto Forum:
Current Time: Fri Apr 26 06:20:22 GMT 2024
Powered by FUDForum. Page generated in 0.05340 seconds
|