TIP: Click on subject to list as thread! ANSI
echo: pascal
to: ALL
from: `C.P. Pieters`
date: 1997-07-14 00:00:00
subject: Re: Making Pascal Display Picture Files


--------------25ABE3595CCEFC69D5A400BF
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

I don't know what PASCAL you're using, but with Borland Pascal 7, you
can create your own pictures with (any kind of) graphical software (like
photo-shop, etc.) or the resources toolkit that is included with Pascal.

These pictures can be added in your program, using the {$R }
directive (as I'm not quite sure if other formats like TIFF and JPEG are
supported...)
and then can be displayed with the (Windows) call BitBlt.

I've include a function whic I use (sorry for the Dutch comments...)
which displays a bitmap and overlays it with a colour bitmap. As you
might see, the bitmaps are referenced with a PChar type, which is a
pointer to the bitmap's stringname,

function TVenster.PutShape(Bericht: TBericht; Rop:LongInt): Bool;
var HMyBit:HBitmap;
    HMyDC: HDC;
begin
  HSrcDC:=GetDC(HWindow);
  HMyDC:=CreateCompatibleDC(HSrcDC);        { Een Device Context maken
die gelijk is aan DC van de bestemming (venster).}
  with Bericht do
  begin
    PutShape:=true;
    HMyBit:=LoadBitMap(HInstance, Bitmap); { Load a Bitmap.}
    SelectObject(HMyDC, HMyBit);           { Put bitmap in new Device
Context. }
    if(not BitBlt(HSrcDC, (Pos.X+1)*C_BlokGrootte,
(Pos.Y+1)*C_BlokGrootte, C_BlokGrootte, C_BlokGrootte, HMyDC, 0,0, Rop))
{ display bitmap in source Window.}
    then
    begin
      PutShape:=false; {Fout bij laden.}
    end; { if Bitblt.}
    DeleteObject(HMyBit); { Verwijder de aangemaakte Bitmap uit het
geheugen.}

    if (KleurC_Wit) then
    begin
      HMyBit:=LoadBitMap(HInstance, KleurNaam[Kleur]); { Load a colour.}

      SelectObject(HMyDC, HMyBit);           { Zet de bitmap in de
nieuwe Device Context. }
      if(not BitBlt(HSrcDC,
(Pos.X+1)*C_BlokGrootte,(Pos.Y+1)*C_BlokGrootte,C_BlokGrootte,
C_BlokGrootte, HMyDC, 0,0, SrcAnd))
      then
      begin
        PutShape:=false; {Fout bij laden.}
      end; { if Bitblt.}
      DeleteObject(HMyBit); { Verwijder de aangemaakte Bitmap uit het
geheugen.}
    end; {if not Gegv.Kleur.}
  end; { with Posi.}
  DeleteDC(HMyDC); { Verwijder de aangemaakte Device Context uit het
geheugen.}
  UpdateWindow(HWindow);
  ReleaseDC(HWindow, HSrcDC);
end; { Putshape.}


Mike Bailey wrote:

> I'm sorta new to pascal programming, could someone show me how or put
> me
> on the right track to figuring out how to make pascal display picture
> files, jpg, gif, bmp, pcx, tif, etc...
> I would be eternally grateful if anyone could help.
> Mike Bailey a.k.a. Phantom CyberSpace
> Owner/K&K SoftWare, Consulting & Webpage Design



--------------25ABE3595CCEFC69D5A400BF
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit


I don't know what PASCAL you're using, but with Borland Pascal 7, you can
create your own pictures with (any kind of) graphical software (like photo-shop,
etc.) or the resources toolkit that is included with Pascal.
These pictures can be added in your program, using the {$R >name.bmp>}
directive (as I'm not quite sure if other formats like TIFF and JPEG are
supported...)
and then can be displayed with the (Windows) call BitBlt.

I've include a function whic I use (sorry for the Dutch comments...)
which displays a bitmap and overlays it with a colour bitmap. As you might
see, the bitmaps are referenced with a PChar type, which is a pointer to
the bitmap's stringname,

function TVenster.PutShape(Bericht: TBericht; Rop:LongInt): Bool;
var HMyBit:HBitmap;
    HMyDC: HDC;
begin
  HSrcDC:=GetDC(HWindow);
  HMyDC:=CreateCompatibleDC(HSrcDC);       
{ Een Device Context maken die gelijk is aan DC van de bestemming (venster).}
  with Bericht do
  begin
    PutShape:=true;
    HMyBit:=LoadBitMap(HInstance, Bitmap); { Load a
Bitmap.}
    SelectObject(HMyDC, HMyBit);          
{ Put bitmap in new Device Context. }
    if(not BitBlt(HSrcDC, (Pos.X+1)*C_BlokGrootte, (Pos.Y+1)*C_BlokGrootte,
C_BlokGrootte, C_BlokGrootte, HMyDC, 0,0, Rop)) { display bitmap in source
Window.}
    then
    begin
      PutShape:=false; {Fout bij laden.}
    end; { if Bitblt.}
    DeleteObject(HMyBit); { Verwijder de aangemaakte
Bitmap uit het geheugen.}

    if (Kleur>>C_Wit) then
    begin
      HMyBit:=LoadBitMap(HInstance, KleurNaam[Kleur]);
{ Load a colour.}
      SelectObject(HMyDC, HMyBit);          
{ Zet de bitmap in de nieuwe Device Context. }
      if(not BitBlt(HSrcDC, (Pos.X+1)*C_BlokGrootte,(Pos.Y+1)*C_BlokGrootte,C_BlokGrootte,
C_BlokGrootte, HMyDC, 0,0, SrcAnd))
      then
      begin
        PutShape:=false; {Fout bij
laden.}
      end; { if Bitblt.}
      DeleteObject(HMyBit); { Verwijder de
aangemaakte Bitmap uit het geheugen.}
    end; {if not Gegv.Kleur.}
  end; { with Posi.}
  DeleteDC(HMyDC); { Verwijder de aangemaakte Device Context uit
het geheugen.}
  UpdateWindow(HWindow);
  ReleaseDC(HWindow, HSrcDC);
end; { Putshape.}
 

Mike Bailey wrote:
I'm sorta new to pascal programming, could someone
show me how or put me
on the right track to figuring out how to make pascal display picture
files, jpg, gif, bmp, pcx, tif, etc...
I would be eternally grateful if anyone could help.
Mike Bailey a.k.a. Phantom CyberSpace
Owner/K&K SoftWare, Consulting & Webpage Design
  

--------------25ABE3595CCEFC69D5A400BF--

SOURCE: alt.fidonet via archive.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.