Skip to content
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

Neos jp character fix #7

Merged
merged 2 commits into from
Nov 14, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions dll_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@

using namespace msdfgen;

template <int N>
static void invertColor(const BitmapRef<float, N> &bitmap) {
const float *end = bitmap.pixels + N * bitmap.width*bitmap.height;
for (float *p = bitmap.pixels; p < end; ++p)
*p = 1.f - *p;
}

DLL_EXPORT Shape* DLL_API create_shape()
{
Shape* shape = new Shape();
Expand Down Expand Up @@ -80,17 +73,6 @@ DLL_EXPORT void DLL_API shape_generateMSDF(float* pixels, int width, int height,
// and there's no documentation as to what the intent was.

generateMSDF(msdf, *shape, projection, range, generatorConfig);

// Get sign of signed distance outside bounds
// This was taken from main.cpp as a way to guess the expected orientation.
Shape::Bounds bounds = shape->getBounds();
Point2 p(bounds.l - (bounds.r - bounds.l) - 1, bounds.b - (bounds.t - bounds.b) - 1);
double distance = SimpleTrueShapeDistanceFinder::oneShotDistance(*shape, p);
if (distance >= 0) {
invertColor(msdf);
}

// This call is where the errors are introduced, but it corrects the inversion.
distanceSignCorrection(msdf, *shape, projection, FILL_NONZERO);
msdfErrorCorrection(msdf, *shape, projection, range, postErrorCorrectionConfig);
}