A pixel art painter geared specifically at NES pixel art. Includes export for .chr binary file as well as palette and namespace data.
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

62 行
1.3KB

  1. import Utils from "/app/js/common/Utils.js"
  2. export default class ISurface{
  3. constructor(){
  4. this.__default_pi = [
  5. "#080808",
  6. "#343434",
  7. "#a2a2a2",
  8. "#efefef",
  9. "#666666" // Out of bounds color.
  10. ];
  11. }
  12. get width(){return 0;}
  13. get height(){return 0;}
  14. get length(){return 0;}
  15. get coloridx(){
  16. return new Proxy(this, {
  17. get: function(obj, prop){
  18. if (prop === "length")
  19. return 0;
  20. if (!Utils.isInt(prop))
  21. throw new TypeError("Expected integer index.");
  22. if (prop < 0)
  23. throw new RangeError("Index is out of bounds.");
  24. return obj.__default_pi[4];
  25. },
  26. set: function(obj, prop, value){
  27. if (!Utils.isInt(prop))
  28. throw new TypeError("Expected integer index.");
  29. if (prop < 0)
  30. throw new RangeError("Index out of bounds.");
  31. if (!Utils.isInt(value))
  32. throw new TypeError("Color index expected to be an integer.");
  33. if (value < 0 || value >= 4)
  34. throw new RangeError("Color index is out of bounds.");
  35. return true;
  36. }
  37. });
  38. }
  39. copy(b){return this;}
  40. clone(){return new ISurface();}
  41. getColor(x, y){
  42. return this.__default_pi[4];
  43. }
  44. getColorIndex(x, y){
  45. return {pi:-1, ci:-1};
  46. }
  47. setColorIndex(x, y, ci, pi){
  48. return this;
  49. }
  50. }