FasTC/IO/config/ImageWriter.h.in

77 lines
2 KiB
C
Raw Normal View History

2016-08-17 23:49:13 +00:00
// Copyright 2016 The University of North Carolina at Chapel Hill
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Please send all BUG REPORTS to <pavel@cs.unc.edu>.
// <http://gamma.cs.unc.edu/FasTC/>
2012-11-15 16:51:55 +00:00
2012-10-20 22:22:29 +00:00
#ifndef _IMAGE_WRITER_H_
#define _IMAGE_WRITER_H_
#include "FasTC/TexCompTypes.h"
#include "FasTC/ImageFileFormat.h"
2012-10-20 22:22:29 +00:00
namespace FasTC {
class Pixel;
}
2012-10-20 22:22:29 +00:00
class ImageWriter {
protected:
const FasTC::Pixel *m_Pixels;
2013-01-28 21:42:11 +00:00
uint32 m_RawFileDataSz;
uint8 *m_RawFileData;
2012-10-20 22:22:29 +00:00
uint32 m_Width;
uint32 m_Height;
ImageWriter(const int width, const int height, const FasTC::Pixel *rawData)
: m_Pixels(rawData)
2013-01-28 21:42:11 +00:00
, m_RawFileDataSz(256)
, m_RawFileData(new uint8[m_RawFileDataSz])
2012-10-20 22:22:29 +00:00
, m_Width(width), m_Height(height)
{ }
uint32 GetChannelForPixel(uint32 x, uint32 y, uint32 ch);
public:
virtual ~ImageWriter() {
if(m_RawFileData) {
delete m_RawFileData;
m_RawFileData = 0;
}
2012-10-20 22:22:29 +00:00
}
uint32 GetWidth() const { return m_Width; }
uint32 GetHeight() const { return m_Height; }
uint32 GetImageDataSz() const { return m_Width * m_Height * sizeof(uint32); }
2013-09-06 05:39:11 +00:00
uint32 GetRawFileDataSz() const { return m_RawFileDataSz; }
uint8 *GetRawFileData() const { return m_RawFileData; }
2012-10-20 22:22:29 +00:00
virtual bool WriteImage() = 0;
};
2012-10-20 23:01:07 +00:00
#ifndef PNG_FOUND
2012-10-20 22:22:29 +00:00
#cmakedefine PNG_FOUND
2012-10-20 23:01:07 +00:00
#endif // PNG_FOUND
2012-10-20 22:22:29 +00:00
#ifndef PVRTEXLIB_FOUND
#cmakedefine PVRTEXLIB_FOUND
#endif // PVRTEXLIB_FOUND
#ifndef OPENGL_FOUND
#cmakedefine OPENGL_FOUND
#endif // OPENGL_FOUND
2012-10-20 22:22:29 +00:00
#endif // _IMAGE_LOADER_H_