Results 1 to 10 of 34

Thread: BeRoPNG - A very tiny but complete PNG loader

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sorry, I know this is an old thread but I tried BeRoPNG to work with ptcgraph. This is my (simple) example:
    Code:
    var
      f: file;
      fsize: longword;
      buffer: pbyte;  
      ImageData: PPNGPixel;
      ImageWidth,
      ImageHeight:longint;
        gd,gm:smallint;
    BEGIN
      AssignFile(f, 'bluepointer.png');
      Reset(f, 1);
      fsize := FileSize(f);
      buffer := getmem(fsize);
      blockread(f, buffer^, fsize);
      CloseFile(f);
    
      BeRoPNG.LoadPNG(buffer, fsize, ImageData, ImageWidth, ImageHeight, false);
      
      Gd:=D16bit;
      Gm:=m800x600;
      InitGraph(Gd, Gm, 'Test'); 
      
      
       if GraphResult <> grOk then begin
             Writeln('Graphics error: ', GraphErrorMsg(ErrorCode));
        Halt(1);
        end;
      
      putimage (10,10,imageData^,1);
      delay (2000);
      closegraph;
      
      
      freemem(buffer);
      freemem(ImageData);
        
       
    END.
    But the result isn't correct (see the attached screenshot). I think the problem is that ptcgraph uses a 16 bit colour format with no alpha channel. Any ideas how this can work?
    beropngtest.jpg
    Best regards,
    Cybermonkey

  2. #2
    PGD Staff code_glitch's Avatar
    Join Date
    Oct 2009
    Location
    UK (England, the bigger bit)
    Posts
    933
    Blog Entries
    45
    Cybermonkey: I've run into this myself quite a few times. Try open the image in gimp or something and fiddle a bit with the compression options when you export. This usually fixes things for reasons I don't fully understand...

    (Though reading your suspicion I guess it might be because GIMP adds an alpha channel during the export? )
    I once tried to change the world. But they wouldn't give me the source code. Damned evil cunning.

  3. #3
    Unfortunately it still doesn't work ...
    Best regards,
    Cybermonkey

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •