Advertisement

Help With Pascal

Started by July 29, 2000 10:21 PM
1 comment, last by GaMeStA 24 years, 4 months ago
Can someone help me with the graph unit? and how do you open a picture(any format) and display it on the screen with pascal? a source code will do fine thank you for reading
When there is a will, there is a way...
There is no function to display bitmaps or any other picture file with pascal i don't think, you have to do it yerself (dont ask me how to do that)

About pascal graphics, you prolly already know this but ill write it down anyway....

This procedure would initialise 640*480 graphics.....hopefully

    procedure setgraphics;var   graphmode, graphdriver:integer;   begin     graphmode := 0;     graphdriver := Detect;     initgraph (graphdriver, graphmode, 'c:\stuff\pascal\units');   end;{And some crappy code that moves a circle in the main coding block }begin     setgraphics;     clearviewport;     x := 300;     y := 250;     while (key <> 'q') do           begin                key := readkey;                setcolor (white);                    if (key = '6') then                       begin                            clearviewport;                            circle (x,y,size);                            moveto (x,y);                            x := x + speed;                       end;                    if (key =  '4') then                       begin                            clearviewport;                            circle (x,y,size);                            moveto (x,y);                            x := x - speed;                       end;                    if (key = '2') then                       begin                            clearviewport;                            circle (x,y,size);                            moveto (x,y);                            y := y + speed;                       end;                    if (key = '8') then                       begin                            clearviewport;                            circle (x,y,size);                            moveto (x,y);                            y := y - speed;                       end;     end;end.    


I just dragged it out of an old zip file so it should work




Edited by - CoiN on August 2, 2000 3:48:44 PM
Advertisement
Did this once... I don''t remember exactly how, but you must read the BITMAP INFO|FILE HEADER and there it will write:
BM - for Win32 bitmap
(not sure for the next)
header offset
data offset
height
width
palettes(not for 24-bit bmps)

DATA: rbyte gbyte bbyte

try to get some format description from www.wotsit.org, but it''ll be hard, because the descriptions are only made for windows c programs... Maybe you should start learning Visual C or Delphi

"Everything is relative." -- Even in the world of computers.
everything is relative. -- even in the world of computers... so PUSH BEYOND THE LIMITS OF SANITY!

This topic is closed to new replies.

Advertisement