GameApi 28
Library used by GameApi Builder tool
Loading...
Searching...
No Matches
source_image.h
Go to the documentation of this file.
1// Copyright 2021 The Draco Authors.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15#ifndef DRACO_TEXTURE_SOURCE_IMAGE_H_
16#define DRACO_TEXTURE_SOURCE_IMAGE_H_
17
19
20#ifdef DRACO_TRANSCODER_SUPPORTED
21#include <cstdint>
22#include <string>
23#include <vector>
24
25#include "draco/core/status.h"
26
27namespace draco {
28
29// This class is used to hold the encoded and decoded data and characteristics
30// for an image. In order for the image to contain "valid" encoded data, either
31// the |filename_| must point to a valid image file or the |mime_type_| and
32// |encoded_data_| must contain valid image data.
33class SourceImage {
34 public:
35 SourceImage() {}
36
37 // No copy constructors.
38 SourceImage(const SourceImage &) = delete;
39 SourceImage &operator=(const SourceImage &) = delete;
40 // No move constructors.
41 SourceImage(SourceImage &&) = delete;
42 SourceImage &operator=(SourceImage &&) = delete;
43
44 void Copy(const SourceImage &src);
45
46 // Sets the name of the source image file.
47 void set_filename(const std::string &filename) { filename_ = filename; }
48 const std::string &filename() const { return filename_; }
49
50 void set_mime_type(const std::string &mime_type) { mime_type_ = mime_type; }
51 const std::string &mime_type() const { return mime_type_; }
52
53 std::vector<uint8_t> &MutableEncodedData() { return encoded_data_; }
54 const std::vector<uint8_t> &encoded_data() const { return encoded_data_; }
55
56 private:
57 // The filename of the image. This field can be empty as long as |mime_type_|
58 // and |encoded_data_| is not empty.
59 std::string filename_;
60
61 // The mimetype of the |encoded_data_|.
62 std::string mime_type_;
63
64 // The encoded data of the image. This field can be empty as long as
65 // |filename_| is not empty.
66 std::vector<uint8_t> encoded_data_;
67};
68
69} // namespace draco
70
71#endif // DRACO_TRANSCODER_SUPPORTED
72#endif // DRACO_TEXTURE_SOURCE_IMAGE_H_
tag src
Definition meshpage.php:1786
Definition attribute_octahedron_transform.cc:21