Skip to content

Commit

Permalink
Update to v1.1
Browse files Browse the repository at this point in the history
- Includes option to show crosshair
- Add icon for binary (just because)
- Remove unused code
- Update assembly and manifest version to 1.1
- Updates tooltips
  • Loading branch information
VictorGrycuk committed Sep 17, 2020
1 parent cb90627 commit e48a718
Show file tree
Hide file tree
Showing 11 changed files with 48 additions and 11 deletions.
17 changes: 17 additions & 0 deletions streamdeck-magnifier/streamdeck-magnifier/Helpers/ImageHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,22 @@ internal static Image CopyFromScreen(int zoomLevel)

return img;
}

internal static void DrawCrosshair(Image image)
{
using (var graphics = Graphics.FromImage(image))
{
var color = ((Bitmap)image).GetPixel(72, 72);
var pen = new Pen(IsDarkColor(color) ? Color.White : Color.Black, 1);
graphics.DrawLine(pen, 0, 72, 144, 72);
graphics.DrawLine(pen, 72, 0, 72, 144);
}
}

internal static bool IsDarkColor(Color color)
{
var luminance = 0.212655 * color.R + 0.715158 * color.G + 0.072187 * color.B;
return luminance < 150;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ private enum ProcessDPIAwareness
[DllImport("User32.Dll")]
private static extern long SetCursorPos(int x, int y);

[DllImport("gdi32.dll", CharSet = CharSet.Auto, SetLastError = true, ExactSpelling = true)]
private static extern int BitBlt(IntPtr hDC, int x, int y, int nWidth, int nHeight, IntPtr hSrcDC, int xSrc, int ySrc, int dwRop);

[DllImport("shcore.dll")]
private static extern int SetProcessDpiAwareness(ProcessDPIAwareness value);

Expand Down
Binary file not shown.
7 changes: 7 additions & 0 deletions streamdeck-magnifier/streamdeck-magnifier/Magnifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Magnifier.Helpers;
using System;
using System.Threading.Tasks;
using System.Drawing;

namespace Magnifier
{
Expand Down Expand Up @@ -37,6 +38,12 @@ public override void OnTick()
{
var img = ImageHelper.CopyFromScreen(settings.ZoomLevel);
img = ImageHelper.ResizeImage(img, 144, 144);

if (settings.UseCrosshair)
{
ImageHelper.DrawCrosshair(img);
}

Connection.SetImageAsync(img);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ public static MagnifierSettings CreateDefaultSettings()
[JsonProperty(PropertyName = "zoomLevel")]
public string PIZoomLevel { get; set; }

[JsonProperty(PropertyName = "useCrosshair")]
public bool UseCrosshair { get; set; }

public int ZoomLevel { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no,minimal-ui,viewport-fit=cover">
<meta name=apple-mobile-web-app-capable content=yes>
<meta name=apple-mobile-web-app-status-bar-style content=black>
<title>streamdeck_magnifier Settings</title>
<title>Magnifier Settings</title>
<link rel="stylesheet" href="sdpi.css">
<script src="sdtools.common.js"></script>
</head>
Expand All @@ -21,6 +21,15 @@
<option value="32">32x</option>
</select>
</div>
<div type="checkbox" class="sdpi-item" id="crosshair">
<div class="sdpi-item-label">Show Crosshair</div>
<div class="sdpi-item-value min100">
<div class="sdpi-item-child">
<input id="useCrosshair" class="sdProperty sdCheckbox" type="checkbox" name="useCrosshair" oninput="setSettings()">
<label for="useCrosshair" class="sdpi-item-label"><span></span></label>
</div>
</div>
</div>
</div>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no,minimal-ui,viewport-fit=cover">
<meta name=apple-mobile-web-app-capable content=yes>
<meta name=apple-mobile-web-app-status-bar-style content=black>
<title>streamdeck_magnifier Settings</title>
<title>Mover Settings</title>
<link rel="stylesheet" href="sdpi.css">
<script src="sdtools.common.js"></script>
</head>
Expand Down
Binary file not shown.
6 changes: 3 additions & 3 deletions streamdeck-magnifier/streamdeck-magnifier/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
}
],
"SupportedInMultiActions": false,
"Tooltip": "Magnifier",
"Tooltip": "Converts a Stream Deck key into a magnifier.\n(Optional) Shows a crosshair",
"UUID": "victorgrycuk.streamdeck.magnifier",
"PropertyInspectorPath": "PropertyInspector/MagnifierPI.html"
},
Expand All @@ -26,7 +26,7 @@
}
],
"SupportedInMultiActions": false,
"Tooltip": "Mover",
"Tooltip": "Allows to move the mouse in one of the 4 directions using a Stream Deck key",
"UUID": "victorgrycuk.streamdeck.mover",
"PropertyInspectorPath": "PropertyInspector/MoverPI.html"
}
Expand All @@ -36,7 +36,7 @@
"Description": "Converts a Stream Deck key into a screen magnifier, with up to 32x zoom.\nIncludes an option to move the mouse pixel by pixel for better precision.",
"Icon": "Images/magnifierIcon",
"URL": "https://github.com/VictorGrycuk/streamdeck-magnifier",
"Version": "1.0",
"Version": "1.1",
"CodePath": "streamdeck-magnifier",
"Category": "Magnifier",
"CategoryIcon": "Images/categoryIcon",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,14 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\streamdeck_magnifier.sdPlugin\</OutputPath>
<OutputPath>bin\Release\com.victorgrycuk.magnifier.sdPlugin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>magnifier.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="CommandLine, Version=2.7.82.0, Culture=neutral, PublicKeyToken=5a870481e358d379, processorArchitecture=MSIL">
<HintPath>..\packages\CommandLineParser.2.7.82\lib\net461\CommandLine.dll</HintPath>
Expand Down Expand Up @@ -123,6 +126,7 @@
<Content Include="Images\moverKeyImage.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="magnifier.ico" />
<Content Include="PropertyInspector\caret.svg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
Expand Down

0 comments on commit e48a718

Please sign in to comment.