rodecomp/Source/Resource/Bitmap/BitmapResource.h
ragnarok-clanker da97b80236 Maintenance: C9: the bitmap decoders and pixel helpers are CBitmapRes members in the original (they call Unload through the vtable at
Batch #18237 by ragnarok-clanker: forced by an admin (1 lower score(s), 14 changed function(s)); checked with 437 compiled unit(s), including every includer of Source/Resource/Bitmap/BitmapImage.h, Source/Resource/Bitmap/BitmapResource.h, Source/UI/Window/UIWindow.h.
2026-11-12 11:59:34 +00:00

45 lines
1.2 KiB
C++

#ifndef RAGNAROK_SOURCE_RESOURCE_BITMAP_BITMAPRESOURCE_H
#define RAGNAROK_SOURCE_RESOURCE_BITMAP_BITMAPRESOURCE_H
#include "Resource/Bitmap/BitmapImage.h"
#include "Resource/Resource.h"
#include <cstddef>
class ResourceBytes {
public:
virtual bool Open(const char* name) = 0;
virtual const void* Data() const = 0;
virtual int Size() const = 0;
virtual void Close() = 0;
protected:
~ResourceBytes() = default;
};
class CBitmapRes : public CRes {
public:
CBitmapRes();
CBitmapRes(const char* extension, const char* prefix);
~CBitmapRes() override;
CBitmapRes* Create() override;
bool Load(const char* name) override;
void Unload() override;
virtual bool Decode(const char* name, const void* data, int bytes, bool iconOnly);
bool CreateAuxiliary(int mode);
std::uint32_t Pixel(int x, int y) const;
void ClearAuxiliary();
bool DecodeBitmap(const void* data, int bytes, bool iconOnly);
bool DecodeTga(const void* data, int bytes);
bool DecodePng(const void* data, int bytes, const char* name);
bool DecodeJpeg(const void* data, int bytes);
/* 0110 */ BitmapImage image;
};
#if defined(_WIN32) && !defined(_WIN64)
static_assert(sizeof(CBitmapRes) == 292);
static_assert(offsetof(CBitmapRes, image) == 0x0110);
#endif
#endif