Solved

transpose a bitmap

Posted on 2009-05-10
5
666 Views
Last Modified: 2013-11-22
I need a function to transpose ( flip and rotate CCW 90 deg ) a bitmap simply and fast. Any ideas?
0
Comment
Question by:IOOI
  • 3
  • 2
5 Comments
 
LVL 13

Expert Comment

by:rfwoolf
ID: 24349419
Google is your friend:
http://www.delphi3000.com/article.asp?ID=2764

Procedure TurnImage(Src, Dst: TImage);
var x,y: integer;
begin
  Dst.Width:= Src.Height; Dst.Height:= Src.Width;
  For x:= 0 to Src.Width-1 do begin
    For y:= 0 to Src.Height-1 do begin
      Dst.Canvas.Pixels[(Src.Height-1)-y,x]:= Src.Canvas.Pixels[x,y];
    end;
  end;
end;

You can adapt this to do what you want.
0
 
LVL 13

Expert Comment

by:rfwoolf
ID: 24349439
Also, I actually couldn't go to that link when I found it in google - I had to check the Google cache.
But if you do go to the cache of that link you'll see  the above procedure PLUS improvements on it, stuff like being able to accept jpegs, being able to flip the image, being able to rotate it, and combinations thereof.
0
 

Author Comment

by:IOOI
ID: 24349442
I have googled a lot which is why I finally asked.

I'm aware of Canvas.Pixel but it is very slow because you can access individual pixels.

I was looking for a solution that uses scanline and simply switches x,y of individual pixels to get a transpose.
0
 
LVL 13

Accepted Solution

by:
rfwoolf earned 200 total points
ID: 24349611
If you haven't already, have a look at this page to see if there's a component or solution that might be able to help you: http://www.efg2.com/Lab/Library/Delphi/Graphics/ImageProcessing.htm
0
 

Author Closing Comment

by:IOOI
ID: 31579955
Thanks! I got a few ideas from that page.
0

Featured Post

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

770 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