unit graphics_2D_implementations; {$ASSERTIONS ON} // FIXME finish implementations. // TODO pens. // TODO rename to "graphics" ? or however something that draws on "pixmaps" and uses pixmap units mostly is called anyway. // TODO just rename "pixmap" to "Image". {$MODE OBJFPC} {$M+} interface uses graphics_2D, framebuffers, pixmaps, colors, type_fixes; type T2DGraphics = class(TInterfacedObject, I2DGraphics, IInterface) private fFramebuffer : TFramebufferInfo; fPen : IPen; // the current one. protected function GetPen : IPen; procedure SetPen(const aPen : IPen); public destructor Destroy; override; published constructor Create(const aFramebuffer : TFramebufferInfo); procedure DrawLine(aX1, aY1, aX2, aY2 : TCoordinate); procedure DrawRectangle(aX1, aY1, aX2, aY2 : TCoordinate); procedure DrawEllipse(aX1, aY1, aX2, aY2 : TCoordinate); procedure DrawArc(aX1, aY1, aX2, aY2 : TCoordinate; aBeginning : TAngle; aEnd : TAngle); procedure DrawCubicBezier(aPoints : TPointArray); procedure ClearBox(aX1, aY1, aX2, aY2 : TCoordinate; const aColor : IColor); procedure BLIT(const aPixmap : IPixmap; aX1, aY1, aX2, aY2 : TCoordinate; aDestinationX1, aDestinationY1 : Integer; aMode : TBLITMode); { TODO text, bezier curves (quadratic, cubic) (not B-Spline). } { TODO more obscure things like flood fill } property Pen : IPen read GetPen write SetPen; function GetBuiltinPen(aID : TBuiltInPenID; aWidth, aHeight : Cardinal) : IPen; end; implementation destructor T2DGraphics.Destroy; begin inherited; end; constructor T2DGraphics.Create(const aFramebuffer : TFramebufferInfo); begin inherited Create(); fFramebuffer := aFramebuffer; end; procedure T2DGraphics.DrawLine(aX1, aY1, aX2, aY2 : TCoordinate); begin assert(False); end; procedure T2DGraphics.DrawRectangle(aX1, aY1, aX2, aY2 : TCoordinate); begin assert(False); end; procedure T2DGraphics.DrawEllipse(aX1, aY1, aX2, aY2 : TCoordinate); begin assert(False); end; procedure T2DGraphics.DrawArc(aX1, aY1, aX2, aY2 : TCoordinate; aBeginning : TAngle; aEnd : TAngle); begin assert(False); end; procedure T2DGraphics.DrawCubicBezier(aPoints : TPointArray); begin assert(False); end; procedure T2DGraphics.ClearBox(aX1, aY1, aX2, aY2 : TCoordinate; const aColor : IColor); begin assert(False); end; procedure T2DGraphics.BLIT(const aPixmap : IPixmap; aX1, aY1, aX2, aY2 : TCoordinate; aDestinationX1, aDestinationY1 : Integer; aMode : TBLITMode); begin assert(False); end; { TODO text, bezier curves (quadratic, cubic) (not B-Spline). } { TODO more obscure things like flood fill } //property Pen : IPen read GetPen write SetPen; function T2DGraphics.GetBuiltinPen(aID : TBuiltInPenID; aWidth, aHeight : Cardinal) : IPen; begin assert(False); Result := nil; end; function T2DGraphics.GetPen : IPen; begin Result := fPen; end; procedure T2DGraphics.SetPen(const aPen : IPen); begin fPen := aPen; end; end.