Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
1c26415
port Renderer to es6 class, not done.
asukaminato0721 Mar 23, 2023
384e0eb
Color && Renderer2D to class
asukaminato0721 Mar 23, 2023
a36da0c
RendererGL to es6 class
asukaminato0721 Mar 23, 2023
fc29d0c
reduce modified lines
asukaminato0721 Mar 28, 2023
655eaa3
add four names
asukaminato0721 Mar 30, 2023
617ab00
Merge branch 'main' into to-es6
asukaminato0721 Apr 6, 2023
0b76897
port ImageInfos, FontInfo, Cubic to class
asukaminato0721 Apr 6, 2023
45f2315
port manual test to class
asukaminato0721 Apr 6, 2023
6a78263
Merge branch 'main' into to-es6
asukaminato0721 May 8, 2023
ac0b531
fix lint
asukaminato0721 May 8, 2023
f63dab0
Merge branch 'main' into to-es6
asukaminato0721 May 21, 2023
51a2ff9
fix ci
asukaminato0721 May 21, 2023
07fa7e6
revert some
asukaminato0721 May 21, 2023
9704b38
add Missing semicolon.
asukaminato0721 May 21, 2023
52f7d43
Merge branch 'processing:main' into to-es6
asukaminato0721 May 30, 2023
4ce53af
ColorConversion to simpler obj.
asukaminato0721 May 30, 2023
20a504a
fix ci
asukaminato0721 May 30, 2023
d505d94
Color to all es6
asukaminato0721 May 30, 2023
cfc1f58
fix ci
asukaminato0721 May 30, 2023
cd1094a
try fix ci
asukaminato0721 May 30, 2023
b170a20
MediaElement, File to class
asukaminato0721 May 31, 2023
48c65b7
fix eslint
asukaminato0721 May 31, 2023
21847cc
TypedDict, StringDict, NumberDict to class
asukaminato0721 May 31, 2023
699de84
finish rewrite MediaElement
asukaminato0721 May 31, 2023
f841c83
fix ci
asukaminato0721 May 31, 2023
346a560
Camera to class
asukaminato0721 May 31, 2023
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
433 changes: 216 additions & 217 deletions src/color/color_conversion.js

Large diffs are not rendered by default.

1,268 changes: 632 additions & 636 deletions src/color/p5.Color.js

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions src/core/p5.Renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import * as constants from '../core/constants';
* @param {p5} [pInst] pointer to p5 instance
* @param {Boolean} [isMainCanvas] whether we're using it as main canvas
*/
p5.Renderer = function(elt, pInst, isMainCanvas) {
p5.Renderer = function (elt, pInst, isMainCanvas) {
p5.Element.call(this, elt, pInst);
this.canvas = elt;
this._pixelsState = pInst;
Expand Down Expand Up @@ -63,7 +63,7 @@ p5.Renderer.prototype = Object.create(p5.Element.prototype);

// the renderer should return a 'style' object that it wishes to
// store on the push stack.
p5.Renderer.prototype.push = function() {
p5.Renderer.prototype.push = function () {
return {
properties: {
_doStroke: this._doStroke,
Expand All @@ -89,7 +89,7 @@ p5.Renderer.prototype.push = function() {
// a pop() operation is in progress
// the renderer is passed the 'style' object that it returned
// from its push() method.
p5.Renderer.prototype.pop = function(style) {
p5.Renderer.prototype.pop = function (style) {
if (style.properties) {
// copy the style properties back into the renderer
Object.assign(this, style.properties);
Expand All @@ -99,7 +99,7 @@ p5.Renderer.prototype.pop = function(style) {
/**
* Resize our canvas element.
*/
p5.Renderer.prototype.resize = function(w, h) {
p5.Renderer.prototype.resize = function (w, h) {
this.width = w;
this.height = h;
this.elt.width = w * this._pInst._pixelDensity;
Expand All @@ -112,7 +112,7 @@ p5.Renderer.prototype.resize = function(w, h) {
}
};

p5.Renderer.prototype.get = function(x, y, w, h) {
p5.Renderer.prototype.get = function (x, y, w, h) {
const pixelsState = this._pixelsState;
const pd = pixelsState._pixelDensity;
const canvas = this.canvas;
Expand Down Expand Up @@ -145,7 +145,7 @@ p5.Renderer.prototype.get = function(x, y, w, h) {
return region;
};

p5.Renderer.prototype.textLeading = function(l) {
p5.Renderer.prototype.textLeading = function (l) {
if (typeof l === 'number') {
this._setProperty('_leadingSet', true);
this._setProperty('_textLeading', l);
Expand All @@ -155,7 +155,7 @@ p5.Renderer.prototype.textLeading = function(l) {
return this._textLeading;
};

p5.Renderer.prototype.textSize = function(s) {
p5.Renderer.prototype.textSize = function (s) {
if (typeof s === 'number') {
this._setProperty('_textSize', s);
if (!this._leadingSet) {
Expand All @@ -168,7 +168,7 @@ p5.Renderer.prototype.textSize = function(s) {
return this._textSize;
};

p5.Renderer.prototype.textStyle = function(s) {
p5.Renderer.prototype.textStyle = function (s) {
if (s) {
if (
s === constants.NORMAL ||
Expand All @@ -185,21 +185,21 @@ p5.Renderer.prototype.textStyle = function(s) {
return this._textStyle;
};

p5.Renderer.prototype.textAscent = function() {
p5.Renderer.prototype.textAscent = function () {
if (this._textAscent === null) {
this._updateTextMetrics();
}
return this._textAscent;
};

p5.Renderer.prototype.textDescent = function() {
p5.Renderer.prototype.textDescent = function () {
if (this._textDescent === null) {
this._updateTextMetrics();
}
return this._textDescent;
};

p5.Renderer.prototype.textAlign = function(h, v) {
p5.Renderer.prototype.textAlign = function (h, v) {
if (typeof h !== 'undefined') {
this._setProperty('_textAlign', h);

Expand All @@ -216,12 +216,12 @@ p5.Renderer.prototype.textAlign = function(h, v) {
}
};

p5.Renderer.prototype.textWrap = function(wrapStyle) {
p5.Renderer.prototype.textWrap = function (wrapStyle) {
this._setProperty('_textWrap', wrapStyle);
return this._textWrap;
};

p5.Renderer.prototype.text = function(str, x, y, maxWidth, maxHeight) {
p5.Renderer.prototype.text = function (str, x, y, maxWidth, maxHeight) {
const p = this._pInst;
const textWrapStyle = this._textWrap;

Expand Down Expand Up @@ -452,18 +452,18 @@ p5.Renderer.prototype.text = function(str, x, y, maxWidth, maxHeight) {
return p;
};

p5.Renderer.prototype._applyDefaults = function() {
p5.Renderer.prototype._applyDefaults = function () {
return this;
};

/**
* Helper function to check font type (system or otf)
*/
p5.Renderer.prototype._isOpenType = function(f = this._textFont) {
p5.Renderer.prototype._isOpenType = function (f = this._textFont) {
return typeof f === 'object' && f.font && f.font.supported;
};

p5.Renderer.prototype._updateTextMetrics = function() {
p5.Renderer.prototype._updateTextMetrics = function () {
if (this._isOpenType()) {
this._setProperty('_textAscent', this._textFont._textAscent());
this._setProperty('_textDescent', this._textFont._textDescent());
Expand Down
Loading