|
|
|
|
|
|
|
|
throw new TypeError("Expected integer index."); |
|
|
throw new TypeError("Expected integer index."); |
|
|
prop = parseInt(prop); |
|
|
prop = parseInt(prop); |
|
|
if (prop < 0 || prop >= len) |
|
|
if (prop < 0 || prop >= len) |
|
|
return this.__default_pi[4]; |
|
|
|
|
|
|
|
|
return NESPalette.Default[4]; |
|
|
|
|
|
|
|
|
var res = LRIdx2TileIdxCo(prop); |
|
|
var res = LRIdx2TileIdxCo(prop); |
|
|
var list = (res.lid === 0) ? obj.__LP : obj.__RP; |
|
|
var list = (res.lid === 0) ? obj.__LP : obj.__RP; |
|
|
|
|
|
|
|
|
if (this.__palette !== null){ |
|
|
if (this.__palette !== null){ |
|
|
return this.__palette.get_palette_color(pi, ci); |
|
|
return this.__palette.get_palette_color(pi, ci); |
|
|
} |
|
|
} |
|
|
return this.__default_pi[ci]; |
|
|
|
|
|
|
|
|
return NESPalette.Default[ci]; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
getColorIndex(x, y){ |
|
|
getColorIndex(x, y){ |
|
|
|
|
|
|
|
|
var list = (res.lid === 0) ? this.__LP : this.__RP; |
|
|
var list = (res.lid === 0) ? this.__LP : this.__RP; |
|
|
return { |
|
|
return { |
|
|
pi: list[res.index].paletteIndex, |
|
|
pi: list[res.index].paletteIndex, |
|
|
ci: list[res.index].getPixelIndex(res.x, res.y); |
|
|
|
|
|
|
|
|
ci: list[res.index].getPixelIndex(res.x, res.y) |
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
|
|
|
|
|