2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2008-04-16 22:40:48 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
2007-06-25 19:50:25 +00:00
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
2008-04-16 22:40:48 +00:00
|
|
|
* of the License, or (at your option) any later version.
|
2007-06-25 19:50:25 +00:00
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2007-06-25 19:50:25 +00:00
|
|
|
*
|
2011-05-07 20:53:49 +00:00
|
|
|
* Contributors: Amorilia (amorilia@users.sourceforge.net)
|
2007-06-25 19:50:25 +00:00
|
|
|
*
|
2008-04-16 22:40:48 +00:00
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
2007-06-25 19:50:25 +00:00
|
|
|
*/
|
|
|
|
|
|
2011-02-27 20:23:21 +00:00
|
|
|
/** \file blender/imbuf/intern/dds/Image.h
|
|
|
|
|
* \ingroup imbdds
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
2007-06-25 19:50:25 +00:00
|
|
|
/*
|
|
|
|
|
* This file is based on a similar file from the NVIDIA texture tools
|
|
|
|
|
* (http://nvidia-texture-tools.googlecode.com/)
|
|
|
|
|
*
|
|
|
|
|
* Original license from NVIDIA follows.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
// This code is in the public domain -- castanyo@yahoo.es
|
|
|
|
|
|
2012-02-17 18:59:41 +00:00
|
|
|
#ifndef __IMAGE_H__
|
|
|
|
|
#define __IMAGE_H__
|
2007-06-25 19:50:25 +00:00
|
|
|
|
This is patch: [#7975] imbuf for DDS textures: improved read support and a few bugs fixed
Kent
Notes From the author:
The attached patch syncs the DDS code in Blender with the latest revision
(324) of the nvidia texture tools. This fixes a few minor issues and adds
support for a more types of DDS textures, in particular uncompressed textures
that don't have the standard 16, 24, or 32 bits per pixel.
Note: I have started using the nvidia texture tools convention for naming
integer types (uint, uint16, uint8, uint64 etc.) because doing so makes it
much easier to merge patches from upstream. Since the code is compiled
separately from the rest of Blender, this likely does not pose a problem.
However, if there turns out to be a good reason for avoiding those nvidia type
names from upstream, I'd be happy to fix it.
Regards,
Amorilia
2007-12-26 21:46:30 +00:00
|
|
|
#include <Common.h>
|
2007-06-25 19:50:25 +00:00
|
|
|
#include <Color.h>
|
|
|
|
|
|
|
|
|
|
/// 32 bit RGBA image.
|
|
|
|
|
class Image
|
|
|
|
|
{
|
|
|
|
|
public:
|
2018-06-17 17:04:54 +02:00
|
|
|
|
|
|
|
|
enum Format
|
2007-06-25 19:50:25 +00:00
|
|
|
{
|
|
|
|
|
Format_RGB,
|
|
|
|
|
Format_ARGB,
|
|
|
|
|
};
|
2018-06-17 17:04:54 +02:00
|
|
|
|
2007-06-25 19:50:25 +00:00
|
|
|
Image();
|
|
|
|
|
~Image();
|
2018-06-17 17:04:54 +02:00
|
|
|
|
This is patch: [#7975] imbuf for DDS textures: improved read support and a few bugs fixed
Kent
Notes From the author:
The attached patch syncs the DDS code in Blender with the latest revision
(324) of the nvidia texture tools. This fixes a few minor issues and adds
support for a more types of DDS textures, in particular uncompressed textures
that don't have the standard 16, 24, or 32 bits per pixel.
Note: I have started using the nvidia texture tools convention for naming
integer types (uint, uint16, uint8, uint64 etc.) because doing so makes it
much easier to merge patches from upstream. Since the code is compiled
separately from the rest of Blender, this likely does not pose a problem.
However, if there turns out to be a good reason for avoiding those nvidia type
names from upstream, I'd be happy to fix it.
Regards,
Amorilia
2007-12-26 21:46:30 +00:00
|
|
|
void allocate(uint w, uint h);
|
2012-03-09 18:28:30 +00:00
|
|
|
#if 0
|
2013-03-29 06:25:22 +00:00
|
|
|
bool load(const char *name);
|
2018-06-17 17:04:54 +02:00
|
|
|
|
2013-03-29 06:25:22 +00:00
|
|
|
void wrap(void *data, uint w, uint h);
|
2007-06-25 19:50:25 +00:00
|
|
|
void unwrap();
|
2012-03-09 18:28:30 +00:00
|
|
|
#endif
|
2018-06-17 17:04:54 +02:00
|
|
|
|
This is patch: [#7975] imbuf for DDS textures: improved read support and a few bugs fixed
Kent
Notes From the author:
The attached patch syncs the DDS code in Blender with the latest revision
(324) of the nvidia texture tools. This fixes a few minor issues and adds
support for a more types of DDS textures, in particular uncompressed textures
that don't have the standard 16, 24, or 32 bits per pixel.
Note: I have started using the nvidia texture tools convention for naming
integer types (uint, uint16, uint8, uint64 etc.) because doing so makes it
much easier to merge patches from upstream. Since the code is compiled
separately from the rest of Blender, this likely does not pose a problem.
However, if there turns out to be a good reason for avoiding those nvidia type
names from upstream, I'd be happy to fix it.
Regards,
Amorilia
2007-12-26 21:46:30 +00:00
|
|
|
uint width() const;
|
|
|
|
|
uint height() const;
|
2018-06-17 17:04:54 +02:00
|
|
|
|
2018-10-11 08:49:28 +11:00
|
|
|
const Color32 *scanline(uint h) const;
|
|
|
|
|
Color32 *scanline(uint h);
|
2018-06-17 17:04:54 +02:00
|
|
|
|
2018-10-11 08:49:28 +11:00
|
|
|
const Color32 *pixels() const;
|
|
|
|
|
Color32 *pixels();
|
2018-06-17 17:04:54 +02:00
|
|
|
|
This is patch: [#7975] imbuf for DDS textures: improved read support and a few bugs fixed
Kent
Notes From the author:
The attached patch syncs the DDS code in Blender with the latest revision
(324) of the nvidia texture tools. This fixes a few minor issues and adds
support for a more types of DDS textures, in particular uncompressed textures
that don't have the standard 16, 24, or 32 bits per pixel.
Note: I have started using the nvidia texture tools convention for naming
integer types (uint, uint16, uint8, uint64 etc.) because doing so makes it
much easier to merge patches from upstream. Since the code is compiled
separately from the rest of Blender, this likely does not pose a problem.
However, if there turns out to be a good reason for avoiding those nvidia type
names from upstream, I'd be happy to fix it.
Regards,
Amorilia
2007-12-26 21:46:30 +00:00
|
|
|
const Color32 & pixel(uint idx) const;
|
|
|
|
|
Color32 & pixel(uint idx);
|
2018-06-17 17:04:54 +02:00
|
|
|
|
This is patch: [#7975] imbuf for DDS textures: improved read support and a few bugs fixed
Kent
Notes From the author:
The attached patch syncs the DDS code in Blender with the latest revision
(324) of the nvidia texture tools. This fixes a few minor issues and adds
support for a more types of DDS textures, in particular uncompressed textures
that don't have the standard 16, 24, or 32 bits per pixel.
Note: I have started using the nvidia texture tools convention for naming
integer types (uint, uint16, uint8, uint64 etc.) because doing so makes it
much easier to merge patches from upstream. Since the code is compiled
separately from the rest of Blender, this likely does not pose a problem.
However, if there turns out to be a good reason for avoiding those nvidia type
names from upstream, I'd be happy to fix it.
Regards,
Amorilia
2007-12-26 21:46:30 +00:00
|
|
|
const Color32 & pixel(uint x, uint y) const;
|
|
|
|
|
Color32 & pixel(uint x, uint y);
|
2018-06-17 17:04:54 +02:00
|
|
|
|
2007-06-25 19:50:25 +00:00
|
|
|
Format format() const;
|
|
|
|
|
void setFormat(Format f);
|
2018-06-17 17:04:54 +02:00
|
|
|
|
2007-06-25 19:50:25 +00:00
|
|
|
private:
|
|
|
|
|
void free();
|
2018-06-17 17:04:54 +02:00
|
|
|
|
2007-06-25 19:50:25 +00:00
|
|
|
private:
|
This is patch: [#7975] imbuf for DDS textures: improved read support and a few bugs fixed
Kent
Notes From the author:
The attached patch syncs the DDS code in Blender with the latest revision
(324) of the nvidia texture tools. This fixes a few minor issues and adds
support for a more types of DDS textures, in particular uncompressed textures
that don't have the standard 16, 24, or 32 bits per pixel.
Note: I have started using the nvidia texture tools convention for naming
integer types (uint, uint16, uint8, uint64 etc.) because doing so makes it
much easier to merge patches from upstream. Since the code is compiled
separately from the rest of Blender, this likely does not pose a problem.
However, if there turns out to be a good reason for avoiding those nvidia type
names from upstream, I'd be happy to fix it.
Regards,
Amorilia
2007-12-26 21:46:30 +00:00
|
|
|
uint m_width;
|
|
|
|
|
uint m_height;
|
2007-06-25 19:50:25 +00:00
|
|
|
Format m_format;
|
2018-10-11 08:49:28 +11:00
|
|
|
Color32 *m_data;
|
2007-06-25 19:50:25 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
This is patch: [#7975] imbuf for DDS textures: improved read support and a few bugs fixed
Kent
Notes From the author:
The attached patch syncs the DDS code in Blender with the latest revision
(324) of the nvidia texture tools. This fixes a few minor issues and adds
support for a more types of DDS textures, in particular uncompressed textures
that don't have the standard 16, 24, or 32 bits per pixel.
Note: I have started using the nvidia texture tools convention for naming
integer types (uint, uint16, uint8, uint64 etc.) because doing so makes it
much easier to merge patches from upstream. Since the code is compiled
separately from the rest of Blender, this likely does not pose a problem.
However, if there turns out to be a good reason for avoiding those nvidia type
names from upstream, I'd be happy to fix it.
Regards,
Amorilia
2007-12-26 21:46:30 +00:00
|
|
|
inline const Color32 & Image::pixel(uint x, uint y) const
|
2007-06-25 19:50:25 +00:00
|
|
|
{
|
|
|
|
|
return pixel(y * width() + x);
|
|
|
|
|
}
|
|
|
|
|
|
This is patch: [#7975] imbuf for DDS textures: improved read support and a few bugs fixed
Kent
Notes From the author:
The attached patch syncs the DDS code in Blender with the latest revision
(324) of the nvidia texture tools. This fixes a few minor issues and adds
support for a more types of DDS textures, in particular uncompressed textures
that don't have the standard 16, 24, or 32 bits per pixel.
Note: I have started using the nvidia texture tools convention for naming
integer types (uint, uint16, uint8, uint64 etc.) because doing so makes it
much easier to merge patches from upstream. Since the code is compiled
separately from the rest of Blender, this likely does not pose a problem.
However, if there turns out to be a good reason for avoiding those nvidia type
names from upstream, I'd be happy to fix it.
Regards,
Amorilia
2007-12-26 21:46:30 +00:00
|
|
|
inline Color32 & Image::pixel(uint x, uint y)
|
2007-06-25 19:50:25 +00:00
|
|
|
{
|
|
|
|
|
return pixel(y * width() + x);
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:36:42 +00:00
|
|
|
#endif /* __IMAGE_H__ */
|