Welcome to Dream.In.Code
Getting C++ Help is Easy!

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




Dynamic memory allocation

 
Reply to this topicStart new topic

Dynamic memory allocation, Can any one teach me how to use DMA to move an image...

moonlight_28
10 Apr, 2007 - 10:28 PM
Post #1

New D.I.C Head
*

Joined: 11 Mar, 2007
Posts: 23


My Contributions
im stuck... I wanted to make a moving airplane in using TC... and graphics... but I don't know How to use DMA... and getimage and put image something...
User is offlineProfile CardPM
+Quote Post

NickDMax
RE: Dynamic Memory Allocation
10 Apr, 2007 - 11:56 PM
Post #2

2B||!2B
Group Icon

Joined: 18 Feb, 2007
Posts: 2,858



Thanked: 49 times
Dream Kudos: 550
My Contributions
I had just written a long post when my computer rebooted on its own (actually I think the "windows update: restart now" window came up and I hit enter thinking I was hitting enter in this window... who knows).

So the brief version:

void * imageBuffer = malloc(size); is how you would allocate a dynamic buffer.
(you may need to say far void * but I don't think so.)

unsigned short imageSize(int left, int top, int right, in bottom) returns the size of a buffer needed to hold an image from coordinates (left, top)-(right, bottom)

void getimage(int left, int top, int right, int bottom, void * imageBuffer) will get an image and place it into the buffer

void putimage (int left, int top, const void * imageBuffer, int op) will put an image to the screen using an given operation:

COPY_PUT - overwites background
XOR_PUT - Xor forground and backgound images
OR_PUT - etc
AND_PUT - etc
NOT_PUT - overwites the background with the negative of the image buffer.


I would not that although BGI works... it is a LAME graphics library and you would be better off to use a 3rd party VESA library. (I used to use one called VSA -- came with a book "unleashed graphics" I think).

Here might be a good place to find some other libraries


User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/1/08 10:03PM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month