| * Copyright 2011 Google Inc. |
| * Use of this source code is governed by a BSD-style license that can be |
| * found in the LICENSE file. |
| class SimpleView : public SampleView { |
| this->setBGColor(0xFFDDDDDD); |
| // overrides from SkEventSink |
| virtual bool onQuery(SkEvent* evt) { |
| if (SampleCode::TitleQ(*evt)) { |
| SampleCode::TitleR(evt, "Box Gradient"); |
| return this->INHERITED::onQuery(evt); |
| virtual void onDrawContent(SkCanvas* canvas) { |
| paint.setAntiAlias(true); |
| paint.setStyle(SkPaint::kStroke_Style); |
| paint.setStrokeWidth(SkScalarHalf(SkIntToScalar(3))); |
| paint.setStyle(SkPaint::kFill_Style); |
| r.set(x, y, x + SkIntToScalar(100), y + SkIntToScalar(100)); |
| for (int i = 0; i < 256; ++i) { |
| paint.setColor(0xFF000000 + i * 0x00010000); |
| canvas->drawRect(r, paint); |
| typedef SampleView INHERITED; |
| ////////////////////////////////////////////////////////////////////////////// |
| static SkView* MyFactory() { return new SimpleView; } |
| static SkViewRegister reg(MyFactory); |