File: malphagen.cpp

package info (click to toggle)
postal1 2015.git20250526%2Bds-2
  • links: PTS, VCS
  • area: contrib
  • in suites: forky, sid
  • size: 14,024 kB
  • sloc: cpp: 130,877; ansic: 38,942; python: 874; makefile: 351; sh: 61
file content (26 lines) | stat: -rw-r--r-- 902 bytes parent folder | download | duplicates (2)
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
#include <iostream>
#include <cstdlib>
#include "RSPiX/Src/ORANGE/color/colormatch.h"

const double transparencyLevels[] = {0.0588235294118, 0.117647058824, 0.172549019608, 0.23137254902, 0.290196078431, 0.352941176471, 0.411764705882, 0.470588235294, 0.525490196078, 0.58431372549, 0.643137254902, 0.705882352941, 0.764705882353, 0.823529411765, 0.878431372549, 0.937254901961};

void malphagen(const char* in, const char* out)
{
	RImage myIm;
	myIm.Load((char*) in);
	RMultiAlpha myMAl;
	myMAl.Alloc(16);
	for (int_fast8_t i = 0; i < 16; ++i)
	{
		myMAl.CreateLayer(i, transparencyLevels[i], 10, 236);
		myMAl.m_pAlphaList[i]->ms_SetPalette(&myIm);
		myMAl.m_pAlphaList[i]->CreateAlphaRGB(transparencyLevels[i], 10, 236);
	}
	myMAl.Finish(TRUE);
	FILE* myF = fopen(out, "wb");
	RFile myRF;
	myRF.Open(myF, RFile::LittleEndian, RFile::Binary);
	myMAl.Save(&myRF);
	myRF.Close(); // closes myF also
}