/** * Used to create negative color for provided color. Alpha value will be the same as in source color. * * @param color color to negotiate. * * @return new negative color. */ public static Vector4f negativeColor(Vector4f color) { Vector4f dest = new Vector4f(1).sub(color); dest.w = color.w; return dest; }
/** * Subtract the supplied vector from this one. * * @param v * the vector to subtract * @return a vector holding the result */ public Vector4f sub(Vector4fc v) { return sub(v, thisOrNew()); }
/** * Subtract the supplied vector from this one. * * @param v * the vector to subtract * @return a vector holding the result */ public Vector4f sub(Vector4fc v) { return sub(v, thisOrNew()); }
/** * Used to negotiate only rgb part. Alpha value will be setted to 1. * * @param color color to negotiate. * * @return new negative color. */ public static Vector4f negativeColorRGB(Vector4f color) { Vector4f dest = new Vector4f(1).sub(color); dest.w = 1; return dest; }
/** * Subtract <code>(x, y, z, w)</code> from this. * * @param x * the x component to subtract * @param y * the y component to subtract * @param z * the z component to subtract * @param w * the w component to subtract * @return a vector holding the result */ public Vector4f sub(float x, float y, float z, float w) { return sub(x, y, z, w, thisOrNew()); }
/** * Subtract <code>(x, y, z, w)</code> from this. * * @param x * the x component to subtract * @param y * the y component to subtract * @param z * the z component to subtract * @param w * the w component to subtract * @return a vector holding the result */ public Vector4f sub(float x, float y, float z, float w) { return sub(x, y, z, w, thisOrNew()); }
/** * Used to create negative color and set it to dest. Alpha value will be the same as in source color. * * @param color color to negotiate. * @param dest target color object to set. */ public static void negativeColor(Vector4f color, Vector4f dest) { dest.zero().set(1).sub(color); dest.w = color.w; }
/** * Used to create negative color and set it to dest. Alpha value will be setted to 1. * * @param color color to negotiate. * @param dest target color object to set. * * @return destination color filled with negative color. */ public static Vector4f negativeColorRGB(Vector4f color, Vector4f dest) { dest.zero().set(1).sub(color); dest.w = 1; return dest; }
public Vector4f sub(Vector4fc v, Vector4f dest) { return sub(v.x(), v.y(), v.z(), v.w(), dest); }
public Vector4f sub(Vector4fc v, Vector4f dest) { return sub(v.x(), v.y(), v.z(), v.w(), dest); }
@Override public void renderSelf(PasswordInput component, Context leguiContext, long nanovg) { createScissor(nanovg, component); { Vector2f pos = component.getAbsolutePosition(); Vector2f size = component.getSize(); boolean enabled = component.isEnabled(); Vector4f bc = new Vector4f(component.getStyle().getBackground().getColor()); if (enabled && component.isFocused()) { bc.w *= 1.1f; } else if (!enabled) { bc.w *= 0.5f; } if (!component.isEditable()) { bc.w *= 0.3f; } renderBackground(component, leguiContext, nanovg); Vector4f p = new Vector4f(component.getStyle().getPadding().w, component.getStyle().getPadding().x, component.getStyle().getPadding().y, component.getStyle().getPadding().z); Vector4f intersectRect = new Vector4f(pos.x + p.x, pos.y + p.y, size.x - p.x - p.z, size.y - p.y - p.w); intersectScissor(nanovg, new Vector4f(intersectRect).sub(1, 1, -2, -2)); renderText(leguiContext, nanovg, component, size, intersectRect, bc); } resetScissor(nanovg); }
intersectScissor(nanovg, new Vector4f(intersectRect).sub(1, 1, -2, -2)); renderText(context, nanovg, component, size, intersectRect, bc);