skia2/samplecode/Nima.h
Brian Osman c069a57301 added NIMA sample to showcase animations
improved third_party template to include headers as system headers for non-Windows machines

Bug: skia:
Change-Id: Id2fa74fc31b49f9b07cc83e7f60477c7ab4f8d83
Reviewed-on: https://skia-review.googlesource.com/135450
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2018-06-19 20:30:28 +00:00

55 lines
1.2 KiB
C++

/*
* Copyright 2018 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef Nima_DEFINED
#define Nima_DEFINED
#include <nima/Actor.hpp>
#include <nima/ActorImage.hpp>
#include <nima/Vec2D.hpp>
#include "SkCanvas.h"
#include "SkImage.h"
class SampleActor;
class SampleActorImage;
class SampleActor : public nima::Actor {
public:
SampleActor(std::string baseName);
~SampleActor();
void render(SkCanvas* canvas) const;
private:
sk_sp<SkImage> fTexture;
std::vector<SampleActorImage> fActorImages;
std::unique_ptr<SkPaint> fPaint;
typedef nima::Actor INHERITED;
};
class SampleActorImage {
public:
SampleActorImage(nima::ActorImage* actorImage, sk_sp<SkImage> texture, SkPaint* paint);
~SampleActorImage();
void render(const SampleActor* actor, SkCanvas* canvas) const;
int drawOrder() const { return fActorImage->drawOrder(); }
private:
nima::Vec2D deform(const nima::Vec2D& position, float* boneIdx, float* boneWgt) const;
private:
nima::ActorImage* fActorImage;
sk_sp<SkImage> fTexture;
SkPaint* fPaint;
};
#endif