mirror of
https://github.com/Stone-Red-Code/DesktopMagic.git
synced 2026-09-04 00:46:12 +02:00
- Add RenderQuality enum to the Plugin API
- Add `RenderQuality` property to the `Plugin` class - Set the render quality of the plugin image
This commit is contained in:
@@ -13,12 +13,11 @@
|
||||
SizeChanged="Window_SizeChanged"
|
||||
Closing="Window_Closing"
|
||||
ContentRendered="Window_ContentRendered"
|
||||
|
||||
x:Name="window">
|
||||
<Grid>
|
||||
<Rectangle x:Name="panel" Fill="#4CBAFFEF" Stroke="White" Margin="0,0,0,0" Visibility="Collapsed" />
|
||||
<Viewbox StretchDirection="Both" Stretch="Uniform">
|
||||
<Image x:Name="image" HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Top" RenderTransformOrigin="0.5,0.5" Stretch="Uniform" MouseDown="Window_MouseDown" MouseMove="Window_MouseMove" MouseWheel="Window_MouseWheel"/>
|
||||
<Image x:Name="image" HorizontalAlignment="Left" RenderOptions.EdgeMode="Aliased" Margin="0,0,0,0" VerticalAlignment="Top" RenderTransformOrigin="0.5,0.5" Stretch="Uniform" MouseDown="Window_MouseDown" MouseMove="Window_MouseMove" MouseWheel="Window_MouseWheel"/>
|
||||
</Viewbox>
|
||||
</Grid>
|
||||
<WindowChrome.WindowChrome>
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
using DesktopMagicPluginAPI;
|
||||
using DesktopMagicPluginAPI.Drawing;
|
||||
using DesktopMagicPluginAPI.Inputs;
|
||||
|
||||
using Microsoft.Win32;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
@@ -251,9 +254,18 @@ namespace DesktopMagic
|
||||
|
||||
if (result is not null)
|
||||
{
|
||||
BitmapScalingMode renderOptions = pluginClassInstance.RenderQuality switch
|
||||
{
|
||||
RenderQuality.High => BitmapScalingMode.HighQuality,
|
||||
RenderQuality.Low => BitmapScalingMode.LowQuality,
|
||||
RenderQuality.Performance => BitmapScalingMode.NearestNeighbor,
|
||||
_ => BitmapScalingMode.Unspecified
|
||||
};
|
||||
|
||||
//Update Image
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
RenderOptions.SetBitmapScalingMode(image, renderOptions);
|
||||
image.Source = BitmapToImageSource(result);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -46,12 +46,17 @@
|
||||
- [Right](#F-DesktopMagicPluginAPI-Inputs-MouseButton-Right 'DesktopMagicPluginAPI.Inputs.MouseButton.Right')
|
||||
- [Plugin](#T-DesktopMagicPluginAPI-Plugin 'DesktopMagicPluginAPI.Plugin')
|
||||
- [Application](#P-DesktopMagicPluginAPI-Plugin-Application 'DesktopMagicPluginAPI.Plugin.Application')
|
||||
- [RenderQuality](#P-DesktopMagicPluginAPI-Plugin-RenderQuality 'DesktopMagicPluginAPI.Plugin.RenderQuality')
|
||||
- [UpdateInterval](#P-DesktopMagicPluginAPI-Plugin-UpdateInterval 'DesktopMagicPluginAPI.Plugin.UpdateInterval')
|
||||
- [Main()](#M-DesktopMagicPluginAPI-Plugin-Main 'DesktopMagicPluginAPI.Plugin.Main')
|
||||
- [OnMouseClick(position,mouseButton)](#M-DesktopMagicPluginAPI-Plugin-OnMouseClick-System-Drawing-Point,DesktopMagicPluginAPI-Inputs-MouseButton- 'DesktopMagicPluginAPI.Plugin.OnMouseClick(System.Drawing.Point,DesktopMagicPluginAPI.Inputs.MouseButton)')
|
||||
- [OnMouseMove(position)](#M-DesktopMagicPluginAPI-Plugin-OnMouseMove-System-Drawing-Point- 'DesktopMagicPluginAPI.Plugin.OnMouseMove(System.Drawing.Point)')
|
||||
- [OnMouseWheel(position,Delta)](#M-DesktopMagicPluginAPI-Plugin-OnMouseWheel-System-Drawing-Point,System-Int32- 'DesktopMagicPluginAPI.Plugin.OnMouseWheel(System.Drawing.Point,System.Int32)')
|
||||
- [Start()](#M-DesktopMagicPluginAPI-Plugin-Start 'DesktopMagicPluginAPI.Plugin.Start')
|
||||
- [RenderQuality](#T-DesktopMagicPluginAPI-Drawing-RenderQuality 'DesktopMagicPluginAPI.Drawing.RenderQuality')
|
||||
- [High](#F-DesktopMagicPluginAPI-Drawing-RenderQuality-High 'DesktopMagicPluginAPI.Drawing.RenderQuality.High')
|
||||
- [Low](#F-DesktopMagicPluginAPI-Drawing-RenderQuality-Low 'DesktopMagicPluginAPI.Drawing.RenderQuality.Low')
|
||||
- [Performance](#F-DesktopMagicPluginAPI-Drawing-RenderQuality-Performance 'DesktopMagicPluginAPI.Drawing.RenderQuality.Performance')
|
||||
- [Slider](#T-DesktopMagicPluginAPI-Inputs-Slider 'DesktopMagicPluginAPI.Inputs.Slider')
|
||||
- [#ctor(min,max,value)](#M-DesktopMagicPluginAPI-Inputs-Slider-#ctor-System-Double,System-Double,System-Double- 'DesktopMagicPluginAPI.Inputs.Slider.#ctor(System.Double,System.Double,System.Double)')
|
||||
- [Maximum](#P-DesktopMagicPluginAPI-Inputs-Slider-Maximum 'DesktopMagicPluginAPI.Inputs.Slider.Maximum')
|
||||
@@ -508,6 +513,13 @@ The plugin class.
|
||||
|
||||
Informations about the main application.
|
||||
|
||||
<a name='P-DesktopMagicPluginAPI-Plugin-RenderQuality'></a>
|
||||
### RenderQuality `property`
|
||||
|
||||
##### Summary
|
||||
|
||||
Gets or sets the render quality of the bitmap image.
|
||||
|
||||
<a name='P-DesktopMagicPluginAPI-Plugin-UpdateInterval'></a>
|
||||
### UpdateInterval `property`
|
||||
|
||||
@@ -582,6 +594,38 @@ Occurs once when the pugin gets activated.
|
||||
|
||||
This method has no parameters.
|
||||
|
||||
<a name='T-DesktopMagicPluginAPI-Drawing-RenderQuality'></a>
|
||||
## RenderQuality `type`
|
||||
|
||||
##### Namespace
|
||||
|
||||
DesktopMagicPluginAPI.Drawing
|
||||
|
||||
##### Summary
|
||||
|
||||
Specifies which render quality is used to display the bitmap images.
|
||||
|
||||
<a name='F-DesktopMagicPluginAPI-Drawing-RenderQuality-High'></a>
|
||||
### High `constants`
|
||||
|
||||
##### Summary
|
||||
|
||||
Slower then [Low](#F-DesktopMagicPluginAPI-Drawing-RenderQuality-Low 'DesktopMagicPluginAPI.Drawing.RenderQuality.Low') but produces higher quality output.
|
||||
|
||||
<a name='F-DesktopMagicPluginAPI-Drawing-RenderQuality-Low'></a>
|
||||
### Low `constants`
|
||||
|
||||
##### Summary
|
||||
|
||||
Faster then [High](#F-DesktopMagicPluginAPI-Drawing-RenderQuality-High 'DesktopMagicPluginAPI.Drawing.RenderQuality.High') but produces lower quality output.
|
||||
|
||||
<a name='F-DesktopMagicPluginAPI-Drawing-RenderQuality-Performance'></a>
|
||||
### Performance `constants`
|
||||
|
||||
##### Summary
|
||||
|
||||
Provides performance benefits over [Low](#F-DesktopMagicPluginAPI-Drawing-RenderQuality-Low 'DesktopMagicPluginAPI.Drawing.RenderQuality.Low')
|
||||
|
||||
<a name='T-DesktopMagicPluginAPI-Inputs-Slider'></a>
|
||||
## Slider `type`
|
||||
|
||||
|
||||
@@ -53,6 +53,26 @@
|
||||
<param name="point"><see cref="T:System.Drawing.PointF"/> structure that specifies the upper-left corner of the drawn text.</param>
|
||||
<param name="width">The specified width.</param>
|
||||
</member>
|
||||
<member name="T:DesktopMagicPluginAPI.Drawing.RenderQuality">
|
||||
<summary>
|
||||
Specifies which render quality is used to display the bitmap images.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:DesktopMagicPluginAPI.Drawing.RenderQuality.High">
|
||||
<summary>
|
||||
Slower then <see cref="F:DesktopMagicPluginAPI.Drawing.RenderQuality.Low"/> but produces higher quality output.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:DesktopMagicPluginAPI.Drawing.RenderQuality.Low">
|
||||
<summary>
|
||||
Faster then <see cref="F:DesktopMagicPluginAPI.Drawing.RenderQuality.High"/> but produces lower quality output.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:DesktopMagicPluginAPI.Drawing.RenderQuality.Performance">
|
||||
<summary>
|
||||
Provides performance benefits over <see cref="F:DesktopMagicPluginAPI.Drawing.RenderQuality.Low"/>
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:DesktopMagicPluginAPI.Inputs.Button">
|
||||
<summary>
|
||||
Represents a button control.
|
||||
@@ -311,6 +331,11 @@
|
||||
Gets or sets the interval, expressed in milliseconds, at which to call the <see cref="M:DesktopMagicPluginAPI.Plugin.Main"/> method.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:DesktopMagicPluginAPI.Plugin.RenderQuality">
|
||||
<summary>
|
||||
Gets or sets the render quality of the bitmap image.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:DesktopMagicPluginAPI.Plugin.Start">
|
||||
<summary>
|
||||
Occurs once when the pugin gets activated.
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DesktopMagicPluginAPI.Drawing
|
||||
{
|
||||
/// <summary>
|
||||
/// Specifies which render quality is used to display the bitmap images.
|
||||
/// </summary>
|
||||
public enum RenderQuality
|
||||
{
|
||||
/// <summary>
|
||||
/// Slower then <see cref="Low"/> but produces higher quality output.
|
||||
/// </summary>
|
||||
High,
|
||||
|
||||
/// <summary>
|
||||
/// Faster then <see cref="High"/> but produces lower quality output.
|
||||
/// </summary>
|
||||
Low,
|
||||
|
||||
/// <summary>
|
||||
/// Provides performance benefits over <see cref="Low"/>
|
||||
/// </summary>
|
||||
Performance
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
using DesktopMagicPluginAPI.Inputs;
|
||||
using DesktopMagicPluginAPI.Drawing;
|
||||
using DesktopMagicPluginAPI.Inputs;
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
|
||||
@@ -35,6 +37,11 @@ namespace DesktopMagicPluginAPI
|
||||
/// </summary>
|
||||
public virtual int UpdateInterval { get; set; } = 1000;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the render quality of the bitmap image.
|
||||
/// </summary>
|
||||
public virtual RenderQuality RenderQuality { get; set; } = RenderQuality.High;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs once when the pugin gets activated.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user