(Gast)
n/a Beiträge
|
Re: kann Daten nicht an Rect übergeben
13. Okt 2008, 13:59
Kann mal bitte jemand drüberschaun?
Bekomme einfach meine Kanten nicht rund
Delphi-Quellcode:
procedure TSkinEngine.CreateFormRegion(TransColor: COLORREF);
var
bm : Bitmap;
pData : PRgnData;
lpRect : PRect;
hRgn1 : HRGN;
hRgn2 : HRGN;
sRegionData : THANDLE;
TT : Integer;
MaxRegions : Integer;
hDIB : Cardinal;
I, J, K, M : Integer;
IsSame : Integer;
bRedraw : Boolean;
Ar: array of PRGBQuad;
begin
hDIB := GetPaintBitmap(MainWindow(0));
if hDIB = 0 then
exit;
MaxRegions := 4000;
GetObject(hDIB, SIZEOF(bm), @bm);
SetLength(Ar, integer(bm.bmBits));
Ar := @bm.bmBits;
if TransColor = 0 then
TransColor := Cardinal(Ar[(bm.bmHeight - 1) * bm.bmWidth]) and $FFFFFF;
sRegionData := GlobalAlloc(GMEM_MOVEABLE, sizeof(RGNDATAHEADER) + (sizeof(TRECT) * MaxRegions));
pData := GlobalLock(sRegionData);
pData^.rdh.nCount := MaxRegions + 1;;
pData^.rdh.dwSize := sizeof(RGNDATAHEADER);
pData^.rdh.iType := RDH_RECTANGLES;
pData^.rdh.rcBound.Left := 0;
pData^.rdh.rcBound.Top := 0;
pData^.rdh.rcBound.Right := bm.bmWidth;
pData^.rdh.rcBound.Bottom := bm.bmHeight;
lpRect:= PRECT(@pData^.Buffer);
for J := 0 TO bm.bmHeight - 1 do
begin
TT := bm.bmWidth * (bm.bmHeight - 1 - J);
M := -1;
for I := 0 TO bm.bmWidth do
begin
if I = bm.bmWidth then
K := TransColor
else K := Cardinal(@Ar[TT]) and $FFFFFF;
TT := TT + 1;
if K = integer(TransColor) then
IsSame := -1
else
IsSame := 0;
if IsSame = 0 then
if M = -1 then
M := I
else if M >= 0 then
begin
if integer(pData^.rdh.nCount) >= MaxRegions then
begin
hRgn2 := ExtCreateRegion(nil, sizeof(RGNDATAHEADER) +
(sizeof(TRECT) * pData^.rdh.nCount), PRGNDATA(pData)^);
if hRgn1 = 0 then
begin
hRgn1 := hRgn2;
end else
begin
CombineRgn(hRgn1, hRgn1, hRgn2, RGN_OR);
zDeleteObject(hRgn2);
end;
pData^.rdh.nCount := 0;
end;
inc(pData^.rdh.nCount);
lpRect.Left := M;
lpRect.Right := I;
lpRect.Top := J;
lpRect.Bottom := J + 1;
inc(lpRect);
M := -1;
end;
end;
end;
hRgn2 := ExtCreateRegion(nil, sizeof(RGNDATAHEADER) +
(sizeof(TRECT) * pData^.rdh.nCount), pData^);
if hRgn1 = 0 then
begin
hRgn1 := hRgn2
end else
begin
CombineRgn(hRgn1, hRgn1, hRgn2, RGN_OR);
DeleteObject(hRgn2);
end;
if hRgn1 <> 0 then
begin
if IsWindowVisible(MainWindow(0)) then
bRedraw := TRUE
else
bRedraw := FALSE;
SetWindowRgn(MainWindow(0), hRgn1, bRedraw);
end;
SetLength(Ar, 0);
end;
gruss Emil
|
|
Zitat
|