File:  [NeXTSTEP 3.3 examples] / Examples / AppKit / Draw / PSGraphic.m
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:48:36 2018 UTC (8 years, 1 month ago) by root
Branches: NeXT, MAIN
CVS tags: NeXTSTEP33, HEAD
Sample Programs from NeXSTEP 3.3

#import "draw.h"

@implementation PSGraphic

- 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
{
    char *data;
    int length;
    float bbox[4];

    [super read:stream];
    NXReadTypes(stream,"ffffi",&bbox[0],&bbox[1],&bbox[2],&bbox[3],&length);
    vm_allocate(task_self(), (vm_address_t *)&data, length, YES);
    NXReadArray(stream, "c", length, data);
    newStream = NXOpenMemory(data, length, NX_READONLY);

    return self;
}

/*
 * No write: because PSGraphic is no longer used (replaced by Image).
 * It is here only for compatibility.
 */

@end

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.