| OLD | NEW |
| 1 Creating a Skia "Hello World!" | 1 Creating a Skia "Hello World!" |
| 2 ============================== | 2 ============================== |
| 3 | 3 |
| 4 This tutorial will guide you through the steps to create a Hello World Desktop | 4 This tutorial will guide you through the steps to create a Hello World Desktop |
| 5 application in Skia. | 5 application in Skia. |
| 6 | 6 |
| 7 Who this tutorial is for: | 7 Who this tutorial is for: |
| 8 ------------------------- | 8 ------------------------- |
| 9 | 9 |
| 10 This will be useful to you if you want to create a window that can receive | 10 This will be useful to you if you want to create a window that can receive |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 ### Run the SkiaExamples. | 49 ### Run the SkiaExamples. |
| 50 | 50 |
| 51 You should see a window open displaying rotating text and some geometry. | 51 You should see a window open displaying rotating text and some geometry. |
| 52 | 52 |
| 53 Step 3: Create your own Sample | 53 Step 3: Create your own Sample |
| 54 ------------------------------ | 54 ------------------------------ |
| 55 | 55 |
| 56 Create a file `experimental/SkiaExamples/Tutorial.cpp` within the Skia tree. Co
py the following code: | 56 Create a file `experimental/SkiaExamples/Tutorial.cpp` within the Skia tree. Co
py the following code: |
| 57 | 57 |
| 58 <!--?prettify lang=cc?--> |
| 59 |
| 58 ~~~~ | 60 ~~~~ |
| 59 | |
| 60 #include "SkExample.h" | 61 #include "SkExample.h" |
| 61 #include "SkDevice.h" | 62 #include "SkDevice.h" |
| 62 | 63 |
| 63 class HelloTutorial : public SkExample { | 64 class HelloTutorial : public SkExample { |
| 64 public: | 65 public: |
| 65 HelloTutorial(SkExampleWindow* window) | 66 HelloTutorial(SkExampleWindow* window) |
| 66 : SkExample(window) | 67 : SkExample(window) |
| 67 { | 68 { |
| 68 fName = "Tutorial"; // This is how Skia will find your example. | 69 fName = "Tutorial"; // This is how Skia will find your example. |
| 69 | 70 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 92 | 93 |
| 93 // If you ever want to do animation. Use the inval method to trigger
a redraw. | 94 // If you ever want to do animation. Use the inval method to trigger
a redraw. |
| 94 this->fWindow->inval(NULL); | 95 this->fWindow->inval(NULL); |
| 95 } | 96 } |
| 96 }; | 97 }; |
| 97 | 98 |
| 98 static SkExample* MyFactory(SkExampleWindow* window) { | 99 static SkExample* MyFactory(SkExampleWindow* window) { |
| 99 return new HelloTutorial(window); | 100 return new HelloTutorial(window); |
| 100 } | 101 } |
| 101 static SkExample::Registry registry(MyFactory); | 102 static SkExample::Registry registry(MyFactory); |
| 102 | |
| 103 ~~~~ | 103 ~~~~ |
| 104 | 104 |
| 105 | 105 |
| 106 Step 4: Compile and run SkiaExamples with your Sample | 106 Step 4: Compile and run SkiaExamples with your Sample |
| 107 ----------------------------------------------------- | 107 ----------------------------------------------------- |
| 108 | 108 |
| 109 Here is what you have to do to compile your example. There will be | 109 Here is what you have to do to compile your example. There will be |
| 110 functionality to make this easier, but for now, this is what you have to do: | 110 functionality to make this easier, but for now, this is what you have to do: |
| 111 * Open `gyp/experimental.gyp` and look for the `SkiaExamples` target. | 111 |
| 112 * In the 'sources' section of the SkiaExampels target, add | 112 * Open `gyp/experimental.gyp` and look for the `SkiaExamples` target. |
| 113 |
| 114 * In the 'sources' section of the SkiaExampels target, add |
| 113 `../experimental/SkiaExamples/Tutorial.cpp` to the list of sources. | 115 `../experimental/SkiaExamples/Tutorial.cpp` to the list of sources. |
| 114 * Repeat Step 2 to update our gyp targets and build our example. | 116 |
| 115 * Run the SkiaExamples, specifying the name of our new example: `$> out/Releas
e/SkiaExamples --match Tutorial` | 117 * Repeat Step 2 to update our gyp targets and build our example. |
| 118 |
| 119 * Run the SkiaExamples, specifying the name of our new example: |
| 120 |
| 121 $> out/Release/SkiaExamples --match Tutorial |
| 116 | 122 |
| 117 Step 5: How to iterate through multiple examples | 123 Step 5: How to iterate through multiple examples |
| 118 ------------------------------------------------ | 124 ------------------------------------------------ |
| 119 | 125 |
| 120 If you did not specify an example with the --match flag, or if your match | 126 If you did not specify an example with the `--match` flag, or if your match |
| 121 string matches more than one example, you can use the *n* key to iterate | 127 string matches more than one example, you can use the *n* key to iterate |
| 122 through all of the examples registered. | 128 through all of the examples registered. |
| 123 | 129 |
| OLD | NEW |