/*
Copyright (C) 2010, Heikki Salo
All rights reserved.
Distributed under the BSD license:
http://www.opensource.org/licenses/bsd-license.php
*/
#ifndef DP_TEXTURE_HPP
#define DP_TEXTURE_HPP
#include "stdafx.h"
#include "DPBase.hpp"
class DPTexture : DPBase {
public:
~DPTexture();
DPTexture(const char*, python::object&, UINT, UINT, UINT, UINT, UINT);
DPTexture(ID3D11Texture2D*);
void release();
void resolve(DPTexture&);
void copy(DPTexture&);
void copyRegion(UINT, UINT, UINT, UINT, UINT, UINT, DPTexture&, UINT, UINT);
void filter(UINT);
void save(const char*, UINT format);
python::object size();
UINT itemSize();
python::object description();
python::str getItemFormat();
void map(UINT, UINT);
void unmap();
python::object getitem(python::object&);
void setitem(python::object&, python::object&);
python::object getorsetitem(python::object&, python::object*, bool);
ID3D11Texture2D* getTexture() { return texture; }
bool isMapped() { return mapData.pData != 0; }
bool isWritable();
D3D11_MAPPED_SUBRESOURCE getMapData() { return mapData; }
private:
ID3D11Texture2D* texture;
D3D11_MAPPED_SUBRESOURCE mapData;
D3D11_MAP mapType;
UINT mappedSubresource;
bool pointInside(UINT x, UINT y);
void checkAccessRW(bool, bool);
};
#ifdef DP_BUFFER_SUPPORT
extern "C" int DPTextureGetBuffer(PyObject*, Py_buffer*, int);
extern "C" void DPTextureReleaseBuffer(PyObject*, Py_buffer*);
#endif
#endif