Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pixi/graphics

Package Overview
Dependencies
Maintainers
2
Versions
122
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pixi/graphics - npm Package Compare versions

Comparing version 7.1.0-alpha to 7.1.0

32

lib/const.d.ts

@@ -34,2 +34,3 @@ /**

}
/** @deprecated */
export interface IGraphicsCurvesSettings {

@@ -44,15 +45,28 @@ adaptive: boolean;

/**
* Graphics curves resolution settings. If `adaptive` flag is set to `true`,
* the resolution is calculated based on the curve's length to ensure better visual quality.
* Adaptive draw works with `bezierCurveTo` and `quadraticCurveTo`.
* @private
*/
export declare const curves: {
adaptive: boolean;
maxLength: number;
minSegments: number;
maxSegments: number;
epsilon: number;
_segmentsCount(length: number, defaultSegments?: number): number;
};
/**
* @static
* @constant
* @readonly
* @memberof PIXI
* @name GRAPHICS_CURVES
* @type {object}
* @property {boolean} [adaptive=true] - flag indicating if the resolution should be adaptive
* @property {number} [maxLength=10] - maximal length of a single segment of the curve (if adaptive = false, ignored)
* @property {number} [minSegments=8] - minimal number of segments in the curve (if adaptive = false, ignored)
* @property {number} [maxSegments=2048] - maximal number of segments in the curve (if adaptive = false, ignored)
* @deprecated since 7.1.0
* @see PIXI.Graphics.curves
*/
export declare const GRAPHICS_CURVES: IGraphicsCurvesSettings;
export declare const GRAPHICS_CURVES: {
adaptive: boolean;
maxLength: number;
minSegments: number;
maxSegments: number;
epsilon: number;
_segmentsCount(length: number, defaultSegments?: number): number;
};

@@ -17,3 +17,3 @@ 'use strict';

})(LINE_CAP || {});
const GRAPHICS_CURVES = {
const curves = {
adaptive: true,

@@ -37,2 +37,3 @@ maxLength: 10,

};
const GRAPHICS_CURVES = curves;

@@ -42,2 +43,3 @@ exports.GRAPHICS_CURVES = GRAPHICS_CURVES;

exports.LINE_JOIN = LINE_JOIN;
exports.curves = curves;
//# sourceMappingURL=const.js.map

@@ -1,8 +0,8 @@

import { Point, Polygon, Matrix, BLEND_MODES, Texture, Shader } from '@pixi/core';
import { BLEND_MODES, Matrix, Point, Polygon, Shader, Texture } from '@pixi/core';
import { Container } from '@pixi/display';
import { LINE_CAP, LINE_JOIN } from './const';
import { GraphicsGeometry } from './GraphicsGeometry';
import { FillStyle } from './styles/FillStyle';
import { LineStyle } from './styles/LineStyle';
import { Container } from '@pixi/display';
import { LINE_JOIN, LINE_CAP } from './const';
import type { IShape, IPointData, Renderer, BatchDrawCall } from '@pixi/core';
import type { BatchDrawCall, IPointData, IShape, Renderer } from '@pixi/core';
import type { IDestroyOptions } from '@pixi/display';

@@ -57,2 +57,21 @@ /** Batch element computed from Graphics geometry */

/**
* Graphics curves resolution settings. If `adaptive` flag is set to `true`,
* the resolution is calculated based on the curve's length to ensure better visual quality.
* Adaptive draw works with `bezierCurveTo` and `quadraticCurveTo`.
* @static
* @property {boolean} [adaptive=true] - flag indicating if the resolution should be adaptive
* @property {number} [maxLength=10] - maximal length of a single segment of the curve (if adaptive = false, ignored)
* @property {number} [minSegments=8] - minimal number of segments in the curve (if adaptive = false, ignored)
* @property {number} [maxSegments=2048] - maximal number of segments in the curve (if adaptive = false, ignored)
* @property {number} [epsilon=0.0001] - precision of the curve fitting
*/
static readonly curves: {
adaptive: boolean;
maxLength: number;
minSegments: number;
maxSegments: number;
epsilon: number;
_segmentsCount(length: number, defaultSegments?: number): number;
};
/**
* Temporary point to use for containsPoint.

@@ -241,9 +260,12 @@ * @private

/**
* The arcTo() method creates an arc/curve between two tangents on the canvas.
* The `arcTo` method creates an arc/curve between two tangents on the canvas.
* The first tangent is from the start point to the first control point,
* and the second tangent is from the first control point to the second control point.
* Note that the second control point is not necessarily the end point of the arc.
*
* "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google!
* @param x1 - The x-coordinate of the first tangent point of the arc
* @param y1 - The y-coordinate of the first tangent point of the arc
* @param x2 - The x-coordinate of the end of the arc
* @param y2 - The y-coordinate of the end of the arc
* @param x1 - The x-coordinate of the first control point of the arc
* @param y1 - The y-coordinate of the first control point of the arc
* @param x2 - The x-coordinate of the second control point of the arc
* @param y2 - The y-coordinate of the second control point of the arc
* @param radius - The radius of the arc

@@ -250,0 +272,0 @@ * @returns - This Graphics object. Good for chaining method calls

@@ -6,8 +6,8 @@ 'use strict';

var core = require('@pixi/core');
require('./utils/index.js');
var display = require('@pixi/display');
var _const = require('./const.js');
var GraphicsGeometry = require('./GraphicsGeometry.js');
var FillStyle = require('./styles/FillStyle.js');
var LineStyle = require('./styles/LineStyle.js');
var display = require('@pixi/display');
var _const = require('./const.js');
require('./utils/index.js');
var QuadraticUtils = require('./utils/QuadraticUtils.js');

@@ -375,5 +375,5 @@ var BezierUtils = require('./utils/BezierUtils.js');

if (!DEFAULT_SHADERS[pluginName]) {
const { MAX_TEXTURES } = renderer.plugins[pluginName];
const sampleValues = new Int32Array(MAX_TEXTURES);
for (let i = 0; i < MAX_TEXTURES; i++) {
const { maxTextures } = renderer.plugins[pluginName];
const sampleValues = new Int32Array(maxTextures);
for (let i = 0; i < maxTextures; i++) {
sampleValues[i] = i;

@@ -486,2 +486,3 @@ }

let Graphics = _Graphics;
Graphics.curves = _const.curves;
Graphics._TEMP_POINT = new core.Point();

@@ -488,0 +489,0 @@

@@ -1,2 +0,2 @@

import type { Matrix, SHAPES, IShape } from '@pixi/core';
import type { IShape, Matrix, SHAPES } from '@pixi/core';
import type { FillStyle } from './styles/FillStyle';

@@ -3,0 +3,0 @@ import type { LineStyle } from './styles/LineStyle';

@@ -0,6 +1,6 @@

import { BatchDrawCall, BatchGeometry } from '@pixi/core';
import { Bounds } from '@pixi/display';
import { GraphicsData } from './GraphicsData';
import { BatchPart } from './utils';
import { BatchGeometry, BatchDrawCall } from '@pixi/core';
import { GraphicsData } from './GraphicsData';
import { Bounds } from '@pixi/display';
import type { Texture, Circle, Ellipse, Polygon, Rectangle, RoundedRectangle, IPointData, Matrix } from '@pixi/core';
import type { Circle, Ellipse, IPointData, Matrix, Polygon, Rectangle, RoundedRectangle, Texture } from '@pixi/core';
import type { FillStyle } from './styles/FillStyle';

@@ -7,0 +7,0 @@ import type { LineStyle } from './styles/LineStyle';

@@ -5,6 +5,6 @@ 'use strict';

var index = require('./utils/index.js');
var core = require('@pixi/core');
var display = require('@pixi/display');
var GraphicsData = require('./GraphicsData.js');
var display = require('@pixi/display');
var index = require('./utils/index.js');
var BatchPart = require('./utils/BatchPart.js');

@@ -311,3 +311,3 @@ var buildPoly = require('./utils/buildPoly.js');

const data = this.batches[i];
const MAX_TEXTURES = 8;
const maxTextures = 8;
const style = data.style;

@@ -319,3 +319,3 @@ const nextTexture = style.texture.baseTexture;

currentTexture = null;
textureCount = MAX_TEXTURES;
textureCount = maxTextures;
TICK++;

@@ -326,3 +326,3 @@ }

if (nextTexture._batchEnabled !== TICK) {
if (textureCount === MAX_TEXTURES) {
if (textureCount === maxTextures) {
TICK++;

@@ -329,0 +329,0 @@ textureCount = 0;

/// <reference path="../global.d.ts" />
import { ArcUtils, BatchPart, BezierUtils, buildLine, QuadraticUtils } from './utils';
import type { SHAPES } from '@pixi/core';
import type { BatchDrawCall } from '@pixi/core/';
import type { IShapeBuildCommand } from './utils/IShapeBuildCommand';
export * from './const';
export * from './styles/FillStyle';
export * from './Graphics';
export * from './GraphicsData';
export * from './GraphicsGeometry';
export * from './styles/FillStyle';
export * from './styles/LineStyle';
import { buildLine, ArcUtils, BezierUtils, QuadraticUtils, BatchPart } from './utils';
import type { BatchDrawCall } from '@pixi/core/';
import type { IShapeBuildCommand } from './utils/IShapeBuildCommand';
import type { SHAPES } from '@pixi/core';
export declare const graphicsUtils: {

@@ -13,0 +13,0 @@ buildPoly: IShapeBuildCommand;

@@ -5,9 +5,9 @@ 'use strict';

var index = require('./utils/index.js');
var _const = require('./const.js');
var FillStyle = require('./styles/FillStyle.js');
var Graphics = require('./Graphics.js');
var GraphicsData = require('./GraphicsData.js');
var GraphicsGeometry = require('./GraphicsGeometry.js');
var FillStyle = require('./styles/FillStyle.js');
var LineStyle = require('./styles/LineStyle.js');
var index = require('./utils/index.js');
var buildPoly = require('./utils/buildPoly.js');

@@ -41,8 +41,9 @@ var buildCircle = require('./utils/buildCircle.js');

exports.LINE_JOIN = _const.LINE_JOIN;
exports.FillStyle = FillStyle.FillStyle;
exports.curves = _const.curves;
exports.Graphics = Graphics.Graphics;
exports.GraphicsData = GraphicsData.GraphicsData;
exports.GraphicsGeometry = GraphicsGeometry.GraphicsGeometry;
exports.FillStyle = FillStyle.FillStyle;
exports.LineStyle = LineStyle.LineStyle;
exports.graphicsUtils = graphicsUtils;
//# sourceMappingURL=index.js.map

@@ -0,3 +1,3 @@

import { LINE_CAP, LINE_JOIN } from '../const';
import { FillStyle } from './FillStyle';
import { LINE_JOIN, LINE_CAP } from '../const';
/**

@@ -4,0 +4,0 @@ * Represents the line style for Graphics.

@@ -5,4 +5,4 @@ 'use strict';

var _const = require('../const.js');
var FillStyle = require('./FillStyle.js');
var _const = require('../const.js');

@@ -9,0 +9,0 @@ class LineStyle extends FillStyle.FillStyle {

@@ -15,12 +15,10 @@ interface IArcLikeShape {

/**
* The arcTo() method creates an arc/curve between two tangents on the canvas.
*
* "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google!
* Calculate information of the arc for {@link PIXI.Graphics.arcTo}.
* @private
* @param x1 - The x-coordinate of the beginning of the arc
* @param y1 - The y-coordinate of the beginning of the arc
* @param x2 - The x-coordinate of the end of the arc
* @param y2 - The y-coordinate of the end of the arc
* @param x1 - The x-coordinate of the first control point of the arc
* @param y1 - The y-coordinate of the first control point of the arc
* @param x2 - The x-coordinate of the second control point of the arc
* @param y2 - The y-coordinate of the second control point of the arc
* @param radius - The radius of the arc
* @param points -
* @param points - Collection of points to add to
* @returns - If the arc length is valid, return center of circle, radius and other info otherwise `null`.

@@ -27,0 +25,0 @@ */

@@ -5,4 +5,4 @@ 'use strict';

var core = require('@pixi/core');
var _const = require('../const.js');
var core = require('@pixi/core');

@@ -50,3 +50,3 @@ class ArcUtils {

const sweep = endAngle - startAngle;
const n = _const.GRAPHICS_CURVES._segmentsCount(Math.abs(sweep) * radius, Math.ceil(Math.abs(sweep) / core.PI_2) * 40);
const n = _const.curves._segmentsCount(Math.abs(sweep) * radius, Math.ceil(Math.abs(sweep) / core.PI_2) * 40);
const theta = sweep / (n * 2);

@@ -53,0 +53,0 @@ const theta2 = theta * 2;

@@ -0,3 +1,3 @@

import type { FillStyle } from '../styles/FillStyle';
import type { LineStyle } from '../styles/LineStyle';
import type { FillStyle } from '../styles/FillStyle';
/**

@@ -4,0 +4,0 @@ * A structure to hold interim batch objects for Graphics.

@@ -44,3 +44,3 @@ 'use strict';

points.length -= 2;
const n = _const.GRAPHICS_CURVES._segmentsCount(BezierUtils.curveLength(fromX, fromY, cpX, cpY, cpX2, cpY2, toX, toY));
const n = _const.curves._segmentsCount(BezierUtils.curveLength(fromX, fromY, cpX, cpY, cpX2, cpY2, toX, toY));
let dt = 0;

@@ -47,0 +47,0 @@ let dt2 = 0;

@@ -258,3 +258,3 @@ 'use strict';

const indices = graphicsGeometry.indices;
const eps2 = _const.GRAPHICS_CURVES.epsilon * _const.GRAPHICS_CURVES.epsilon;
const eps2 = _const.curves.epsilon * _const.curves.epsilon;
for (let i = indexStart; i < indexCount + indexStart - 2; ++i) {

@@ -261,0 +261,0 @@ x0 = verts[i * 2];

@@ -6,19 +6,15 @@ /**

*/
import { buildPoly } from './buildPoly';
export { buildPoly };
import { buildCircle } from './buildCircle';
export { buildCircle };
import { buildRectangle } from './buildRectangle';
export { buildRectangle };
import { buildRoundedRectangle } from './buildRoundedRectangle';
export { buildRoundedRectangle };
export * from './buildLine';
import { SHAPES } from '@pixi/core';
import type { BatchDrawCall } from '@pixi/core';
import type { BatchPart } from './BatchPart';
import type { IShapeBuildCommand } from './IShapeBuildCommand';
export * from './ArcUtils';
export * from './BatchPart';
export * from './BezierUtils';
export * from './buildCircle';
export * from './buildLine';
export * from './buildPoly';
export * from './buildRectangle';
export * from './buildRoundedRectangle';
export * from './QuadraticUtils';
export * from './BatchPart';
import type { BatchPart } from './BatchPart';
import { SHAPES } from '@pixi/core';
import type { BatchDrawCall } from '@pixi/core';
import type { IShapeBuildCommand } from './IShapeBuildCommand';
/**

@@ -25,0 +21,0 @@ * Map of fill commands for each shape type.

@@ -5,12 +5,12 @@ 'use strict';

var core = require('@pixi/core');
var buildCircle = require('./buildCircle.js');
var buildPoly = require('./buildPoly.js');
var buildCircle = require('./buildCircle.js');
var buildRectangle = require('./buildRectangle.js');
var buildRoundedRectangle = require('./buildRoundedRectangle.js');
var buildLine = require('./buildLine.js');
var ArcUtils = require('./ArcUtils.js');
var BatchPart = require('./BatchPart.js');
var BezierUtils = require('./BezierUtils.js');
var buildLine = require('./buildLine.js');
var QuadraticUtils = require('./QuadraticUtils.js');
var BatchPart = require('./BatchPart.js');
var core = require('@pixi/core');

@@ -27,11 +27,11 @@ const FILL_COMMANDS = {

exports.buildCircle = buildCircle.buildCircle;
exports.buildPoly = buildPoly.buildPoly;
exports.buildCircle = buildCircle.buildCircle;
exports.buildRectangle = buildRectangle.buildRectangle;
exports.buildRoundedRectangle = buildRoundedRectangle.buildRoundedRectangle;
exports.buildLine = buildLine.buildLine;
exports.ArcUtils = ArcUtils.ArcUtils;
exports.BatchPart = BatchPart.BatchPart;
exports.BezierUtils = BezierUtils.BezierUtils;
exports.buildLine = buildLine.buildLine;
exports.QuadraticUtils = QuadraticUtils.QuadraticUtils;
exports.BatchPart = BatchPart.BatchPart;
exports.BATCH_POOL = BATCH_POOL;

@@ -38,0 +38,0 @@ exports.DRAW_CALL_POOL = DRAW_CALL_POOL;

@@ -26,3 +26,3 @@ 'use strict';

const fromY = points[points.length - 1];
const n = _const.GRAPHICS_CURVES._segmentsCount(QuadraticUtils.curveLength(fromX, fromY, cpX, cpY, toX, toY));
const n = _const.curves._segmentsCount(QuadraticUtils.curveLength(fromX, fromY, cpX, cpY, toX, toY));
let xa = 0;

@@ -29,0 +29,0 @@ let ya = 0;

{
"name": "@pixi/graphics",
"version": "7.1.0-alpha",
"version": "7.1.0",
"main": "lib/index.js",

@@ -25,7 +25,7 @@ "module": "lib/index.mjs",

"homepage": "http://pixijs.com/",
"bugs": "https://github.com/pixijs/pixi.js/issues",
"bugs": "https://github.com/pixijs/pixijs/issues",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/pixijs/pixi.js.git"
"url": "https://github.com/pixijs/pixijs.git"
},

@@ -44,3 +44,3 @@ "publishConfig": {

],
"gitHead": "0fb26a500c738cb550da277c112d15d9dd3f87b6"
"gitHead": "4079e92895ecb692afe9f0b15d3e48ee40852ada"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc