Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: How store TDirectDrawSurface to TDIB ?

  1. #1

    How store TDirectDrawSurface to TDIB ?

    Please, how store TDirectDrawSurface as picture to TDIB ?

    like
    Procedure XY(Source:TDirectDrawSurface)
    begin
    ...
    Source...SaveToDIB(FilenameOfDIB)
    end;

    its posible ?
    Ijcro.

  2. #2

    How store TDirectDrawSurface to TDIB ?

    [pascal]var
    DIB: TDIB;
    Source: TDirectDrawSurface;
    ...
    DIB.Assign(Source);
    ...[/pascal]
    [size=10px][ Join us in #pgd on irc.freenode.net ] [ Sign the Petition for a Software Patent Free Europe ][/size]

  3. #3

    How store TDirectDrawSurface to TDIB ?

    Ooh, is it that simply

    Thanx
    Ijcro.

  4. #4

    How store TDirectDrawSurface to TDIB ?

    Quote Originally Posted by Useless Hacker
    [pascal]var
    DIB: TDIB;
    Source: TDirectDrawSurface;
    ...
    DIB.Assign(Source);
    ...[/pascal]
    EXCELLENT ! Thanks

    Works fine.

    But I have a little question. On SOURCE is set up Transparent and discrete TransparentColor. How get information from TDirectDrawSurface?
    Exist any tutorial how work with TDirectDrawSurface?

    Regards
    Ijcro.

  5. #5

    How store TDirectDrawSurface to TDIB ?

    Quote Originally Posted by ijcro
    But I have a little question. On SOURCE is set up Transparent and discrete TransparentColor. How get information from TDirectDrawSurface?
    Exist any tutorial how work with TDirectDrawSurface?
    I don't really understand what you mean. What information do you want to get from the TDirectDrawSurface?
    [size=10px][ Join us in #pgd on irc.freenode.net ] [ Sign the Petition for a Software Patent Free Europe ][/size]

  6. #6

    How store TDirectDrawSurface to TDIB ?

    Sorry, my English is too poor ops: .

    I want get value of transparent color (or one value color that be use as transparent color). Do you understand me, please?

    I am trying like
    [pascal]color:TDDColorKey;
    ..
    TDirectDrawSurface.IDDSurface.GetColorKey(DDCKEY_S RCBLT,color);[/pascal]

    but it returned strange color. I thing that is wrong parameter, no know.
    Ijcro.

  7. #7

    How store TDirectDrawSurface to TDIB ?

    What's wrong with reading the TDirectDrawSurface.TransparentColor property?
    [size=10px][ Join us in #pgd on irc.freenode.net ] [ Sign the Petition for a Software Patent Free Europe ][/size]

  8. #8

    How store TDirectDrawSurface to TDIB ?

    My problem:
    Cannot read a write-only property
    Ijcro.

  9. #9

    How store TDirectDrawSurface to TDIB ?

    Ah, sorry, I didn't realise it was write-only.

    Here is a (untested) function to get the TransparentColor from a surface:
    [pascal]function GetSurfaceTransparentColor(Surface: TDirectDrawSurface): Longint;
    var
    hr: HResult;
    ddck: TDDColorKey;
    begin
    if (Surface <> nil) and (Surface.ISurface <> nil) then begin
    hr := Surface.ISurface.GetColorKey(DDCKEY_SRCBLT, ddck);
    if (hr = DD_OK) then begin
    Result := ddck.dwColorSpaceLowValue;
    end else begin
    // failed to read ColorKey
    Result := 0;
    end;
    end else begin
    // surface is invalid
    Result := 0;
    end;
    end;[/pascal]
    I am not sure of the exact difference between dwColorSpaceLowValue and dwColorSpaceHighValue; the SetTransparentColor methods sets them both to the TransparentColor, so I'm assuming it is the same in this case (you could try replacing dwColorSpaceLowValue with dwColorSpaceHighValue if this doesn't work.) I don't have a copy of the DirectDraw documentation handy, so I can't check right now.

    I don't really see why you need to read the TransparentColor of a surface anyway, seeing as you must have set it previously.
    [size=10px][ Join us in #pgd on irc.freenode.net ] [ Sign the Petition for a Software Patent Free Europe ][/size]

  10. #10

    How store TDirectDrawSurface to TDIB ?

    Values dwColorSpaceLowValue and dwColorSpaceHighValue are equal.
    Transparent color returned is not true yet.
    As test was setup clLime color for transparent. Structures under TDirectDrawSurface not contain similar value represented clLime or its parts

    Where is error?

    P.S. I am using anonymous painting with TDirectDrawSurface. I don't know from a object come TDirectDrawSurface ...
    Ijcro.

Page 1 of 2 12 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
  •  
Comodo SSL