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

Class RGBImageLock

framework/image.h:120–148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

118};
119
120class RGBImageLock
121{
122 private:
123 sp<RGBImage> img;
124 // Disallow copy
125 RGBImageLock(const RGBImageLock &) = delete;
126 ImageLockUse use;
127
128 public:
129 RGBImageLock(sp<RGBImage> img, ImageLockUse use = ImageLockUse::Write);
130 ~RGBImageLock();
131 Colour get(const Vec2<unsigned int> &pos) const
132 {
133 LogAssert(this->use == ImageLockUse::Read || this->use == ImageLockUse::ReadWrite);
134 unsigned offset = pos.y * this->img->size.x + pos.x;
135 LogAssert(offset < this->img->size.x * this->img->size.y);
136 return this->img->pixels[offset];
137 }
138 void set(const Vec2<unsigned int> &pos, const Colour &c)
139 {
140 LogAssert(this->use == ImageLockUse::Write || this->use == ImageLockUse::ReadWrite);
141 unsigned offset = pos.y * this->img->size.x + pos.x;
142 LogAssert(offset < this->img->size.x * this->img->size.y);
143 this->img->pixels[offset] = c;
144 }
145
146 // FIXME: Magic backdoor to the RGBA data
147 void *getData();
148};
149
150class ImageSet : public ResObject
151{

Callers 1

drawOrgLineFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected