Skip to main content



      Home
Home » Modeling » Graphiti » Image resize and rotate
Image resize and rotate [message #677404] Wed, 08 June 2011 08:27 Go to next message
Eclipse UserFriend
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 09:04 Go to previous messageGo to next message
Eclipse UserFriend
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 10:32 Go to previous messageGo to next message
Eclipse UserFriend
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 04:34 Go to previous messageGo to next message
Eclipse UserFriend
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 06:16 Go to previous messageGo to next message
Eclipse UserFriend
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] Fri, 26 April 2013 23:23 Go to previous message
Eclipse UserFriend
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: Wed Jul 23 01:31:09 EDT 2025

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

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

Back to the top