Richard,
I replied to your private request for code to rotate a bitmap by 45 degrees,
but my reply bounced back. Since you first asked on this list, I'll now
reply on the list.
Yes please could you send it to me. I am looking for something which can
do anti-aliasing, and this sounds like it...
Sorry, but there's no anti-aliasing here and I don't even know how to do it.
My algorithm is very simple. Here's the idea. Suppose you start with this
3-by-4 bitmap (you need a monospace font to see this well):
abcd
efgh
ijkl
You can rotate it by 45 degrees smoothly with simple linear transformation
if you expand the area by a factor of two, like this:
..a...
.e*b..
i*f*c.
.j*g*d
..k*h.
...l..
The periods '.' are the background, needed to get a rectangular result. The
astericks '*' are filler. You could get a "smooth" result if you take each
filler pixel to be the average color of its four adjacent pixels. A simpler
approach is to use the color of just one pixel, say the one to its left. If
we also add filler to one side of the resulting diamond, this will make the
result exactly twice the area of the original, and we get:
..aa...
.eebb..
iiffcc.
.jjggdd
..kkhh.
...ll..
There are yet other ways to set those 'filler' pixels, I suppose.
My 'algorithm' is to take the pixel at location (X, Y) [zero-based] in a
bitmap of height H and width W and to copy its color to the new bitmap of
height H + W - 2 and width H + W - 1 at location (X + Y, H - 1 - X + Y).
The 'filler' pixel, the same color according to my second graphic above, is
at location (X + Y, H - X + Y). Before all this copying is done, all pixels
in the destination bitmap should be set to the desired background color, so
the corners are taken care of.
Simple, but it works and it is 'smooth,' and using averaged filler pixels
would be even smoother. Its main disadvantage is that the size of the
bitmap was increased.
I hope this helps.
What is Campus Crusade for Christ?
It is an interdenominational Christian organization, of which I am a staff
member. We now have about 26,000 full-time staff and over 100,000 associate
staff and volunteers. Our purpose is to help fulfill the Great Commission
that Jesus gave in Matthew 28:18-20, which in summary is to "make disciples
of all nations." We do that by winning people to Jesus Christ (evangelism),
building them in their faith, training them to do the work of Christian
ministry, and sending them out to do the same with others. We are probably
most famous for our evangelistic tools such as 'The Four Spiritual Laws'
booklet and the 'JESUS' Film.
The name "Campus Crusade for Christ" comes from our origin on university
campuses in the United States in 1951, but we now have many more ministries.
I have been a missionary to East Africa (Kenya and Tanzania) for a little
more than 25 years, doing a variety of ministries. I am now on furlough in
the United States raising funds, but when I return to Kenya I will be a
half-time computer supervisor at the Nairobi International School of
Theology and a half-time student at the same school to complete my Master of
Divinity degree.
I hope that wasn't more than you wanted!
Rory Daulton
***@email.com
Campus Crusade for Christ
---
[This E-mail scanned for viruses by Declude Virus and Nmax "Your MAXimum Connection!"]
[This E-mail scanned for spam by Declude JunkMail and Nmax "Your MAXimum Connection!"]
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get 128 Bit SSL Encryption!
http://us.click.yahoo.com/CBxunD/vN2EAA/xGHJAA/i7folB/TM
---------------------------------------------------------------------~->
The Delphi Collection Web Site!
http://www.delphicollection.com/public/index.shtml
---------------------------------------------------------------
Unsubscribe:delphi-programming-***@yahoogroups.com
List owner:delphi-programming-***@yahoogroups.com
---------------------------------------------------------------
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/