discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Creating NSImage in a tool


From: Stefan Urbanek
Subject: Creating NSImage in a tool
Date: Mon, 13 Feb 2006 15:17:50 +0100
User-agent: Internet Messaging Program (IMP) 3.2.2

Hi,

I need a tool that will take some inputs and will generate one or more TIFFS. I
am trying to create an image in a tool under MS Windows like this:

#import <Foundation/NSAutoreleasePool.h>
#import <Foundation/NSString.h>
#import <AppKit/NSImage.h>
#import <AppKit/NSBezierPath.h>
#import <AppKit/NSColor.h>

NSImage *image = nil;

void create_image(void)
{
        NSLog(@"Creating image");
        image = [[NSImage alloc] initWithSize:NSMakeSize(100.0, 100.0)];

        NSLog(@"Drawing path");
        [image lockFocus];
        [NSBezierPath strokeRect:NSMakeRect(10,10,80,80)];
        [image unlockFocus];
}
int main(void)
{
        NSAutoreleasePool *pool = [NSAutoreleasePool new];

        create_image();

        NSLog(@"Done");
        [image release];
        [pool release];
        return 0;
}

The output is:

$ make && shared_obj/test.exe 
Making all for tool test...
 Compiling file main.m ...
main.m:33:2: warning: no newline at end of file
 Linking tool test ...
Info: resolving ___objc_class_name_NSConstantString by linking to
__imp____objc_class_name_NSConstantString (auto-import)
Info: resolving ___objc_class_name_NSImage by linking to
__imp____objc_class_name_NSImage (auto-import)
Info: resolving ___objc_class_name_NSBezierPath by linking to
__imp____objc_class_name_NSBezierPath (auto-import)
Info: resolving ___objc_class_name_NSAutoreleasePool by linking to
__imp____objc_class_name_NSAutoreleasePool (auto-import)
2006-02-13 15:10:14.000 test.exe[3512] Creating image
2006-02-13 15:10:14.000 test.exe[3512] Drawing path
The file 'c' is writable by someone other than its owner.
Ignoring it.
c:\Documents and Settings\b_urbanek\Desktop\gstest\shared_obj\test.exe: Uncaught
exception WindowServerCommunication, reason: Unable to retrieve list of screens
from window server.

what is the correct way of crating an image in a tool (not an application)?

Environment: GNUstep-base-1.11.1-gui-0.10.1-3 - windows installer(*)

Thanks,

Stefan Urbanek
(*) very clean, simple and straightforward installer, BTW :-)
--
http://stefan.agentfarms.net

First they ignore you, then they laugh at you, then they fight you, then
you win.
- Mahatma Gandhi




reply via email to

[Prev in Thread] Current Thread [Next in Thread]