MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / toRGBImage

Method toRGBImage

framework/image.cpp:32–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30PaletteImage::~PaletteImage() = default;
31
32sp<RGBImage> PaletteImage::toRGBImage(sp<Palette> p)
33{
34 sp<RGBImage> i = mksp<RGBImage>(size);
35
36 RGBImageLock imgLock{i, ImageLockUse::Write};
37
38 for (unsigned int y = 0; y < this->size.y; y++)
39 {
40 for (unsigned int x = 0; x < this->size.x; x++)
41 {
42 uint8_t idx = this->indices[y * this->size.x + x];
43 imgLock.set(Vec2<unsigned int>{x, y}, p->getColour(idx));
44 }
45 }
46 return i;
47}
48
49void PaletteImage::blit(sp<PaletteImage> src, sp<PaletteImage> dst, Vec2<unsigned int> srcOffset,
50 Vec2<unsigned int> dstOffset)

Callers 2

loadImageMethod · 0.80
ApocCursorMethod · 0.80

Calls 1

setMethod · 0.45

Tested by

no test coverage detected