0

我有mainClasssubClass

主类.h:

@interface mainClass : NSOpenGLView {
   NSBitmapImageRep *repG;
 }
@property (nonatomic, retain) NSBitmapImageRep *repG;
@end

主类.m:

#import "mainClass.h"

@implementation mainClass
@synthesize repG;
.....

-(void)setBitmapRepresentation {
   repG = [[NSBitmapImageRep alloc] initWithCIImage:someMyImage];
}
@end

子类.h

#import "mainClass.h"

@interface subClass : mainClass {
   CIImage *someInputImage;
   CIFilter *myFilter;
}
@end

子类.m

#import subClass.h

@implementation filteringFrontLayer

.......

-(void)setInputImageForFilter {
    someInputImage = [[CIImage alloc] initWithBitmapImageRep:repG];
    [myFilter setValue:someInputImage forKey:@"inputImage"];
}

它不起作用。它返回空的 CIImage ( Invalid parameter not satisfying: ciImage != nil)。如何在我的子类中访问repG(位图数据)及其值(值在 mainClass 中设置)?

4

1 回答 1

0

您还可以使用其访问器访问该属性:

someInputImage = [[CIImage alloc] initWithBitmapImageRep:[self repG]];
于 2012-08-29T11:24:59.310 回答