skia2/experimental/SimpleCocoaApp/SampleWindow.mm
2011-06-24 15:00:28 +00:00

30 lines
864 B
Plaintext

#import "SkCanvas.h"
#import "SkPaint.h"
#import "SkView.h"
class SkSampleView : public SkView {
public:
SkSampleView() {};
protected:
virtual void onDraw(SkCanvas* canvas) {
canvas->drawColor(0xFFFFFFFF);
SkPaint p;
p.setTextSize(20);
p.setAntiAlias(true);
canvas->drawText("Hello World!", 13, 50, 30, p);
this->INHERITED::onDraw(canvas);
}
private:
typedef SkView INHERITED;
};
////////////////////////////////////////////////////////////////////////////////
#import "SampleWindow.h"
@implementation SampleWindow
-(void) installSkViews {
fSampleSkView = new SkSampleView;
fSampleSkView->setVisibleP(true);
fSampleSkView->setSize([self frame].size.width, [self frame].size.height);
[fView addSkView:fSampleSkView];
[fView setNeedsDisplay:YES];
fSampleSkView->unref();
}
@end