Solved

rotation of timage

Posted on 1998-04-12
4
403 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
  • 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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to fill array with TArray.Create? 14 90
Adoquery sql  left join does not work 25 90
how to change, disabled button color FMX ? 1 32
Firemonkey allowing RTL on android 6 32
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

772 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