/// <summary> /// Initializes a new instance of the <see cref="CursorEffects"/> class. /// </summary> /// <param name="deviceContext">The D2D device context.</param> public CursorEffects(D2D.DeviceContext deviceContext) : base(deviceContext) { // Set alpha = 1 var colorMatrix = new RawMatrix5x4() { M11 = 1, M22 = 1, M33 = 1, M54 = 1, }; this.PushEffect(D2D.Effect.Crop) .SetupLast((e) => e.SetValue((int)D2D.CropProperties.Rectangle, new RawRectangleF(0, 0, 0, 0))) .PushEffect(D2D.Effect.Invert) .PushEffect(D2D.Effect.ColorMatrix) .SetupLast((e) => e.SetValue((int)D2D.ColorMatrixProperties.ColorMatrix, colorMatrix)) .SetCompositionMode(D2D.CompositeMode.DestinationOver); }
/// <summary> /// Sets the named property to the given value. /// </summary> /// <param name="index">Index of the property</param> /// <param name="value">Value of the property</param> /// <unmanaged>HRESULT ID2D1Properties::SetValue([In] const wchar_t* name,[In] D2D1_PROPERTY_TYPE type,[In, Buffer] const void* data,[In] unsigned int dataSize)</unmanaged> public unsafe void SetValue(int index, RawMatrix5x4 value) { SetValue(index, PropertyType.Matrix5x4, new IntPtr(&value), sizeof(RawMatrix5x4)); }
/// <summary> /// Sets the named property to the given value. /// </summary> /// <param name="name">Name of the property</param> /// <param name="value">Value of the property</param> /// <unmanaged>HRESULT ID2D1Properties::SetValueByName([In] const wchar_t* name,[In] D2D1_PROPERTY_TYPE type,[In, Buffer] const void* data,[In] unsigned int dataSize)</unmanaged> public unsafe void SetValueByName(string name, RawMatrix5x4 value) { SetValueByName(name, PropertyType.Matrix5x4, new IntPtr(&value), sizeof(RawMatrix5x4)); }