mbColorLib: Fix painting issues of TmbTrackbarPicker-descendents in Linux (did not paint at all).

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5550 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2016-12-20 22:00:42 +00:00
parent f00577f5f4
commit 69886645c6
2 changed files with 26 additions and 25 deletions

View File

@@ -43,9 +43,9 @@ object Form1: TForm1
Height = 384 Height = 384
Top = 6 Top = 6
Width = 403 Width = 403
ActivePage = TabSheet3 ActivePage = TabSheet9
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
TabIndex = 2 TabIndex = 9
TabOrder = 0 TabOrder = 0
OnChange = PageControl1Change OnChange = PageControl1Change
OnMouseMove = PageControl1MouseMove OnMouseMove = PageControl1MouseMove
@@ -721,8 +721,8 @@ object Form1: TForm1
TabOrder = 2 TabOrder = 2
Hue = 0 Hue = 0
Saturation = 0 Saturation = 0
Luminance = 78 Luminance = 73
SelectedColor = 5131854 SelectedColor = 4802889
end end
object VColorPicker1: TVColorPicker object VColorPicker1: TVColorPicker
Left = 34 Left = 34
@@ -897,6 +897,7 @@ object Form1: TForm1
Width = 22 Width = 22
HintFormat = 'Magenta: %m (selected)' HintFormat = 'Magenta: %m (selected)'
ArrowPlacement = spBefore ArrowPlacement = spBefore
Anchors = [akTop, akLeft, akBottom]
TabOrder = 1 TabOrder = 1
SelectedColor = clFuchsia SelectedColor = clFuchsia
end end
@@ -907,6 +908,7 @@ object Form1: TForm1
Width = 31 Width = 31
HintFormat = 'Yellow: %y (selected)' HintFormat = 'Yellow: %y (selected)'
ArrowPlacement = spBoth ArrowPlacement = spBoth
Anchors = [akTop, akLeft, akBottom]
TabOrder = 2 TabOrder = 2
SelectedColor = clYellow SelectedColor = clYellow
end end
@@ -917,6 +919,7 @@ object Form1: TForm1
Width = 22 Width = 22
HintFormat = 'Black: %k (selected)' HintFormat = 'Black: %k (selected)'
NewArrowStyle = True NewArrowStyle = True
Anchors = [akTop, akLeft, akBottom]
TabOrder = 3 TabOrder = 3
Cyan = 0 Cyan = 0
Black = 1 Black = 1
@@ -930,6 +933,7 @@ object Form1: TForm1
HintFormat = 'Red: %r (selected)' HintFormat = 'Red: %r (selected)'
ArrowPlacement = spBefore ArrowPlacement = spBefore
NewArrowStyle = True NewArrowStyle = True
Anchors = [akTop, akLeft, akBottom]
TabOrder = 4 TabOrder = 4
Green = 122 Green = 122
Blue = 122 Blue = 122
@@ -943,6 +947,7 @@ object Form1: TForm1
HintFormat = 'Green: %g (selected)' HintFormat = 'Green: %g (selected)'
ArrowPlacement = spBoth ArrowPlacement = spBoth
NewArrowStyle = True NewArrowStyle = True
Anchors = [akTop, akLeft, akBottom]
TabOrder = 5 TabOrder = 5
Red = 122 Red = 122
Blue = 122 Blue = 122
@@ -955,6 +960,7 @@ object Form1: TForm1
Width = 22 Width = 22
HintFormat = 'Blue: %b (selected)' HintFormat = 'Blue: %b (selected)'
SelectionIndicator = siRect SelectionIndicator = siRect
Anchors = [akTop, akLeft, akBottom]
TabOrder = 6 TabOrder = 6
Green = 122 Green = 122
Red = 122 Red = 122

View File

@@ -64,7 +64,7 @@ type
function YToArrowPos(p: integer): integer; function YToArrowPos(p: integer): integer;
protected protected
FArrowPos: integer; FArrowPos: integer;
FBack: TBitmap; // FBack: TBitmap;
FChange: boolean; FChange: boolean;
FManual: boolean; FManual: boolean;
FLayout: TTrackBarLayout; FLayout: TTrackBarLayout;
@@ -184,10 +184,10 @@ begin
FGradientWidth := 256; FGradientWidth := 256;
FGradientHeight := 1; FGradientHeight := 1;
FBack := TBitmap.Create; // FBack := TBitmap.Create;
FBufferBmp := TBitmap.Create; FBufferBmp := TBitmap.Create;
FBufferBmp.PixelFormat := pf32bit; //FBufferBmp.PixelFormat := pf32bit;
mx := 0; mx := 0;
my := 0; my := 0;
@@ -214,7 +214,7 @@ end;
destructor TmbTrackbarPicker.Destroy; destructor TmbTrackbarPicker.Destroy;
begin begin
FBack.Free; // FBack.Free;
inherited; inherited;
end; end;
@@ -301,9 +301,8 @@ end;
procedure TmbTrackbarPicker.CreateGradient; procedure TmbTrackbarPicker.CreateGradient;
var var
i,j: integer; i,j: integer;
row: pRGBQuadArray; col: TColor;
c: TColor; fpcol: TFPColor;
q: TRGBQuad;
intfimg: TLazIntfImage; intfimg: TLazIntfImage;
imgHandle, imgMaskHandle: HBitmap; imgHandle, imgMaskHandle: HBitmap;
begin begin
@@ -320,14 +319,11 @@ begin
for i := 0 to FBufferBmp.Width-1 do for i := 0 to FBufferBmp.Width-1 do
begin begin
c := GetGradientColor(i); col := GetGradientColor(i);
if WebSafe then c := GetWebSafe(c); if WebSafe then col := GetWebSafe(col);
q := RGBToRGBQuad(c); fpcol := TColorToFPColor(col);
for j := 0 to FBufferBmp.Height-1 do for j := 0 to FBufferBmp.Height-1 do
begin intfImg.Colors[i, j] := fpcol;
row := intfImg.GetDataLineStart(j);
row[i] := q;
end;
end; end;
end end
else else
@@ -335,14 +331,13 @@ begin
FBufferBmp.Width := FGradientHeight; FBufferBmp.Width := FGradientHeight;
FBufferBmp.Height := FGradientWidth; FBufferBmp.Height := FGradientWidth;
intfImg.LoadFromBitmap(FBufferBmp.Handle, FBufferBmp.MaskHandle); intfImg.LoadFromBitmap(FBufferBmp.Handle, FBufferBmp.MaskHandle);
for i := 0 to FBufferBmp.Height-1 do for j := 0 to FBufferBmp.Height-1 do
begin begin
row := intfImg.GetDataLineStart(i); col := GetGradientColor(FBufferBmp.Height - 1 - j);
c := GetGradientColor(FBufferBmp.Height - 1 - i); if WebSafe then col := GetWebSafe(col);
if WebSafe then c := GetWebSafe(c); fpcol := TColorToFPColor(col);
q := RGBtoRGBQuad(c); for i := 0 to FBufferBmp.Width-1 do
for j := 0 to FBufferBmp.Width-1 do intfImg.Colors[i, j] := fpcol;
row[j] := q;
end; end;
end; end;