gnustep ubuntu上的coregraphics [英] coregraphics on gnustep ubuntu

查看:140
本文介绍了gnustep ubuntu上的coregraphics的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我正在考虑将为我的ios应用程序编写的某些逻辑移植到服务器. 我正在构建一个层次结构的视图,然后将其栅格化为位图

我已经使用 chameleon 来成功将相关位移植到Mac OS.

现在,由于GNUstep在AppKit上有一个开放的实现,因此我想尝试使用将此移植到ubuntu上.我设法使hello world应用程序正常运行.但是,对我来说,以下内容在编译时引发错误对我来说很奇怪.

#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;
}

错误:

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’

对于我来说,应该抛出这些错误似乎很奇怪,因为我认为核心图形位于AppKit之下.我是否在gnustep中缺少特定模块?

解决方案

据我所知,CoreGraphics并未在GNUstep中实现;我相信 Cocotron 可以实现.

错误error: request for member ‘layer’ in something not a structure or union引用表达式view.layer,您希望从view对象返回layer属性.该语法来自Objective-C 2.0,GNUstep不提供现成的语法,最后我知道.检查 ObjC2FAQ ,以了解有关启用它的信息(以及对GNUstep的限制).

同时,您可以改用原始的Objective-C语法:[view layer].

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?

解决方案

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].

这篇关于gnustep ubuntu上的coregraphics的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆