(width, height)
| 1772 | // --------------------------------------------------------------------- |
| 1773 | |
| 1774 | var gifImage = function (width, height) { |
| 1775 | var _width = width |
| 1776 | var _height = height |
| 1777 | var _data = new Array(width * height) |
| 1778 | |
| 1779 | var _this = {} |
| 1780 | |
| 1781 | _this.setPixel = function (x, y, pixel) { |
| 1782 | _data[y * _width + x] = pixel |
| 1783 | } |
| 1784 | |
| 1785 | _this.write = function (out) { |
| 1786 | // --------------------------------- |
| 1787 | // GIF Signature |
| 1788 | |
| 1789 | out.writeString('GIF87a') |
| 1790 | |
| 1791 | // --------------------------------- |
| 1792 | // Screen Descriptor |
| 1793 | |
| 1794 | out.writeShort(_width) |
| 1795 | out.writeShort(_height) |
| 1796 | |
| 1797 | out.writeByte(0x80) // 2bit |
| 1798 | out.writeByte(0) |
| 1799 | out.writeByte(0) |
| 1800 | |
| 1801 | // --------------------------------- |
| 1802 | // Global Color Map |
| 1803 | |
| 1804 | // black |
| 1805 | out.writeByte(0x00) |
| 1806 | out.writeByte(0x00) |
| 1807 | out.writeByte(0x00) |
| 1808 | |
| 1809 | // white |
| 1810 | out.writeByte(0xff) |
| 1811 | out.writeByte(0xff) |
| 1812 | out.writeByte(0xff) |
| 1813 | |
| 1814 | // --------------------------------- |
| 1815 | // Image Descriptor |
| 1816 | |
| 1817 | out.writeString(',') |
| 1818 | out.writeShort(0) |
| 1819 | out.writeShort(0) |
| 1820 | out.writeShort(_width) |
| 1821 | out.writeShort(_height) |
| 1822 | out.writeByte(0) |
| 1823 | |
| 1824 | // --------------------------------- |
| 1825 | // Local Color Map |
| 1826 | |
| 1827 | // --------------------------------- |
| 1828 | // Raster Data |
| 1829 | |
| 1830 | var lzwMinCodeSize = 2 |
| 1831 | var raster = getLZWRaster(lzwMinCodeSize) |
no test coverage detected