Please, how store TDirectDrawSurface as picture to TDIB ?
like
Procedure XY(Source:TDirectDrawSurface)
begin
...
Source...SaveToDIB(FilenameOfDIB)
end;
its posible ?
Please, how store TDirectDrawSurface as picture to TDIB ?
like
Procedure XY(Source:TDirectDrawSurface)
begin
...
Source...SaveToDIB(FilenameOfDIB)
end;
its posible ?
Ijcro.
[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]
Ooh, is it that simply
Thanx
Ijcro.
EXCELLENT ! ThanksOriginally Posted by Useless Hacker
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.
I don't really understand what you mean. What information do you want to get from the TDirectDrawSurface?Originally Posted by ijcro
[size=10px][ Join us in #pgd on irc.freenode.net ] [ Sign the Petition for a Software Patent Free Europe ][/size]
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.
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]
My problem:
Cannot read a write-only property
Ijcro.
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]
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.
Bookmarks