Skip to content

Commit

Permalink
Disable smoothing option
Browse files Browse the repository at this point in the history
  • Loading branch information
odrick committed Mar 3, 2020
1 parent d74d610 commit 20b6dda
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/client/resources/static/localization/de.csv
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ DELETE;Löschen
DELETE_TITLE;Löscht das ausgewählte Bild
REPLACE_FILES_PROMPT;Bestehende Dateien ersetzen?
DISPLAY_OUTLINES;Umriss:
DISABLE_SMOOTHING;Glättung deaktivieren
DISABLE_SMOOTHING_TITLE;Deaktivieren Sie die Bildglättung
SCALE;Skalierung:
SHOW_SPRITES;Animationen
SPRITE_NAME;Sprite-Name:
Expand Down
2 changes: 2 additions & 0 deletions src/client/resources/static/localization/en.csv
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ TINIFY_TITLE;Tinify using https://tinypng.com
TINIFY;Tinify
TINIFY_KEY_TITLE;TinyPNG key https://tinypng.com/developers
TINIFY_KEY;TinyPNG key
DISABLE_SMOOTHING;Disable smoothing
DISABLE_SMOOTHING_TITLE;Disable image smoothing
SCALE;Scale:
SCALE_TITLE;Base texture scale
FILTER;Filter:
Expand Down
2 changes: 2 additions & 0 deletions src/client/resources/static/localization/es.csv
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ TINIFY_TITLE;Tinify usando https://tinypng.com
TINIFY;Tinify
TINIFY_KEY_TITLE;TinyPNG key https://tinypng.com/developers
TINIFY_KEY;TinyPNG key
DISABLE_SMOOTHING;Deshabilitar suavizado
DISABLE_SMOOTHING_TITLE;Deshabilitar suavizado de imagen
SCALE;Escala:
SCALE_TITLE;Escala de la textura base
FILTER;Filtro:
Expand Down
2 changes: 2 additions & 0 deletions src/client/resources/static/localization/ru.csv
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ TINIFY_TITLE;Оптимизировать, используя TinyPNG https://ti
TINIFY;Оптимизировать TinyPNG
TINIFY_KEY_TITLE;Ключ TinyPNG https://tinypng.com/developers
TINIFY_KEY;Ключ TinyPNG
DISABLE_SMOOTHING;Отключить сглаживание
DISABLE_SMOOTHING_TITLE;Отключить сглаживание изображения
SCALE;Масштаб:
SCALE_TITLE;Текущий масштаб текстуры. Влияет на пересчет размеров и координат при экспорте
FILTER;Фильтр:
Expand Down
2 changes: 2 additions & 0 deletions src/client/resources/static/localization/zh-cn.csv
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ TINIFY_TITLE;Tinify 用法 https://tinypng.com(压缩png)
TINIFY;Tinify
TINIFY_KEY_TITLE;TinyPNG key https://tinypng.com/developers
TINIFY_KEY;TinyPNG key
DISABLE_SMOOTHING;禁用平滑
DISABLE_SMOOTHING_TITLE;禁用图像平滑
SCALE;放大:
SCALE_TITLE;基础纹理缩放
FILTER;滤镜:
Expand Down
7 changes: 7 additions & 0 deletions src/client/ui/PackProperties.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ class PackProperties extends React.Component {
data.tinify = ReactDOM.findDOMNode(this.refs.tinify).checked;
data.tinifyKey = ReactDOM.findDOMNode(this.refs.tinifyKey).value;
data.scale = Number(ReactDOM.findDOMNode(this.refs.scale).value);
data.disableSmoothing = ReactDOM.findDOMNode(this.refs.disableSmoothing).checked;
data.filter = ReactDOM.findDOMNode(this.refs.filter).value;
data.exporter = ReactDOM.findDOMNode(this.refs.exporter).value;
data.fileName = ReactDOM.findDOMNode(this.refs.fileName).value;
Expand Down Expand Up @@ -161,6 +162,7 @@ class PackProperties extends React.Component {
ReactDOM.findDOMNode(this.refs.tinify).checked = this.packOptions.tinify;
ReactDOM.findDOMNode(this.refs.tinifyKey).value = this.packOptions.tinifyKey;
ReactDOM.findDOMNode(this.refs.scale).value = Number(this.packOptions.scale);
ReactDOM.findDOMNode(this.refs.disableSmoothing).checked = this.packOptions.disableSmoothing;
ReactDOM.findDOMNode(this.refs.filter).value = this.packOptions.filter;
ReactDOM.findDOMNode(this.refs.exporter).value = this.packOptions.exporter;
ReactDOM.findDOMNode(this.refs.fileName).value = this.packOptions.fileName;
Expand Down Expand Up @@ -308,6 +310,11 @@ class PackProperties extends React.Component {
<td><input ref="tinifyKey" type="text" className="border-color-gray" defaultValue={this.packOptions.tinifyKey} onBlur={this.onExporterPropChanged} /></td>
<td></td>
</tr>
<tr title={I18.f("DISABLE_SMOOTHING_TITLE")}>
<td>{I18.f("DISABLE_SMOOTHING")}</td>
<td><input ref="disableSmoothing" type="checkbox" className="border-color-gray" onChange={this.onPropChanged} defaultChecked={this.packOptions.disableSmoothing ? "checked" : ""} /></td>
<td></td>
</tr>
<tr title={I18.f("SCALE_TITLE")}>
<td>{I18.f("SCALE")}</td>
<td><input ref="scale" type="number" min="0" className="border-color-gray" defaultValue={this.packOptions.scale} onBlur={this.onPropChanged}/></td>
Expand Down
5 changes: 5 additions & 0 deletions src/client/utils/TextureRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ class TextureRenderer {
render(data, options={}) {
let ctx = this.buffer.getContext("2d");

let imageSmoothingEnabled = ctx.imageSmoothingEnabled;
ctx.imageSmoothingEnabled = !options.disableSmoothing;

let { width, height } = TextureRenderer.getSize(data, options);

this.width = width;
Expand All @@ -75,6 +78,8 @@ class TextureRenderer {
for(let item of data) {
this.renderItem(ctx, item, options);
}

ctx.imageSmoothingEnabled = imageSmoothingEnabled;
}

scale(val) {
Expand Down

0 comments on commit 20b6dda

Please sign in to comment.