?
Solved

rotation of timage

Posted on 1998-04-12
4
Medium Priority
?
424 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 40 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses
Course of the Month12 days, 19 hours left to enroll

777 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