MCPcopy Create free account
hub / github.com/SFML/SFML / getPixel

Method getPixel

src/SFML/Graphics/Image.cpp:691–699  ·  view source on GitHub ↗

///////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

689
690////////////////////////////////////////////////////////////
691Color Image::getPixel(Vector2u coords) const
692{
693 assert(coords.x < m_size.x && "Image::getPixel() x coordinate is out of bounds");
694 assert(coords.y < m_size.y && "Image::getPixel() y coordinate is out of bounds");
695
696 const auto index = (coords.x + coords.y * m_size.x) * 4;
697 const std::uint8_t* pixel = &m_pixels[index];
698 return {pixel[0], pixel[1], pixel[2], pixel[3]};
699}
700
701
702////////////////////////////////////////////////////////////

Callers 4

Render.test.cppFile · 0.80
Texture.test.cppFile · 0.80
Image.test.cppFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected