org.lwjgl.nanovg.NanoVG.nvgFill()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(8.3k)|赞(0)|评价(0)|浏览(74)

本文整理了Java中org.lwjgl.nanovg.NanoVG.nvgFill()方法的一些代码示例,展示了NanoVG.nvgFill()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。NanoVG.nvgFill()方法的具体详情如下:
包路径:org.lwjgl.nanovg.NanoVG
类名称:NanoVG
方法名:nvgFill

NanoVG.nvgFill介绍

[英]Fills the current path with current fill style.
[中]使用当前填充样式填充当前路径。

代码示例

代码示例来源:origin: lwjglgamedev/lwjglbook

nvgRect(vg, 0, window.getHeight() - 100, window.getWidth(), 50);
nvgFillColor(vg, rgba(0x23, 0xa1, 0xf1, 200, colour));
nvgFill(vg);
nvgRect(vg, 0, window.getHeight() - 50, window.getWidth(), 10);
nvgFillColor(vg, rgba(0xc1, 0xe3, 0xf9, 200, colour));
nvgFill(vg);
nvgCircle(vg, xcenter, ycenter, radius);
nvgFillColor(vg, rgba(0xc1, 0xe3, 0xf9, 200, colour));
nvgFill(vg);

代码示例来源:origin: SpinyOwl/legui

/**
   * Used to render specific Icon.
   *
   * @param image image to render.
   * @param position image position.
   * @param size image size.
   * @param context context.
   * @param nanovg nanoVG context.
   */
  @Override
  protected void renderImage(FBOImage image, Vector2fc position, Vector2fc size, Map<String, Object> properties, Context context, long nanovg) {

    try (NVGPaint imagePaint = NVGPaint.calloc()) {
      NvgLoadableImageReferenceManager manager = (NvgLoadableImageReferenceManager) context.getContextData().get(IMAGE_REFERENCE_MANAGER);

      int imageRef = manager.getImageReference(image, nanovg);
      float x = position.x();
      float y = position.y();
      float w = size.x();
      float h = size.y();
      Vector4f r = (Vector4f) properties.getOrDefault(C_RADIUS, 0);

      nvgBeginPath(nanovg);
      nvgImagePattern(nanovg, x, y, w, h, 0, imageRef, 1, imagePaint);
      nvgRoundedRectVarying(nanovg, x, y, w, h, r.x, r.y, r.z, r.w);
      nvgFillPaint(nanovg, imagePaint);
      nvgFill(nanovg);
    }
  }
}

代码示例来源:origin: lwjglgamedev/lwjglbook

nvgRect(vg, 0, window.getHeight() - 100, window.getWidth(), 50);
nvgFillColor(vg, rgba(0x23, 0xa1, 0xf1, 200, colour));
nvgFill(vg);
nvgRect(vg, 0, window.getHeight() - 50, window.getWidth(), 10);
nvgFillColor(vg, rgba(0xc1, 0xe3, 0xf9, 200, colour));
nvgFill(vg);
nvgCircle(vg, xcenter, ycenter, radius);
nvgFillColor(vg, rgba(0xc1, 0xe3, 0xf9, 200, colour));
nvgFill(vg);

代码示例来源:origin: SpinyOwl/legui

nvgRoundedRectVarying(nanovg, x, y, w, h, r.x, r.y, r.z, r.w);
nvgFillPaint(nanovg, imagePaint);
nvgFill(nanovg);

代码示例来源:origin: lwjglgamedev/lwjglbook

nvgRect(vg, 0, window.getHeight() - 100, window.getWidth(), 50);
nvgFillColor(vg, rgba(0x23, 0xa1, 0xf1, 200, colour));
nvgFill(vg);
nvgRect(vg, 0, window.getHeight() - 50, window.getWidth(), 10);
nvgFillColor(vg, rgba(0xc1, 0xe3, 0xf9, 200, colour));
nvgFill(vg);
nvgCircle(vg, xcenter, ycenter, radius);
nvgFillColor(vg, rgba(0xc1, 0xe3, 0xf9, 200, colour));
nvgFill(vg);

代码示例来源:origin: SpinyOwl/legui

public static void dropShadow(long context, float x, float y, float w, float h, float cornerRadius, Vector4f shadowColor) {
  try (
      NVGPaint shadowPaint = NVGPaint.calloc();
      NVGColor colorA = NVGColor.calloc();
      NVGColor colorB = NVGColor.calloc()
  ) {
    NvgColorUtil.fillNvgColorWithRGBA(shadowColor, colorA);
    NvgColorUtil.fillNvgColorWithRGBA(0, 0, 0, 0, colorB);
    nvgBoxGradient(context, x, y + 2, w, h, cornerRadius * 2, 10, colorA, colorB, shadowPaint);
    nvgBeginPath(context);
    nvgRect(context, x - 10, y - 10, w + 20, h + 30);
    nvgRoundedRect(context, x, y, w, h, cornerRadius);
    nvgPathWinding(context, NVG_HOLE);
    nvgFillPaint(context, shadowPaint);
    nvgFill(context);
  }
}

代码示例来源:origin: lwjglgamedev/lwjglbook

nvgRect(vg, 0, window.getHeight() - 100, window.getWidth(), 50);
nvgFillColor(vg, rgba(0x23, 0xa1, 0xf1, 200, colour));
nvgFill(vg);
nvgRect(vg, 0, window.getHeight() - 50, window.getWidth(), 10);
nvgFillColor(vg, rgba(0xc1, 0xe3, 0xf9, 200, colour));
nvgFill(vg);
nvgCircle(vg, xcenter, ycenter, radius);
nvgFillColor(vg, rgba(0xc1, 0xe3, 0xf9, 200, colour));
nvgFill(vg);

代码示例来源:origin: SpinyOwl/legui

nvgRoundedRectVarying(context, x, y, w, h, borderRadius.x, borderRadius.y, borderRadius.z, borderRadius.w);
nvgFillPaint(context, shadowPaint);
nvgFill(context);

代码示例来源:origin: lwjglgamedev/lwjglbook

nvgRect(vg, 0, window.getHeight() - 100, window.getWidth(), 50);
nvgFillColor(vg, rgba(0x23, 0xa1, 0xf1, 200, colour));
nvgFill(vg);
nvgRect(vg, 0, window.getHeight() - 50, window.getWidth(), 10);
nvgFillColor(vg, rgba(0xc1, 0xe3, 0xf9, 200, colour));
nvgFill(vg);
nvgCircle(vg, xcenter, ycenter, radius);
nvgFillColor(vg, rgba(0xc1, 0xe3, 0xf9, 200, colour));
nvgFill(vg);

代码示例来源:origin: lwjglgamedev/lwjglbook

nvgRect(vg, 0, window.getHeight() - 100, window.getWidth(), 50);
nvgFillColor(vg, rgba(0x23, 0xa1, 0xf1, 200, colour));
nvgFill(vg);
nvgRect(vg, 0, window.getHeight() - 50, window.getWidth(), 10);
nvgFillColor(vg, rgba(0xc1, 0xe3, 0xf9, 200, colour));
nvgFill(vg);
nvgCircle(vg, xcenter, ycenter, radius);
nvgFillColor(vg, rgba(0xc1, 0xe3, 0xf9, 200, colour));
nvgFill(vg);

代码示例来源:origin: lwjglgamedev/lwjglbook

nvgRect(vg, 0, window.getHeight() - 100, window.getWidth(), 50);
nvgFillColor(vg, rgba(0x23, 0xa1, 0xf1, 200, colour));
nvgFill(vg);
nvgRect(vg, 0, window.getHeight() - 50, window.getWidth(), 10);
nvgFillColor(vg, rgba(0xc1, 0xe3, 0xf9, 200, colour));
nvgFill(vg);
nvgCircle(vg, xcenter, ycenter, radius);
nvgFillColor(vg, rgba(0xc1, 0xe3, 0xf9, 200, colour));
nvgFill(vg);

代码示例来源:origin: SpinyOwl/legui

/**
 * Used to draw rectangle.
 *
 * @param nvg nanovg context.
 * @param position rectangle position.
 * @param size rectangle size.
 * @param bgColor rectangle background color.
 */
public static void drawRect(long nvg, Vector2fc position, Vector2fc size, Vector4fc bgColor) {
  if (bgColor.w() <= MIN_ALPHA) {
    return;
  }
  try (NVGColor fillColor = NVGColor.calloc()) {
    NvgColorUtil.fillNvgColorWithRGBA(bgColor, fillColor);
    nvgBeginPath(nvg);
    nvgFillColor(nvg, fillColor);
    nvgRect(nvg, position.x(), position.y(), size.x(), size.y());
    nvgFill(nvg);
  }
}

代码示例来源:origin: SpinyOwl/legui

/**
 * Used to draw rectangle.
 *
 * @param nvg nanovg context
 * @param rectangle rectangle size and position.
 * @param bgColor rectangle background color.
 */
public static void drawRect(long nvg, Vector4fc rectangle, Vector4fc bgColor) {
  if (bgColor.w() <= MIN_ALPHA) {
    return;
  }
  try (NVGColor fillColor = NVGColor.calloc()) {
    NvgColorUtil.fillNvgColorWithRGBA(bgColor, fillColor);
    nvgBeginPath(nvg);
    nvgFillColor(nvg, fillColor);
    nvgRect(nvg, rectangle.x(), rectangle.y(), rectangle.z(), rectangle.w());
    nvgFill(nvg);
  }
}

代码示例来源:origin: SpinyOwl/legui

/**
 * Used to draw rectangle.
 *
 * @param nvg nanovg context
 * @param rectangle rectangle size and position.
 * @param bgColor rectangle background color.
 * @param radius cornder radius
 */
public static void drawRect(long nvg, Vector4fc rectangle, Vector4fc bgColor, float radius) {
  if (bgColor.w() <= MIN_ALPHA) {
    return;
  }
  try (NVGColor fillColor = NVGColor.calloc()) {
    NvgColorUtil.fillNvgColorWithRGBA(bgColor, fillColor);
    nvgBeginPath(nvg);
    nvgFillColor(nvg, fillColor);
    nvgRoundedRect(nvg, rectangle.x(), rectangle.y(), rectangle.z(), rectangle.w(), radius);
    nvgFill(nvg);
  }
}

代码示例来源:origin: SpinyOwl/legui

/**
 * Used to draw rectangle.
 *
 * @param nvg nanovg context.
 * @param position rectangle position.
 * @param size rectangle size.
 * @param bgColor rectangle background color.
 * @param radius cornder radius
 */
public static void drawRect(long nvg, Vector2fc position, Vector2fc size, Vector4fc bgColor, float radius) {
  if (bgColor.w() <= MIN_ALPHA) {
    return;
  }
  try (NVGColor fillColor = NVGColor.calloc()) {
    NvgColorUtil.fillNvgColorWithRGBA(bgColor, fillColor);
    nvgBeginPath(nvg);
    nvgFillColor(nvg, fillColor);
    nvgRoundedRect(nvg, position.x(), position.y(), size.x(), size.y(), radius);
    nvgFill(nvg);
  }
}

代码示例来源:origin: SpinyOwl/legui

/**
 * Used to draw rectangle.
 *
 * @param nvg nanovg context
 * @param rectangle rectangle size and position.
 * @param bgColor rectangle background color.
 * @param radius cornder radius
 */
public static void drawRect(long nvg, Vector4fc rectangle, Vector4fc bgColor, Vector4f radius) {
  if (radius != null && !radius.equals(ZERO_CORNDERS)) {
    try (NVGColor fillColor = NVGColor.calloc()) {
      NvgColorUtil.fillNvgColorWithRGBA(bgColor, fillColor);
      nvgBeginPath(nvg);
      nvgFillColor(nvg, fillColor);
      nvgRoundedRectVarying(nvg, rectangle.x(), rectangle.y(), rectangle.z(), rectangle.w(), radius.x, radius.y, radius.z, radius.w);
      nvgFill(nvg);
    }
  } else {
    drawRect(nvg, rectangle, bgColor, radius);
  }
}

代码示例来源:origin: SpinyOwl/legui

/**
 * Used to draw rectangle.
 *
 * @param nvg nanovg context.
 * @param position rectangle position.
 * @param size rectangle size.
 * @param bgColor rectangle background color.
 * @param radius cornder radius
 */
public static void drawRect(long nvg, Vector2fc position, Vector2fc size, Vector4fc bgColor, Vector4f radius) {
  if (radius != null && !radius.equals(ZERO_CORNDERS)) {
    try (NVGColor fillColor = NVGColor.calloc()) {
      NvgColorUtil.fillNvgColorWithRGBA(bgColor, fillColor);
      nvgBeginPath(nvg);
      nvgFillColor(nvg, fillColor);
      if (radius.x == radius.y && radius.x == radius.z && radius.x == radius.w) {
        nvgRoundedRect(nvg, position.x(), position.y(), size.x(), size.y(), radius.x);
      } else {
        nvgRoundedRectVarying(nvg, position.x(), position.y(), size.x(), size.y(), radius.x, radius.y, radius.z, radius.w);
      }
      nvgFill(nvg);
    }
  } else {
    drawRect(nvg, position, size, bgColor);
  }
}

相关文章