[client] add linux taskbar icon

This commit is contained in:
2019-03-14 22:37:28 +03:00
parent 0f5cf7fdc5
commit f09e70c5f8
3 changed files with 30 additions and 0 deletions

View File

@@ -32,6 +32,9 @@ class Client {
L.d(TAG, 'Debug: ${Const.DEBUG}'); L.d(TAG, 'Debug: ${Const.DEBUG}');
L.i(TAG, 'Version: ${Const.VERSION}'); L.i(TAG, 'Version: ${Const.VERSION}');
L.i(TAG, 'Build: ${Const.BUILD}'); L.i(TAG, 'Build: ${Const.BUILD}');
#if linux
LinuxIcon.apply();
#end
Style.register(); Style.register();
var view:ClientView = new ClientView(); var view:ClientView = new ClientView();
Root.bind(view); Root.bind(view);

View File

@@ -0,0 +1,27 @@
package ru.m.tankz;
import flash.display.BitmapData;
import flash.filters.ColorMatrixFilter;
import flash.geom.Point;
import flash.Lib;
import openfl.Assets;
class LinuxIcon {
private static function prepareIcon(bitmap:BitmapData):BitmapData {
var matrix:Array<Float> = [];
matrix = matrix.concat([0, 0, 1, 0, 0]);
matrix = matrix.concat([0, 1, 0, 0, 0]);
matrix = matrix.concat([1, 0, 0, 0, 0]);
matrix = matrix.concat([0, 0, 0, 1, 0]);
var cmf:ColorMatrixFilter = new ColorMatrixFilter(matrix);
var bitmap:BitmapData = bitmap.clone();
bitmap.applyFilter(bitmap, bitmap.rect, new Point(0, 0), cmf);
return bitmap;
}
public static function apply() {
var icon = Assets.getBitmapData("resources/icon.png");
Lib.current.stage.window.setIcon(prepareIcon(icon).image);
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 10 KiB