You've already forked lazarus-ccr
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:
@ -87,7 +87,7 @@ end;
|
|||||||
{ x is RED, y is GREEN }
|
{ x is RED, y is GREEN }
|
||||||
function TBAxisColorPicker.GetGradientColor2D(x, y: Integer): TColor;
|
function TBAxisColorPicker.GetGradientColor2D(x, y: Integer): TColor;
|
||||||
begin
|
begin
|
||||||
Result := RGB(x, FGradientBmp.Height - 1 - y, FB);
|
Result := RGB(x, FBufferBmp.Height - 1 - y, FB);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TBAxisColorPicker.CorrectCoords(var x, y: integer);
|
procedure TBAxisColorPicker.CorrectCoords(var x, y: integer);
|
||||||
@ -131,7 +131,7 @@ end;
|
|||||||
|
|
||||||
procedure TBAxisColorPicker.Paint;
|
procedure TBAxisColorPicker.Paint;
|
||||||
begin
|
begin
|
||||||
Canvas.StretchDraw(ClientRect, FGradientBmp);
|
Canvas.StretchDraw(ClientRect, FBufferBmp);
|
||||||
CorrectCoords(mxx, myy);
|
CorrectCoords(mxx, myy);
|
||||||
DrawMarker(mxx, myy);
|
DrawMarker(mxx, myy);
|
||||||
end;
|
end;
|
||||||
|
@ -139,7 +139,7 @@ end;
|
|||||||
|
|
||||||
procedure TCIEAColorPicker.Paint;
|
procedure TCIEAColorPicker.Paint;
|
||||||
begin
|
begin
|
||||||
Canvas.StretchDraw(ClientRect, FGradientBmp);
|
Canvas.StretchDraw(ClientRect, FBufferBmp);
|
||||||
CorrectCoords(mxx, myy);
|
CorrectCoords(mxx, myy);
|
||||||
DrawMarker(mxx, myy);
|
DrawMarker(mxx, myy);
|
||||||
end;
|
end;
|
||||||
|
@ -137,7 +137,7 @@ end;
|
|||||||
|
|
||||||
procedure TCIEBColorPicker.Paint;
|
procedure TCIEBColorPicker.Paint;
|
||||||
begin
|
begin
|
||||||
Canvas.StretchDraw(ClientRect, FGradientBmp);
|
Canvas.StretchDraw(ClientRect, FBufferBmp);
|
||||||
CorrectCoords(mxx, myy);
|
CorrectCoords(mxx, myy);
|
||||||
DrawMarker(mxx, myy);
|
DrawMarker(mxx, myy);
|
||||||
end;
|
end;
|
||||||
|
@ -132,7 +132,7 @@ end;
|
|||||||
|
|
||||||
procedure TCIELColorPicker.Paint;
|
procedure TCIELColorPicker.Paint;
|
||||||
begin
|
begin
|
||||||
Canvas.StretchDraw(ClientRect, FGradientBmp);
|
Canvas.StretchDraw(ClientRect, FBufferBmp);
|
||||||
CorrectCoords(mxx, myy);
|
CorrectCoords(mxx, myy);
|
||||||
DrawMarker(mxx, myy);
|
DrawMarker(mxx, myy);
|
||||||
end;
|
end;
|
||||||
|
@ -86,7 +86,7 @@ end;
|
|||||||
|
|
||||||
function TGAxisColorPicker.GetGradientColor2D(x, y: Integer): TColor;
|
function TGAxisColorPicker.GetGradientColor2D(x, y: Integer): TColor;
|
||||||
begin
|
begin
|
||||||
Result := RGB(FGradientBmp.Height - 1 - y, FG, x);
|
Result := RGB(FBufferBmp.Height - 1 - y, FG, x);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TGAxisColorPicker.CorrectCoords(var x, y: integer);
|
procedure TGAxisColorPicker.CorrectCoords(var x, y: integer);
|
||||||
@ -130,7 +130,7 @@ end;
|
|||||||
|
|
||||||
procedure TGAxisColorPicker.Paint;
|
procedure TGAxisColorPicker.Paint;
|
||||||
begin
|
begin
|
||||||
Canvas.StretchDraw(ClientRect, FGradientBmp);
|
Canvas.StretchDraw(ClientRect, FBufferBmp);
|
||||||
CorrectCoords(mxx, myy);
|
CorrectCoords(mxx, myy);
|
||||||
DrawMarker(mxx, myy);
|
DrawMarker(mxx, myy);
|
||||||
end;
|
end;
|
||||||
|
@ -254,7 +254,7 @@ begin
|
|||||||
CombineRgn(rgn, r1, r2, RGN_DIFF);
|
CombineRgn(rgn, r1, r2, RGN_DIFF);
|
||||||
end;
|
end;
|
||||||
SelectClipRgn(Canvas.Handle, rgn);
|
SelectClipRgn(Canvas.Handle, rgn);
|
||||||
Canvas.Draw(0, 0, FGradientBmp);
|
Canvas.Draw(0, 0, FBufferBmp);
|
||||||
DeleteObject(rgn);
|
DeleteObject(rgn);
|
||||||
DrawHueLine;
|
DrawHueLine;
|
||||||
if FDoChange then
|
if FDoChange then
|
||||||
|
@ -91,7 +91,7 @@ end;
|
|||||||
|
|
||||||
function THSColorPicker.GetGradientColor2D(X, Y: Integer): TColor;
|
function THSColorPicker.GetGradientColor2D(X, Y: Integer): TColor;
|
||||||
begin
|
begin
|
||||||
Result := HSLRangeToRGB(x, FGradientBmp.Height - 1 - y, 120);
|
Result := HSLRangeToRGB(x, FBufferBmp.Height - 1 - y, 120);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure THSColorPicker.CorrectCoords(var x, y: integer);
|
procedure THSColorPicker.CorrectCoords(var x, y: integer);
|
||||||
@ -130,7 +130,7 @@ end;
|
|||||||
|
|
||||||
procedure THSColorPicker.Paint;
|
procedure THSColorPicker.Paint;
|
||||||
begin
|
begin
|
||||||
Canvas.StretchDraw(ClientRect, FGradientBmp);
|
Canvas.StretchDraw(ClientRect, FBufferBmp);
|
||||||
CorrectCoords(mxx, myy);
|
CorrectCoords(mxx, myy);
|
||||||
DrawMarker(mxx, myy);
|
DrawMarker(mxx, myy);
|
||||||
end;
|
end;
|
||||||
|
@ -115,7 +115,7 @@ begin
|
|||||||
InflateRect(R, -1, -1); // Avoid spurious black pixels at the border
|
InflateRect(R, -1, -1); // Avoid spurious black pixels at the border
|
||||||
rgn := CreateEllipticRgnIndirect(R);
|
rgn := CreateEllipticRgnIndirect(R);
|
||||||
SelectClipRgn(Canvas.Handle, rgn);
|
SelectClipRgn(Canvas.Handle, rgn);
|
||||||
Canvas.Draw(0, 0, FGradientBmp);
|
Canvas.Draw(0, 0, FBufferBmp);
|
||||||
DeleteObject(rgn);
|
DeleteObject(rgn);
|
||||||
DrawSatCirc;
|
DrawSatCirc;
|
||||||
DrawHueLine;
|
DrawHueLine;
|
||||||
|
@ -333,7 +333,7 @@ begin
|
|||||||
with OffScreen.Canvas do
|
with OffScreen.Canvas do
|
||||||
begin
|
begin
|
||||||
Pen.Style := psClear;
|
Pen.Style := psClear;
|
||||||
// draw color comb from FColorCombs array
|
// draw color combs from FColorCombs array
|
||||||
XOffs := FRadius + FColorCombRect.Left;
|
XOffs := FRadius + FColorCombRect.Left;
|
||||||
YOffs := FRadius + FColorCombRect.Top;
|
YOffs := FRadius + FColorCombRect.Top;
|
||||||
// draw the combs
|
// draw the combs
|
||||||
@ -375,7 +375,7 @@ begin
|
|||||||
Brush.Color := FBWCombs[I].Color;
|
Brush.Color := FBWCombs[I].Color;
|
||||||
if I in [0, High(FBWCombs)] then
|
if I in [0, High(FBWCombs)] then
|
||||||
begin
|
begin
|
||||||
if Pen.Color = clWhite then
|
if Pen.Color = clWhite then // "white" needs a border if background is white as well
|
||||||
Pen.Color := clGray;
|
Pen.Color := clGray;
|
||||||
DrawComb(OffScreen.Canvas, FBWCombs[I].Position.X + XOffs, FBWCombs[I].Position.Y + YOffs, 2 * FCombSize)
|
DrawComb(OffScreen.Canvas, FBWCombs[I].Position.X + XOffs, FBWCombs[I].Position.Y + YOffs, 2 * FCombSize)
|
||||||
end else
|
end else
|
||||||
|
@ -87,7 +87,7 @@ end;
|
|||||||
{ x is BLUE, y is GREEN }
|
{ x is BLUE, y is GREEN }
|
||||||
function TRAxisColorPicker.GetGradientColor2D(x, y: Integer): TColor;
|
function TRAxisColorPicker.GetGradientColor2D(x, y: Integer): TColor;
|
||||||
begin
|
begin
|
||||||
Result := RGB(FR, FGradientBmp.Height - 1 - y, x);
|
Result := RGB(FR, FBufferBmp.Height - 1 - y, x);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TRAxisColorPicker.CorrectCoords(var x, y: integer);
|
procedure TRAxisColorPicker.CorrectCoords(var x, y: integer);
|
||||||
@ -131,7 +131,7 @@ end;
|
|||||||
|
|
||||||
procedure TRAxisColorPicker.Paint;
|
procedure TRAxisColorPicker.Paint;
|
||||||
begin
|
begin
|
||||||
Canvas.StretchDraw(ClientRect, FGradientBmp);
|
Canvas.StretchDraw(ClientRect, FBufferBmp);
|
||||||
CorrectCoords(mxx, myy);
|
CorrectCoords(mxx, myy);
|
||||||
DrawMarker(mxx, myy);
|
DrawMarker(mxx, myy);
|
||||||
end;
|
end;
|
||||||
|
@ -116,7 +116,7 @@ end;
|
|||||||
|
|
||||||
procedure TSLColorPicker.Paint;
|
procedure TSLColorPicker.Paint;
|
||||||
begin
|
begin
|
||||||
Canvas.StretchDraw(ClientRect, FGradientBMP);
|
Canvas.StretchDraw(ClientRect, FBufferBMP);
|
||||||
UpdateCoords;
|
UpdateCoords;
|
||||||
DrawMarker(mdx, mdy);
|
DrawMarker(mdx, mdy);
|
||||||
end;
|
end;
|
||||||
|
@ -42,9 +42,9 @@ object Form1: TForm1
|
|||||||
Height = 363
|
Height = 363
|
||||||
Top = 6
|
Top = 6
|
||||||
Width = 403
|
Width = 403
|
||||||
ActivePage = TabSheet7
|
ActivePage = TabSheet3
|
||||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
TabIndex = 7
|
TabIndex = 2
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
OnMouseMove = PageControl1MouseMove
|
OnMouseMove = PageControl1MouseMove
|
||||||
object TabSheet1: TTabSheet
|
object TabSheet1: TTabSheet
|
||||||
@ -139,15 +139,15 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
object TabSheet3: TTabSheet
|
object TabSheet3: TTabSheet
|
||||||
Caption = 'mbColorPalette'
|
Caption = 'mbColorPalette'
|
||||||
ClientHeight = 303
|
ClientHeight = 335
|
||||||
ClientWidth = 391
|
ClientWidth = 395
|
||||||
ImageIndex = 2
|
ImageIndex = 2
|
||||||
object Label3: TLabel
|
object Label3: TLabel
|
||||||
AnchorSideTop.Control = ComboBox2
|
AnchorSideTop.Control = ComboBox2
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 15
|
Height = 15
|
||||||
Top = 272
|
Top = 304
|
||||||
Width = 24
|
Width = 24
|
||||||
Caption = 'Sort:'
|
Caption = 'Sort:'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
@ -157,7 +157,7 @@ object Form1: TForm1
|
|||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
Left = 224
|
Left = 224
|
||||||
Height = 15
|
Height = 15
|
||||||
Top = 272
|
Top = 304
|
||||||
Width = 28
|
Width = 28
|
||||||
Caption = 'Style:'
|
Caption = 'Style:'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
@ -167,7 +167,7 @@ object Form1: TForm1
|
|||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
Left = 336
|
Left = 336
|
||||||
Height = 15
|
Height = 15
|
||||||
Top = 272
|
Top = 304
|
||||||
Width = 23
|
Width = 23
|
||||||
Caption = 'Size:'
|
Caption = 'Size:'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
@ -175,7 +175,7 @@ object Form1: TForm1
|
|||||||
object Button1: TButton
|
object Button1: TButton
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 25
|
Height = 25
|
||||||
Top = 236
|
Top = 268
|
||||||
Width = 107
|
Width = 107
|
||||||
Anchors = [akLeft, akBottom]
|
Anchors = [akLeft, akBottom]
|
||||||
Caption = 'Generate blue pal'
|
Caption = 'Generate blue pal'
|
||||||
@ -185,7 +185,7 @@ object Form1: TForm1
|
|||||||
object Button2: TButton
|
object Button2: TButton
|
||||||
Left = 120
|
Left = 120
|
||||||
Height = 25
|
Height = 25
|
||||||
Top = 236
|
Top = 268
|
||||||
Width = 135
|
Width = 135
|
||||||
Anchors = [akLeft, akBottom]
|
Anchors = [akLeft, akBottom]
|
||||||
Caption = 'Generate gradient pal'
|
Caption = 'Generate gradient pal'
|
||||||
@ -195,7 +195,7 @@ object Form1: TForm1
|
|||||||
object Button4: TButton
|
object Button4: TButton
|
||||||
Left = 262
|
Left = 262
|
||||||
Height = 25
|
Height = 25
|
||||||
Top = 236
|
Top = 268
|
||||||
Width = 121
|
Width = 121
|
||||||
Anchors = [akLeft, akBottom]
|
Anchors = [akLeft, akBottom]
|
||||||
Caption = 'Load palette from file'
|
Caption = 'Load palette from file'
|
||||||
@ -204,21 +204,21 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
object ScrollBox1: TScrollBox
|
object ScrollBox1: TScrollBox
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 221
|
Height = 253
|
||||||
Top = 8
|
Top = 8
|
||||||
Width = 381
|
Width = 385
|
||||||
HorzScrollBar.Page = 75
|
HorzScrollBar.Page = 75
|
||||||
VertScrollBar.Page = 221
|
VertScrollBar.Page = 234
|
||||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
BorderStyle = bsNone
|
BorderStyle = bsNone
|
||||||
ClientHeight = 221
|
ClientHeight = 253
|
||||||
ClientWidth = 364
|
ClientWidth = 385
|
||||||
TabOrder = 3
|
TabOrder = 3
|
||||||
object mbColorPalette1: TmbColorPalette
|
object mbColorPalette1: TmbColorPalette
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 234
|
Height = 234
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 360
|
Width = 385
|
||||||
Align = alTop
|
Align = alTop
|
||||||
Colors.Strings = (
|
Colors.Strings = (
|
||||||
'clBlack'
|
'clBlack'
|
||||||
@ -480,6 +480,7 @@ object Form1: TForm1
|
|||||||
)
|
)
|
||||||
HintFormat = 'RGB(%r, %g, %b)'#13'Hex: %h'
|
HintFormat = 'RGB(%r, %g, %b)'#13'Hex: %h'
|
||||||
AutoHeight = True
|
AutoHeight = True
|
||||||
|
CellStyle = csCorel
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
OnSelColorChange = mbColorPalette1SelColorChange
|
OnSelColorChange = mbColorPalette1SelColorChange
|
||||||
OnMouseMove = mbColorPalette1MouseMove
|
OnMouseMove = mbColorPalette1MouseMove
|
||||||
@ -488,7 +489,7 @@ object Form1: TForm1
|
|||||||
object ComboBox2: TComboBox
|
object ComboBox2: TComboBox
|
||||||
Left = 34
|
Left = 34
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 268
|
Top = 300
|
||||||
Width = 87
|
Width = 87
|
||||||
Anchors = [akLeft, akBottom]
|
Anchors = [akLeft, akBottom]
|
||||||
ItemHeight = 15
|
ItemHeight = 15
|
||||||
@ -505,7 +506,7 @@ object Form1: TForm1
|
|||||||
object ComboBox3: TComboBox
|
object ComboBox3: TComboBox
|
||||||
Left = 124
|
Left = 124
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 268
|
Top = 300
|
||||||
Width = 87
|
Width = 87
|
||||||
Anchors = [akLeft, akBottom]
|
Anchors = [akLeft, akBottom]
|
||||||
ItemHeight = 15
|
ItemHeight = 15
|
||||||
@ -538,7 +539,7 @@ object Form1: TForm1
|
|||||||
object ComboBox4: TComboBox
|
object ComboBox4: TComboBox
|
||||||
Left = 256
|
Left = 256
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 268
|
Top = 300
|
||||||
Width = 71
|
Width = 71
|
||||||
Anchors = [akLeft, akBottom]
|
Anchors = [akLeft, akBottom]
|
||||||
ItemHeight = 15
|
ItemHeight = 15
|
||||||
@ -555,7 +556,7 @@ object Form1: TForm1
|
|||||||
object UpDown1: TUpDown
|
object UpDown1: TUpDown
|
||||||
Left = 364
|
Left = 364
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 268
|
Top = 300
|
||||||
Width = 15
|
Width = 15
|
||||||
Anchors = [akLeft, akBottom]
|
Anchors = [akLeft, akBottom]
|
||||||
Min = 0
|
Min = 0
|
||||||
|
@ -24,7 +24,7 @@ type
|
|||||||
FHintState: THintState;
|
FHintState: THintState;
|
||||||
procedure HintTimer(Sender: TObject);
|
procedure HintTimer(Sender: TObject);
|
||||||
protected
|
protected
|
||||||
FGradientBmp: TBitmap;
|
FBufferBmp: TBitmap;
|
||||||
FGradientWidth: Integer;
|
FGradientWidth: Integer;
|
||||||
FGradientHeight: Integer;
|
FGradientHeight: Integer;
|
||||||
FHintShown: Boolean;
|
FHintShown: Boolean;
|
||||||
@ -181,7 +181,7 @@ begin
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
ABitmap.Canvas.Brush.Color := Color;
|
ABitmap.Canvas.Brush.Color := Color;
|
||||||
ABitmap.Canvas.FillRect(ABitmap.Canvas.ClipRect);
|
ABitmap.Canvas.FillRect(ABitmap.Canvas.ClipRect);
|
||||||
Canvas.Draw(0, 0, ABitmap);
|
// Canvas.Draw(0, 0, ABitmap);
|
||||||
|
|
||||||
{$IFDEF DELPHI_7_UP}{$IFDEF DELPHI}
|
{$IFDEF DELPHI_7_UP}{$IFDEF DELPHI}
|
||||||
if ParentBackground then
|
if ParentBackground then
|
||||||
|
@ -33,7 +33,8 @@ type
|
|||||||
FMouseLoc: TMouseLoc;
|
FMouseLoc: TMouseLoc;
|
||||||
FMouseOver, FMouseDown, FAutoHeight: boolean;
|
FMouseOver, FMouseDown, FAutoHeight: boolean;
|
||||||
FColCount, FRowCount, FTop, FLeft, FIndex, FCheckedIndex, FCellSize, FTotalCells: integer;
|
FColCount, FRowCount, FTop, FLeft, FIndex, FCheckedIndex, FCellSize, FTotalCells: integer;
|
||||||
FTempBmp, PBack: TBitmap;
|
FTempBmp: TBitmap;
|
||||||
|
//PBack: TBitmap;
|
||||||
FState: TColorCellState;
|
FState: TColorCellState;
|
||||||
FColors, FNames: TStrings;
|
FColors, FNames: TStrings;
|
||||||
FPalette: TFileName;
|
FPalette: TFileName;
|
||||||
@ -177,12 +178,12 @@ implementation
|
|||||||
constructor TmbColorPalette.Create(AOwner: TComponent);
|
constructor TmbColorPalette.Create(AOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
ControlStyle := ControlStyle - [csAcceptsControls] + [csOpaque];
|
// ControlStyle := ControlStyle - [csAcceptsControls] + [csOpaque];
|
||||||
DoubleBuffered := true;
|
// DoubleBuffered := true;
|
||||||
PBack := TBitmap.Create;
|
// PBack := TBitmap.Create;
|
||||||
PBack.PixelFormat := pf32bit;
|
// PBack.PixelFormat := pf32bit;
|
||||||
FTempBmp := TBitmap.Create;
|
FTempBmp := TBitmap.Create;
|
||||||
FTempBmp.PixelFormat := pf32bit;
|
//FTempBmp.PixelFormat := pf32bit;
|
||||||
{$IFDEF DELPHI_7_UP} {$IFDEF DELPHI}
|
{$IFDEF DELPHI_7_UP} {$IFDEF DELPHI}
|
||||||
ParentBackground := true;
|
ParentBackground := true;
|
||||||
{$ENDIF} {$ENDIF}
|
{$ENDIF} {$ENDIF}
|
||||||
@ -219,7 +220,7 @@ end;
|
|||||||
|
|
||||||
destructor TmbColorPalette.Destroy;
|
destructor TmbColorPalette.Destroy;
|
||||||
begin
|
begin
|
||||||
PBack.Free;
|
//PBack.Free;
|
||||||
FTempBmp.Free;
|
FTempBmp.Free;
|
||||||
FNames.Free;
|
FNames.Free;
|
||||||
FColors.Free;
|
FColors.Free;
|
||||||
@ -297,10 +298,10 @@ procedure TmbColorPalette.Paint;
|
|||||||
var
|
var
|
||||||
i: integer;
|
i: integer;
|
||||||
begin
|
begin
|
||||||
PBack.Width := Width;
|
{ PBack.Width := Width;
|
||||||
PBack.Height := Height;
|
PBack.Height := Height;
|
||||||
PaintParentBack(PBack);
|
PaintParentBack(PBack);
|
||||||
|
}
|
||||||
//make bmp
|
//make bmp
|
||||||
FTempBmp.Width := Width;
|
FTempBmp.Width := Width;
|
||||||
FTempBmp.Height := Height;
|
FTempBmp.Height := Height;
|
||||||
@ -453,7 +454,8 @@ begin
|
|||||||
with ThemeServices do
|
with ThemeServices do
|
||||||
if Enabled then
|
if Enabled then
|
||||||
case FState of
|
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);
|
ccsOver: DrawElement(ACanvas.Handle, GetElementDetails(ttbButtonHot), R);
|
||||||
ccsDown: DrawElement(ACanvas.Handle, GetElementDetails(ttbButtonPressed), R);
|
ccsDown: DrawElement(ACanvas.Handle, GetElementDetails(ttbButtonPressed), R);
|
||||||
ccsChecked: DrawElement(ACanvas.Handle, GetElementDetails(ttbButtonChecked), R);
|
ccsChecked: DrawElement(ACanvas.Handle, GetElementDetails(ttbButtonChecked), R);
|
||||||
|
@ -170,29 +170,29 @@ var
|
|||||||
imgHandle, imgMaskHandle: HBitmap;
|
imgHandle, imgMaskHandle: HBitmap;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
begin
|
begin
|
||||||
if FGradientBmp = nil then
|
if FBufferBmp = nil then
|
||||||
begin
|
begin
|
||||||
FGradientBmp := TBitmap.Create;
|
FBufferBmp := TBitmap.Create;
|
||||||
FGradientBmp.PixelFormat := pf32bit;
|
FBufferBmp.PixelFormat := pf32bit;
|
||||||
end;
|
end;
|
||||||
FGradientBmp.Width := FGradientWidth;
|
FBufferBmp.Width := FGradientWidth;
|
||||||
FGradientBmp.Height := FGradientHeight;
|
FBufferBmp.Height := FGradientHeight;
|
||||||
|
|
||||||
{$IFDEF FPC}
|
{$IFDEF FPC}
|
||||||
intfimg := TLazIntfImage.Create(FGradientBmp.Width, FGradientBmp.Height);
|
intfimg := TLazIntfImage.Create(FBufferBmp.Width, FBufferBmp.Height);
|
||||||
try
|
try
|
||||||
intfImg.LoadFromBitmap(FGradientBmp.Handle, FGradientBmp.MaskHandle);
|
intfImg.LoadFromBitmap(FBufferBmp.Handle, FBufferBmp.MaskHandle);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
for y := 0 to FGradientBmp.Height - 1 do
|
for y := 0 to FBufferBmp.Height - 1 do
|
||||||
begin
|
begin
|
||||||
{$IFDEF FPC}
|
{$IFDEF FPC}
|
||||||
row := intfImg.GetDataLineStart(y); //FGradientBmp.Height - 1 - y);
|
row := intfImg.GetDataLineStart(y); //FBufferBmp.Height - 1 - y);
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
row := FHSVBmp.Scanline(y); //FGradientBmp.Height - 1 - y);
|
row := FHSVBmp.Scanline(y); //FGradientBmp.Height - 1 - y);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
for x := 0 to FGradientBmp.Width - 1 do
|
for x := 0 to FBufferBmp.Width - 1 do
|
||||||
begin
|
begin
|
||||||
c := GetGradientColor2D(x, y);
|
c := GetGradientColor2D(x, y);
|
||||||
if WebSafe then
|
if WebSafe then
|
||||||
@ -203,8 +203,8 @@ begin
|
|||||||
|
|
||||||
{$IFDEF FPC}
|
{$IFDEF FPC}
|
||||||
intfimg.CreateBitmaps(imgHandle, imgMaskHandle, false);
|
intfimg.CreateBitmaps(imgHandle, imgMaskHandle, false);
|
||||||
FGradientBmp.Handle := imgHandle;
|
FBufferBmp.Handle := imgHandle;
|
||||||
FGradientBmp.MaskHandle := imgMaskHandle;
|
FBufferBmp.MaskHandle := imgMaskHandle;
|
||||||
finally
|
finally
|
||||||
intfimg.Free;
|
intfimg.Free;
|
||||||
end;
|
end;
|
||||||
|
@ -206,8 +206,8 @@ begin
|
|||||||
|
|
||||||
FGradientWidth := 256;
|
FGradientWidth := 256;
|
||||||
FGradientHeight := 12;
|
FGradientHeight := 12;
|
||||||
FGradientBmp := TBitmap.Create;
|
FBufferBmp := TBitmap.Create;
|
||||||
FGradientBmp.PixelFormat := pf32bit;
|
FBufferBmp.PixelFormat := pf32bit;
|
||||||
|
|
||||||
mx := 0;
|
mx := 0;
|
||||||
my := 0;
|
my := 0;
|
||||||
@ -236,7 +236,7 @@ end;
|
|||||||
|
|
||||||
destructor TmbTrackbarPicker.Destroy;
|
destructor TmbTrackbarPicker.Destroy;
|
||||||
begin
|
begin
|
||||||
FGradientBmp.Free;
|
FBufferBmp.Free;
|
||||||
FBack.Free;
|
FBack.Free;
|
||||||
inherited;
|
inherited;
|
||||||
end;
|
end;
|
||||||
@ -253,7 +253,7 @@ var
|
|||||||
imgHandle, imgMaskHandle: HBitmap;
|
imgHandle, imgMaskHandle: HBitmap;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
begin
|
begin
|
||||||
if FGradientBmp = nil then
|
if FBufferBmp = nil then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
{$IFDEF FPC}
|
{$IFDEF FPC}
|
||||||
@ -263,17 +263,17 @@ begin
|
|||||||
|
|
||||||
if Layout = lyHorizontal then
|
if Layout = lyHorizontal then
|
||||||
begin
|
begin
|
||||||
FGradientBmp.Width := FGradientWidth;
|
FBufferBmp.Width := FGradientWidth;
|
||||||
FGradientBmp.Height := FGradientHeight;
|
FBufferBmp.Height := FGradientHeight;
|
||||||
{$IFDEF FPC}
|
{$IFDEF FPC}
|
||||||
intfImg.LoadFromBitmap(FGradientBmp.Handle, FGradientBmp.MaskHandle);
|
intfImg.LoadFromBitmap(FBufferBmp.Handle, FBufferBmp.MaskHandle);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
for i := 0 to FGradientBmp.Width-1 do
|
for i := 0 to FBufferBmp.Width-1 do
|
||||||
begin
|
begin
|
||||||
c := GetGradientColor(i);
|
c := GetGradientColor(i);
|
||||||
if WebSafe then c := GetWebSafe(c);
|
if WebSafe then c := GetWebSafe(c);
|
||||||
q := RGBToRGBQuad(c);
|
q := RGBToRGBQuad(c);
|
||||||
for j := 0 to FGradientBmp.Height-1 do
|
for j := 0 to FBufferBmp.Height-1 do
|
||||||
begin
|
begin
|
||||||
{$IFDEF FPC}
|
{$IFDEF FPC}
|
||||||
row := intfImg.GetDataLineStart(j);
|
row := intfImg.GetDataLineStart(j);
|
||||||
@ -286,30 +286,30 @@ begin
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
FGradientBmp.Width := FGradientHeight;
|
FBufferBmp.Width := FGradientHeight;
|
||||||
FGradientBmp.Height := FGradientWidth;
|
FBufferBmp.Height := FGradientWidth;
|
||||||
{$IFDEF FPC}
|
{$IFDEF FPC}
|
||||||
intfImg.LoadFromBitmap(FGradientBmp.Handle, FGradientBmp.MaskHandle);
|
intfImg.LoadFromBitmap(FBufferBmp.Handle, FBufferBmp.MaskHandle);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
for i := 0 to FGradientBmp.Height-1 do
|
for i := 0 to FBufferBmp.Height-1 do
|
||||||
begin
|
begin
|
||||||
{$IFDEF FPC}
|
{$IFDEF FPC}
|
||||||
row := intfImg.GetDataLineStart(i);
|
row := intfImg.GetDataLineStart(i);
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
row := FGradientBmp.ScanLine[i];
|
row := FGradientBmp.ScanLine[i];
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
c := GetGradientColor(FGradientBmp.Height - 1 - i);
|
c := GetGradientColor(FBufferBmp.Height - 1 - i);
|
||||||
if WebSafe then c := GetWebSafe(c);
|
if WebSafe then c := GetWebSafe(c);
|
||||||
q := RGBtoRGBQuad(c);
|
q := RGBtoRGBQuad(c);
|
||||||
for j := 0 to FGradientBmp.Width-1 do
|
for j := 0 to FBufferBmp.Width-1 do
|
||||||
row[j] := q;
|
row[j] := q;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$IFDEF FPC}
|
{$IFDEF FPC}
|
||||||
intfimg.CreateBitmaps(imgHandle, imgMaskHandle, false);
|
intfimg.CreateBitmaps(imgHandle, imgMaskHandle, false);
|
||||||
FGradientBmp.Handle := imgHandle;
|
FBufferBmp.Handle := imgHandle;
|
||||||
FGradientBmp.MaskHandle := imgMaskHandle;
|
FBufferBmp.MaskHandle := imgMaskHandle;
|
||||||
finally
|
finally
|
||||||
intfImg.Free;
|
intfImg.Free;
|
||||||
end;
|
end;
|
||||||
@ -873,7 +873,7 @@ end;
|
|||||||
procedure TmbTrackBarPicker.Execute(tbaAction: integer);
|
procedure TmbTrackBarPicker.Execute(tbaAction: integer);
|
||||||
begin
|
begin
|
||||||
case tbaAction of
|
case tbaAction of
|
||||||
TBA_Paint : Canvas.StretchDraw(FPickRect, FGradientBmp);
|
TBA_Paint : Canvas.StretchDraw(FPickRect, FBufferBmp);
|
||||||
TBA_RedoBMP : CreateGradient;
|
TBA_RedoBMP : CreateGradient;
|
||||||
// Rest handled in descendants
|
// Rest handled in descendants
|
||||||
end;
|
end;
|
||||||
|
Reference in New Issue
Block a user