Skip to content

Instantly share code, notes, and snippets.

@d7samurai
d7samurai / .readme.md
Last active March 25, 2024 04:11
Minimal D3D11 bonus material: pixel art antialiasing

Minimal D3D11 bonus material: pixel art antialiasing

A minimal Direct3D 11 implementation of "antialiased point sampling", useful for smooth fractional movement and non-integer scaling of pixel art AKA "fat pixel" aesthetics.

Also view below side-by-side point sampling comparison on YouTube (video is zoomed in to counter implicit downsampling & compression artifacts and make aa effect more apparent) or check out the Shadertoy.

skull

The actual sampler is set to bilinear filtering (the default D3D11 sampler state) in order to utilize single texture-read hardware interpolation, then emulating point sampling in the shader and applying AA at the fat pixel boundaries. Use with premultiplied alpha textures* and keep a one pixel transparent border around each sprite/tile.

@Beefster09
Beefster09 / scale.frag
Last active October 29, 2021 00:34
GLSL: smooth pixel scaling
#version 330 core
in vec2 frag_uv;
uniform sampler2D virtual_screen;
uniform float sharpness = 2.0;
out vec4 frag_color;
float sharpen(float pix_coord) {
@amake
amake / android-7-localization.org
Last active July 25, 2023 22:34
Correct localization on Android 7

Correct localization on Android 7

Prior to Android 7, the system had a single preferred locale, and fallback behavior was quite rudimentary. Starting with Android 7, the user can now specify a priority list of locales, and fallback behavior is improved.

However, in many cases it is still surprisingly difficult to make full use of locale fallback, and there are some hidden gotchas when trying to fully support both Android 7 and earlier versions.

@vxhviet
vxhviet / javaCV.md
Last active February 26, 2024 22:59
How to fucking add JavaCV to Android Studio

Source: Me, GitHub, following this for update GitHub

Question: How to fucking add JavaCV to Android Studio so I can use the fucking annoying FFmpeg?

Answer: This tut will use JavaCV 1.1, version 1.2 currently has SIGSEGV issue. JavaCV 1.1 comes with FFmpeg 2.8.1.

  1. Obtain the prebulit binaries here.
  2. Extract it and copy these files:
  • javacpp.jar (essential).
  • javacv.jar (essential).