-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAlpha.h
More file actions
46 lines (38 loc) · 1.34 KB
/
Copy pathAlpha.h
File metadata and controls
46 lines (38 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
Copyright (c) 2024-2025 Toksisitee. All rights reserved.
This work is licensed under the terms of the MIT license.
For a copy, refer to license.md or https://opensource.org/licenses/MIT
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
*/
#pragma once
#include "Assets.h"
#include "Palette.h"
namespace Assets
{
namespace Alpha
{
constexpr uint32_t k_uWidth = 256;
constexpr uint32_t k_uHeight = 256;
constexpr uint32_t k_uSize = k_uWidth * k_uHeight;
}
class CAlpha : public CAsset
{
public:
// ====== Virtual Overrides ======
Result LoadBin( const std::string& sFilePath ) override;
Result LoadImg( const std::string& sFilePath ) override { return Result::FAIL_LOAD; }
Result ExportImg( const std::string& sFilePath ) override;
Result ExportBin( const std::string& sFilePath ) override;
bool CreateTexture( LPDIRECT3DDEVICE9 pD3DDevice ) override;
inline void* GetPtr() override { return static_cast<void*>(&m_Data); }
// ================================
Result Generate();
Color GetAlphaColor( uint8_t uIndex );
protected:
uint32_t ComputeTable( uint8_t* pData, const Color& targetColor, uint32_t uRow );
private:
uint8_t m_Data[Alpha::k_uWidth * Alpha::k_uHeight];
};
}