* Improved line end detection for rawimages

git-svn-id: trunk@6630 -
This commit is contained in:
marc 2005-01-18 00:09:31 +00:00
parent 7c5349758d
commit 3ddadc078f

View File

@ -2075,6 +2075,7 @@ function TGtkWidgetSet.GetWindowRawImageDescription(GDKWindow: PGdkWindow;
Desc: PRawImageDescription): boolean; Desc: PRawImageDescription): boolean;
var var
Visual: PGdkVisual; Visual: PGdkVisual;
Image: PGdkImage;
Width, Height: integer; Width, Height: integer;
// WindowType: TGdkWindowType; // WindowType: TGdkWindowType;
IsGdkBitmap: Boolean; IsGdkBitmap: Boolean;
@ -2164,12 +2165,29 @@ begin
17..32: Desc^.BitsPerPixel:=32; 17..32: Desc^.BitsPerPixel:=32;
else Desc^.BitsPerPixel:=64; else Desc^.BitsPerPixel:=64;
end; end;
// LineEnd // LineEnd
case Desc^.Depth of Image := gdk_image_new(GDK_IMAGE_NORMAL, Visual, 1, 1);
0..8: Desc^.LineEnd:=rileByteBoundary; if Image = nil
9..32: Desc^.LineEnd:=rileDWordBoundary; // On X11 i386 lines are never aligned to words, only to dwords then begin
else Desc^.LineEnd:=rileQWordBoundary; DebugLn('TGtkWidgetSet.GetWindowRawImageDescription testimage creation failed ');
Exit;
end; end;
try
case Image^.bpl div Image^.bpp of
1: Desc^.LineEnd:=rileByteBoundary;
2: Desc^.LineEnd:=rileWordBoundary;
4: Desc^.LineEnd:=rileDWordBoundary;
8: Desc^.LineEnd:=rileQWordBoundary;
else
DebugLn('TGtkWidgetSet.GetWindowRawImageDescription Unknown line end: %d/%d=%d', [Image^.bpl, Image^.bpp, Image^.bpl div Image^.bpp]);
Exit;
end;
finally
gdk_image_destroy(Image);
Image := nil;
end;
// Precisions and Shifts // Precisions and Shifts
if IsGdkBitmap then begin if IsGdkBitmap then begin
Desc^.RedPrec:=1; Desc^.RedPrec:=1;
@ -2187,7 +2205,7 @@ begin
end; end;
// AlphaBitsPerPixel and AlphaLineEnd // AlphaBitsPerPixel and AlphaLineEnd
Desc^.AlphaBitsPerPixel:=Desc^.AlphaPrec; Desc^.AlphaBitsPerPixel:=Desc^.AlphaPrec;
Desc^.AlphaLineEnd:=rileByteBoundary; Desc^.AlphaLineEnd:=rileByteBoundary; //TODO: MWE: check if alpha ending is the same as normal ending
Desc^.AlphaBitOrder:=riboBitsInOrder; Desc^.AlphaBitOrder:=riboBitsInOrder;
Desc^.AlphaByteOrder:=riboLSBFirst; Desc^.AlphaByteOrder:=riboLSBFirst;
@ -6994,6 +7012,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.618 2005/01/18 00:09:31 marc
* Improved line end detection for rawimages
Revision 1.617 2005/01/17 15:36:31 mattias Revision 1.617 2005/01/17 15:36:31 mattias
improved gtk intf to calculate TextHeight improved gtk intf to calculate TextHeight