Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Image resize and rotate
Image resize and rotate [message #677404] Wed, 08 June 2011 12:27 Go to next message
Stefano  is currently offline Stefano Friend
Messages: 2
Registered: June 2011
Junior Member
Hello,
I'm trying to rotate an Image (GraphicsAlgorithm extension) that I create with the following code (mainly taken from your tutorial):

ContainerShape containerShape = peCreateService.createContainerShape(targetDiagram, true);
GraphicsAlgorithm visibleGA;
Rectangle invisibleRectangle;
        {
        invisibleRectangle = gaService.createRectangle(containerShape);
	gaService.setLocationAndSize(invisibleRectangle, context.getX(), context.getY(), width + 2*xBorder, height + 2*yBorder);


        Image visibleGA  = gaService.createImage(container, SLDImageProvider.IMG_CONTACTOR);
        visibleGA.setStretchH(true);
        visibleGA.setStretchV(true);
        visibleGA.setProportional(true); 
 
       gaService.setLocationAndSize(visibleGA, xBorder, yBorder, width, height);
 
        }


This code does not seem to enable the resizing of the Image nor the stretching of the image to the height and width dimensions.

Could you possibly help me understand how to allow the resizing?
Also I'd like to understand how to rotate the image: if there is standard way to do this, could you give a example please?

Thank you very much.

S
Re: Image resize and rotate [message #677417 is a reply to message #677404] Wed, 08 June 2011 13:04 Go to previous messageGo to next message
Tim Kaiser is currently offline Tim KaiserFriend
Messages: 118
Registered: July 2009
Senior Member
Hi,

i think the issue is already tracked:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=342869

Best, Tim
Re: Image resize and rotate [message #677441 is a reply to message #677417] Wed, 08 June 2011 14:32 Go to previous messageGo to next message
Stefano  is currently offline Stefano Friend
Messages: 2
Registered: June 2011
Junior Member
Hi,
thank you for your quick response.

I have been through these articles but I still cannot to resize an GA Image: using an extension of AbstractImageProvider, I may specify only the image path and I cannot get the SWT Image handler from the GA Image created by GAService.

Thank you.
Stefano
Re: Image resize and rotate [message #1022073 is a reply to message #677404] Thu, 21 March 2013 08:34 Go to previous messageGo to next message
Christy HENSON is currently offline Christy HENSONFriend
Messages: 1
Registered: March 2013
Junior Member
Actually, you need seperate the image rotate and resize, the code would be different, try this sample code of image rotation.
Bitmap LoadImage = new Bitmap(@"C:\\1.bmp");
Graphics rotate = Graphics.FromImage(LoadImage);
rotate.TranslateTransform((float)bmp.Width / 2, (float)bmp.Height / 2);
rotate.RotateTransform(rotationAngle);
rotate.TranslateTransform(-(float)bmp.Width / 2, -(float)bmp.Height / 2);
rotate.InterpolationMode = InterpolationMode.HighQualityBicubic;
rotate.DrawImage(img, new Point(0, 0));
rotate.Dispose();
Re: Image resize and rotate [message #1048332 is a reply to message #677404] Wed, 24 April 2013 10:16 Go to previous messageGo to next message
klausnew dfdgs is currently offline klausnew dfdgsFriend
Messages: 7
Registered: April 2013
Junior Member
resize image example
Imports System.IO
Imports System.Drawing.Printing
Imports RasterEdge.Imaging
Imports RasterEdge.Imaging.Processing

Dim Image As New RasterEdgeImaging()

Private Shared Function ResizeImage() As Image
If True Then
Dim LoadImage As New Bitmap("C:\\1.bmp")
Dim newsize As Size = New size(width, height)
Dim newsize As e.g.Size = New size(150, 250)
End IfEnd Function
Image.ResizeImage (@"C:\\1.bmp", new size(150,250))
Re: Image resize and rotate [message #1050355 is a reply to message #1048332] Sat, 27 April 2013 03:23 Go to previous message
klausnew dfdgs is currently offline klausnew dfdgsFriend
Messages: 7
Registered: April 2013
Junior Member
this is image rotate.
Imports System.IO
Imports System.Drawing.Printing
Imports RasterEdge.Imaging
Imports RasterEdge.Imaging.Processing

Dim Image As New RasterEdgeImaging()

Public Sub RotateImage()
If True Then
Dim LoadImage As New Bitmap("C:\\1.bmp")
Dim rotate As Graphics = Graphics.FromImage(LoadImage)
rotate.TranslateTransform(CType(bmp.Width, Single) / 2, CType(bmp.Height, Single) / 2)
rotate.RotateTransform(rotationAngle)
rotate.TranslateTransform(-CType(bmp.Width, Single) / 2, -CType(bmp.Height, Single) / 2)
rotate.InterpolationMode = InterpolationMode.HighQualityBicubic
rotate.DrawImage(img, New Point(0, 0))
rotate.Dispose()
Return LoadImage()
End If
End Sub
Previous Topic:Add for existing Model
Next Topic:Getting the selected connection
Goto Forum:
  


Current Time: Fri Apr 26 08:50:37 GMT 2024

Powered by FUDForum. Page generated in 0.02912 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top