Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Can GetImage get the whole screen?

oracletwooracletwo Posts: 14Member
Is there a way to capture the whole screen using GetImage?
Right now I can only use GetImage to capture a 350 X 350
area. If I try to capture 400 X 400 then the compuer
crashes. My compiler directive is: {$M 20384,0,640360}.
Is there a way to make sure I can access extended memory?
Thanx.

Comments

  • Pelle-48Pelle-48 Posts: 43Member
    Are you using Turbo Pascal 7 or anyone else?
    GetImage is not made for more than 64 kB. I have testing making BMP files in Paint Shop Pro and 350x350x16 colors results in 60 kB but 400x400x16 colors in 78 kB
    If you are using Windows it would be good to download Free Pascal. You can use PrtScr to save any graphics to other programs.
    Staying with TP you should save the graphics in files of type BMP with GetPixel
  • oracletwooracletwo Posts: 14Member
    Thanks, Pelle-48. Yes, I'm using TP7 but I'm interested in Free Pascal though I don't know much about it. Can you do more with it? I've had success accessing extended memory from my programs but you're right, GetImage itself is limited. I'll just use PrtScr for now but I sure would like to learn how to save a bmp file from my programs when I can get less busy. Do you know where I can get code for that? My current project will have a gif reader. Thanks again and Merry Christmas.
  • oracletwooracletwo Posts: 14Member
    Thanks, Pelle-48. Yes, I'm using TP7 but I'm interested in Free Pascal though I don't know much about it. Can you do more with it? I've had success accessing extended memory from my programs but you're right, GetImage itself is limited. I'll just use PrtScr for now but I sure would like to learn how to save a bmp file from my programs when I can get less busy. Do you know where I can get code for that? My current project will have a gif reader. Thanks again and Merry Christmas.
  • oracletwooracletwo Posts: 14Member
    Thanks, Pelle-48. Yes, I'm using TP7 but I'm interested in Free Pascal though I don't know much about it. Can you do more with it? I've had success accessing extended memory from my programs but you're right, GetImage itself is limited. I'll just use PrtScr for now but I sure would like to learn how to save a bmp file from my programs when I can get less busy. Do you know where I can get code for that? My current project will have a gif reader. Thanks again and Merry Christmas.
  • Pelle-48Pelle-48 Posts: 43Member
    Hello and Merry Xmas to you too!
    I will show you saving of an image to a BMP-file.
    This is an image in size 1024x768 with 16 colors from TP7.

    procedure bmp1024;
    var x,y,w1,w2,w3: word;
    col,r,r1,g,g1,b,b1: byte;
    c1,c2,c3,c4,c5,c6,c7,c8: string;
    f: text;

    begin
    assign(f,'graf01.bmp');
    rewrite(f);
    c1:= chr($42) + chr($4d) + chr($36) + chr($0) ;
    c1:= c1 + chr($24) + chr($0) + chr($0) + chr($0);
    c1:= c1 + chr($0) + chr($0) + chr($36) + chr($0);
    c1:= c1 + chr($0) + chr($0) + chr($28) + chr($0) ;

    c2:= chr($0) + chr($0) + chr($0) + chr($4) ;
    c2:= c2 + chr($0) + chr($0) + chr($0) + chr($3) ;
    c2:= c2 + chr($0) + chr($0) + chr($1) + chr($0) ;
    c2:= c2 + chr($18) + chr($0) + chr($0) + chr($0) ;

    c3:= chr($0) + chr($0) + chr($0) + chr($0) ;
    c3:= c3 + chr($24) + chr($0) + chr($12) + chr($0b) ;
    c3:= c3 + chr($0) + chr($0) + chr($12) + chr($b) ;
    c3:= c3 + chr($0) + chr($0) + chr($0) + chr($0) ;

    c4:= chr($0) + chr($0) + chr($0) + chr($0) + chr($0) + chr($0) ;
    c5:=c1 + c2 + c3 + c4;
    write(f,c5);
    For y:=0 to MaxY do
    begin
    For x:=0 to MaxX do
    begin
    col:=GetPixel(x,y);
    case col of
    15: begin
    r:=0;
    g:=0;
    b:=0;
    end;
    10: begin
    r:=0;
    g:=255;
    b:=0;
    end;
    else begin
    r:=255;
    g:=255;
    b:=255;
    end;
    end;

    write(f,chr(b));
    write(f,chr(g));
    write(f,chr(r));
    end;
    end;
    close(f);
    end;

    The start of the BMP is depending of the size of the image. I have been using a program called fileview.exe to read files and find out. Any hexview reader can do it. What image size can you have with TP7? Graphic cards made today are not very good. The best card I have found was Tseng Lab 6000 giving 1280x1024x16 colors
  • oracletwooracletwo Posts: 14Member
    Sorry about the previous multiple postings; The problem is fixed now. I'm afraid that in the future that I'm going to be quite a pest on this nice forum. I know just enough about programming to be dangerous but now that I'm getting back into it I really like it. Anyway, thanks for the code about saving a bmp file. Will check it out. There's so much to learn!

    Say, I know where you guys can really help me out: My tp7 package includes a supurb source code for a unit that's called editors.pas (editors.tpu) but I can't find or figure out the 'launch' point in that code. I really need this unit for my current project but I just don't know what procedure in it to call from my program. This unit is a very nice text editor.

    I'm familiar with pointers, arrays, objects, units, graphics and stuff but I could really use some advice and help here. Do you want me to post this code? I haven't done much with records and such. Thanks Pelle-48 and
  • Pelle-48Pelle-48 Posts: 43Member
    Hello you don't have to be quick in this forum- nobody else is.
    Yes I have the files editors.pas and editors.tpu but I don't know anything about them. If you run graphics with TP7 what resolution can you get?
    640x480 (VGA), 800x600, 1024x768 or 1280x1024?
    I could send a BMP saver for the right one (the first I have shown is only for 1024x768)
  • oracletwooracletwo Posts: 14Member
    Thanks Pelle-48. I solved my problem so I'll have the simple editor that I need. My solution wasn't elegant but it'll get the job done. I simply looked for a program that used the editors.tpu and then just modified that program. It works fine now. I'm a babe in the woods when it comes to object records though I've been doing some reading on that subject. When I finish the program that I'm working on I'll send ya a copy if I can and if you want one. It should be a modest but interesting program. Thanks again and best wishes.
  • oracletwooracletwo Posts: 14Member
    Pelle-48, the more that I think about it, the more I think I'd like my program to display its images from internal source code rather than by having the gif or bmp images residing in the same directory as the program. This would have numerous advantages, including the fact that I would no longer need a viewer; I could just use the Graph unit. As you have truly said before, GetImage/PutImage are limited but the whole process of displaying a bmp could be done pixel by pixel.

    I've have some good results accessing extended memory so it could be done fast. I recall the code that you posted about bmps and so I'm going to make it a priority to give this some thought. I have a million things to do (fortunately) but this will be at the top of the list. I hope you'll forgive me if I again call upon your help in the future but if so, I will certainly mention your name in the acknowledgement section of my program. PS: I found a program called tvdemo.pas in my TP7 package and it's an even better editor than the one I was going to use!

Sign In or Register to comment.