Solved

transpose a bitmap

Posted on 2009-05-10
5
656 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
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…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

757 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now