Breaking Changes
List of changes in each version that breaks backward compatibility.
Version 4.9.1
Unit names have been changed:
AutoLayout.Diagram → AutoLayoutDiagram
AutoLayout.Executer → AutoLayoutExecuter
AutoLayout.Force → AutoLayoutForce
for backward compatibility with old Delphi versions (Delphi 7 up to Delphi/C++ Builder 2007).
Version 4.8
TMS Diagram packages have been restructured. The packages are now separated into runtime and design-time packages, allowing a better usage of the packages in an application using runtime packages (allows it to work with 64-bit applications using runtime packages, for example). Also, Libsuffix option is now being used so the dcp files are generated with the same name for all Delphi versions. Here is an overview of what's changed:
Before version 4.8, there was a single package named adgrm<version>.dpk (where <version> is the "name" of delphi version), which generated BPL and DCP with same names:
Previous versions:
Version | Package File Name | BPL File Name | DCP File Name |
---|---|---|---|
Delphi 7 | adgrm7.dpk | adgrm7.bpl | adgrm7.dcp |
Delphi 2007 | adgrm2007.dpk | adgrm2007.bpl | adgrm2007.dcp |
Delphi 2009 | adgrm2009.dpk | adgrm2009.bpl | adgrm2009.dcp |
Delphi 2010 | adgrm2010.dpk | adgrm2010.bpl | adgrm2010.dcp |
Delphi XE | adgrm2011.dpk | adgrm2011.bpl | adgrm2011.dcp |
Delphi XE2 | adgrmxe2.dpk | adgrmxe2.bpl | adgrmxe2.dcp |
Delphi XE3 | adgrmxe3.dpk | adgrmxe3.bpl | adgrmxe3.dcp |
Delphi XE4 | adgrmxe4.dpk | adgrmxe4.bpl | adgrmxe4.dcp |
Delphi XE5 | adgrmxe5.dpk | adgrmxe5.bpl | adgrmxe5.dcp |
Delphi XE6 | adgrmxe6.dpk | adgrmxe6.bpl | adgrmxe6.dcp |
Delphi XE7 | adgrmxe7.dpk | adgrmxe7.bpl | adgrmxe7.dcp |
From version 4.8 and on, there are two packages:
TMSDiagram.dpk (runtime package)
dclTMSDiagram.dpk (design-time packages)
DCP files are generated with same name, and only BPL files are generated with the suffix indicating the Delphi version. The suffix, however, is the same used by the IDE packages (numeric one indicating IDE version: 160, 170, etc.). The new package structure is as following:
Version | Package File Name | BPL File Name | DCP File Name |
---|---|---|---|
Delphi 7 | TMSDiagram.dpk dclTMSDiagram.dpk |
TMSDiagram70.bpl dclTMSDiagram70.bpl |
TMSDiagram.dcp dclTMSDiagram.dcp |
Delphi 2007 | TMSDiagram.dpk dclTMSDiagram.dpk |
TMSDiagram100.bpl dclTMSDiagram100.bpl |
TMSDiagram.dcp dclTMSDiagram.dcp |
Delphi 2009 | TMSDiagram.dpk dclTMSDiagram.dpk |
TMSDiagram120.bpl dclTMSDiagram120.bpl |
TMSDiagram.dcp dclTMSDiagram.dcp |
Delphi 2010 | TMSDiagram.dpk dclTMSDiagram.dpk |
TMSDiagram140.bpl dclTMSDiagram140.bpl |
TMSDiagram.dcp dclTMSDiagram.dcp |
Delphi XE | TMSDiagram.dpk dclTMSDiagram.dpk |
TMSDiagram150.bpl dclTMSDiagram150.bpl |
TMSDiagram.dcp dclTMSDiagram.dcp |
Delphi XE2 | TMSDiagram.dpk dclTMSDiagram.dpk |
TMSDiagram160.bpl dclTMSDiagram160.bpl |
TMSDiagram.dcp dclTMSDiagram.dcp |
Delphi XE3 | TMSDiagram.dpk dclTMSDiagram.dpk |
TMSDiagram170.bpl dclTMSDiagram170.bpl |
TMSDiagram.dcp dclTMSDiagram.dcp |
Delphi XE4 | TMSDiagram.dpk dclTMSDiagram.dpk |
TMSDiagram180.bpl dclTMSDiagram180.bpl |
TMSDiagram.dcp dclTMSDiagram.dcp |
Delphi XE5 | TMSDiagram.dpk dclTMSDiagram.dpk |
TMSDiagram190.bpl dclTMSDiagram190.bpl |
TMSDiagram.dcp dclTMSDiagram.dcp |
Delphi XE6 | TMSDiagram.dpk dclTMSDiagram.dpk |
TMSDiagram200.bpl dclTMSDiagram200.bpl |
TMSDiagram.dcp dclTMSDiagram.dcp |
Delphi XE7 | TMSDiagram.dpk dclTMSDiagram.dpk |
TMSDiagram210.bpl dclTMSDiagram210.bpl |
TMSDiagram.dcp dclTMSDiagram.dcp |
Version 4.0
Major changes in the drawing system. More info below.
Upgrade Notes: Diagram Studio 4.0 introduces several changes from previous versions. Those changes might cause compiling error in existing code using Diagram Studio, requiring you to adjust your source code.
Most changes are only at syntax level, so to make your code work you don't need to fully understand why the changes were made, but only how to change your source code to make it compatible. So to allow you to quickly change your source code we provide here a quick guide with the most compiling problems you might encounter, and how to quickly adjust your source code. More details about the changes and how/why they were done are explained later in the chapter.
Increased position precision - from integer to float
One of the major changes in Diagram Studio 4.0 is the improvement in the internal calculations. Types like TRect, TPoint and several Integer fields and properties were changed to TSquare, TDot and Double types, so that all coordinates and internal variables were changed from integer types to floating point types. This increased calculation precision and solved some problems with objects being positioned in a slightly different position where they should be.
We will not list here all variables, parameters and methods changed, because they were many. We will list here mostly what has been changed that might cause some incompatibility, and later we will describe common pieces of code that are broken in current version and how to solve it.
Main changes:
Many properties, variables, function results and parameters had their types changed this way:
a. From TRect to TSquare
b. From integer to Double
c. From TPoint to TDot
d. From TPointArray to TDotArray
So if your existing code breaks, take into consideration that you might need to change the data types of your variables, or make your code compatible with the new types of some Diagram Studio properties and variables. Check the "Quick guide for upgrading from Diagram 3.5 and earlier versions" chapter to see the most common incompatibilities that you might encounter in your code.
Quick guide for upgrading from Diagram 3.5 and earlier versions
List of common compile errors and how to fix them.
Problem #1
Overridden method signature differs from ancestor declaration.
Solution: change method signature to match the new correct signature. The list below contains all methods that have their signature changed, with the previous signature and the new one you must use.
In TDiagramControl class:
function ControlRect: TRect; //Old
function ControlRect: TSquare; //New
procedure DrawCell(ACanvas: TCanvas; ACell: TTextCell); //Old
procedure DrawCell(AInfo: TDiagramDrawInfo; ACell: TTextCell); // New
procedure DrawCell(ACanvas: TCanvas); //Old
procedure DrawCell(AInfo: TDiagramDrawInfo); //New
procedure DrawHandle(ACanvas: TCanvas; AHandle: TStretchHandle); //Old
procedure DrawHandle(AInfo: TDiagramDrawInfo; AHandle: TStretchHandle); //New
procedure DrawHandles(Canvas: TCanvas); //Old
procedure DrawHandles(AInfo: TDiagramDrawInfo); //Old
function GetHandlePoint(AHandle: TStretchHandle): TPoint; //Old
function GetHandlePoint(AHandle: TStretchHandle): TDot; //New
function GetLinkPoint(ALinkPoint: TLinkPoint): TPoint; //Old
function GetLinkPoint(ALinkPoint: TLinkPoint): TDot; //New
procedure PaintControl(Canvas: TCanvas; ARect: TRect); //Old
procedure PaintControl(AInfo: TDiagramDrawInfo); //New
function SurroundRect: TRect; //Old
function SurroundRect: TSquare; //New
In TCustomDiagramBlock class:
procedure DrawBlock(Canvas: TCanvas; ARect: TRect); //Old
procedure DrawBlock(AInfo: TDiagramDrawInfo; ABlockInfo: TDiagramDrawBlockInfo); //New
procedure DrawBlockCursor(Canvas: TCanvas; ARect: TSquare; AAngle: double); //Old
procedure DrawBlockCursor(AInfo: TDiagramDrawInfo; ABlockInfo: TDiagramDrawBlockInfo); //New
procedure DrawShape(Canvas: TCanvas; ARect: TRect; AAngle: double); //Old
procedure DrawShape(AInfo: TDiagramDrawInfo; ABlockInfo: TDiagramDrawBlockInfo); //New
function SurroundRgn: TPointArray; //Old
function SurroundRgn: TDotArray; //New
In TCustomDiagramLine class:
procedure DrawLine(Canvas: TCanvas; AHandles: TStretchHandles; DrawArrows: boolean); //Old
procedure DrawLine(AInfo: TDiagramDrawInfo; ALineInfo: TDiagramDrawLineInfo); //New
In TLineArrow class:
procedure Draw(Canvas: TCanvas; AFrom, ATo: TPoint; AZoomRatio: double); //Old
procedure Draw(AInfo: TDiagramDrawInfo; AArrowInfo: TDiagramDrawArrowInfo); //New
Problem #2
Undeclared identifier: 'Canvas' (in TDiagramControl methods with changed signature like PaintControl, DrawBlock etc.). See problem 1.
Example (removed parameter Canvas: TCanvas):
Canvas.LineTo(x1, y1);
Solution: replace any Canvas reference by AInfo.Canvas.
Example (new parameter AInfo: TDiagramDrawInfo):
AInfo.Canvas.LineTo(x1, y1);
Problem #3
Undeclared identifier: 'ARect' (in TCustomDiagramBlock methods with changed signature like DrawBlock, DrawShape etc.). See problem 1.
Example (removed parameter ARect: TRect):
Drawer.CurRect := ARect;
Solution: replace any ARect reference by ABlockInfo.Rect.
Example (new parameter ABlockInfo: TDiagramDrawBlockInfo):
Drawer.CurRect := ABlockInfo.Rect;
Problem #4
Undeclared identifier: 'AAngle' (in TCustomDiagramBlock methods with changed signature).
Parameter AAngle was removed from some virtual methods like DrawShape and DrawBlockCursor. Information comes now in 'Angle' field of new record parameter (ABlockInfo: TDiagramDrawBlockInfo). See problem 1.
Solution: replace any AAngle reference by ABlockInfo.Angle.
Problem #5
Undeclared identifier: 'AHandles' or 'DrawArrows' (in TCustomDiagramLine methods with changed signature).
Parameters AHandles and DrawArrows were removed from virtual method DrawLine. Information comes now in fields of new record parameter (ALineInfo: TDiagramDrawLineInfo). See problem 1.
Solution: replace any AHandles reference by ALineInfo.Handles and DrawArrows by ALineInfo.DrawArrows.
Problem #6
Undeclared identifier: 'AFrom', 'ATo' or 'AZoomRatio' (in TLineArrow methods with changed signature).
Parameters AFrom, ATo and AZoomRatio where removed from virtual method Draw. Information comes now in fields of new record parameter (AArrowInfo: TDiagramDrawArrowInfo). See problem 1.
Solution: replace any AFrom reference by AArrowInfo.FromPoint, ATo by AArrowInfo.ToPoint and AZoomRatio by AArrowInfo.ZoomRatio.
Problem #7
Incompatible types: 'TSquare' and 'TRect' (using TRect when TSquare is expected).
Example:
Drawer.OriginalRect := Rect(0, 0, 100, 100);
Solution: Replace TRect by TSquare. If needed change integer parameters by floating point parameters. You can use Square function in place of Rect function.
Example:
OriginalRect := Square(0, 0, 100, 100);
// OriginalRect is a new TDiagramControl property. See tip in problem 14.
Problem #8
Incompatible types: 'TRect' and 'TSquare' (using TSquare when TRect is expected).
Example:
Canvas.FillRect(ABlockInfo.Rect);
Canvas.MoveTo(ABlockInfo.Rect.Left, ABlockInfo.Rect.Top);
Solution: Use ToRect function to convert a TSquare back to a TRect, when needed. Some methods still use TRect, but since many TRect values were replaced by TSquare (see problem 7), you might need to convert it back. Maybe will be needed also convert double parameters back to integer parameters.
Example:
var R: TRect;
R := ToRect(ABlockInfo.Rect);
Canvas.FillRect(R);
Canvas.MoveTo(R.Left, R.Top);
Problem #9
Incompatible types: 'TDotArray' and 'TPointArray'.
Example:
RotPoly(PointArray([PP(40,85), PP(60,85), PP(50,100), PP(40,85)]);
Solution: Replace TPointArray (array of TPoint) by TDotArray (array of TDot). If needed change integer parameters by floating point parameters. You can use DotArray in place of PointArray function.
Example:
RotPoly(DotArray([PP(40,85), PP(60,85), PP(50,100), PP(40,85)]);
If you had a BlockPolygon method that was returning a TPointArray, you may need change it to return a TDotArray.
Some TPoint functions/methods and its new TDot corresponding:
AddPoint => AddPointX
ConcatPoints => ConcatPointsX
Rot => RotX
SubPoint => SubPointX
Problem #10
Incompatible types: 'Array' (TPointArray) and 'TDotArray'.
Example:
AInfo.Canvas.Polygon(BlockPolygon);
Solution: Use RoundDotArray function to convert a TDotArray back to a TPointArray, when needed. Some methods still use TPointArray, but since you replaced TPointArray by TDotArray (see problem 9), you might need to convert it back.
Example:
AInfo.Canvas.Polygon(RoundDotArray(BlockPolygon));
Problem #11
Incompatible types: 'TPoint' and 'TDot'.
Example:
var P: TPoint;
P := ClientToCanvas(Point(10, 1));
Solution: Replace TPoint by TDot. If needed, change integer parameters by floating point parameters. You can use Dot function in place of Point function.
Example:
var P: TDot;
P := ClientToCanvas(Dot(10, 1));
Problem #12
Operator not applicable to this operand type.
Example:
LinkPoints.Add((Right - Left) div 2, Top, aoUp);
Solution: replace integer operators by floating point operators.
Example:
LinkPoints.Add((Right - Left) / 2, Top, aoUp);
Problem #13
Undeclared identifier: bmSolid/bmClear/etc. (when using GPCanvas.Brush for GDI+).
Solution: uses DgrClasses
unit (add it to your unit's uses clause). The
new type TDgrBrushMode is declared in that unit now.
Problem #14
Symbol TPointX/TRectX is deprecated.
Solution: use TDot/TSquare instead.
Tip
Instead of set both Drawer.OriginalRect and GPDrawer.SourceRect properties, now you can just set TDiagramControl.OriginalRect property, so that all used Drawers will be up to date.
Example:
// before
Drawer.OriginalRect := Rect(0, 0, 100, 80);
{$IFDEF GDIPLUS}
GPDrawer.SourceRect := RectX(0, 0, 100, 80);
{$ENDIF}
// now
OriginalRect := Square(0, 0, 100, 80);
Problem #15
Method GetBlockPath/GetTranslatedBlockPath/GetSurroundBlockPath is deprecated.
Solution: override new generic methods for path drawing. Old ones were specific to GDI+, while the new ones are applicable to both GDI+, Direct2D, and other libraries that might be supported in future.
procedure GetBlockPath(APath: TDgrGraphicsPath; ADrawer: TDgrBlockDrawer);
procedure GetTranslatedBlockPath(APath: TDgrGraphicsPath; ADrawer: TDgrBlockDrawer);
procedure GetSurroundBlockPath(APath: TDgrGraphicsPath; ADrawer: TDgrBlockDrawer);
Problem #16
Incompatible types: 'TDiagramDrawInfo' and 'TCanvas' (diagram events).
This error can occur in some event handler methods of TatDiagram, that have their signature modified (TCanvas replaced by TDiagramDrawInfo).
Solution: change method signature to match the new correct signature. The list below contains all events whose handler method must be adjusted.
OnAfterDrawBlock: TDrawBlockEvent
OnDrawBlock: TDrawBlockEvent
OnDrawShape: TDrawShapeEvent
TDrawShapeEvent type was removed and now these three events are TDrawBlockEvent. Below the previous signatures and the new one you must use.
TDrawBlockEvent = procedure(Sender: TObject; ABlock: TCustomDiagramBlock;
Canvas: TCanvas; ARect: TRect; var APainted: boolean) of object; //Old
TDrawShapeEvent = procedure(Sender: TObject; ABlock: TCustomDiagramBlock;
Canvas: TCanvas; ARect: TRect; AAngle: double; var APainted: boolean) of object; //Old
TDrawBlockEvent = procedure(Sender: TObject; ABlock: TCustomDiagramBlock;
AInfo: TDiagramDrawInfo; ABlockInfo: TDiagramDrawBlockInfo;
var APainted: boolean) of object; //New
Direct2D support and generic drawer classes
The 4.0 version of Diagram Studio introduces some generic classes for drawing blocks with both GDI+ and Direct2D. GDI+ was already supported but the new version now supports usage of Direct2D (available for Delphi 2010 and later, supported only in Windows Vista and later). To use Direct2D in your custom blocks you must use the new drawing classes provided by Diagram Studio, so some code tuning might be needed. The new classes are very similar to the ones provided in earlier version for GDI+ usage, so if you have existing code that already paint blocks using GDI+, you can adapt your code to use Direct2D very easily. The good part is that once your custom painting code uses the new classes, you can easily switch between Direct2D and GDI+. And in future if more graphic libraries are supported by Diagram Studio, your existing code will be compatible. There is no need to use specific code for GDI+, Direct2D, and others. (Please note that drawing with GDI still requires specific code).
Compatibility with existing code for drawing with GDI+ was partially kept (although a lot of functions and methods have been marked as deprecated), so if you don't want to support Direct2D now you don't have to change your code to use the new drawing classes, although it's highly recommended. If you want diagram to keep using only GDI+, see the topic about graphic libraries.
Here we will list the main changes that have been done in Diagram Studio in respect to Direct2D support, changes made to Diagram Studio source code, and comments about what you need to change in your existing source code. It's also highly recommended that you check the topic "Quick guide for upgrading from Diagram 3.5 and earlier versions", which lists the most common changes you need to do in your source code to be compatible with the new Diagram Studio.
Units in uses clause
Units DgrGdipApi
, DgrGdipObj
and GdipClasses
are specific for GDI+
drawing. You can replace them by the new unit DgrClasses
, which contains
the generic drawing classes. You don't need to put DgrClasses
under the
{$IFDEF GDIPLUS} directive, so if the directive is there, you can removed it.
Overview of new generic drawing classes
Abstract/base classes (unit
DgrClasses
): TDgrBlockDrawer, TDgrCanvas, TDgrGraphicsPath, TDgrPaintEngine.GDI+ drawing classes (unit
GdipClasses
): TGPBlockDrawer, TGPCanvas, TGdipGraphicsPath, TGdipPaintEngine.Direct2D drawing classes (unit
Direct2DClasses
): TD2DBlockDrawer, TD2DCanvas, TD2DGraphicsPath, TD2DPaintEngine.
GDI+ and Direct2D classes descend from the base ones.
Signature changed for paint/draw methods
Several drawing methods (either virtual or static) have their signature changed. The reason was that many methods received parameters like Canvas, Rect, etc., which only made sense for GDI drawing. Now the methods receive a parameter of type TDiagramDrawInfo, which is a record type with lots of information for drawing the block, including the parameters removed from method signature. Here is a piece of TDiagramDrawInfo declaration, used in TDiagramControl methods:
TDiagramDrawInfo = record
...
// Canvas Object of diagram
Canvas: TCanvas;
// Instance for a TBlockDrawerClass to help in the drawing of controls.
Drawer: TBlockDrawer;
// Instance for a TDgrBlockDrawer descendant to help in the drawing of controls using
// specific GraphicLib functions (GDI+/TGPBlockDrawer and Direct2D/TD2DBlockDrawer)
DgrDrawer: TDgrBlockDrawer;
...
end;
Note that the record contains references to a TBlockDrawer and TDgrBlockDrawer instances. It's recommended that you use those objects to perform block drawing. For compatibility reasons, the properties Drawer and GPDrawer were kept in TDiagramControl class, but it's recommended that you use those in the record (using DgrDrawer in place of GPDrawer, since the latter is GDI+ specific while the former is generic).
Along with TDiagramDrawInfo, additional parameters of TCustomDiagramBlock methods were put together in a TDiagramDrawBlockInfo record:
TDiagramDrawBlockInfo = record
Rect: TSquare;
Angle: double;
end;
Similarly, TDiagramDrawLineInfo record is used by TCustomDiagramLine methods:
TDiagramDrawLineInfo = record
Handles: TStretchHandles;
DrawArrows: boolean;
end;
For a complete list of methods changed, check the "Quick guide for upgrading from Diagram 3.5 and earlier versions".
New virtual methods for specifying block shape using paths
There are three new virtual methods in TCustomDiagramBlock component for retrieving the shape of blocks using paths. The methods are generic and used for both GDI+ and Direct2D:
GetBlockPath(APath: TDgrGraphicsPath; ADrawer: TDgrBlockDrawer);
GetTranslatedBlockPath(APath: TDgrGraphicsPath; ADrawer: TDgrBlockDrawer);
GetSurroundBlockPath(APath: TDgrGraphicsPath; ADrawer: TDgrBlockDrawer);
Note that the new methods have the same names as the methods previously used for GDI+ only. To keep compatibility, the old GDI+ methods were kept as overloaded methods (but marked as deprecated), and if you just want to use GDI+ you can keep your code using those methods, there is no need to replace them by the generic ones. Here are the specific GDI+ methods kept:
GetBlockPath(APath: TGPGraphicsPath);
GetTranslatedBlockPath(APath: TGPGraphicsPath);
GetSurroundBlockPath(APath: TGPGraphicsPath);
Property OriginalRect
When creating new custom blocks, you needed to specify the original rectangle of the drawing. You needed to do that for Drawer (GDI drawing) and GPDrawer (GDI+ drawing) objects, as showed in this example:
Drawer.OriginalRect := Rect(0, 0, 100, 100);
{$IFDEF GDIPLUS}
GPDrawer.SourceRect := RectX(0, 0, 100, 100);
{$ENDIF}
Now you just need to set the new property OriginalRect (in TDiagramControl). By setting OriginalRect property all the available drawers are updated regardless of each graphic library is being used. So the previous code can be replaced by:
OriginalRect := Square(0, 0, 100, 100);
// note that Rect and RectX were replaced by Square function
Property PathDrawingMode
In previous versions, if you wanted to know if GDI or GDI+ was being used to perform the drawing, you used the property IsGdiPlus. Now there is a new boolean property named PathDrawingMode which indicates if the drawing mode is being done using standard GDI (direct painting to Canvas) or using the newly created generic classes (GDI+, Direct2D) which is based on graphic paths for performing drawing. So, in general, this construction:
if IsGdiPlus then
GpDrawer.SomeDrawingMethod;
Use this:
if PathDrawingMode then
DgrDrawer.SomeDrawingMethod;
Converting specific GDI+ code to generic (GDI+/Direct2D) code
The new generic drawing classes were built to be very similar to the existing classes for specific GDI+ drawing. It was done this way so that you can easily change your code to use the generic classes in order to get benefit of Direct2D drawing.
Basically the new classes map to existing GDI+ classes. For example, if you use TGPCanvas or TGPDrawer objects, just change them to TDgrCanvas or TDgrDrawer and your code will be almost done. The methods and properties in the new classes were built to have same names, signatures and types of the GDI+ classes. The only exceptions cases in which you will need to fine tune your source code will be listed here.
a. The new class TDgrGraphicsPath is used instead of TGPGraphicsPath. So in old GDI+ methods where you used TGPGraphicsPath objects, now use the new one TDgrGraphcisPath.
b. Methods AddArc, AddBezier, AddEllipse and AddLine have four different overloaded signatures in GDI+ classes. In the new generic class only one signature is available, so if you are using one of the other overloaded versions of the method in your old GDI+ code, you will need to adapt them to use one of these methods in TDgrCanvas:
function AddArc(x, y, width, height, startAngle, sweepAngle: number): integer;
function AddBezier(x1, y1, x2, y2, x3, y3, x4, y4: number): integer;
function AddEllipse(x, y, width, height: number): integer;
function AddLine(x1, y1, x2, y2: number): integer;
c. Methods AddLines e AddPolygon, in old GDI+ classes, receive two parameters: a pointer to an array of TGPPoint, and the number of elements in array. In the new generic class only one parameter is received: an array of TDot.
function AddLines(points: TDotArray): integer;
function AddPolygon(points: TDotArray): integer;
Example
// old GDI+ classes
path.AddLines(PGPPoint(@lines[0]), 10);
// new generic class
path.AddLines(lines); //lines is a TDotArray
d. Method AddRectangle, in old GDI+ classes, receives a TGPRect or a TGPRectF as parameter. In new generic class you must provide a TSquare parameter:
function AddRectangle(rect: TSquare): integer;
e. Method SetFillMode, in old GDI+ classes, receives a parameter of type DgrGdipApi.FillMode. The new generic class receives a parameter of type Graphics.TFillMode = (fmAlternate, fmWinding).
f. In your block paint methods, instead of using a reference to GPDrawer (of type TGPDrawer), use the new class type TDgrDrawer. Usually a reference to a TDgrDrawer object is available in a new parameter "AInfo: TDiagramDrawInfo" passed in drawing methods like DrawBlock, DrawShape, etc. In summary:
GPDrawer => AInfo.DgrDrawer
GPDrawer.GPCanvas => AInfo.DgrDrawer.Canvas
Methods that handle paths (like for example GetBlockPath or GetTranslatedBlockPath) already receive a parameter "ADrawer: TDgrBlockDrawer", which should be used instead of GPDrawer.
g. Path creation, in old GDI+ classes, was done directly but instantiating a TGPGraphicsPath. For example:
{$IFDEF GDIPLUS}
path := TGPGraphicsPath.Create;
{$ENDIF}
In new generic classes you must use the CreatePath method. This method will take care of creating an instance of the correct class. The result class will be the generic TDgrGraphicsPath, but it can be a TGPGraphicsPath if the drawing library being used is GDI+, or can be TD2DGraphicsPath if the drawing library used is Direct2D.
Example:
if PathDrawingMode then
path := CreatePath;
So, for example, inside a method that receives "AInfo: TDiagramDrawInfo" as a parameter you can use this:
path := AInfo.DgrDrawer.Canvas.CreatePath;
Graphic libraries: GDI, GDI+ and Direct2D
Diagram Studio 4.0 supports GDI, GDI+ and Direct2D libraries for painting of controls, and allows choosing the used library at runtime, by setting a property, either for the whole diagram (TatDiagram.GraphicLib property) or a specific block (TDiagramControl.GraphicLib property).
The property GraphicLib is of TDgrGraphicLib type (declared in unit DgrClasses) and can be one of following values:
dglGDI: GDI
dglGDIPlus: GDI+
dglDirect2D: Direct2D (available for Delphi 2010 and later)
Diagram Studio determines at runtime which library is used by default (see DefaultGraphicLib function in DgrClasses.pas): if application is compiled in Delphi 2010 or later and is running in an environment that supports Direct2D (Windows Vista or later), then Direct2D library is used by default; otherwise diagram uses GDI+ (unless GDI+ has been removed by conditional defines, in this case uses GDI).
Warning
Existing source code for drawing of diagram blocks using specific GDI+ features will not work when diagram is using Direct2D library.
To force the use of GDI+, set GraphicLib property for dglGDIPlus at startup, in the specific block (TDiagramControl) or globally in diagram (TatDiagram).
To adapt your code to work with both GDI+ and Direct2D, see "Converting specific GDI+ code to generic (GDI+/Direct2D) code" section in "Direct2D support and generic drawer classes" topic.