Page 3 of 5 FirstFirst 12345 LastLast
Results 21 to 30 of 49

Thread: Vampyre Imaging Library 0.22.0 Released

  1. #21

    Vampyre Imaging Library 0.22.0 Released

    I finished integrating, it works finely!
    No more headache with loading the LibPng binaries!

    Thank you

    One side note: Despite the {$minenumsize 4} defined in ImagingOptions.inc, TImageFormat is *still* one byte in size! I had a nasty run-in with AVs when I redefined TImageData in my code, with Format having a type of "dword" (now corrected to "byte").
    This perversion is because my game modules know nothing about their environment (including Vampyre), accessing it via wrapper functions provided by the engine core.

  2. #22

    Vampyre Imaging Library 0.22.0 Released

    One side note: Despite the {$minenumsize 4} defined in ImagingOptions.inc, TImageFormat is *still* one byte in size! I had a nasty run-in with AVs when I redefined TImageData in my code, with Format having a type of "dword" (now corrected to "byte").
    Thanks for bringing this up. This is most probably cause of crashes of Vampyre compiled to DLL and called from C. I've just tried moving {$minenumsize} to other places and it seems that it gets reset later by setting {$mode}. I've corrected this and updated the code in SVN repository - you can change it back to "dword" if you use this new code.
    Vampyre Imaging Library
    Earth Under Fire (PGD Big Boss 3rd place)
    Domains Of Chaos (PGD Multiplexity 5th place)

  3. #23

    Vampyre Imaging Library 0.22.0 Released

    Uh... Thanks :lol: [shuffles away: Svn. :shock: Scary. :cry:] I, uh, solved it for now by editing ImagingTypes.pas and adding to my program:
    [pascal] procedure StartVampyre;
    begin
    if sizeof(tvyimage) <> sizeof (timagedata)
    then Die('Record size mismatch, check compiler options/conditionals.'#13#10
    + 'SizeOf(TVyImage) = %0; SizeOf(TImageData) = %1.'
    , [sizeof(tvyimage), sizeof(timagedata)]);
    end; [/pascal]

    I'll... check it with the next version you release, ok? ops:

  4. #24

    Vampyre Imaging Library 0.22.0 Released

    Quote Originally Posted by Chebmaster
    Uh... Thanks :lol: [shuffles away: Svn. :shock: Scary. :cry:] I, uh, solved it for now by editing ImagingTypes.pas and adding to my program:
    ...
    I'll... check it with the next version you release, ok? ops:
    Or you could just download this one updated file that fixes this:
    http://imaginglib.svn.sourceforge.ne...ingOptions.inc
    Not sure when I will be able to make a new release.
    Vampyre Imaging Library
    Earth Under Fire (PGD Big Boss 3rd place)
    Domains Of Chaos (PGD Multiplexity 5th place)

  5. #25

    Vampyre Imaging Library 0.22.0 Released

    Thanks

  6. #26

    Vampyre Imaging Library 0.22.0 Released

    Quote Originally Posted by jdarling
    I'd love to see PSD (PhotoShop) support built in.
    I've just finished support for loading and saving of PSD images, it is in SVN repository now. It can handle most types of PSD images (indexed, grayscale, RGB(A) 24-64bit, CMYK, FP32 HDR).
    Vampyre Imaging Library
    Earth Under Fire (PGD Big Boss 3rd place)
    Domains Of Chaos (PGD Multiplexity 5th place)

  7. #27

    Vampyre Imaging Library 0.22.0 Released

    A great news, indeed When it's out of the scary SVN, I'll try it.

    Did you implement support for the user program to know the layer names and blending modes? The power of PSD is in the fact that your game can directly use the images you are working on, without a need for "exporting". So you can use layers to implement some serious stuff that is very hard to achieve otherwise (lets just remember the skin area marking in Neverwinter Nights 1 - without the layers it was *such a pain*, the skin/leather/metall were marked via colourization, it was easier to commit suicide right away than edit such a skin :x)

  8. #28

    Vampyre Imaging Library 0.22.0 Released

    Oh! I did just remember! A long time ago, in the 20th century, my favorite graphical editor was DeLuxe Paint II Enhanced (yup, that infamous hardcore MS-DOS thingy). The game I made then (a 3d first-person shooter) ran under MS-DOS, compiled in Turbo Pascal, but the database compiler for it, on the other hand, was a 32-bit application written in some ancient version of Delphi (either 2 or 3 - I can't remember exactly).

    So, the point of my rant: I want to share a piece of code with you. The one that loads DPIIE's format, .LBM. The procedure needs a bit [cough, cough] of cleaning, but... I guraantee that it *worked*, because I used the .LBM format a lot. The thing is, DPIIE has an internal error and while it in itself could load and save its own files just finely, the modern viewers (for example, IrfanView) just crash on them.

    The procedure is pretty dumb and supports only the 256-color images (no 1- 2- or 4- bit versions, sorry -- I just had no need for them back them). Also it is probably a good idea to redefine the record as "packed".

    [pascal]UNIT M_LBM_F;
    INTERFACE
    USES Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
    ExtCtrls, Gauges, StdCtrls,
    e_String, M_Spr;

    Procedure ReadLbm(name: string);
    Var LbmX,LbmY: Word;

    IMPLEMENTATION
    Uses M_LIB;
    Type pType=Array[0..255] of record R,G,B: Byte end;
    VAR
    P0: PType;
    PAL:array[0..768] of byte;
    MPa:array[0..767] of byte absolute P0;
    GRAD: array[0..15,0..1] of byte;
    LNAME: STRING;
    Function min(a,b: longint):longint;
    begin
    if a<b then min:=a else min:=b
    end;

    Function SwW(w: word):word;
    var a:array[0..1] of byte absolute w;
    b:byte;
    begin
    b:=a[0]; a[0]:=a[1]; a[1]:=b;
    SwW:=w;
    end;
    Function SwL(l: longint):longint;
    var a:array[0..3] of byte absolute l;
    b:byte;
    begin
    b:=a[0]; a[0]:=a[3]; a[3]:=b;
    b:=a[1]; a[1]:=a[2]; a[2]:=b;
    SwL:=l;
    end;

    Procedure LBMError(ru:string);
    begin
    ErrOut('Invalid '+LName+' (possible, not in DeLuxe Paint II format)'#10#13+ru);
    end;

    Type
    BMHDType = Record
    Xsize,
    YSize,
    X0,
    Y0 : Word;
    BitPlanes,
    Reserved,
    Encoding : Byte;
    Reserved2: array[1..3] of byte;
    Xaspect,Yaspect: Byte;
    Xmax,
    Ymax : Word;
    End;

    type pa = array[0..0] of byte;
    Procedure ReadLbm(nametring);
    label TinyShit;
    var f: file;
    s:string;
    ba: array[0..3] of byte;
    l: longint absolute ba;
    ind, bi: longint;
    X, Y, i, n ,BSize :integer;
    BMHD: BmhdType;
    B: array[0..20048] of byte;
    c, a: byte;
    p: ^pa;
    o: integer;
    function ReadB: string;
    var _s:string;
    _b:byte;
    begin
    _s:=#0#0#0#0;
    BlockRead(f,_s[1],4);
    i:=IoResult;
    if i<>0 then RunError(i);
    ReadB:=_s;
    BlockRead(f,l,4);
    i:=IoResult;
    if i<>0 then RunError(i);
    _b:=ba[0]; ba[0]:=ba[3]; ba[3]:=_b;
    _b:=ba[1]; ba[1]:=ba[2]; ba[2]:=_b;
    ind:=ind+l+8;
    end;
    begin
    i:=0;
    assign(f,name);
    LName:=Name;
    {$I- }
    reset(f,1);
    i:=IoResult;
    if i<>0 then RunError(i);
    if (FileSize(f)<1000) then RunError(254);
    s:=ReadB; IF s<>'FORM' then LbmError(s);
    Seek(f,; s:=ReadB; if s<>'PBM'#$20 then
    LbmError('File must be 256-color PBM-FORM, not the ILBM-FORM.');
    ind:=12;
    Seek(f,ind); i:=IoResult; if i<>0 then RunError(i);
    s:=ReadB;
    if s<>'BMHD' then
    LbmError('Expected header BMHD, not the '+s);
    BlockRead(f,BMHD,SizeOf(BmHd)); i:=IoResult; if i<>0 then RunError(i);
    With BMHD do begin
    if (BitPlanes<> or (Encoding<>1) then
    LbmError('Uncnown compression type '+IntToStr(BitPlanes)+':'+IntToStr(Encoding));
    Xsize:=sww(xsize); YSize:=sww(Ysize);
    X0:=sww(X0); Y0 :=sww(Y0);
    Xmax:=sww(Xmax); Ymax :=sww(ymax);
    ResizeImage(XSize, YSize);
    end;
    Seek(f,ind); i:=IoResult; if i<>0 then RunError(i);
    s:=ReadB;
    if s<>'CMAP' then
    LbmError('After header expected palette CMAP, not the '+s);
    BlockRead(f,PAL,3*256); i:=IoResult; if i<>0 then RunError(i);
    for i := $00 to $FF*3 do PAL[i]:=PAL[i] shr 2;
    {palette(pal);}
    n:=0;
    While n<=15 do begin
    Seek(f,ind); i:=IoResult; if i<>0 then RunError(i);
    s:=ReadB;
    if (s<>'CRNG') and (s<>'DPPS') then
    LbmError('After palette expected 16 gradient descriptions CRNG, not the '+s);
    BlockRead(f,B,6); i:=IoResult; if i<>0 then RunError(i);
    BlockRead(f,GRAD[n],2); i:=IoResult; if i<>0 then RunError(i);
    if s='DPPS' then Dec(n);
    Inc(n);
    end;
    Seek(f,ind); i:=IoResult; if i<>0 then RunError(i);
    bi:=ind+8;
    s:=ReadB;
    if (s<>'TINY') and (s<>'BODY') then
    LbmError('After gradients expected TINY, or file BODY,~ not the '+s);
    If s='TINY' then begin
    TinyShit:
    Seek(f,ind); i:=IoResult; if i<>0 then RunError(i);
    bi:=ind;
    s:=ReadB;
    if copy(s,2,3)='BOD' then begin
    ind:=bi+1;
    Goto TinyShit;
    end;
    bi:=bi+8;
    if s<>'BODY' then
    LbmError('Expected BODY,~ not the '+s);
    end;
    X:=0; Y:=0;
    BSize:=l;
    GetMem(p, BSize);
    Seek(f, bi);
    BlockRead(f, p^, BSize);
    If IOResult<0>=BMHD.Xsize then begin
    SendLineToImage(y, B[0]);
    Inc(y);
    x:=0;
    end;
    Until (Y=BMHD.YSize) {or (y=Ysize)};
    FreeMem(p, BSize);
    end;
    END.[/pascal]

    I put the sample LBM images here: http://host-17-99.imsys.net/_share/_001/lbm/
    As you can notice, IrfanView chokes with "IFF decoding error" on most of them.

  9. #29

    Vampyre Imaging Library 0.22.0 Released

    Galfar, i'm having troubles with imaging and 32 bit BMP image saving, the pictures apparently contain raw picture and a header, but they won't open with any program i tried (irfanview, delphi Tpicture, paint shop pro... )
    This is my game project - Top Down City:
    http://www.pascalgamedevelopment.com...y-Topic-Reboot

    My OpenAL audio wrapper with Intelligent Source Manager to use unlimited:
    http://www.pascalgamedevelopment.com...source+manager

  10. #30

    Vampyre Imaging Library 0.22.0 Released

    Quote Originally Posted by Delfi
    Galfar, i'm having troubles with imaging and 32 bit BMP image saving, the pictures apparently contain raw picture and a header, but they won't open with any program i tried (irfanview, delphi Tpicture, paint shop pro... )
    Could you please send me one of those problematic BMPs?
    I have tried one and it worked well in Irfan and Photoshop, it loaded ok but had swapped red and blue in Paint Shop Pro.
    I think I know what causes it - I'm saving images with alpha to BMP V4 (introduced in Windows 95) where I can explicitly define that BMP contains n bit alpha channel.
    But it looks like some programs can only handle V3 bitmaps.
    Vampyre Imaging Library
    Earth Under Fire (PGD Big Boss 3rd place)
    Domains Of Chaos (PGD Multiplexity 5th place)

Page 3 of 5 FirstFirst 12345 LastLast

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
  •