mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-27 23:03:44 +02:00
Carbon intf: implemented setting pixel color of TCanvas
git-svn-id: trunk@11322 -
This commit is contained in:
parent
fafa934568
commit
9c17ab1e6f
@ -31,7 +31,7 @@ uses
|
||||
// carbon bindings
|
||||
FPCMacOSAll,
|
||||
// LCL
|
||||
LCLProc, LCLType, Graphics, Controls, Forms,
|
||||
LCLProc, LCLType, Graphics, GraphType, Controls, Forms,
|
||||
// LCL Carbon
|
||||
CarbonDef, CarbonGDIObjects;
|
||||
|
||||
@ -115,6 +115,7 @@ type
|
||||
procedure Polygon(Points: PPoint; NumPts: Integer; Winding: boolean);
|
||||
procedure Polyline(Points: PPoint; NumPts: Integer);
|
||||
procedure Rectangle(X1, Y1, X2, Y2: Integer);
|
||||
procedure SetPixel(X, Y: Integer; AColor: TGraphicsColor);
|
||||
function StretchDraw(X, Y, Width, Height: Integer; SrcDC: TCarbonBitmapContext;
|
||||
XSrc, YSrc, SrcWidth, SrcHeight: Integer; Rop: DWORD): Boolean;
|
||||
public
|
||||
@ -1167,6 +1168,30 @@ begin
|
||||
CGContextDrawPath(CGContext, kCGPathFillStroke);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TCarbonDeviceContext.SetPixel
|
||||
Params: X, Y - Position
|
||||
AColor - New color for specified position
|
||||
|
||||
Sets the color of the specified pixel on the canvas
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TCarbonDeviceContext.SetPixel(X, Y: Integer; AColor: TGraphicsColor);
|
||||
var
|
||||
R, G, B: Byte;
|
||||
begin
|
||||
CGContextSaveGState(CGContext);
|
||||
try
|
||||
// apply color to fill
|
||||
CGContextSetBlendMode(CGContext, kCGBlendModeNormal);
|
||||
RedGreenBlue(ColorToRGB(AColor), R, G, B);
|
||||
CGContextSetRGBFillColor(CGContext, R / 255, G / 255, B / 255, 1.0);
|
||||
|
||||
CGContextFillRect(CGContext, GetCGRect(X, Y, X + 1, Y + 1));
|
||||
finally
|
||||
CGContextRestoreGState(CGContext);
|
||||
end;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: StretchMaskBlt
|
||||
Params: X, Y - Left/top corner of the destination rectangle
|
||||
|
@ -707,7 +707,6 @@ end;
|
||||
AColor - New color for specified position
|
||||
|
||||
Sets the color of the specified pixel on the canvas
|
||||
Not implemented!
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TCarbonWidgetSet.DCSetPixel(CanvasHandle: HDC; X, Y: integer;
|
||||
AColor: TGraphicsColor);
|
||||
@ -715,8 +714,10 @@ begin
|
||||
{$IFDEF VerboseObject}
|
||||
DebugLn('TCarbonWidgetSet.DCSetPixel DC: ' + DbgS(CanvasHandle) + ' X: ' + DbgS(X) + ' Y: ' + DbgS(Y) + 'Color: ' + DbgS(AColor));
|
||||
{$ENDIF}
|
||||
|
||||
DebugLn('TCarbonWidgetSet.DCSetPixel TODO');
|
||||
|
||||
if not CheckDC(CanvasHandle, 'DCSetPixel') then Exit;
|
||||
|
||||
TCarbonDeviceContext(CanvasHandle).SetPixel(X, Y, AColor);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user