skip -= size;
}
- data.data = new char[data.stride*data.height];
+ data.pixels = new char[data.stride*data.height];
if(height<0)
{
for(unsigned y=0; y<data.height; ++y)
- read_full(io, data.data+(data.height-1-y)*data.stride, data.stride);
+ read_full(io, data.pixels+(data.height-1-y)*data.stride, data.stride);
}
else
{
for(unsigned y=0; y<data.height; ++y)
- read_full(io, data.data+y*data.stride, data.stride);
+ read_full(io, data.pixels+y*data.stride, data.stride);
}
}
data.height = ilGetInteger(IL_IMAGE_HEIGHT);
data.stride = data.width*ilGetInteger(IL_IMAGE_BYTES_PER_PIXEL);
unsigned data_size = data.stride*data.height;
- data.data = new char[data_size];
+ data.pixels = new char[data_size];
ILubyte *il_data = ilGetData();
- copy(il_data, il_data+data_size, data.data);
+ copy(il_data, il_data+data_size, data.pixels);
ilBindImage(0);
ilResetRead();
fmt(RGB),
width(0),
height(0),
- data(0)
+ pixels(0)
{ }
Image::Data::Data(const Data &other):
width(other.width),
height(other.height),
stride(other.stride),
- data(other.data ? new char[stride*height] : 0)
+ pixels(other.pixels ? new char[stride*height] : 0)
{
- if(data)
- copy(other.data, other.data+stride*height, data);
+ if(pixels)
+ copy(other.pixels, other.pixels+stride*height, pixels);
}
Image::Data &Image::Data::operator=(const Data &other)
{
- delete[] data;
- data = 0;
+ delete[] pixels;
+ pixels = 0;
fmt = other.fmt;
width = other.width;
height = other.height;
stride = other.stride;
- if(other.data)
+ if(other.pixels)
{
- data = new char[stride*height];
- copy(other.data, other.data+stride*height, data);
+ pixels = new char[stride*height];
+ copy(other.pixels, other.pixels+stride*height, pixels);
}
return *this;
Image::Data::~Data()
{
- delete[] data;
+ delete[] pixels;
}
unsigned width;
unsigned height;
unsigned stride;
- char *data;
+ char *pixels;
Data();
Data(const Data &);
unsigned get_width() const { return data.width; }
unsigned get_height() const { return data.height; }
unsigned get_stride() const { return data.stride; }
- const void *get_data() const { return data.data; }
+ DEPRECATED const void *get_data() const { return data.pixels; }
+ const void *get_pixels() const { return data.pixels; }
};
} // namespace Graphics
data.stride = priv->jpeg.output_width*priv->jpeg.output_components;
data.fmt = RGB;
- data.data = new char[data.stride*data.height];
+ data.pixels = new char[data.stride*data.height];
JSAMPROW rows[8];
while(priv->jpeg.output_scanline<data.height)
{
unsigned y = data.height-priv->jpeg.output_scanline;
unsigned count = min(y, 8U);
for(unsigned i=0; i<count; ++i)
- rows[i] = reinterpret_cast<JSAMPROW>(data.data+(y-i-1)*data.stride);
+ rows[i] = reinterpret_cast<JSAMPROW>(data.pixels+(y-i-1)*data.stride);
jpeg_read_scanlines(&priv->jpeg, rows, count);
}
default: throw unsupported_image_format("unknown color type");
}
- data.data = new char[data.stride*data.height];
+ data.pixels = new char[data.stride*data.height];
if(interlace==PNG_INTERLACE_ADAM7)
{
unsigned n_passes = png_set_interlace_handling(priv->png);
rows = new png_byte *[data.height];
for(unsigned y=0; y<data.height; ++y)
- rows[y] = reinterpret_cast<png_byte *>(data.data+data.stride*(data.height-1-y));
+ rows[y] = reinterpret_cast<png_byte *>(data.pixels+data.stride*(data.height-1-y));
for(unsigned i=0; i<n_passes; ++i)
png_read_rows(priv->png, rows, 0, data.height);
else
{
for(unsigned y=0; y<data.height; ++y)
- png_read_row(priv->png, reinterpret_cast<png_byte *>(data.data+data.stride*(data.height-1-y)), 0);
+ png_read_row(priv->png, reinterpret_cast<png_byte *>(data.pixels+data.stride*(data.height-1-y)), 0);
}
png_read_end(priv->png, 0);
CGDataProviderRef dp = CGImageGetDataProvider(image);
CFDataRef image_data = CGDataProviderCopyData(dp);
- data.data = new char[data.height*data.stride];
+ data.pixels = new char[data.height*data.stride];
unsigned offset = (alpha==kCGImageAlphaNoneSkipFirst);
CFRange range = CFRangeMake(offset, CFDataGetLength(image_data)-offset);
- CFDataGetBytes(image_data, range, reinterpret_cast<UInt8 *>(data.data));
+ CFDataGetBytes(image_data, range, reinterpret_cast<UInt8 *>(data.pixels));
CFRelease(image_data);
CFRelease(image);