mbColorLib: Rename internal FGradientBmp to FBufferBmp

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5501 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2016-12-15 09:05:53 +00:00
parent 9d70cf2465
commit b956e84c19
16 changed files with 81 additions and 78 deletions

View File

@ -87,7 +87,7 @@ end;
{ x is RED, y is GREEN }
function TBAxisColorPicker.GetGradientColor2D(x, y: Integer): TColor;
begin
Result := RGB(x, FGradientBmp.Height - 1 - y, FB);
Result := RGB(x, FBufferBmp.Height - 1 - y, FB);
end;
procedure TBAxisColorPicker.CorrectCoords(var x, y: integer);
@ -131,7 +131,7 @@ end;
procedure TBAxisColorPicker.Paint;
begin
Canvas.StretchDraw(ClientRect, FGradientBmp);
Canvas.StretchDraw(ClientRect, FBufferBmp);
CorrectCoords(mxx, myy);
DrawMarker(mxx, myy);
end;

View File

@ -139,7 +139,7 @@ end;
procedure TCIEAColorPicker.Paint;
begin
Canvas.StretchDraw(ClientRect, FGradientBmp);
Canvas.StretchDraw(ClientRect, FBufferBmp);
CorrectCoords(mxx, myy);
DrawMarker(mxx, myy);
end;

View File

@ -137,7 +137,7 @@ end;
procedure TCIEBColorPicker.Paint;
begin
Canvas.StretchDraw(ClientRect, FGradientBmp);
Canvas.StretchDraw(ClientRect, FBufferBmp);
CorrectCoords(mxx, myy);
DrawMarker(mxx, myy);
end;

View File

@ -132,7 +132,7 @@ end;
procedure TCIELColorPicker.Paint;
begin
Canvas.StretchDraw(ClientRect, FGradientBmp);
Canvas.StretchDraw(ClientRect, FBufferBmp);
CorrectCoords(mxx, myy);
DrawMarker(mxx, myy);
end;

View File

@ -86,7 +86,7 @@ end;
function TGAxisColorPicker.GetGradientColor2D(x, y: Integer): TColor;
begin
Result := RGB(FGradientBmp.Height - 1 - y, FG, x);
Result := RGB(FBufferBmp.Height - 1 - y, FG, x);
end;
procedure TGAxisColorPicker.CorrectCoords(var x, y: integer);
@ -130,7 +130,7 @@ end;
procedure TGAxisColorPicker.Paint;
begin
Canvas.StretchDraw(ClientRect, FGradientBmp);
Canvas.StretchDraw(ClientRect, FBufferBmp);
CorrectCoords(mxx, myy);
DrawMarker(mxx, myy);
end;

View File

@ -254,7 +254,7 @@ begin
CombineRgn(rgn, r1, r2, RGN_DIFF);
end;
SelectClipRgn(Canvas.Handle, rgn);
Canvas.Draw(0, 0, FGradientBmp);
Canvas.Draw(0, 0, FBufferBmp);
DeleteObject(rgn);
DrawHueLine;
if FDoChange then

View File

@ -91,7 +91,7 @@ end;
function THSColorPicker.GetGradientColor2D(X, Y: Integer): TColor;
begin
Result := HSLRangeToRGB(x, FGradientBmp.Height - 1 - y, 120);
Result := HSLRangeToRGB(x, FBufferBmp.Height - 1 - y, 120);
end;
procedure THSColorPicker.CorrectCoords(var x, y: integer);
@ -130,7 +130,7 @@ end;
procedure THSColorPicker.Paint;
begin
Canvas.StretchDraw(ClientRect, FGradientBmp);
Canvas.StretchDraw(ClientRect, FBufferBmp);
CorrectCoords(mxx, myy);
DrawMarker(mxx, myy);
end;

View File

@ -115,7 +115,7 @@ begin
InflateRect(R, -1, -1); // Avoid spurious black pixels at the border
rgn := CreateEllipticRgnIndirect(R);
SelectClipRgn(Canvas.Handle, rgn);
Canvas.Draw(0, 0, FGradientBmp);
Canvas.Draw(0, 0, FBufferBmp);
DeleteObject(rgn);
DrawSatCirc;
DrawHueLine;

View File

@ -333,7 +333,7 @@ begin
with OffScreen.Canvas do
begin
Pen.Style := psClear;
// draw color comb from FColorCombs array
// draw color combs from FColorCombs array
XOffs := FRadius + FColorCombRect.Left;
YOffs := FRadius + FColorCombRect.Top;
// draw the combs
@ -375,7 +375,7 @@ begin
Brush.Color := FBWCombs[I].Color;
if I in [0, High(FBWCombs)] then
begin
if Pen.Color = clWhite then
if Pen.Color = clWhite then // "white" needs a border if background is white as well
Pen.Color := clGray;
DrawComb(OffScreen.Canvas, FBWCombs[I].Position.X + XOffs, FBWCombs[I].Position.Y + YOffs, 2 * FCombSize)
end else

View File

@ -87,7 +87,7 @@ end;
{ x is BLUE, y is GREEN }
function TRAxisColorPicker.GetGradientColor2D(x, y: Integer): TColor;
begin
Result := RGB(FR, FGradientBmp.Height - 1 - y, x);
Result := RGB(FR, FBufferBmp.Height - 1 - y, x);
end;
procedure TRAxisColorPicker.CorrectCoords(var x, y: integer);
@ -131,7 +131,7 @@ end;
procedure TRAxisColorPicker.Paint;
begin
Canvas.StretchDraw(ClientRect, FGradientBmp);
Canvas.StretchDraw(ClientRect, FBufferBmp);
CorrectCoords(mxx, myy);
DrawMarker(mxx, myy);
end;

View File

@ -116,7 +116,7 @@ end;
procedure TSLColorPicker.Paint;
begin
Canvas.StretchDraw(ClientRect, FGradientBMP);
Canvas.StretchDraw(ClientRect, FBufferBMP);
UpdateCoords;
DrawMarker(mdx, mdy);
end;

View File

@ -42,9 +42,9 @@ object Form1: TForm1
Height = 363
Top = 6
Width = 403
ActivePage = TabSheet7
ActivePage = TabSheet3
Anchors = [akTop, akLeft, akRight, akBottom]
TabIndex = 7
TabIndex = 2
TabOrder = 0
OnMouseMove = PageControl1MouseMove
object TabSheet1: TTabSheet
@ -139,15 +139,15 @@ object Form1: TForm1
end
object TabSheet3: TTabSheet
Caption = 'mbColorPalette'
ClientHeight = 303
ClientWidth = 391
ClientHeight = 335
ClientWidth = 395
ImageIndex = 2
object Label3: TLabel
AnchorSideTop.Control = ComboBox2
AnchorSideTop.Side = asrCenter
Left = 6
Height = 15
Top = 272
Top = 304
Width = 24
Caption = 'Sort:'
ParentColor = False
@ -157,7 +157,7 @@ object Form1: TForm1
AnchorSideTop.Side = asrCenter
Left = 224
Height = 15
Top = 272
Top = 304
Width = 28
Caption = 'Style:'
ParentColor = False
@ -167,7 +167,7 @@ object Form1: TForm1
AnchorSideTop.Side = asrCenter
Left = 336
Height = 15
Top = 272
Top = 304
Width = 23
Caption = 'Size:'
ParentColor = False
@ -175,7 +175,7 @@ object Form1: TForm1
object Button1: TButton
Left = 6
Height = 25
Top = 236
Top = 268
Width = 107
Anchors = [akLeft, akBottom]
Caption = 'Generate blue pal'
@ -185,7 +185,7 @@ object Form1: TForm1
object Button2: TButton
Left = 120
Height = 25
Top = 236
Top = 268
Width = 135
Anchors = [akLeft, akBottom]
Caption = 'Generate gradient pal'
@ -195,7 +195,7 @@ object Form1: TForm1
object Button4: TButton
Left = 262
Height = 25
Top = 236
Top = 268
Width = 121
Anchors = [akLeft, akBottom]
Caption = 'Load palette from file'
@ -204,21 +204,21 @@ object Form1: TForm1
end
object ScrollBox1: TScrollBox
Left = 6
Height = 221
Height = 253
Top = 8
Width = 381
Width = 385
HorzScrollBar.Page = 75
VertScrollBar.Page = 221
VertScrollBar.Page = 234
Anchors = [akTop, akLeft, akRight, akBottom]
BorderStyle = bsNone
ClientHeight = 221
ClientWidth = 364
ClientHeight = 253
ClientWidth = 385
TabOrder = 3
object mbColorPalette1: TmbColorPalette
Left = 0
Height = 234
Top = 0
Width = 360
Width = 385
Align = alTop
Colors.Strings = (
'clBlack'
@ -480,6 +480,7 @@ object Form1: TForm1
)
HintFormat = 'RGB(%r, %g, %b)'#13'Hex: %h'
AutoHeight = True
CellStyle = csCorel
TabOrder = 0
OnSelColorChange = mbColorPalette1SelColorChange
OnMouseMove = mbColorPalette1MouseMove
@ -488,7 +489,7 @@ object Form1: TForm1
object ComboBox2: TComboBox
Left = 34
Height = 23
Top = 268
Top = 300
Width = 87
Anchors = [akLeft, akBottom]
ItemHeight = 15
@ -505,7 +506,7 @@ object Form1: TForm1
object ComboBox3: TComboBox
Left = 124
Height = 23
Top = 268
Top = 300
Width = 87
Anchors = [akLeft, akBottom]
ItemHeight = 15
@ -538,7 +539,7 @@ object Form1: TForm1
object ComboBox4: TComboBox
Left = 256
Height = 23
Top = 268
Top = 300
Width = 71
Anchors = [akLeft, akBottom]
ItemHeight = 15
@ -555,7 +556,7 @@ object Form1: TForm1
object UpDown1: TUpDown
Left = 364
Height = 23
Top = 268
Top = 300
Width = 15
Anchors = [akLeft, akBottom]
Min = 0

View File

@ -24,7 +24,7 @@ type
FHintState: THintState;
procedure HintTimer(Sender: TObject);
protected
FGradientBmp: TBitmap;
FBufferBmp: TBitmap;
FGradientWidth: Integer;
FGradientHeight: Integer;
FHintShown: Boolean;
@ -181,7 +181,7 @@ begin
{$ENDIF}
ABitmap.Canvas.Brush.Color := Color;
ABitmap.Canvas.FillRect(ABitmap.Canvas.ClipRect);
Canvas.Draw(0, 0, ABitmap);
// Canvas.Draw(0, 0, ABitmap);
{$IFDEF DELPHI_7_UP}{$IFDEF DELPHI}
if ParentBackground then

View File

@ -33,7 +33,8 @@ type
FMouseLoc: TMouseLoc;
FMouseOver, FMouseDown, FAutoHeight: boolean;
FColCount, FRowCount, FTop, FLeft, FIndex, FCheckedIndex, FCellSize, FTotalCells: integer;
FTempBmp, PBack: TBitmap;
FTempBmp: TBitmap;
//PBack: TBitmap;
FState: TColorCellState;
FColors, FNames: TStrings;
FPalette: TFileName;
@ -177,12 +178,12 @@ implementation
constructor TmbColorPalette.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
ControlStyle := ControlStyle - [csAcceptsControls] + [csOpaque];
DoubleBuffered := true;
PBack := TBitmap.Create;
PBack.PixelFormat := pf32bit;
// ControlStyle := ControlStyle - [csAcceptsControls] + [csOpaque];
// DoubleBuffered := true;
// PBack := TBitmap.Create;
// PBack.PixelFormat := pf32bit;
FTempBmp := TBitmap.Create;
FTempBmp.PixelFormat := pf32bit;
//FTempBmp.PixelFormat := pf32bit;
{$IFDEF DELPHI_7_UP} {$IFDEF DELPHI}
ParentBackground := true;
{$ENDIF} {$ENDIF}
@ -219,7 +220,7 @@ end;
destructor TmbColorPalette.Destroy;
begin
PBack.Free;
//PBack.Free;
FTempBmp.Free;
FNames.Free;
FColors.Free;
@ -297,10 +298,10 @@ procedure TmbColorPalette.Paint;
var
i: integer;
begin
PBack.Width := Width;
{ PBack.Width := Width;
PBack.Height := Height;
PaintParentBack(PBack);
}
//make bmp
FTempBmp.Width := Width;
FTempBmp.Height := Height;
@ -453,7 +454,8 @@ begin
with ThemeServices do
if Enabled then
case FState of
ccsNone: ACanvas.CopyRect(R, PBack.Canvas, R);
ccsNone: ;
//ccsNone: ACanvas.CopyRect(R, PBack.Canvas, R);
ccsOver: DrawElement(ACanvas.Handle, GetElementDetails(ttbButtonHot), R);
ccsDown: DrawElement(ACanvas.Handle, GetElementDetails(ttbButtonPressed), R);
ccsChecked: DrawElement(ACanvas.Handle, GetElementDetails(ttbButtonChecked), R);

View File

@ -170,29 +170,29 @@ var
imgHandle, imgMaskHandle: HBitmap;
{$ENDIF}
begin
if FGradientBmp = nil then
if FBufferBmp = nil then
begin
FGradientBmp := TBitmap.Create;
FGradientBmp.PixelFormat := pf32bit;
FBufferBmp := TBitmap.Create;
FBufferBmp.PixelFormat := pf32bit;
end;
FGradientBmp.Width := FGradientWidth;
FGradientBmp.Height := FGradientHeight;
FBufferBmp.Width := FGradientWidth;
FBufferBmp.Height := FGradientHeight;
{$IFDEF FPC}
intfimg := TLazIntfImage.Create(FGradientBmp.Width, FGradientBmp.Height);
intfimg := TLazIntfImage.Create(FBufferBmp.Width, FBufferBmp.Height);
try
intfImg.LoadFromBitmap(FGradientBmp.Handle, FGradientBmp.MaskHandle);
intfImg.LoadFromBitmap(FBufferBmp.Handle, FBufferBmp.MaskHandle);
{$ENDIF}
for y := 0 to FGradientBmp.Height - 1 do
for y := 0 to FBufferBmp.Height - 1 do
begin
{$IFDEF FPC}
row := intfImg.GetDataLineStart(y); //FGradientBmp.Height - 1 - y);
row := intfImg.GetDataLineStart(y); //FBufferBmp.Height - 1 - y);
{$ELSE}
row := FHSVBmp.Scanline(y); //FGradientBmp.Height - 1 - y);
{$ENDIF}
for x := 0 to FGradientBmp.Width - 1 do
for x := 0 to FBufferBmp.Width - 1 do
begin
c := GetGradientColor2D(x, y);
if WebSafe then
@ -203,8 +203,8 @@ begin
{$IFDEF FPC}
intfimg.CreateBitmaps(imgHandle, imgMaskHandle, false);
FGradientBmp.Handle := imgHandle;
FGradientBmp.MaskHandle := imgMaskHandle;
FBufferBmp.Handle := imgHandle;
FBufferBmp.MaskHandle := imgMaskHandle;
finally
intfimg.Free;
end;

View File

@ -206,8 +206,8 @@ begin
FGradientWidth := 256;
FGradientHeight := 12;
FGradientBmp := TBitmap.Create;
FGradientBmp.PixelFormat := pf32bit;
FBufferBmp := TBitmap.Create;
FBufferBmp.PixelFormat := pf32bit;
mx := 0;
my := 0;
@ -236,7 +236,7 @@ end;
destructor TmbTrackbarPicker.Destroy;
begin
FGradientBmp.Free;
FBufferBmp.Free;
FBack.Free;
inherited;
end;
@ -253,7 +253,7 @@ var
imgHandle, imgMaskHandle: HBitmap;
{$ENDIF}
begin
if FGradientBmp = nil then
if FBufferBmp = nil then
exit;
{$IFDEF FPC}
@ -263,17 +263,17 @@ begin
if Layout = lyHorizontal then
begin
FGradientBmp.Width := FGradientWidth;
FGradientBmp.Height := FGradientHeight;
FBufferBmp.Width := FGradientWidth;
FBufferBmp.Height := FGradientHeight;
{$IFDEF FPC}
intfImg.LoadFromBitmap(FGradientBmp.Handle, FGradientBmp.MaskHandle);
intfImg.LoadFromBitmap(FBufferBmp.Handle, FBufferBmp.MaskHandle);
{$ENDIF}
for i := 0 to FGradientBmp.Width-1 do
for i := 0 to FBufferBmp.Width-1 do
begin
c := GetGradientColor(i);
if WebSafe then c := GetWebSafe(c);
q := RGBToRGBQuad(c);
for j := 0 to FGradientBmp.Height-1 do
for j := 0 to FBufferBmp.Height-1 do
begin
{$IFDEF FPC}
row := intfImg.GetDataLineStart(j);
@ -286,30 +286,30 @@ begin
end
else
begin
FGradientBmp.Width := FGradientHeight;
FGradientBmp.Height := FGradientWidth;
FBufferBmp.Width := FGradientHeight;
FBufferBmp.Height := FGradientWidth;
{$IFDEF FPC}
intfImg.LoadFromBitmap(FGradientBmp.Handle, FGradientBmp.MaskHandle);
intfImg.LoadFromBitmap(FBufferBmp.Handle, FBufferBmp.MaskHandle);
{$ENDIF}
for i := 0 to FGradientBmp.Height-1 do
for i := 0 to FBufferBmp.Height-1 do
begin
{$IFDEF FPC}
row := intfImg.GetDataLineStart(i);
{$ELSE}
row := FGradientBmp.ScanLine[i];
{$ENDIF}
c := GetGradientColor(FGradientBmp.Height - 1 - i);
c := GetGradientColor(FBufferBmp.Height - 1 - i);
if WebSafe then c := GetWebSafe(c);
q := RGBtoRGBQuad(c);
for j := 0 to FGradientBmp.Width-1 do
for j := 0 to FBufferBmp.Width-1 do
row[j] := q;
end;
end;
{$IFDEF FPC}
intfimg.CreateBitmaps(imgHandle, imgMaskHandle, false);
FGradientBmp.Handle := imgHandle;
FGradientBmp.MaskHandle := imgMaskHandle;
FBufferBmp.Handle := imgHandle;
FBufferBmp.MaskHandle := imgMaskHandle;
finally
intfImg.Free;
end;
@ -873,7 +873,7 @@ end;
procedure TmbTrackBarPicker.Execute(tbaAction: integer);
begin
case tbaAction of
TBA_Paint : Canvas.StretchDraw(FPickRect, FGradientBmp);
TBA_Paint : Canvas.StretchDraw(FPickRect, FBufferBmp);
TBA_RedoBMP : CreateGradient;
// Rest handled in descendants
end;