coregraphics on gnustep ubuntu

依然范特西╮ 提交于 2019-12-25 10:55:47

问题


so im thinking about porting some logic written for my ios app to the server. I am building a view hierachy and then rasterizing it to bitmaps

I have used chameleon to successfully port the relevant bits to mac os.

and now I would like to try porting this to ubuntu using since GNUstep has an open implementation on AppKit. I managed to get the hello world app working. However, It seemed strange to me than the following throws errors on compiling.

#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>

int main (int argc, const char * argv[])
{
        NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    [NSApplication sharedApplication];
        NSRunAlertPanel(@"Random",@"hello from GNUStep Appkit!",@"close this window",@"Another Button",nil);
    NSView *view = [[NSView alloc]init];
    view.layer;
    CGRect rect;
        [pool drain];
        return 0;
}

Errors:

hello.m: In function ‘main’:
hello.m:10:6: error: request for member ‘layer’ in something not a structure or union
hello.m:11:2: error: unknown type name ‘CGRect’

It seems strange to me that these errors should be thrown, as I believed coregraphics to sit below AppKit. Am I missing a particular module in gnustep?


回答1:


As far as I know, CoreGraphics is not implemented in GNUstep; I believe though that Cocotron has an implementation.

The error error: request for member ‘layer’ in something not a structure or union refers to the expression view.layer, which you intended to return the layer property from the view object. That syntax is from Objective-C 2.0, which wasn't supported out of the box with GNUstep, last I knew; check ObjC2FAQ for information about enabling it (and what its limitations on GNUstep are).

In the meantime, you can instead use the original Objective-C syntax: [view layer].



来源:https://stackoverflow.com/questions/16146242/coregraphics-on-gnustep-ubuntu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!