#include "GuiGraphicsWindowsDirect2D.h"
#include "GuiGraphicsRenderersWindowsDirect2D.h"
#include "GuiGraphicsLayoutProviderWindowsDirect2D.h"
#include "..\..\NativeWindow\Windows\ServicesImpl\WindowsImageService.h"
#include "..\..\GraphicsElement\GuiGraphicsDocumentElement.h"
#include "..\..\Controls\GuiApplication.h"
#include "..\..\NativeWindow\Windows\GDI\WinGDI.h"
#include <math.h>
namespace
{
namespace
{
namespace
{
::
()
{
}
}
namespace
{
using
namespace
elements
;
using
namespace
collections
;
using
namespace
windows
;
D2D1
::
(
)
{
return
D2D1
::
(
.
/
255.0f
,
.
/
255.0f
,
.
/
255.0f
,
.
/
255.0f
);
}
class
CachedSolidBrushAllocator
{
DEFINE_CACHED_RESOURCE_ALLOCATOR(Color, ComPtr<ID2D1SolidColorBrush>)
public
:
static
const
=
32
;
struct
{
<
>
;
;
bool
(
const
&
)
const
{
return
false
;}
bool
(
const
&
)
const
{
return
true
;} };
struct
{
;
<
>
;
bool
(
const
&
)
const
{
return
false
;}
bool
(
const
&
)
const
{
return
true
;} };
<
,
>
;
<
>
;
public
:
<
>
(
const
&
) {
=
.
().
(
);
if
(
index
!=-
1
) {
=
.
().
(
index
);
package
.
++;
.
(
,
package
);
return
package
.
; }
<
>
;
for
(
=
0
;
i
<
.
();
i
++) {
if
(
i
].
) {
=
i
];
.
(
i
);
resource
deadPackage
.
;
break
; } }
if
(!
resource
) {
resource
(
); }
;
package
.
resource
;
package
.
=
1
;
.
(
,
package
);
return
package
.
; }
void
(
const
&
) {
=
.
().
(
);
if
(
index
!=-
1
) {
=
.
().
(
index
);
package
.
--;
if
(
package
.
==
0
) {
.
(
);
if
(
.
()==
) {
.
(
-
1
); }
;
deadPackage
.
;
deadPackage
.
package
.
;
.
(
0
,
deadPackage
); }
else
{
.
(
,
package
); } } }
IWindowsDirect2DRenderTarget
*
;
public
:
CachedSolidBrushAllocator
()
:guiRenderTarget(
0
)
{
}
void
(
IWindowsDirect2DRenderTarget
*
)
{
=
;
}
<
>
(
)
{
*
=
0
;
auto
=
->
();
=
renderTarget
->
(
(
), &
brush
);
CHECK_ERROR(SUCCEEDED(hr), L"You should check HRESULT to see why it failed.");
do
{
if
(!((((
)(
hr
)) >=
0
)))
throw
(
L"You should check HRESULT to see why it failed."
);}
while
(
0
);
return
brush
;
}
};
class
CachedLinearBrushAllocator
{
typedef
<
,
>
;
DEFINE_CACHED_RESOURCE_ALLOCATOR(ColorPair, ComPtr<ID2D1LinearGradientBrush>)
public
:
static
const
=
32
;
struct
{
<
>
;
;
bool
(
const
&
)
const
{
return
false
;}
bool
(
const
&
)
const
{
return
true
;} };
struct
{
;
<
>
;
bool
(
const
&
)
const
{
return
false
;}
bool
(
const
&
)
const
{
return
true
;} };
<
,
>
;
<
>
;
public
:
<
>
(
const
&
) {
=
.
().
(
);
if
(
index
!=-
1
) {
=
.
().
(
index
);
package
.
++;
.
(
,
package
);
return
package
.
; }
<
>
;
for
(
=
0
;
i
<
.
();
i
++) {
if
(
i
].
) {
=
i
];
.
(
i
);
resource
deadPackage
.
;
break
; } }
if
(!
resource
) {
resource
(
); }
;
package
.
resource
;
package
.
=
1
;
.
(
,
package
);
return
package
.
; }
void
(
const
&
) {
=
.
().
(
);
if
(
index
!=-
1
) {
=
.
().
(
index
);
package
.
--;
if
(
package
.
==
0
) {
.
(
);
if
(
.
()==
) {
.
(
-
1
); }
;
deadPackage
.
;
deadPackage
.
package
.
;
.
(
0
,
deadPackage
); }
else
{
.
(
,
package
); } } }
IWindowsDirect2DRenderTarget
*
;
public
:
CachedLinearBrushAllocator
()
:guiRenderTarget(
0
)
{
}
void
(
IWindowsDirect2DRenderTarget
*
)
{
=
;
}
<
>
(
)
{
*
=
->
();
ID2D1GradientStopCollection
*
=
0
;
{
[
2
];
stops
[
0
].
(
.
);
stops
[
0
].
=
0.0f
;
stops
[
1
].
(
.
);
stops
[
1
].
=
1.0f
;
=
renderTarget
->
CreateGradientStopCollection
(
stops
,
2
,
,
,
&
stopCollection
);
CHECK_ERROR(SUCCEEDED(hr), L"You should check HRESULT to see why it failed.");
do
{
if
(!((((
)(
hr
)) >=
0
)))
throw
(
L"You should check HRESULT to see why it failed."
);}
while
(
0
);
}
*
=
0
;
{
[
2
] = { {
0
,
0
}, {
0
,
0
} };
=
renderTarget
->
CreateLinearGradientBrush
(
D2D1
::
LinearGradientBrushProperties
(
points
[
0
],
points
[
1
]),
stopCollection
,
&
brush
);
stopCollection
->
();
CHECK_ERROR(SUCCEEDED(hr), L"You should check HRESULT to see why it failed.");
do
{
if
(!((((
)(
hr
)) >=
0
)))
throw
(
L"You should check HRESULT to see why it failed."
);}
while
(
0
);
}
return
brush
;
}
};
class
CachedRadialBrushAllocator
{
typedef
<
,
>
;
DEFINE_CACHED_RESOURCE_ALLOCATOR(ColorPair, ComPtr<ID2D1RadialGradientBrush>)
public
:
static
const
=
32
;
struct
{
<
>
;
;
bool
(
const
&
)
const
{
return
false
;}
bool
(
const
&
)
const
{
return
true
;} };
struct
{
;
<
>
;
bool
(
const
&
)
const
{
return
false
;}
bool
(
const
&
)
const
{
return
true
;} };
<
,
>
;
<
>
;
public
:
<
>
(
const
&
) {
=
.
().
(
);
if
(
index
!=-
1
) {
=
.
().
(
index
);
package
.
++;
.
(
,
package
);
return
package
.
; }
<
>
;
for
(
=
0
;
i
<
.
();
i
++) {
if
(
i
].
) {
=
i
];
.
(
i
);
resource
deadPackage
.
;
break
; } }
if
(!
resource
) {
resource
(
); }
;
package
.
resource
;
package
.
=
1
;
.
(
,
package
);
return
package
.
; }
void
(
const
&
) {
=
.
().
(
);
if
(
index
!=-
1
) {
=
.
().
(
index
);
package
.
--;
if
(
package
.
==
0
) {
.
(
);
if
(
.
()==
) {
.
(
-
1
); }
;
deadPackage
.
;
deadPackage
.
package
.
;
.
(
0
,
deadPackage
); }
else
{
.
(
,
package
); } } }
IWindowsDirect2DRenderTarget
*
;
public
:
CachedRadialBrushAllocator
()
:guiRenderTarget(
0
)
{
}
void
(
IWindowsDirect2DRenderTarget
*
)
{
=
;
}
<
>
(
)
{
*
=
->
();
ID2D1GradientStopCollection
*
=
0
;
{
[
2
];
stops
[
0
].
(
.
);
stops
[
0
].
=
0.0f
;
stops
[
1
].
(
.
);
stops
[
1
].
=
1.0f
;
=
renderTarget
->
CreateGradientStopCollection
(
stops
,
2
,
,
,
&
stopCollection
);
CHECK_ERROR(SUCCEEDED(hr), L"You should check HRESULT to see why it failed.");
do
{
if
(!((((
)(
hr
)) >=
0
)))
throw
(
L"You should check HRESULT to see why it failed."
);}
while
(
0
);
}
*
=
0
;
{
[
2
] = { {
0
,
0
}, {
0
,
0
} };
=
renderTarget
->
CreateRadialGradientBrush
(
D2D1
::
RadialGradientBrushProperties
(
points
[
0
],
points
[
1
],
1
,
1
),
stopCollection
,
&
brush
);
stopCollection
->
();
CHECK_ERROR(SUCCEEDED(hr), L"You should check HRESULT to see why it failed.");
do
{
if
(!((((
)(
hr
)) >=
0
)))
throw
(
L"You should check HRESULT to see why it failed."
);}
while
(
0
);
}
return
brush
;
}
};
class
CachedTextFormatAllocator
{
private
:
DEFINE_CACHED_RESOURCE_ALLOCATOR(FontProperties, Ptr<Direct2DTextFormatPackage>)
public
:
static
const
=
32
;
struct
{
<
Direct2DTextFormatPackage
>
;
;
bool
(
const
&
)
const
{
return
false
;}
bool
(
const
&
)
const
{
return
true
;} };
struct
{
;
<
Direct2DTextFormatPackage
>
;
bool
(
const
&
)
const
{
return
false
;}
bool
(
const
&
)
const
{
return
true
;} };
<
,
>
;
<
>
;
public
:
<
Direct2DTextFormatPackage
>
(
const
&
) {
=
.
().
(
);
if
(
index
!=-
1
) {
=
.
().
(
index
);
package
.
++;
.
(
,
package
);
return
package
.
; }
<
Direct2DTextFormatPackage
>
;
for
(
=
0
;
i
<
.
();
i
++) {
if
(
i
].
) {
=
i
];
.
(
i
);
resource
deadPackage
.
;
break
; } }
if
(!
resource
) {
resource
(
); }
;
package
.
resource
;
package
.
=
1
;
.
(
,
package
);
return
package
.
; }
void
(
const
&
) {
=
.
().
(
);
if
(
index
!=-
1
) {
=
.
().
(
index
);
package
.
--;
if
(
package
.
==
0
) {
.
(
);
if
(
.
()==
) {
.
(
-
1
); }
;
deadPackage
.
;
deadPackage
.
package
.
;
.
(
0
,
deadPackage
); }
else
{
.
(
,
package
); } } }
public
:
static
<
>
(
const
&
)
{
*
=
GetWindowsDirect2DObjectProvider
()->
();
*
=
0
;
=
dwriteFactory
->
(
.
.
(),
(
.
?
:
DWRITE_FONT_WEIGHT_NORMAL
),
(
.
?
:
),
DWRITE_FONT_STRETCH_NORMAL
,
(
)
.
,
L""
,
&
format
);
CHECK_ERROR(SUCCEEDED(hr), L"You should check HRESULT to see why it failed.");
do
{
if
(!((((
)(
hr
)) >=
0
)))
throw
(
L"You should check HRESULT to see why it failed."
);}
while
(
0
);
format
->
(
DWRITE_WORD_WRAPPING_NO_WRAP
);
return
format
;
}
<
Direct2DTextFormatPackage
>
(
const
&
)
{
<
Direct2DTextFormatPackage
>
=
new
Direct2DTextFormatPackage
;
textFormat
(
);
textFormat
.
=
DWRITE_TRIMMING_GRANULARITY_CHARACTER
;
textFormat
.
=
0
;
textFormat
.
=
0
;
*
=
0
;
GetWindowsDirect2DObjectProvider
()->
()->
CreateEllipsisTrimmingSign
(
textFormat
.
(), &
ellipseInlineObject
);
textFormat
ellipseInlineObject
;
return
textFormat
;
}
};
class
CachedCharMeasurerAllocator
{
DEFINE_CACHED_RESOURCE_ALLOCATOR(FontProperties, Ptr<text::CharMeasurer>)
public
:
static
const
=
32
;
struct
{
<
text
::
>
;
;
bool
(
const
&
)
const
{
return
false
;}
bool
(
const
&
)
const
{
return
true
;} };
struct
{
;
<
text
::
>
;
bool
(
const
&
)
const
{
return
false
;}
bool
(
const
&
)
const
{
return
true
;} };
<
,
>
;
<
>
;
public
:
<
text
::
>
(
const
&
) {
=
.
().
(
);
if
(
index
!=-
1
) {
=
.
().
(
index
);
package
.
++;
.
(
,
package
);
return
package
.
; }
<
text
::
>
;
for
(
=
0
;
i
<
.
();
i
++) {
if
(
i
].
) {
=
i
];
.
(
i
);
resource
deadPackage
.
;
break
; } }
if
(!
resource
) {
resource
(
); }
;
package
.
resource
;
package
.
=
1
;
.
(
,
package
);
return
package
.
; }
void
(
const
&
) {
=
.
().
(
);
if
(
index
!=-
1
) {
=
.
().
(
index
);
package
.
--;
if
(
package
.
==
0
) {
.
(
);
if
(
.
()==
) {
.
(
-
1
); }
;
deadPackage
.
;
deadPackage
.
package
.
;
.
(
0
,
deadPackage
); }
else
{
.
(
,
package
); } } }
protected
:
class
:
public
text
::
{
protected
:
<
>
;
;
(
text
::
,
*
)
{
(
0
,
0
);
*
=
0
;
=
text
::
(
.
[
0
]) &&
text
::
(
.
[
1
]) ?
2
:
1
;
=
GetWindowsDirect2DObjectProvider
()->
()->
(
.
,
count
,
.
(),
0
,
0
,
&
textLayout
);
CHECK_ERROR(SUCCEEDED(hr), L"You should check HRESULT to see why it failed.");
do
{
if
(!((((
)(
hr
)) >=
0
)))
throw
(
L"You should check HRESULT to see why it failed."
);}
while
(
0
);
;
hr
=
textLayout
->
(&
metrics
);
{
charSize
((
)
(
metrics
.
widthIncludingTrailingWhitespace
), (
)
(
metrics
.
));
}
textLayout
->
();
return
charSize
;
}
(
text
::
,
*
)
{
return
(
,
).
;
}
(
*
)
{
return
({
L' '
},
).
;
}
public
:
(
<
>
,
)
:
text
::
(
)
,size(
)
,font(
)
{
}
};
public
:
<
text
::
>
(
const
&
)
{
return
new
(
CachedTextFormatAllocator
::
(
),
.
);
}
};
class
WindowsDirect2DImageFrameCache
:
public
,
public
{
protected
:
IWindowsDirect2DRenderTarget
*
;
*
;
<
>
;
<
>
;
public
:
WindowsDirect2DImageFrameCache
(
IWindowsDirect2DRenderTarget
*
)
:renderTarget(
)
{
}
~
WindowsDirect2DImageFrameCache
()
{
}
void
(
*
)
override
{
=
;
*
=
0
;
=
->
()->
CreateBitmapFromWicBitmap
(
GetWindowsDirect2DObjectProvider
()->
(
),
&
d2dBitmap
);
CHECK_ERROR(SUCCEEDED(hr), L"You should check HRESULT to see why it failed.");
do
{
if
(!((((
)(
hr
)) >=
0
)))
throw
(
L"You should check HRESULT to see why it failed."
);}
while
(
0
);
d2dBitmap
;
}
void
(
*
)
override
{
->
(
);
}
*
()
{
return
;
}
<
>
(
bool
)
{
if
(
)
{
return
;
}
else
{
if
(!
)
{
*
=
GetWindowsDirect2DObjectProvider
()->
(
);
*
=
0
;
=
->
()->
CreateBitmapFromWicBitmap
(
frameBitmap
,
&
d2dBitmap
);
CHECK_ERROR(SUCCEEDED(hr), L"You should check HRESULT to see why it failed.");
do
{
if
(!((((
)(
hr
)) >=
0
)))
throw
(
L"You should check HRESULT to see why it failed."
);}
while
(
0
);
d2dBitmap
;
;
rect
.
=
0
;
rect
.
=
0
;
rect
.
=
().
;
rect
.
=
().
;
*
=
new
[
rect
.
*
rect
.
*
4
];
hr
=
frameBitmap
->
(&
rect
,
rect
.
*
4
,
rect
.
*
rect
.
*
4
,
buffer
);
{
=
rect
.
*
rect
.
;
*
=
buffer
;
for
(
=
0
;
i
<
count
;
i
++)
{
= (
read
[
0
] +
read
[
1
] +
read
[
2
]) /
6
+
read
[
3
] /
2
;
read
[
0
] =
g
;
read
[
1
] =
g
;
read
[
2
] =
g
;
read
+=
4
;
}
;
d2dRect
.
=
0
;
d2dRect
.
=
0
;
d2dRect
.
=
rect
.
;
d2dRect
.
=
rect
.
;
d2dBitmap
->
(&
d2dRect
,
buffer
,
rect
.
*
4
);
}
delete
[]
buffer
;
}
return
;
}
}
};
class
WindowsDirect2DRenderTarget
:
public
,
public
IWindowsDirect2DRenderTarget
{
typedef
<
<
WindowsDirect2DImageFrameCache
>>
;
protected
:
*
;
*
=
nullptr
;
*
=
nullptr
;
<
>
;
clipperCoverWholeTargetCounter
=
0
;
CachedSolidBrushAllocator
;
CachedLinearBrushAllocator
;
CachedRadialBrushAllocator
;
;
<
>
;
<
>
;
<
>
horizontalAntialiasParams
;
<
>
bidirectionalAntialiasParams
;
<
>
(
,
*
,
*
)
{
*
=
0
;
=
->
();
=
->
();
=
->
();
=
->
();
=
->
CreateCustomRenderingParams
(
gamma
,
enhancedContrast
,
clearTypeLevel
,
pixelGeometry
,
,
&
renderingParams
);
{
return
renderingParams
;
}
else
{
return
0
;
}
}
public
:
WindowsDirect2DRenderTarget
(
*
)
:window(
)
{
.
(
this
);
.
(
this
);
.
(
this
);
*
=
GetWindowsDirect2DObjectProvider
()->
();
*
=
0
;
=
dwriteFactory
->
(&
defaultParams
);
{
(
DWRITE_RENDERING_MODE_CLEARTYPE_GDI_NATURAL
,
defaultParams
,
dwriteFactory
);
horizontalAntialiasParams
(
DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL
,
defaultParams
,
dwriteFactory
);
bidirectionalAntialiasParams
(
DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC
,
defaultParams
,
dwriteFactory
);
defaultParams
->
();
}
}
~
WindowsDirect2DRenderTarget
()
{
while
(
.
())
{
<
WindowsDirect2DImageFrameCache
>
=
.
()-
1
];
cache
()->
(
this
);
}
}
*
()
override
{
return
?
:
GetWindowsDirect2DObjectProvider
()->
GetNativeWindowDirect2DRenderTarget
(
);
}
<
>
(
*
,
bool
)
override
{
<
>
=
->
(
this
);
if
(
cache
)
{
return
cache
.
<
WindowsDirect2DImageFrameCache
>()
(
);
}
else
{
<
WindowsDirect2DImageFrameCache
>
=
new
WindowsDirect2DImageFrameCache
(
this
);
if
(
->
(
this
,
d2dCache
))
{
.
(
d2dCache
);
return
d2dCache
(
);
}
else
{
return
0
;
}
}
}
void
(
*
)
override
{
WindowsDirect2DImageFrameCache
*
=
->
(
this
).
<
WindowsDirect2DImageFrameCache
>().
();
.
(
cache
);
}
void
(
bool
,
bool
)
override
{
<
>
;
if
(!
)
{
params
;
}
else
if
(!
)
{
params
horizontalAntialiasParams
;
}
else
{
params
bidirectionalAntialiasParams
;
}
if
(
params
&&
)
{
->
(
params
.
());
}
}
void
()
override
{
=
GetWindowsDirect2DObjectProvider
()->
GetNativeWindowDirect2DRenderTarget
(
);
CHECK_ERROR(d2dRenderTarget, L"vl::presentation::elements_windows_d2d::WindowsDirect2DRenderTarget::StartRendering()#Invalid render target.");
do
{
if
(!(
))
throw
(
L"vl::presentation::elements_windows_d2d::WindowsDirect2DRenderTarget::StartRendering()#Invalid render target."
);}
while
(
0
);
GetWindowsDirect2DObjectProvider
()->
(
);
}
()
override
{
CHECK_ERROR(d2dRenderTarget, L"vl::presentation::elements_windows_d2d::WindowsDirect2DRenderTarget::StartRendering()#Invalid render target.");
do
{
if
(!(
))
throw
(
L"vl::presentation::elements_windows_d2d::WindowsDirect2DRenderTarget::StartRendering()#Invalid render target."
);}
while
(
0
);
auto
=
GetWindowsDirect2DObjectProvider
()->
(
);
=
nullptr
;
return
result
;
}
void
(
)
override
{
if
(
clipperCoverWholeTargetCounter
>
0
)
{
clipperCoverWholeTargetCounter
++;
}
else
{
=
();
;
currentClipper
.
=(
previousClipper
.
>
.
?
previousClipper
.
:
.
);
currentClipper
.
=(
previousClipper
.
>
.
?
previousClipper
.
:
.
);
currentClipper
.
=(
previousClipper
.
<
.
?
previousClipper
.
:
.
);
currentClipper
.
=(
previousClipper
.
<
.
?
previousClipper
.
:
.
);
if
(
currentClipper
.
<
currentClipper
.
&&
currentClipper
.
<
currentClipper
.
)
{
.
(
currentClipper
);
->
(
D2D1
::
((
)
currentClipper
.
, (
)
currentClipper
.
, (
)
currentClipper
.
, (
)
currentClipper
.
),
D2D1_ANTIALIAS_MODE_PER_PRIMITIVE
);
}
else
{
clipperCoverWholeTargetCounter
++;
}
}
}
void
()
override
{
if
(
clipperCoverWholeTargetCounter
>
0
)
{
clipperCoverWholeTargetCounter
--;
}
else
if
(
.
()>
0
)
{
.
(
.
()-
1
);
->
();
}
}
()
override
{
if
(
.
() ==
0
)
{
return
(
(
0
,
0
),
->
(
->
()));
}
else
{
return
.
() -
1
];
}
}
bool
IsClipperCoverWholeTarget
()
override
{
return
clipperCoverWholeTargetCounter
>
0
;
}
*
()
override
{
if
(!
)
{
*
=
GetWindowsDirect2DObjectProvider
()->
GetNativeWindowDirect2DRenderTarget
(
);
*
=
nullptr
;
=
d2dRenderTarget
->
(&
d2dDeviceContext
);
if
(
d2dDeviceContext
)
{
if
(
auto
=
())
{
static
const
char
[] =
"\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52\x00\x00\x00\x08\x00\x00\x00\x08\x08\x06\x00\x00"
"\x00\xC4\x0F\xBE\x8B\x00\x00\x00\x01\x73\x52\x47\x42\x00\xAE\xCE\x1C\xE9\x00\x00\x00\x04\x67\x41\x4D\x41\x00\x00"
"\xB1\x8F\x0B\xFC\x61\x05\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0E\xC3\x00\x00\x0E\xC3\x01\xC7\x6F\xA8\x64\x00"
"\x00\x00\x2F\x49\x44\x41\x54\x28\x53\x75\xC8\xB1\x0D\x00\x30\x0C\x02\x41\xEF\xBF\x34\xB1\x68\xA2\x47\xF8\x9B\x13"
"\x8C\xB6\xD9\x2E\x5D\x9E\x10\xA3\xE8\xF2\x84\x18\x45\x97\x27\xC4\x28\xBA\x3C\xBF\xD2\x03\xC2\xD7\x7F\x81\x23\x94"
"\x3E\x1F\x00\x00\x00\x00\x49\x45\x4E\x44\xAE\x42\x60\x82"
;
auto
=
()->
()->
((
void
*)
EffectBuffer
, (
)(
sizeof
(
EffectBuffer
) -
1
));
*
=
effectImage
?
(
effectImage
(
0
)) :
nullptr
;
if
(
wicEffectBitmap
)
{
*
=
nullptr
;
hr
=
d2dRenderTarget
->
CreateBitmapFromWicBitmap
(
wicEffectBitmap
, &
d2dEffectBitmap
);
if
(
d2dEffectBitmap
)
{
*
=
nullptr
;
hr
=
d2dDeviceContext
->
(
CLSID_D2D1Tile
, &
d2dEffect
);
if
(
d2dEffect
)
{
d2dEffect
->
(
0
,
d2dEffectBitmap
);
d2dEffect
->
(
,
D2D1
::
(
0
,
0
,
2
,
2
));
d2dEffect
;
}
d2dEffectBitmap
->
();
}
}
}
d2dDeviceContext
->
();
}
}
return
.
();
}
*
(
)
override
{
return
.
(
).
();
}
void
(
)
override
{
.
(
);
}
*
CreateDirect2DLinearBrush
(
,
)
override
{
return
.
(
<
,
>(
,
)).
();
}
void
DestroyDirect2DLinearBrush
(
,
)
override
{
.
(
<
,
>(
,
));
}
*
CreateDirect2DRadialBrush
(
,
)
override
{
return
.
(
<
,
>(
,
)).
();
}
void
DestroyDirect2DRadialBrush
(
,
)
override
{
.
(
<
,
>(
,
));
}
};
class
WindowsDirect2DResourceManager
:
public
GuiGraphicsResourceManager
,
public
IWindowsDirect2DResourceManager
,
public
INativeControllerListener
{
protected
:
<
<
WindowsDirect2DRenderTarget
>>
;
<
WindowsDirect2DLayoutProvider
>
;
CachedTextFormatAllocator
;
CachedCharMeasurerAllocator
;
public
:
WindowsDirect2DResourceManager
()
{
new
WindowsDirect2DLayoutProvider
;
}
*
(
*
)
override
{
return
GetWindowsDirect2DObjectProvider
()->
(
);
}
void
(
*
)
override
{
(
);
GetWindowsDirect2DObjectProvider
()->
(
);
(
);
}
void
(
*
)
{
GetWindowsDirect2DObjectProvider
()->
(
);
}
IGuiGraphicsLayoutProvider
*
()
override
{
return
.
();
}
void
(
*
)
override
{
WindowsDirect2DRenderTarget
*
=
new
WindowsDirect2DRenderTarget
(
);
.
(
renderTarget
);
GetWindowsDirect2DObjectProvider
()->
(
,
renderTarget
);
}
void
(
*
)
override
{
WindowsDirect2DRenderTarget
*
=
dynamic_cast
<
WindowsDirect2DRenderTarget
*>(
GetWindowsDirect2DObjectProvider
()->
(
));
GetWindowsDirect2DObjectProvider
()->
(
,
0
);
.
(
renderTarget
);
}
Direct2DTextFormatPackage
*
(
const
&
)
override
{
return
.
(
).
();
}
void
DestroyDirect2DTextFormat
(
const
&
)
override
{
.
(
);
}
<
elements
::
text
::
>
CreateDirect2DCharMeasurer
(
const
&
)
override
{
return
.
(
);
}
void
DestroyDirect2DCharMeasurer
(
const
&
)
override
{
.
(
);
}
};
}
namespace
{
IWindowsDirect2DResourceManager
*
windowsDirect2DResourceManager
=
0
;
IWindowsDirect2DResourceManager
*
GetWindowsDirect2DResourceManager
()
{
return
windowsDirect2DResourceManager
;
}
void
SetWindowsDirect2DResourceManager
(
IWindowsDirect2DResourceManager
*
)
{
windowsDirect2DResourceManager
=
;
}
IWindowsDirect2DObjectProvider
*
windowsDirect2DObjectProvider
=
0
;
IWindowsDirect2DObjectProvider
*
GetWindowsDirect2DObjectProvider
()
{
return
windowsDirect2DObjectProvider
;
}
void
SetWindowsDirect2DObjectProvider
(
IWindowsDirect2DObjectProvider
*
)
{
windowsDirect2DObjectProvider
=
;
}
}
}
}
using
namespace
vl
::
presentation
;
using
namespace
vl
::
presentation
::
elements
;
void
()
{
elements_windows_d2d
::
WindowsDirect2DResourceManager
;
SetGuiGraphicsResourceManager
(&
resourceManager
);
elements_windows_d2d
::
SetWindowsDirect2DResourceManager
(&
resourceManager
);
()->
()->
(&
resourceManager
);
elements_windows_d2d
::
GuiFocusRectangleElementRenderer
::
();
elements_windows_d2d
::
GuiSolidBorderElementRenderer
::
();
elements_windows_d2d
::
Gui3DBorderElementRenderer
::
();
elements_windows_d2d
::
Gui3DSplitterElementRenderer
::
();
elements_windows_d2d
::
GuiSolidBackgroundElementRenderer
::
();
elements_windows_d2d
::
GuiGradientBackgroundElementRenderer
::
();
elements_windows_d2d
::
GuiInnerShadowElementRenderer
::
();
elements_windows_d2d
::
GuiSolidLabelElementRenderer
::
();
elements_windows_d2d
::
GuiImageFrameElementRenderer
::
();
elements_windows_d2d
::
GuiPolygonElementRenderer
::
();
elements_windows_d2d
::
GuiColorizedTextElementRenderer
::
();
elements_windows_d2d
::
GuiDirect2DElementRenderer
::
();
elements
::
::
GuiDocumentElementRenderer
::
();
();
elements_windows_d2d
::
SetWindowsDirect2DResourceManager
(
0
);
SetGuiGraphicsResourceManager
(
0
);
}