Exemplo n.º 1
0
        protected ComObjectBase(IComObject parent, Func<object> createAction)
        {
            _parent = parent;
            _children = new List<IComObject>();
            
            if (_parent != null)
                _parent.RegisterChild(this);

            try
            {
                Object = createAction.Invoke();
            }
            catch
            {
                Object = null;
            }
        }
Exemplo n.º 2
0
 public static bool TryGet <T>(this IComObject <IMFAttributes> input, Guid key, IFormatProvider provider, out T value) => TryGet(input?.Object, key, provider, out value);
Exemplo n.º 3
0
 public static T Get <T>(this IComObject <IMFAttributes> input, Guid key, T defaultValue = default, IFormatProvider provider = null) => Get(input?.Object, key, defaultValue, provider);
Exemplo n.º 4
0
 public static void Set(this IComObject <IMFAttributes> input, Guid key, bool value) => input?.Object.SetUINT32(key, (uint)(value ? 1 : 0)).ThrowOnError();
Exemplo n.º 5
0
 public static IComObject <T> GetBitmap <T>(this IComObject <ID2D1BitmapRenderTarget> renderTarget) where T : ID2D1Bitmap => GetBitmap <T>(renderTarget?.Object);
Exemplo n.º 6
0
 public static IComObject <ID2D1Bitmap> GetBitmap(this IComObject <ID2D1BitmapRenderTarget> renderTarget) => GetBitmap <ID2D1Bitmap>(renderTarget?.Object);
Exemplo n.º 7
0
 public static void PopAxisAlignedClip(this IComObject <ID2D1RenderTarget> renderTarget) => PopAxisAlignedClip(renderTarget?.Object);
Exemplo n.º 8
0
 public static void PopLayer(this IComObject <ID2D1RenderTarget> context) => PopLayer(context?.Object);
Exemplo n.º 9
0
 public static IComObject <ID2D1BitmapRenderTarget> CreateCompatibleRenderTarget(this IComObject <ID2D1RenderTarget> context, D2D_SIZE_F?desiredSize = null, D2D_SIZE_U?desiredPixelSize = null, D2D1_PIXEL_FORMAT?desiredFormat = null, D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options = D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS.D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_NONE) => CreateCompatibleRenderTarget(context?.Object, desiredSize, desiredPixelSize, desiredFormat, options);
Exemplo n.º 10
0
 public static void FillGeometry(this IComObject <ID2D1RenderTarget> context, IComObject <ID2D1Geometry> geometry, IComObject <ID2D1Brush> brush, IComObject <ID2D1Brush> opacityBrush = null) => FillGeometry(context?.Object, geometry?.Object, brush?.Object, opacityBrush?.Object);
Exemplo n.º 11
0
 public static void DrawTextLayout(this IComObject <ID2D1RenderTarget> context,
                                   D2D_POINT_2F origin,
                                   IDWriteTextLayout layout,
                                   ID2D1Brush defaultFillBrush    = null,
                                   D2D1_DRAW_TEXT_OPTIONS options = D2D1_DRAW_TEXT_OPTIONS.D2D1_DRAW_TEXT_OPTIONS_NONE) => DrawTextLayout(context?.Object, origin, layout, defaultFillBrush, options);
Exemplo n.º 12
0
 public static void Clear(this IComObject <ID2D1RenderTarget> renderTarget, _D3DCOLORVALUE?clearColor = null) => Clear(renderTarget?.Object, clearColor);
Exemplo n.º 13
0
 public static void EndDraw(this IComObject <ID2D1RenderTarget> renderTarget) => EndDraw(renderTarget?.Object);
Exemplo n.º 14
0
 public static void SetTags(this IComObject <ID2D1RenderTarget> context, ulong tag1, ulong tag2 = 0) => SetTags(context?.Object, tag1, tag2);
Exemplo n.º 15
0
 public void RegisterChild(IComObject child)
 {
     _children.Add(child);
 }
Exemplo n.º 16
0
 public static D2D1_PIXEL_FORMAT GetPixelFormat(this IComObject <ID2D1RenderTarget> context) => GetPixelFormat(context?.Object);
Exemplo n.º 17
0
 public static void DrawLine(this IComObject <ID2D1RenderTarget> context, D2D_POINT_2F point0, D2D_POINT_2F point1, IComObject <ID2D1Brush> brush, float strokeWidth, IComObject <ID2D1StrokeStyle> strokeStyle = null) => DrawLine(context?.Object, point0, point1, brush?.Object, strokeWidth, strokeStyle?.Object);
Exemplo n.º 18
0
 public static void PushAxisAlignedClip(this IComObject <ID2D1RenderTarget> renderTarget, D2D_RECT_F clipRect, D2D1_ANTIALIAS_MODE antialiasMode = D2D1_ANTIALIAS_MODE.D2D1_ANTIALIAS_MODE_PER_PRIMITIVE) => PushAxisAlignedClip(renderTarget?.Object, clipRect, antialiasMode);
Exemplo n.º 19
0
 public static void FillRoundedRectangle(this IComObject <ID2D1RenderTarget> context, D2D1_ROUNDED_RECT roundedRect, IComObject <ID2D1Brush> brush) => FillRoundedRectangle(context?.Object, roundedRect, brush?.Object);
Exemplo n.º 20
0
 public static IComObject <T> CreateSolidColorBrush <T>(this IComObject <ID2D1RenderTarget> renderTarget, _D3DCOLORVALUE color, D2D1_BRUSH_PROPERTIES?properties = null) where T : ID2D1SolidColorBrush => CreateSolidColorBrush <T>(renderTarget?.Object, color, properties);
Exemplo n.º 21
0
 public static void DrawRectangle(this IComObject <ID2D1RenderTarget> context, D2D_RECT_F rect, IComObject <ID2D1Brush> brush, float strokeWidth, IComObject <ID2D1StrokeStyle> strokeStyle = null) => DrawRectangle(context?.Object, rect, brush?.Object, strokeWidth, strokeStyle?.Object);
Exemplo n.º 22
0
 public static IComObject <ID2D1RadialGradientBrush> CreateRadialGradientBrush(this IComObject <ID2D1RenderTarget> context, D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES gradientBrushProperties, IComObject <ID2D1GradientStopCollection> stops, D2D1_BRUSH_PROPERTIES?brushProperties = null) => CreateRadialGradientBrush(context?.Object, gradientBrushProperties, stops?.Object, brushProperties);
Exemplo n.º 23
0
 public static void FillRectangle(this IComObject <ID2D1RenderTarget> context, D2D_RECT_F rect, IComObject <ID2D1Brush> brush) => FillRectangle(context?.Object, rect, brush?.Object);
Exemplo n.º 24
0
 public static void Set(this IComObject <IMFAttributes> input, Guid key, uint value) => input?.Object.SetUINT32(key, value).ThrowOnError();
Exemplo n.º 25
0
 public static void DrawEllipse(this IComObject <ID2D1RenderTarget> context, D2D1_ELLIPSE ellipse, IComObject <ID2D1Brush> brush, float strokeWidth, IComObject <ID2D1StrokeStyle> strokeStyle = null) => DrawEllipse(context?.Object, ellipse, brush?.Object, strokeWidth, strokeStyle?.Object);
Exemplo n.º 26
0
 public static void Set(this IComObject <IMFAttributes> input, Guid key, Enum value) => input?.Object.SetUINT32(key, (uint)Convert.ChangeType(value, typeof(uint), CultureInfo.InvariantCulture)).ThrowOnError();
Exemplo n.º 27
0
 public static void FillEllipse(this IComObject <ID2D1RenderTarget> context, D2D1_ELLIPSE ellipse, IComObject <ID2D1Brush> brush) => FillEllipse(context?.Object, ellipse, brush?.Object);
Exemplo n.º 28
0
 public static bool TryGet <T>(this IComObject <IMFAttributes> input, Guid key, out T value) => TryGet(input?.Object, key, null, out value);
Exemplo n.º 29
0
 public static void DrawBitmap(this IComObject <ID2D1RenderTarget> renderTarget,
                               IComObject <ID2D1Bitmap> bitmap,
                               float opacity = 1,
                               D2D1_BITMAP_INTERPOLATION_MODE interpolationMode = D2D1_BITMAP_INTERPOLATION_MODE.D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR,
                               D2D_RECT_F?destinationRectangle = null,
                               D2D_RECT_F?sourceRectangle      = null) => DrawBitmap(renderTarget?.Object, bitmap?.Object, opacity, interpolationMode, destinationRectangle, sourceRectangle);
Exemplo n.º 30
0
 public static void DrawGeometry(this IComObject <ID2D1RenderTarget> renderTarget,
                                 IComObject <ID2D1Geometry> geometry,
                                 IComObject <ID2D1Brush> brush,
                                 float strokeWidth,
                                 IComObject <ID2D1StrokeStyle> strokeStyle = null) => DrawGeometry(renderTarget?.Object, geometry?.Object, brush?.Object, strokeWidth, strokeStyle?.Object);
Exemplo n.º 31
0
 public static void PushLayer(this IComObject <ID2D1RenderTarget> context, D2D1_LAYER_PARAMETERS parameters) => PushLayer(context?.Object, parameters);
Exemplo n.º 32
0
 public void UnregisterChild(IComObject child)
 {
     _children.Remove(child);
 }
Exemplo n.º 33
0
 public static IComObject <T> CreateBitmap <T>(this IComObject <ID2D1RenderTarget> renderTarget, D2D_SIZE_U size, IntPtr srcData, uint pitch, D2D1_BITMAP_PROPERTIES properties) where T : ID2D1Bitmap => CreateBitmap <T>(renderTarget?.Object, size, srcData, pitch, properties);