MCPcopy Create free account
hub / github.com/PacktPublishing/3D-Graphics-Rendering-Cookbook / setPixelUnsignedByte

Method setPixelUnsignedByte

shared/Bitmap.h:104–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102 }
103
104 void setPixelUnsignedByte(int x, int y, const glm::vec4& c)
105 {
106 const int ofs = comp_ * (y * w_ + x);
107 if (comp_ > 0) data_[ofs + 0] = uint8_t(c.x * 255.0f);
108 if (comp_ > 1) data_[ofs + 1] = uint8_t(c.y * 255.0f);
109 if (comp_ > 2) data_[ofs + 2] = uint8_t(c.z * 255.0f);
110 if (comp_ > 3) data_[ofs + 3] = uint8_t(c.w * 255.0f);
111 }
112 glm::vec4 getPixelUnsignedByte(int x, int y) const
113 {
114 const int ofs = comp_ * (y * w_ + x);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected