/*
 * Copyright (C) 2020 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef _UI_SPRITE_ICON_H
#define _UI_SPRITE_ICON_H

#include <android/graphics/bitmap.h>
#include <gui/Surface.h>
#include <input/Input.h>

namespace android {

/*
 * Icon that a sprite displays, including its hotspot.
 */
struct SpriteIcon {
    explicit SpriteIcon() = default;
    explicit SpriteIcon(const graphics::Bitmap& bitmap, PointerIconStyle style, float hotSpotX,
                        float hotSpotY, bool drawNativeDropShadow)
          : bitmap(bitmap),
            style(style),
            hotSpotX(hotSpotX),
            hotSpotY(hotSpotY),
            drawNativeDropShadow(drawNativeDropShadow) {}

    graphics::Bitmap bitmap{};
    PointerIconStyle style{PointerIconStyle::TYPE_NULL};
    float hotSpotX{};
    float hotSpotY{};
    bool drawNativeDropShadow{};

    inline bool isValid() const { return bitmap.isValid() && !bitmap.isEmpty(); }

    inline int32_t width() const { return bitmap.getInfo().width; }
    inline int32_t height() const { return bitmap.getInfo().height; }

    // Draw the bitmap onto the given surface. Returns true if it's successful, or false otherwise.
    // Note it doesn't set any metadata to the surface.
    bool draw(const sp<Surface> surface) const;
};

} // namespace android

#endif // _UI_SPRITE_ICON_H
