contract PixelBase is PixelAuthority {
    /*** EVENTS ***/

    /// @dev Transfer event as defined in current draft of ERC721. Emitted every time a Pixel
    ///  ownership is assigned.
    event Transfer(address from, address to, uint256 tokenId);

    /*** CONSTANTS ***/
    uint32 public WIDTH = 1000;
    uint32 public HEIGHT = 1000;

    /*** STORAGE ***/
    /// @dev A mapping from pixel ids to the address that owns them. A pixel address of 0 means,
    /// that the pixel can still be bought.
    mapping (uint256 => address) public pixelIndexToOwner;
    /// Address that is approved to change ownship
    mapping (uint256 => address) public pixelIndexToApproved;
    /// Stores the color of an pixel, indexed by pixelid
    mapping (uint256 => uint32) public colors;
    // @dev A mapping from owner address to count of tokens that address owns.
    //  Used internally inside balanceOf() to resolve ownership count.
    mapping (address => uint256) ownershipTokenCount;

    // Internal utility functions: These functions all assume that their input arguments
    // are valid. We leave it to public methods to sanitize their inputs and follow
    // the required logic.

    /// @dev Assigns ownership of a specific Pixel to an address.
    function _transfer(address _from, address _to, uint256 _tokenId) internal {
        // Can no overflowe since the number of Pixels is capped.
        // transfer ownership
        ownershipTokenCount[_to]++;
        pixelIndexToOwner[_tokenId] = _to;
        if (_from != address(0)) {
            ownershipTokenCount[_from]--;
            delete pixelIndexToApproved[_tokenId];
        }
        // Emit the transfer event.
        Transfer(_from, _to, _tokenId);
    }

    /// @dev Checks if a given address is the current owner of a particular Pixel.
    /// @param _claimant the address we are validating against.
    /// @param _tokenId Pixel id
    function _owns(address _claimant, uint256 _tokenId) internal view returns (bool) {
        return pixelIndexToOwner[_tokenId] == _claimant;
    }

    /// @dev Checks if a given address currently has transferApproval for a particular Pixel.
    /// @param _claimant the address we are confirming pixel is approved for.
    /// @param _tokenId pixel id, only valid when > 0
    function _approvedFor(address _claimant, uint256 _tokenId) internal view returns (bool) {
        return pixelIndexToApproved[_tokenId] == _claimant;
    }
}
/// @title Base contract for PixelCoins. Holds all common structs, events and base variables.
/// @author Oliver Schneider <info@pixelcoins.io> (https://pixelcoins.io)
/// @dev See the PixelCore contract documentation to understand how the various contract facets are arranged.
function _approvedFor(address _claimant, uint256 _tokenId) internal view returns (bool) {
    return pixelIndexToApproved[_tokenId] == _claimant;
}

/// @dev Checks if a given address currently has transferApproval for a particular Pixel.
/// @param _claimant the address we are confirming pixel is approved for.
/// @param _tokenId pixel id, only valid when > 0