|
|
1.1 ! root 1: #import "draw.h" ! 2: ! 3: @implementation Tiff ! 4: ! 5: - replaceWithImage ! 6: { ! 7: Image *retval = [[Image allocFromZone:[self zone]] initFromStream:newStream]; ! 8: [retval setBounds:&bounds]; ! 9: if (!gFlags.selected) [retval deselect]; ! 10: if (gFlags.locked) [retval lock]; ! 11: [self free]; ! 12: return retval; ! 13: } ! 14: ! 15: - read:(NXTypedStream *)stream ! 16: { ! 17: int length; ! 18: char *data; ! 19: NXImageInfo info; ! 20: ! 21: [super read:stream]; ! 22: NXReadTypes(stream, "iiiiii", &info.width, &info.height, ! 23: &info.bitsPerSample, &info.samplesPerPixel, ! 24: &info.planarConfig, &info.photoInterp); ! 25: length = info.height * (info.samplesPerPixel) * ((info.bitsPerSample * info.width + 7) / 8); ! 26: NX_ZONEMALLOC([self zone], data, char, length+1); ! 27: NXReadArray(stream, "c", length, data); ! 28: data[length] = '\0'; ! 29: newStream = NXOpenMemory(NULL, 0, NX_READWRITE); ! 30: NXWriteTIFF(newStream, &info, data); ! 31: NXSeek(newStream, 0, NX_FROMSTART); ! 32: NX_FREE(data); ! 33: ! 34: return self; ! 35: } ! 36: ! 37: @end
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.