C++ School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become a C++ Expert!

Join 300,475 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,739 people online right now. Registration is fast and FREE... Join Now!




Distort a Bitmap / resizing

 

Distort a Bitmap / resizing

Crypt36

3 Jul, 2009 - 12:32 AM
Post #1

New D.I.C Head
*

Joined: 3 Jul, 2009
Posts: 4

I'm looking for a way to distort a Bitmap photo. I'm working with DevC++ and Allegro to create a game.

I want to turn a square photo I have in Bitmap format into a trapezius of even a triangle at max by giving it new corner values like x, xb, y, yb

I had such a function in Flash but can't find it for c++?!

This is an example for adjusting the height en width only:
BITMAP *a,*b;
a = load_bitmap("tile.bmp",NULL);
b = create_bitmap(200,300);
stretch_blit(a, b, 0, 0, a->w, a->h, 0, 0, b->w, b->h);
destroy_bitmap(a);

User is offlineProfile CardPM
+Quote Post


AGRAC393

RE: Distort A Bitmap / Resizing

3 Jul, 2009 - 10:11 AM
Post #2

D.I.C Head
**

Joined: 13 May, 2009
Posts: 229



Thanked: 2 times
My Contributions
You should probly just use Dark GDK...
User is offlineProfile CardPM
+Quote Post

prabh

RE: Distort A Bitmap / Resizing

3 Jul, 2009 - 10:23 AM
Post #3

D.I.C Regular
Group Icon

Joined: 27 Dec, 2008
Posts: 289



Thanked: 8 times
Dream Kudos: 25
My Contributions
yup man DarkGDK is a good option
and it is easy and free to use

User is offlineProfile CardPM
+Quote Post

Crypt36

RE: Distort A Bitmap / Resizing

3 Jul, 2009 - 11:03 PM
Post #4

New D.I.C Head
*

Joined: 3 Jul, 2009
Posts: 4

I don't want to create a 3D game?! I just want to simply distort a photo like all other languages have a standard class or filter for like java or flash but I don't to use java or flash I want C++. Does anyone have a code example using OpenGL maybe? I don't know what to do anymore, I have been browing and browsing for 2 days now and just can't find it?!

this is a piece of code with OpenGL that does the job on a drawn rectangle but have no clue how to make it work for a Photo Bitmap

int DrawGLScene(GLvoid) // Here's Where We Do All The Drawing
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear Screen And Depth Buffer

glLoadIdentity(); // Reset The Current Modelview Matrix
glTranslatef(1.5f,0.0f,-6.0f); // Move Right 1.5 Units And Into The Screen 6.0
glRotatef(rquad,1.0f,0.0f,0.0f); // Rotate The Quad On The X axis ( NEW )
glColor3f(0.5f,0.5f,1.0f); // Set The Color To Blue One Time Only
glBegin(GL_QUADS); // Draw A Quad
glVertex3f(-1.0f, 1.0f, 0.0f); // Top Left
glVertex3f( 1.0f, 1.0f, 0.0f); // Top Right
glVertex3f( 1.0f,-1.0f, 0.0f); // Bottom Right
glVertex3f(-1.0f,-1.0f, 0.0f); // Bottom Left
glEnd(); // Done Drawing The Quad
rtri+=0.2f; // Increase The Rotation Variable For The Triangle ( NEW )
rquad-=0.15f; // Decrease The Rotation Variable For The Quad ( NEW )
return TRUE; // Keep Going
}

This post has been edited by Crypt36: 3 Jul, 2009 - 11:05 PM
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic

Time is now: 11/8/09 03:13AM

Live C++ Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month