-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
100 additions
and
34 deletions.
There are no files selected for viewing
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
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
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
16 changes: 3 additions & 13 deletions
16
packages/pixel-profile/src/renderer/texture-filter/nearest.ts
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { render } from '../renderer' | ||
import { add2, Vec2 } from '../utils' | ||
import { add3, divide3, dot3, mix3, Vec3 } from '../utils/math' | ||
|
||
const radius = 10 | ||
const intensity = 1 | ||
const threshold = 0.9 | ||
const _threshold = threshold * 255 | ||
|
||
export function glow(source: Buffer, width: number, height: number): Buffer { | ||
return render( | ||
source, | ||
width, | ||
height, | ||
(uv, texture2D) => { | ||
const originalColor = texture2D(uv) | ||
|
||
let bloomColor: Vec3 = [0, 0, 0] | ||
let n = 0 | ||
|
||
for (let i = -radius; i <= radius; i++) { | ||
for (let j = -radius; j <= radius; j++) { | ||
const offset: Vec2 = [i / width, j / height] | ||
const sampledColor = texture2D(add2(uv, offset)) | ||
const luminance = dot3(sampledColor, [0.2126, 0.7152, 0.0722]) | ||
if (luminance > _threshold) { | ||
bloomColor = add3(bloomColor, sampledColor) | ||
n++ | ||
} | ||
} | ||
} | ||
|
||
if (n === 0) { | ||
return originalColor | ||
} | ||
|
||
bloomColor = divide3(bloomColor, n) | ||
|
||
const _bloomIntensity = intensity * (n / Math.pow(radius * 2 + 1, 2)) | ||
|
||
const finalColor = mix3(originalColor, bloomColor, _bloomIntensity) | ||
|
||
return [finalColor[0], finalColor[1], finalColor[2], 255] | ||
}, | ||
{ | ||
textureFilter: 'NEAREST' | ||
} | ||
) | ||
} |
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
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
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
Binary file modified
BIN
-604 Bytes
(98%)
...ges-pixel-profile-test-github-stats-test-ts-github-stats-render-card-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+78 Bytes
(100%)
...nder-card-with-all-commits-custom-color-background-and-screen-effect-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+113 Bytes
(100%)
...ithub-stats-test-ts-github-stats-render-card-without-rank-with-theme-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-710 Bytes
(99%)
...l-profile-test-theme-test-ts-theme-render-card-with-blue-chill-theme-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+383 Bytes
(100%)
...ixel-profile-test-theme-test-ts-theme-render-card-with-journey-theme-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-571 Bytes
(99%)
...es-pixel-profile-test-theme-test-ts-theme-render-card-with-lax-theme-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-717 Bytes
(99%)
...pixel-profile-test-theme-test-ts-theme-render-card-with-monica-theme-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+27 Bytes
(100%)
...ixel-profile-test-theme-test-ts-theme-render-card-with-rainbow-theme-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+283 Bytes
(100%)
...el-profile-test-theme-test-ts-theme-render-card-with-road-trip-theme-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-174 Bytes
(100%)
...pixel-profile-test-theme-test-ts-theme-render-card-with-summer-theme-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-803 Bytes
(97%)
...me-test-ts-theme-render-card-with-summer-theme-and-custom-background-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-750 Bytes
(99%)
...t-theme-test-ts-theme-render-card-with-summer-theme-and-custom-color-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+295 Bytes
(100%)
...e-test-ts-theme-with-screen-effect-render-card-with-blue-chill-theme-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+2.02 KB
(100%)
...t-theme-test-ts-theme-with-screen-effect-render-card-with-fuji-theme-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+256 Bytes
(100%)
...heme-test-ts-theme-with-screen-effect-render-card-with-journey-theme-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-107 Bytes
(100%)
...st-theme-test-ts-theme-with-screen-effect-render-card-with-lax-theme-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+326 Bytes
(100%)
...theme-test-ts-theme-with-screen-effect-render-card-with-monica-theme-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+1.37 KB
(100%)
...heme-test-ts-theme-with-screen-effect-render-card-with-rainbow-theme-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-203 Bytes
(100%)
...me-test-ts-theme-with-screen-effect-render-card-with-road-trip-theme-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+1.2 KB
(100%)
...theme-test-ts-theme-with-screen-effect-render-card-with-summer-theme-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+315 Bytes
(100%)
...th-screen-effect-render-card-with-summer-theme-and-custom-background-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+438 Bytes
(100%)
...me-with-screen-effect-render-card-with-summer-theme-and-custom-color-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.