Solved

rotation of timage

Posted on 1998-04-12
4
420 Views
Last Modified: 2011-09-20
how can i rotate a timage at a specific degree's like 90 degree's..... i tried the one posted by kabae but i dont know how it works.... a detailed sample code well be much appreciated...
thanks in advance.....
0
Comment
Question by:kabae
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 1

Accepted Solution

by:
pjdb earned 10 total points
ID: 1361418
Try this one :

On a form, drop a Timage (and load any image you want in it) and a button. Put the folowwing code in the onclick event :

procedure TForm1.Button1Click(Sender: TObject);
var
      i, j:longint;
      work:Timage;
begin
      {create a new Timage in memory}
      work:=Timage.create(application);
      {adjust the size of the new component}
      work.width:=image1.height;
      work.height:=image1.width;
      {for any column}
      for i:=image1.canvas.cliprect.left to image1.canvas.cliprect.right do
            {for any row}
            for j:=image1.canvas.cliprect.top to image1.canvas.cliprect.bottom do
                  {transpose the pixel -> to modify the rotation, just change this line}
                  work.canvas.pixels[image1.canvas.cliprect.bottom - j, i]:=image1.canvas.pixels[i, j];
      {determine the new size of the image on the form}
      image1.height:=work.height;
      image1.width:=work.width;
      {put the new image in the image on the form}
      image1.picture:=work.picture;
      {release the image use in memory}
      work.free;
end;

It seem quite quick (it rotate a 20829 pixels BMP in .7 second)

JDB
0
 

Author Comment

by:kabae
ID: 1361419
my goodness MASTER PJDB
ur d best.. u got it...i love it.. its a work of art...
where did u learn how to do that...
thank u thank u ......very very much ... i will never ever forget u in my whole life.....

from jack of the PHIL....



0
 

Author Comment

by:kabae
ID: 1361420
!!!question!!!
 if i stretch the image i got a white color in the side of the image...

0
 
LVL 1

Expert Comment

by:pjdb
ID: 1361421
Well to stretch the image, i suggest that you replace the line
image1.picture:=work.picture;
by :

image1.canvas.StretchDraw(rect(0, 0, newwidth, newheight), work.Picture.graphic)

where newheight and newwidth are the new size on the image.

JDB
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question