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

View File

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