-
Notifications
You must be signed in to change notification settings - Fork 43
add bitmap support #171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
BenjaminAbt
wants to merge
12
commits into
FritzAndFriends:dev
Choose a base branch
from
BenjaminAbt:feature/add-bitmap-support
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
add bitmap support #171
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
6144813
Fixed Config references to ExecutingAssembly (#128)
csharpfritz 8fa7316
Release test project fix (#130)
csharpfritz feff800
Merge pull request #132 from FritzAndFriends/dev
csharpfritz 067648f
Merge pull request #143 from FritzAndFriends/dev
csharpfritz 06cb3db
Merge pull request #151 from FritzAndFriends/dev
csharpfritz 92ffc13
Merge pull request #165 from FritzAndFriends/dev
csharpfritz 5ed9061
Merge pull request #167 from FritzAndFriends/dev
csharpfritz f02a3b5
add png image support
BenjaminAbt 09fde78
remove unused using
BenjaminAbt 81be1ec
Merge branch 'master' of https://github.com/BenjaminAbt/StreamDeckToo…
BenjaminAbt a984d76
add image data method
BenjaminAbt 66ebfb4
fix info name
BenjaminAbt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,8 @@ | |
| using System; | ||
| using System.Diagnostics; | ||
| using System.IO; | ||
| using System.Drawing; | ||
| using System.Drawing.Imaging; | ||
| using System.Net.WebSockets; | ||
| using System.Threading; | ||
| using System.Threading.Tasks; | ||
|
|
@@ -260,6 +262,41 @@ public async Task SetImageAsync(string context, string imageLocation) | |
| await _proxy.SendStreamDeckEvent(args); | ||
| } | ||
|
|
||
| public async Task SetPngImageAsync(string context, Bitmap image) | ||
| { | ||
| Debug.WriteLine("Getting Image from Bitmap"); | ||
| _logger?.LogDebug("Getting Image from Bitmap"); | ||
|
|
||
| byte[] imgBytes; | ||
| using (var imgByteStream = new MemoryStream()) | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. at this point we could use https://github.com/microsoft/Microsoft.IO.RecyclableMemoryStream |
||
| { | ||
| image.Save(imgByteStream, ImageFormat.Png); | ||
| imgBytes = imgByteStream.ToArray(); | ||
| } | ||
|
|
||
| var imgString = Convert.ToBase64String(imgBytes, Base64FormattingOptions.None); | ||
|
|
||
| await SetImageDataAsync(context, $"data:image/png;base64, {imgString}"); | ||
| } | ||
|
|
||
| public async Task SetImageDataAsync(string context, string imageData) | ||
| { | ||
| Debug.WriteLine("Getting Image from image data"); | ||
| _logger?.LogDebug("Getting Image from image data"); | ||
|
|
||
| var args = new SetImageArgs | ||
| { | ||
| context = context, | ||
| payload = new SetImageArgs.Payload | ||
| { | ||
| TargetType = SetTitleArgs.TargetType.HardwareAndSoftware, | ||
| image = imageData | ||
| } | ||
| }; | ||
|
|
||
| await _proxy.SendStreamDeckEvent(args); | ||
| } | ||
|
|
||
| public async Task ShowAlertAsync(string context) | ||
| { | ||
| var args = new ShowAlertArgs() | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.