{
switch(precision)
{
case(8):
{
Gray8Image grayImage = (Gray8Image)image;
int offset = getBoundsX1();
int x = 0;
int k = getBoundsWidth();
while (k > 0)
{
grayImage.putSample(0, x++, y, buffer[offset++]);
offset++; // skip alpha; should be stored in a TransparencyInformation object
k--;
}
break;
}
case(16):
{
Gray16Image grayImage = (Gray16Image)image;
int offset = getBoundsX1();
int x = 0;
int k = getBoundsWidth();
while (k > 0)
{
int sample = (buffer[offset++] & 0xff) << 8;
sample |= (buffer[offset++] & 0xff);
grayImage.putSample(x++, y, sample);
offset += 2; // skip alpha; TODO: store in TransparencyInformation object
k--;
}
break;
}