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

Method setPixel

src/SFML/Graphics/Image.cpp:676–687  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

674
675////////////////////////////////////////////////////////////
676void Image::setPixel(Vector2u coords, Color color)
677{
678 assert(coords.x < m_size.x && "Image::setPixel() x coordinate is out of bounds");
679 assert(coords.y < m_size.y && "Image::setPixel() y coordinate is out of bounds");
680
681 const auto index = (coords.x + coords.y * m_size.x) * 4;
682 std::uint8_t* pixel = &m_pixels[index];
683 *pixel++ = color.r;
684 *pixel++ = color.g;
685 *pixel++ = color.b;
686 *pixel++ = color.a;
687}
688
689
690////////////////////////////////////////////////////////////

Callers 2

Image.test.cppFile · 0.80
PageMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected