Welcome Guest ( Login | Register )



All times are UTC - 7 hours [ DST ]



Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Rotate Picture using Script
PostPosted: Mon May 05, 2014 5:30 am 

Joined: Wed Feb 05, 2014 5:07 am
Posts: 5

Offline
I want to rotate picture continuously when certain event occur.

I have tried following code: But, there are some error which i could not able to solve. It is showing errors like: System.Drawig.Graphics does not contain a definition for 'TranslateTransform' & 'RotateTransform" and no extension method accepting a first argument of type 'System.Drawing.Grraphics' could be found(are you missing a using directive or an assembly reference?)

If you can guide me then it will be great help to resolve my long standing problem.

thanking you advance.

regards,

Arjun Gohil


namespace Neo.ApplicationFramework.Generated
{
using System.Windows.Forms;
using System;
using System.Drawing;
using Neo.ApplicationFramework.Tools;
using Neo.ApplicationFramework.Common.Graphics.Logic;
using Neo.ApplicationFramework.Controls;
using Neo.ApplicationFramework.Interfaces;


public partial class ScriptModule1
{
public static Bitmap RotateImage(Image image, float rotateAtX, float rotateAtY, float angle, bool bNoClip)
{
int W, H, X, Y;
if (bNoClip)
{
double dW = (double)image.Width;
double dH = (double)image.Height;

double degrees = Math.Abs(angle);
if (degrees <= 90)
{
double radians = 0.0174532925 * degrees;
double dSin = Math.Sin(radians);
double dCos = Math.Cos(radians);
W = (int)(dH * dSin + dW * dCos);
H = (int)(dW * dSin + dH * dCos);
X = (W - image.Width) / 2;
Y = (H - image.Height) / 2;
}
else
{
degrees -= 90;
double radians = 0.0174532925 * degrees;
double dSin = Math.Sin(radians);
double dCos = Math.Cos(radians);
W = (int)(dW * dSin + dH * dCos);
H = (int)(dH * dSin + dW * dCos);
X = (W - image.Width) / 2;
Y = (H - image.Height) / 2;
}
}
else
{
W = image.Width;
H = image.Height;
X = 0;
Y = 0;
}

//create a new empty bitmap to hold rotated image
Bitmap bmpRet = new Bitmap(W, H);
bmpRet.SetResolution(image.HorizontalResolution, image.VerticalResolution);

//make a graphics object from the empty bitmap
Graphics g = Graphics.FromImage(bmpRet);

//Put the rotation point in the "center" of the image
g.TranslateTransform(rotateAtX+X, rotateAtY+Y);

//rotate the image
g.RotateTransform(angle);

//move the image back
g.TranslateTransform(-rotateAtX - X, -rotateAtY - Y);

//draw passed in image onto graphics object
g.DrawImage(image, new PointF(0+X, 0+Y));

return bmpRet;
}
}
}


 Profile  
 
 Post subject: Re: Rotate Picture using Script
PostPosted: Wed May 14, 2014 7:35 am 

Joined: Thu Nov 17, 2011 2:10 am
Posts: 49
Location: Norway

Offline
iX does not have all the features that ex. Visual Studio has.
So if you rescieve errors like this, it is most likely because the iX compilator doesn't support it as default.

You then would have to include some references to System.- dlls


 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 7 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: