Click here to Skip to main content
15,920,513 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to rotate an icon? Pin
eli1502197928-Jul-07 5:38
eli1502197928-Jul-07 5:38 
GeneralRe: How to rotate an icon? Pin
Eytukan28-Jul-07 7:00
Eytukan28-Jul-07 7:00 
GeneralRe: How to rotate an icon? Pin
Mark Salsbery28-Jul-07 7:48
Mark Salsbery28-Jul-07 7:48 
QuestionRe: How to rotate an icon? Pin
Mark Salsbery28-Jul-07 7:56
Mark Salsbery28-Jul-07 7:56 
AnswerRe: How to rotate an icon? Pin
eli1502197928-Jul-07 8:06
eli1502197928-Jul-07 8:06 
GeneralRe: How to rotate an icon? Pin
Randor 28-Jul-07 8:09
professional Randor 28-Jul-07 8:09 
GeneralRe: How to rotate an icon? Pin
eli1502197928-Jul-07 8:14
eli1502197928-Jul-07 8:14 
GeneralRe: How to rotate an icon? Pin
Randor 28-Jul-07 8:45
professional Randor 28-Jul-07 8:45 
Hi,

The link I posted is a very fast way to rotate a bitmap using the memory directly on the DIB. I think maybe you have a misunderstanding of what an ICON is. A icon is simply a bitmap... an array of bytes in memory. Its not a vector format such as SVG or a mathematical model of a shape such as flash. Vector image formats can be rotated extremely fast, however an ICON is not a vector. More on vector graphics: http://en.wikipedia.org/wiki/Vector_graphics[^]

An ICON is a raster format... as previous stated, this is an array of bytes. More about raster formats: http://en.wikipedia.org/wiki/Raster_graphics[^]

In essense what I am saying is that if you want to rotate a bitmap, there is no other way but to rotate all of the bytes representing the image. The question then becomes... 'How fast can I rotate all of those bytes in the multidimensional array'.

The answer is multimedia instructions such as MMX and SSE/SSE2/SSSE which allow you to manipulate multiple bytes in a single instruction. This is why I was pointing out in my previous post how well the code from Yves Maurer at codeguru was bei ng optimized. I was attempting to illustrate that the performance was very good.

In laymen terms, what I am saying is:

1.)A standard beginner level algorithm for rotating a 32x32 icon would be to move each and every pixel one at a time. 32 loops of 32 pixel movements.

2.) Utilizing multimedia instructions such as MMX/SSE/SSE2/SSSE you can manipulate multiple pixels at once. For example... instead of 32 iterations of 32 pixel movements; You may be able to optimize it to 32 iterations of 4/8 movements, depening on multimedia optimizations.

In the old days we had to do much of the asm code ourselves, however beginning with VS2005 many of us asm programmers began seeing that the Visual studio optimizer was doing a hell of a good job.

The code implemented by Yves Maurer can optimize very well, I would recommend using it for your bitmap rotation. Yes there may be slightly more efficient implementations somewhere out on the web, but the margin of gain will be small.

-Randor (David Delaune)
GeneralRe: How to rotate an icon? Pin
eli1502197928-Jul-07 8:54
eli1502197928-Jul-07 8:54 
GeneralRe: How to rotate an icon? Pin
Mark Salsbery28-Jul-07 8:15
Mark Salsbery28-Jul-07 8:15 
GeneralRe: How to rotate an icon? Pin
eli1502197928-Jul-07 8:29
eli1502197928-Jul-07 8:29 
GeneralRe: How to rotate an icon? Pin
Mark Salsbery30-Jul-07 6:55
Mark Salsbery30-Jul-07 6:55 
AnswerRe: How to rotate an icon? Pin
Randor 28-Jul-07 7:07
professional Randor 28-Jul-07 7:07 
GeneralRe: How to rotate an icon? Pin
Randor 28-Jul-07 7:12
professional Randor 28-Jul-07 7:12 
GeneralRe: How to rotate an icon? Pin
GepardHH30-Jul-07 0:52
GepardHH30-Jul-07 0:52 
Questioninvoking C# function from C++ Pin
George_George28-Jul-07 2:26
George_George28-Jul-07 2:26 
AnswerRe: invoking C# function from C++ [Edit] Pin
Eytukan28-Jul-07 3:31
Eytukan28-Jul-07 3:31 
GeneralRe: invoking C# function from C++ [Edit] Pin
George_George30-Jul-07 20:34
George_George30-Jul-07 20:34 
GeneralRe: invoking C# function from C++ [Edit] Pin
Eytukan30-Jul-07 20:59
Eytukan30-Jul-07 20:59 
GeneralRe: invoking C# function from C++ [Edit] Pin
George_George31-Jul-07 14:58
George_George31-Jul-07 14:58 
QuestionReading WAV files into IStream Pin
Anorexic Tribble28-Jul-07 2:25
Anorexic Tribble28-Jul-07 2:25 
AnswerRe: Reading WAV files into IStream Pin
Roger Broomfield28-Jul-07 3:07
Roger Broomfield28-Jul-07 3:07 
GeneralRe: Reading WAV files into IStream Pin
Anorexic Tribble28-Jul-07 4:24
Anorexic Tribble28-Jul-07 4:24 
QuestionWanted - "Command prompt" type component Pin
Robin Hilliard28-Jul-07 1:52
Robin Hilliard28-Jul-07 1:52 
AnswerRe: Wanted - "Command prompt" type component Pin
Hans Dietrich28-Jul-07 18:16
mentorHans Dietrich28-Jul-07 18:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.