struct hiro::draw::ImageStyle

Overview

Structure specifying how the Image should be rendered. More…

#include <ImageRenderer.h>

struct ImageStyle: public hiro::draw::Style {
    // fields

    bool use_nearest_filtering { false };
    bool fit_to_viewport { true };
    bool keep_aspect_ratio { true };
    glm::bvec2 mirror { false, false };
    glm::bvec4 is_channel_enabled { true, true, true, true };
    glm::vec4 channel_offset { 0.0f, 0.0f, 0.0f, 0.0f };
    glm::vec4 channel_multiplier { 1.0f, 1.0f, 1.0f, 1.0f };
    bool discard_transparent_pixels { false };
    bool use_trasform { false };

    // methods

    virtual bool ReadFromStream(std::istream& str);
    virtual void WriteToStream(std::ostream& str);
};

Inherited Members

public:
    // fields

    bool visible = true;
    cogs::Transform transform;

    // methods

    virtual bool ReadFromStream(std::istream& str);
    virtual void WriteToStream(std::ostream& str);

protected:
    // methods

    bool ReadVersion(std::istream& str, const uint32_t expected_version);

Detailed Documentation

Structure specifying how the Image should be rendered.

Fields

bool use_nearest_filtering { false }

Denotes, whether to use nearest or linear filtering when rendering Image.

bool fit_to_viewport { true }

When set to true, Image is rendered in a sizing that can be displayed in a viewport.

bool keep_aspect_ratio { true }

Only when fit_to_viewport is enabled. Adds blank space around Image, so that it is not deformed.

glm::bvec2 mirror { false, false }

Image will be mirrored along defined axes when rendered.

glm::bvec4 is_channel_enabled { true, true, true, true }

Specify which image color channels are enabled. When false, RGB channels are set to 0 and alpha to 1.

glm::vec4 channel_offset { 0.0f, 0.0f, 0.0f, 0.0f }

Custom color space transformation. Final color is computed as: (original_color + offset) * multiplier.

glm::vec4 channel_multiplier { 1.0f, 1.0f, 1.0f, 1.0f }

Custom color space transformation. Final color is computed as: (original_color + offset) * multiplier.

bool discard_transparent_pixels { false }

When set to true, image pixels with zero alpha channel are not rendered.

bool use_trasform { false }

When set to true, image is rendered at a position and scale obtained from transform.

Methods

virtual bool ReadFromStream(std::istream& str)

Import state from stream.

virtual void WriteToStream(std::ostream& str)

Export state to stream.