Created
November 7, 2022 17:54
-
-
Save diogotito/2854e8b4b23654511c55f3dba4a71193 to your computer and use it in GitHub Desktop.
Paint.NET CodeLab filter to calculate alpha for Windows tooltip shadow pixels in screenshots
This file contains 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
// Name: | |
// Submenu: | |
// Author: | |
// Title: | |
// Version: | |
// Desc: | |
// Keywords: | |
// URL: | |
// Help: | |
#region UICode | |
IntSliderControl Amount1 = 0; // [0,100] Slider 1 Description | |
IntSliderControl Amount2 = 0; // [0,100] Slider 2 Description | |
IntSliderControl Amount3 = 0; // [0,100] Slider 3 Description | |
#endregion | |
const byte TOOLTIP_GRAY = 118; | |
void Render(Surface dst, Surface src, Rectangle rect) | |
{ | |
for (int y = rect.Top; y < rect.Bottom; y++) | |
{ | |
for (int x = rect.Left; x < rect.Right; x++) | |
{ | |
ColorBgra currentPixel = src[x,y]; | |
float grayDist = (currentPixel.R - TOOLTIP_GRAY) * 256 / (256 - TOOLTIP_GRAY); | |
currentPixel.R = currentPixel.G = currentPixel.B = 118; | |
currentPixel.A = (byte)(255 - grayDist); | |
dst[x,y] = currentPixel; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment