Archived

This topic is now archived and is closed to further replies.

Rotating a Bitmap

This topic is 5791 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Well here I am, trying to rotate a bitmap . I remembered seeing a library called "rotozoom" on the main SDL page, but it only works with Linux (supposedly). So what am I supposed to do? Write my own function? If so, how? Is there a function in SDL that I can use (I don''t see any in the Doc Project). I feel pretty wierd asking a question like this, newbyish? I''m used to glRotatef(), so I''m pretty stumped here. Thanks for any responses. ------------------------------ Simple DirectMedia Layer:
Main Site - (www.libsdl.org) Cone3D Tutorials- (cone3D.gamedev.net) GameDev.net''s Tutorials - (Here)
OpenGL:
Main Site - (www.opengl.org) NeHe Tutorials - (nehe.gamedev.net) Online Books - (Red Book) (Blue Book)

Share on other sites
*bump*

It's really bothering me. Really .

Edited by - Drizzt DoUrden on February 19, 2002 6:55:55 PM

Share on other sites
Check out SDL_gfx

"Don''t be afraid to dream, for out of such fragile things come miracles."

Share on other sites
Hey,
I don''t remember where it is, but there''s an article on the net (not GameDev) devoted to software rotation of images.

It''s not particularly fun, nor is it particularly fast; but if you must do it, I suggest looking for it.

--Nairb

Share on other sites
quote:
Original post by Redleaf
Check out SDL_gfx

Yeah Readleaf - that''s what I''m using. Drizzt, this library (SDL_gfx) contains a rotozoomSurface() function that you can use in Windows - I''ve used it sucessfully. It''s nothing complex, but email me if you run into any problems. Just be sure to #include "sdl_rotozoom.h" as well as place the sdl_rotozoom.c in your project so you don''t get nasty link errors

_________________________________________________________________

Drew Sikora
A.K.A. Gaiiden

ICQ #: 70449988
AOLIM: DarkPylat

Staff Member, GDNet
Public Relations, Game Institute

3-time Contributing author, Game Design Methods , Charles River Media (coming April/May 2002)
Online column - Design Corner at Pixelate

NJ IGDA Chapter - NJ developers unite!! [Chapter Home | Chapter Forum]

Share on other sites
for (x,y) = pixel on the target bitmap T   figure out (x0,y0) whence in the source bitmap S   the pixel T(x,y) comes from   ( e.g. x0 = cos(-angle)*x,           y0 = sin(-angle)*y,      if you arer centered at (0,0) )   plot the pixel at T(x,y) with the color from S(x0,y0),   possibly with supersampling    (e.g. averaging the neighbouring colors)

Share on other sites
Maybe it is a rare deficiency of SDL, the lack of hardware scaling and rotation.
Well, who knows, maybe it will be included in a future version.

Share on other sites
quote:
Original post by Gaiiden
Yeah Readleaf - that's what I'm using. Drizzt, this library (SDL_gfx) contains a rotozoomSurface() function that you can use in Windows - I've used it sucessfully. It's nothing complex, but email me if you run into any problems. Just be sure to #include "sdl_rotozoom.h" as well as place the sdl_rotozoom.c in your project so you don't get nasty link errors

The problem here is that it still uses SDL_rotozoom. SDL_gfx just has SDL_rotozoom as part of it, and SDL_rotozoom only works for Linux. Or is the rotozoom in SDL_gfx completely different?

[EDIT] - looked at SDL_rotozoom.c:
They include "windows.h" in SDL_rotozoom.c. This means that the rotation will only work in windows correct?
[/EDIT]

------------------------------
Simple DirectMedia Layer:

Main Site - (www.libsdl.org)
Cone3D Tutorials- (cone3D.gamedev.net)
GameDev.net's Tutorials - (Here)

OpenGL:

Main Site - (www.opengl.org)
NeHe Tutorials - (nehe.gamedev.net)
Online Books - (Red Book) (Blue Book)

Edited by - Drizzt DoUrden on February 20, 2002 3:33:31 PM

Share on other sites
It is not a deficiency of sdl, they focus more on platform independence then on feature richness. They don''t claim to be a complete game engine.....

BTW, the library SGE (SDL Graphics Extention) claims to do rotation and transformation, but i haven''t tried it.....

Share on other sites
quote:
Original post by Drizzt DoUrden
The problem here is that it still uses SDL_rotozoom. SDL_gfx just has SDL_rotozoom as part of it, and SDL_rotozoom only works for Linux. Or is the rotozoom in SDL_gfx completely different?

[EDIT] - looked at SDL_rotozoom.c:
They include "windows.h" in SDL_rotozoom.c. This means that the rotation will only work in windows correct?
[/EDIT]

Yeah, but you''ll notice that they encase the windows include in an #ifdef directive, so that only if the code is being used on a Win32 platform is the header included. Will you just go ahead and use it already?? It works! Yeesh, hee hee

• 17
• 11
• 12
• 9
• 49
• Forum Statistics

• Total Topics
631394
• Total Posts
2999755
×