ftp.nice.ch/pub/next/science/mathematics/HippoDraw.2.0.s.tar.gz#/HippoDraw/Hippo.bproj/Draw.subproj/Tiff.m

This is Tiff.m in view mode; [Download] [Up]

#import "draw.h"

@implementation Tiff

- replaceWithImage
{
    Image *retval = [[Image allocFromZone:[self zone]] initFromStream:newStream];
    [retval setBounds:&bounds];
    if (!gFlags.selected) [retval deselect];
    if (gFlags.locked) [retval lock];
    [self free];
    return retval;    
}

- read:(NXTypedStream *)stream
{
    int length;
    char *data;
    NXImageInfo info;

    [super read:stream];
    NXReadTypes(stream, "iiiiii", &info.width, &info.height,
	&info.bitsPerSample, &info.samplesPerPixel,
	&info.planarConfig, &info.photoInterp);
    length = info.height * (info.samplesPerPixel) * ((info.bitsPerSample * info.width + 7) / 8);
    NX_ZONEMALLOC([self zone], data, char, length+1);
    NXReadArray(stream, "c", length, data);
    data[length] = '\0';
    newStream = NXOpenMemory(NULL, 0, NX_READWRITE);
    NXWriteTIFF(newStream, &info, data);
    NXSeek(newStream, 0, NX_FROMSTART);
    NX_FREE(data);

    return self;
}

@end

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.