<div class="c" id="{CB}" style="font-family: monospace;"><ol><span style="color: #339933;">#include <cstdlib>
<span style="color: #339933;">#include <ctime>
<span style="color: #339933;">#include <ctype.h>
<span style="color: #339933;">#include <math.h>
<span style="color: #339933;">#include <stddef.h>
<span style="color: #339933;">#include <stdio.h>
<span style="color: #339933;">#include <stdlib.h>
<span style="color: #339933;">#include <string.h>
<span style="color: #339933;">#include <windows.h>
BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
<span style="color: #b1b100;">switch (ul_reason_for_call) {
<span style="color: #b1b100;">case DLL_PROCESS_ATTACH:
<span style="color: #b1b100;">case DLL_THREAD_ATTACH:
<span style="color: #b1b100;">case DLL_THREAD_DETACH:
<span style="color: #b1b100;">case DLL_PROCESS_DETACH:
<span style="color: #000000; font-weight: bold;">break;
}
<span style="color: #b1b100;">return <span style="color: #000000; font-weight: bold;">true;
}
<span style="color: #993333;">typedef <span style="color: #993333;">struct {
DWORD flags;
DWORD klass;
<span style="color: #993333;">void (*dmark) (<span style="color: #993333;">void*);
<span style="color: #993333;">void (*dfree) (<span style="color: #993333;">void*);
<span style="color: #993333;">double *data; //red is index 1, green is index 2, blue 3, alpha 0
} RGSSCOLOR;
<span style="color: #993333;">typedef <span style="color: #993333;">struct{
DWORD unk1;
DWORD unk2;
BITMAPINFOHEADER *infoheader;
RGSSCOLOR *firstRow;
RGBQUAD *lastRow;
} RGSSBMINFO;
<span style="color: #993333;">typedef <span style="color: #993333;">struct{
DWORD unk1;
DWORD unk2;
RGSSBMINFO *bminfo;
} BITMAPSTRUCT;
<span style="color: #993333;">typedef <span style="color: #993333;">struct{
DWORD flags;
DWORD klass;
<span style="color: #993333;">void (*dmark) (<span style="color: #993333;">void*);
<span style="color: #993333;">void (*dfree) (<span style="color: #993333;">void*);
BITMAPSTRUCT *bm;
} RGSSBITMAP;
<span style="color: #339933;">#define ASSERT(x) if(!x){DebugOut("Failed: %s: %d", #x, __LINE__);}
<span style="color: #000000; font-weight: bold;">extern "C" _declspec (dllexport) BOOL AlienTwo(<span style="color: #993333;">long object){
RGSSBMINFO *bitmap = ((RGSSBITMAP*) (object<<<span style="color: #cc66cc;">1)) -> bm -> bminfo;
DWORD rowsize;
DWORD width, height;
LPBYTE row, pixel1, pixel2, pixel3, pixel4;
<span style="color: #993333;">long x, y;
<span style="color: #993333;">double red, green, blue;
<span style="color: #b1b100;">if(!bitmap) <span style="color: #b1b100;">return <span style="color: #000000; font-weight: bold;">false;
width = bitmap -> infoheader -> biWidth;
height = bitmap -> infoheader -> biHeight;
rowsize = width * <span style="color: #cc66cc;">4;
row = (LPBYTE) (bitmap -> firstRow);
<span style="color: #b1b100;">for ( y = <span style="color: #cc66cc;">0; y < (<span style="color: #993333;">int) height; y++) {
pixel1 = row;
pixel2 = row;
pixel3 = row;
pixel4 = row;
<span style="color: #b1b100;">if((y >= <span style="color: #cc66cc;">0) && ((y + <span style="color: #cc66cc;">1) < (<span style="color: #993333;">int) height)) {
pixel2 -= rowsize;
pixel3 -= rowsize;
}
<span style="color: #b1b100;">for ( x = <span style="color: #cc66cc;">0; x < (<span style="color: #993333;">int) width; x++) {
<span style="color: #b1b100;">if(((y + <span style="color: #cc66cc;">1) < (<span style="color: #993333;">int) height) && ((x + <span style="color: #cc66cc;">1) < (<span style="color: #993333;">int) width)) {
pixel2 += <span style="color: #cc66cc;">4;
pixel4 += <span style="color: #cc66cc;">4;
red = sqrt(pow(((<span style="color: #993333;">double) pixel1[<span style="color: #cc66cc;">2] - pixel2[<span style="color: #cc66cc;">2]), <span style="color: #cc66cc;">2) + pow(((<span style="color: #993333;">double) pixel3[<span style="color: #cc66cc;">2] - pixel4[<span style="color: #cc66cc;">2]), <span style="color: #cc66cc;">2));
green = sqrt(pow(((<span style="color: #993333;">double) pixel1[<span style="color: #cc66cc;">1] - pixel2[<span style="color: #cc66cc;">1]), <span style="color: #cc66cc;">2) + pow(((<span style="color: #993333;">double) pixel3[<span style="color: #cc66cc;">1] - pixel4[<span style="color: #cc66cc;">1]), <span style="color: #cc66cc;">2));
blue = sqrt(pow(((<span style="color: #993333;">double) pixel1[<span style="color: #cc66cc;">0] - pixel2[<span style="color: #cc66cc;">0]), <span style="color: #cc66cc;">2) + pow(((<span style="color: #993333;">double) pixel3[<span style="color: #cc66cc;">0] - pixel4[<span style="color: #cc66cc;">0]), <span style="color: #cc66cc;">2));
}
<span style="color: #b1b100;">else <span style="color: #b1b100;">if(((y + <span style="color: #cc66cc;">1) >= (<span style="color: #993333;">int) height) && ((x + <span style="color: #cc66cc;">1) < (<span style="color: #993333;">int) width)) {
pixel2 += <span style="color: #cc66cc;">4;
pixel4 += <span style="color: #cc66cc;">4;
red = sqrt(pow((<span style="color: #993333;">double) pixel1[<span style="color: #cc66cc;">2], <span style="color: #cc66cc;">2) + pow((<span style="color: #993333;">double) pixel4[<span style="color: #cc66cc;">2], <span style="color: #cc66cc;">2));
green = sqrt(pow((<span style="color: #993333;">double) pixel1[<span style="color: #cc66cc;">1], <span style="color: #cc66cc;">2) + pow((<span style="color: #993333;">double) pixel4[<span style="color: #cc66cc;">1], <span style="color: #cc66cc;">2));
blue = sqrt(pow((<span style="color: #993333;">double) pixel1[<span style="color: #cc66cc;">0], <span style="color: #cc66cc;">2) + pow((<span style="color: #993333;">double) pixel4[<span style="color: #cc66cc;">0], <span style="color: #cc66cc;">2));
}
<span style="color: #b1b100;">else <span style="color: #b1b100;">if(((y + <span style="color: #cc66cc;">1) < (<span style="color: #993333;">int) height) && ((x + <span style="color: #cc66cc;">1) >= (<span style="color: #993333;">int) width)) {
red = sqrt(pow((<span style="color: #993333;">double) pixel1[<span style="color: #cc66cc;">2], <span style="color: #cc66cc;">2) + pow((<span style="color: #993333;">double) pixel3[<span style="color: #cc66cc;">2], <span style="color: #cc66cc;">2));
green = sqrt(pow((<span style="color: #993333;">double) pixel1[<span style="color: #cc66cc;">1], <span style="color: #cc66cc;">2) + pow((<span style="color: #993333;">double) pixel3[<span style="color: #cc66cc;">1], <span style="color: #cc66cc;">2));
blue = sqrt(pow((<span style="color: #993333;">double) pixel1[<span style="color: #cc66cc;">0], <span style="color: #cc66cc;">2) + pow((<span style="color: #993333;">double) pixel3[<span style="color: #cc66cc;">0], <span style="color: #cc66cc;">2));
}
<span style="color: #b1b100;">else {
red = pixel1[<span style="color: #cc66cc;">2];
green = pixel1[<span style="color: #cc66cc;">1];
blue = pixel1[<span style="color: #cc66cc;">0];
}
<span style="color: #b1b100;">if((red + green + blue) > (<span style="color: #993333;">double) <span style="color: #cc66cc;">60) {
<span style="color: #b1b100;">if((red >= green) && (red >= blue)) {
red += <span style="color: #cc66cc;">20;
}
<span style="color: #b1b100;">else <span style="color: #b1b100;">if((green >= red) && (green >= blue)) {
green += <span style="color: #cc66cc;">20;
}
<span style="color: #b1b100;">else {
blue += <span style="color: #cc66cc;">20;
}
<span style="color: #b1b100;">if(red > <span style="color: #cc66cc;">255) red = <span style="color: #cc66cc;">255;
<span style="color: #b1b100;">if(green > <span style="color: #cc66cc;">255) green = <span style="color: #cc66cc;">255;
<span style="color: #b1b100;">if(blue > <span style="color: #cc66cc;">255) blue = <span style="color: #cc66cc;">255;
pixel1[<span style="color: #cc66cc;">2] = (BYTE) red;
pixel1[<span style="color: #cc66cc;">1] = (BYTE) green;
pixel1[<span style="color: #cc66cc;">0] = (BYTE) blue;
}
<span style="color: #b1b100;">else {
pixel1[<span style="color: #cc66cc;">2] = <span style="color: #cc66cc;">0;
pixel1[<span style="color: #cc66cc;">1] = <span style="color: #cc66cc;">0;
pixel1[<span style="color: #cc66cc;">0] = <span style="color: #cc66cc;">0;
}
pixel1 += <span style="color: #cc66cc;">4;
pixel3 += <span style="color: #cc66cc;">4;
}
row -= rowsize;
}
<span style="color: #b1b100;">return <span style="color: #000000; font-weight: bold;">true;
}
<span style="color: #000000; font-weight: bold;">extern "C" _declspec (dllexport) BOOL BlackAndWhite(<span style="color: #993333;">long object){
RGSSBMINFO *bitmap = ((RGSSBITMAP*) (object<<<span style="color: #cc66cc;">1)) -> bm -> bminfo;
DWORD rowsize;
DWORD width, height;
LPBYTE row;
<span style="color: #993333;">long x, y;
<span style="color: #993333;">int shade;
<span style="color: #b1b100;">if(!bitmap) <span style="color: #b1b100;">return <span style="color: #000000; font-weight: bold;">false;
width = bitmap -> infoheader -> biWidth;
height = bitmap -> infoheader -> biHeight;
rowsize = width * <span style="color: #cc66cc;">4;
row = (LPBYTE) (bitmap -> firstRow);
<span style="color: #b1b100;">for ( y = <span style="color: #cc66cc;">0; y < (<span style="color: #993333;">int) height; y++) {
LPBYTE thisrow = row;
<span style="color: #b1b100;">for ( x = <span style="color: #cc66cc;">0; x < (<span style="color: #993333;">int) width; x++) {
shade = ((thisrow[<span style="color: #cc66cc;">2] + thisrow[<span style="color: #cc66cc;">1] + thisrow[<span style="color: #cc66cc;">0]) / <span style="color: #cc66cc;">3);
thisrow[<span style="color: #cc66cc;">2] = shade;
thisrow[<span style="color: #cc66cc;">1] = shade;
thisrow[<span style="color: #cc66cc;">0] = shade;
thisrow += <span style="color: #cc66cc;">4;
}
row -= rowsize;
}
<span style="color: #b1b100;">return <span style="color: #000000; font-weight: bold;">true;
}
<span style="color: #000000; font-weight: bold;">extern "C" _declspec (dllexport) BOOL BlackAndWhite2(<span style="color: #993333;">long object){
RGSSBMINFO *bitmap = ((RGSSBITMAP*) (object<<<span style="color: #cc66cc;">1)) -> bm -> bminfo;
DWORD rowsize;
DWORD width, height;
LPBYTE row;
<span style="color: #993333;">long x, y;
<span style="color: #993333;">int red, green, blue, shade;
<span style="color: #b1b100;">if(!bitmap) <span style="color: #b1b100;">return <span style="color: #000000; font-weight: bold;">false;
width = bitmap -> infoheader -> biWidth;
height = bitmap -> infoheader -> biHeight;
rowsize = width * <span style="color: #cc66cc;">4;
row = (LPBYTE)(bitmap -> firstRow);
<span style="color: #b1b100;">for ( y = <span style="color: #cc66cc;">0; y < (<span style="color: #993333;">int) height; y++) {
LPBYTE thisrow = row;
<span style="color: #b1b100;">for ( x = <span style="color: #cc66cc;">0; x < (<span style="color: #993333;">int) width; x++) {
red = (thisrow[<span style="color: #cc66cc;">1] - thisrow[<span style="color: #cc66cc;">0] + thisrow[<span style="color: #cc66cc;">1] + thisrow[<span style="color: #cc66cc;">2]);
red = (red * thisrow[<span style="color: #cc66cc;">2] / <span style="color: #cc66cc;">256);
<span style="color: #b1b100;">if(red > <span style="color: #cc66cc;">255) red = <span style="color: #cc66cc;">255;
green = (thisrow[<span style="color: #cc66cc;">0] - thisrow[<span style="color: #cc66cc;">1] + thisrow[<span style="color: #cc66cc;">0] + thisrow[<span style="color: #cc66cc;">2]);
green = (green * thisrow[<span style="color: #cc66cc;">1] / <span style="color: #cc66cc;">256);
<span style="color: #b1b100;">if(green > <span style="color: #cc66cc;">255) green = <span style="color: #cc66cc;">255;
blue = (thisrow[<span style="color: #cc66cc;">0] - thisrow[<span style="color: #cc66cc;">1] + thisrow[<span style="color: #cc66cc;">0] + thisrow[<span style="color: #cc66cc;">2]);
blue = (blue * thisrow[<span style="color: #cc66cc;">0] / <span style="color: #cc66cc;">256);
<span style="color: #b1b100;">if(blue > <span style="color: #cc66cc;">255) blue = <span style="color: #cc66cc;">255;
shade = ((red + green + blue) / <span style="color: #cc66cc;">3);
thisrow[<span style="color: #cc66cc;">2] = shade;
thisrow[<span style="color: #cc66cc;">1] = shade;
thisrow[<span style="color: #cc66cc;">0] = shade;
thisrow += <span style="color: #cc66cc;">4;
}
row -= rowsize;
}
<span style="color: #b1b100;">return <span style="color: #000000; font-weight: bold;">true;
}
<span style="color: #000000; font-weight: bold;">extern "C" _declspec (dllexport) BOOL Emboss(<span style="color: #993333;">long object){
RGSSBMINFO *bitmap = ((RGSSBITMAP*) (object<<<span style="color: #cc66cc;">1)) -> bm -> bminfo;
DWORD rowsize;
DWORD width, height;
LPBYTE row;
<span style="color: #993333;">long x, y;
<span style="color: #993333;">int red, green, blue;
<span style="color: #b1b100;">if(!bitmap) <span style="color: #b1b100;">return <span style="color: #000000; font-weight: bold;">false;
width = bitmap -> infoheader -> biWidth;
height = bitmap -> infoheader -> biHeight;
rowsize = width * <span style="color: #cc66cc;">4;
row = (LPBYTE)(bitmap -> firstRow);
<span style="color: #b1b100;">for ( y = <span style="color: #cc66cc;">0; y < (<span style="color: #993333;">int) height; y++) {
LPBYTE thisrow = row;
LPBYTE nextrow = row;
<span style="color: #b1b100;">if((y > <span style="color: #cc66cc;">0) && ((y + <span style="color: #cc66cc;">1) < (<span style="color: #993333;">int) height)) {
nextrow -= (width * <span style="color: #cc66cc;">4);
}
<span style="color: #b1b100;">for ( x = <span style="color: #cc66cc;">0; x < (<span style="color: #993333;">int) width; x++) {
<span style="color: #b1b100;">if(((y + <span style="color: #cc66cc;">1) < (<span style="color: #993333;">int) height) && ((x + <span style="color: #cc66cc;">1) < (<span style="color: #993333;">int) width)) {
nextrow += <span style="color: #cc66cc;">4;
red = (thisrow[<span style="color: #cc66cc;">2] - nextrow[<span style="color: #cc66cc;">2] + <span style="color: #cc66cc;">128);
green = (thisrow[<span style="color: #cc66cc;">1] - nextrow[<span style="color: #cc66cc;">1] + <span style="color: #cc66cc;">128);
blue = (thisrow[<span style="color: #cc66cc;">0] - nextrow[<span style="color: #cc66cc;">0] + <span style="color: #cc66cc;">128);
}
<span style="color: #b1b100;">else {
red = (thisrow[<span style="color: #cc66cc;">2] + <span style="color: #cc66cc;">128);
green = (thisrow[<span style="color: #cc66cc;">1] + <span style="color: #cc66cc;">128);
blue = (thisrow[<span style="color: #cc66cc;">0] + <span style="color: #cc66cc;">128);
}
red = abs(red);
green = abs(green);
blue = abs(blue);
<span style="color: #b1b100;">if(red > <span style="color: #cc66cc;">255) red = <span style="color: #cc66cc;">255;
<span style="color: #b1b100;">if(green > <span style="color: #cc66cc;">255) green = <span style="color: #cc66cc;">255;
<span style="color: #b1b100;">if(blue > <span style="color: #cc66cc;">255) blue = <span style="color: #cc66cc;">255;
thisrow[<span style="color: #cc66cc;">2] = red;
thisrow[<span style="color: #cc66cc;">1] = green;
thisrow[<span style="color: #cc66cc;">0] = blue;
thisrow += <span style="color: #cc66cc;">4;
}
row -= rowsize;
}
<span style="color: #b1b100;">return <span style="color: #000000; font-weight: bold;">true;
}
<span style="color: #000000; font-weight: bold;">extern "C" _declspec (dllexport) BOOL MinusTwo(<span style="color: #993333;">long object){
RGSSBMINFO *bitmap = ((RGSSBITMAP*) (object<<<span style="color: #cc66cc;">1)) -> bm -> bminfo;
DWORD rowsize;
DWORD width, height;
LPBYTE row;
<span style="color: #993333;">long x, y;
<span style="color: #993333;">double color1, color2;
<span style="color: #b1b100;">if(!bitmap) <span style="color: #b1b100;">return <span style="color: #000000; font-weight: bold;">false;
width = bitmap -> infoheader -> biWidth;
height = bitmap -> infoheader -> biHeight;
rowsize = width * <span style="color: #cc66cc;">4;
row = (LPBYTE)(bitmap -> firstRow);
<span style="color: #b1b100;">for ( y = <span style="color: #cc66cc;">0; y < (<span style="color: #993333;">int) height; y++) {
LPBYTE thisrow = row;
LPBYTE nextrow = row;
<span style="color: #b1b100;">if((y > <span style="color: #cc66cc;">0) && ((y + <span style="color: #cc66cc;">1) < (<span style="color: #993333;">int) height)) {
nextrow -= (width * <span style="color: #cc66cc;">4);
}
<span style="color: #b1b100;">for ( x = <span style="color: #cc66cc;">0; x < (<span style="color: #993333;">int) width; x++) {
<span style="color: #b1b100;">if(((y + <span style="color: #cc66cc;">1) < (<span style="color: #993333;">int) height) && ((x + <span style="color: #cc66cc;">1) < (<span style="color: #993333;">int) width)) {
nextrow += <span style="color: #cc66cc;">4;
color2 = (((nextrow[<span style="color: #cc66cc;">2] * <span style="color: #cc66cc;">0.3) + (nextrow[<span style="color: #cc66cc;">1] * <span style="color: #cc66cc;">0.6) + (nextrow[<span style="color: #cc66cc;">0] * <span style="color: #cc66cc;">0.1)) / <span style="color: #cc66cc;">10);
}
<span style="color: #b1b100;">else {
color2 = <span style="color: #cc66cc;">0;
}
color1 = (((thisrow[<span style="color: #cc66cc;">2] * <span style="color: #cc66cc;">0.3) + (thisrow[<span style="color: #cc66cc;">1] * <span style="color: #cc66cc;">0.6) + (thisrow[<span style="color: #cc66cc;">0] * <span style="color: #cc66cc;">0.1)) / <span style="color: #cc66cc;">10);
<span style="color: #b1b100;">if((color1 - color2) > <span style="color: #cc66cc;">0.2) {
thisrow[<span style="color: #cc66cc;">2] = <span style="color: #cc66cc;">0;
thisrow[<span style="color: #cc66cc;">1] = <span style="color: #cc66cc;">0;
thisrow[<span style="color: #cc66cc;">0] = <span style="color: #cc66cc;">0;
}
<span style="color: #b1b100;">else {
thisrow[<span style="color: #cc66cc;">2] = <span style="color: #cc66cc;">255;
thisrow[<span style="color: #cc66cc;">1] = <span style="color: #cc66cc;">255;
thisrow[<span style="color: #cc66cc;">0] = <span style="color: #cc66cc;">255;
}
thisrow += <span style="color: #cc66cc;">4;
}
row -= rowsize;
}
<span style="color: #b1b100;">return <span style="color: #000000; font-weight: bold;">true;
}
<span style="color: #000000; font-weight: bold;">extern "C" _declspec (dllexport) BOOL Sepia(<span style="color: #993333;">long object){
RGSSBMINFO *bitmap = ((RGSSBITMAP*) (object<<<span style="color: #cc66cc;">1)) -> bm -> bminfo;
DWORD rowsize;
DWORD width, height;
LPBYTE row;
<span style="color: #993333;">long x, y;
<span style="color: #993333;">double red, green, blue;
<span style="color: #b1b100;">if(!bitmap) <span style="color: #b1b100;">return <span style="color: #000000; font-weight: bold;">false;
width = bitmap -> infoheader -> biWidth;
height = bitmap -> infoheader -> biHeight;
rowsize = width * <span style="color: #cc66cc;">4;
row = (LPBYTE)(bitmap -> firstRow);
<span style="color: #b1b100;">for ( y = <span style="color: #cc66cc;">0; y < (<span style="color: #993333;">int) height; y++) {
LPBYTE thisrow = row;
<span style="color: #b1b100;">for ( x = <span style="color: #cc66cc;">0; x < (<span style="color: #993333;">int) width; x++) {
red = ((thisrow[<span style="color: #cc66cc;">2] * <span style="color: #cc66cc;">0.393) + (thisrow[<span style="color: #cc66cc;">1] * <span style="color: #cc66cc;">0.769) + (thisrow[<span style="color: #cc66cc;">0] * <span style="color: #cc66cc;">0.189));
green = ((thisrow[<span style="color: #cc66cc;">2] * <span style="color: #cc66cc;">0.349) + (thisrow[<span style="color: #cc66cc;">1] * <span style="color: #cc66cc;">0.686) + (thisrow[<span style="color: #cc66cc;">0] * <span style="color: #cc66cc;">0.168));
blue = ((thisrow[<span style="color: #cc66cc;">2] * <span style="color: #cc66cc;">0.272) + (thisrow[<span style="color: #cc66cc;">1] * <span style="color: #cc66cc;">0.534) + (thisrow[<span style="color: #cc66cc;">0] * <span style="color: #cc66cc;">0.131));
<span style="color: #b1b100;">if(red > <span style="color: #cc66cc;">255) red = <span style="color: #cc66cc;">255;
<span style="color: #b1b100;">if(green > <span style="color: #cc66cc;">255) green = <span style="color: #cc66cc;">255;
<span style="color: #b1b100;">if(blue > <span style="color: #cc66cc;">255) blue = <span style="color: #cc66cc;">255;
thisrow[<span style="color: #cc66cc;">2] = (BYTE) red;
thisrow[<span style="color: #cc66cc;">1] = (BYTE) green;
thisrow[<span style="color: #cc66cc;">0] = (BYTE) blue;
thisrow += <span style="color: #cc66cc;">4;
}
row -= rowsize;
}
<span style="color: #b1b100;">return <span style="color: #000000; font-weight: bold;">true;
}
<span style="color: #000000; font-weight: bold;">extern "C" _declspec (dllexport) BOOL Sharpen(<span style="color: #993333;">long object){
RGSSBMINFO *bitmap = ((RGSSBITMAP*) (object<<<span style="color: #cc66cc;">1)) -> bm -> bminfo;
DWORD rowsize;
DWORD width, height;
LPBYTE row;
<span style="color: #993333;">long x, y;
<span style="color: #993333;">double red, green, blue, ap;
<span style="color: #b1b100;">if(!bitmap) <span style="color: #b1b100;">return <span style="color: #000000; font-weight: bold;">false;
width = bitmap -> infoheader -> biWidth;
height = bitmap -> infoheader -> biHeight;
rowsize = width * <span style="color: #cc66cc;">4;
row = (LPBYTE)(bitmap -> firstRow);
red = <span style="color: #cc66cc;">0;
green = <span style="color: #cc66cc;">0;
blue = <span style="color: #cc66cc;">0;
ap = <span style="color: #cc66cc;">0.8;
<span style="color: #b1b100;">for ( y = <span style="color: #cc66cc;">0; y < (<span style="color: #993333;">int) height; y++) {
LPBYTE thisrow = row;
LPBYTE nextrow = row;
<span style="color: #b1b100;">if((y > <span style="color: #cc66cc;">0) && ((y + <span style="color: #cc66cc;">1) < (<span style="color: #993333;">int) height)) {
nextrow -= (width * <span style="color: #cc66cc;">4);
}
<span style="color: #b1b100;">for ( x = <span style="color: #cc66cc;">0; x < (<span style="color: #993333;">int) width; x++) {
<span style="color: #b1b100;">if(((y + <span style="color: #cc66cc;">1) < (<span style="color: #993333;">int) height) && ((x + <span style="color: #cc66cc;">1) < (<span style="color: #993333;">int) width)) {
nextrow += <span style="color: #cc66cc;">4;
red += nextrow[<span style="color: #cc66cc;">2];
green += nextrow[<span style="color: #cc66cc;">1];
blue += nextrow[<span style="color: #cc66cc;">0];
}
red = (((thisrow[<span style="color: #cc66cc;">2] - (red / <span style="color: #cc66cc;">3)) * ap) + thisrow[<span style="color: #cc66cc;">2]);
green = (((thisrow[<span style="color: #cc66cc;">1] - (green / <span style="color: #cc66cc;">3)) * ap) + thisrow[<span style="color: #cc66cc;">1]);
blue = (((thisrow[<span style="color: #cc66cc;">0] - (blue / <span style="color: #cc66cc;">3)) * ap) + thisrow[<span style="color: #cc66cc;">0]);
<span style="color: #b1b100;">if(red > <span style="color: #cc66cc;">255) red = <span style="color: #cc66cc;">255;
<span style="color: #b1b100;">if(green > <span style="color: #cc66cc;">255) green = <span style="color: #cc66cc;">255;
<span style="color: #b1b100;">if(blue > <span style="color: #cc66cc;">255) blue = <span style="color: #cc66cc;">255;
<span style="color: #b1b100;">if(red < <span style="color: #cc66cc;">0) red = <span style="color: #cc66cc;">0;
<span style="color: #b1b100;">if(green < <span style="color: #cc66cc;">0) green = <span style="color: #cc66cc;">0;
<span style="color: #b1b100;">if(blue < <span style="color: #cc66cc;">0) blue = <span style="color: #cc66cc;">0;
thisrow[<span style="color: #cc66cc;">2] = (BYTE) red;
thisrow[<span style="color: #cc66cc;">1] = (BYTE) green;
thisrow[<span style="color: #cc66cc;">0] = (BYTE) blue;
thisrow += <span style="color: #cc66cc;">4;
}
row -= rowsize;
}
<span style="color: #b1b100;">return <span style="color: #000000; font-weight: bold;">true;
}
<span style="color: #000000; font-weight: bold;">extern "C" _declspec (dllexport) BOOL Soften(<span style="color: #993333;">long object){
RGSSBMINFO *bitmap = ((RGSSBITMAP*) (object<<<span style="color: #cc66cc;">1)) -> bm -> bminfo;
DWORD rowsize;
DWORD width, height;
LPBYTE row;
<span style="color: #993333;">long x, y, xoffset, yoffset;
<span style="color: #993333;">int red, green, blue;
<span style="color: #b1b100;">if(!bitmap) <span style="color: #b1b100;">return <span style="color: #000000; font-weight: bold;">false;
width = bitmap -> infoheader -> biWidth;
height = bitmap -> infoheader -> biHeight;
rowsize = width * <span style="color: #cc66cc;">4;
row = (LPBYTE) (bitmap -> firstRow);
<span style="color: #b1b100;">for ( y = <span style="color: #cc66cc;">0; y < (<span style="color: #993333;">int) height; y++) {
LPBYTE thisrow = row;
<span style="color: #b1b100;">for ( x = <span style="color: #cc66cc;">0; x < (<span style="color: #993333;">int) width; x++) {
red = <span style="color: #cc66cc;">0;
green = <span style="color: #cc66cc;">0;
blue = <span style="color: #cc66cc;">0;
<span style="color: #b1b100;">for ( xoffset = <span style="color: #cc66cc;">-1; xoffset <= <span style="color: #cc66cc;">1; xoffset++) {
<span style="color: #b1b100;">for ( yoffset = <span style="color: #cc66cc;">-1; yoffset <= <span style="color: #cc66cc;">1; yoffset++) {
<span style="color: #b1b100;">if ((y > <span style="color: #cc66cc;">0) && ((y + yoffset) < (<span style="color: #993333;">int) height) && ((y + yoffset) > <span style="color: #cc66cc;">0) && ((x + xoffset) > <span style="color: #cc66cc;">0) && ((x + xoffset) < (<span style="color: #993333;">int) width)) {
LPBYTE newrow = thisrow;
newrow -= (yoffset * (width * <span style="color: #cc66cc;">4));
newrow += (xoffset * <span style="color: #cc66cc;">4);
red += newrow[<span style="color: #cc66cc;">2];
green += newrow[<span style="color: #cc66cc;">1];
blue += newrow[<span style="color: #cc66cc;">0];
}
}
}
red /= <span style="color: #cc66cc;">9;
green /= <span style="color: #cc66cc;">9;
blue /= <span style="color: #cc66cc;">9;
thisrow[<span style="color: #cc66cc;">2] = red;
thisrow[<span style="color: #cc66cc;">1] = green;
thisrow[<span style="color: #cc66cc;">0] = blue;
thisrow += <span style="color: #cc66cc;">4;
}
row -= rowsize;
}
<span style="color: #b1b100;">return <span style="color: #000000; font-weight: bold;">true;
}
<span style="color: #000000; font-weight: bold;">extern "C" _declspec (dllexport) BOOL Splatter(<span style="color: #993333;">long object){
RGSSBMINFO *bitmap = ((RGSSBITMAP*) (object<<<span style="color: #cc66cc;">1)) -> bm -> bminfo;
DWORD rowsize;
DWORD width, height;
LPBYTE row;
<span style="color: #993333;">long x, y;
<span style="color: #993333;">int randomx, randomy;
<span style="color: #b1b100;">if(!bitmap) <span style="color: #b1b100;">return <span style="color: #000000; font-weight: bold;">false;
width = bitmap -> infoheader -> biWidth;
height = bitmap -> infoheader -> biHeight;
rowsize = width * <span style="color: #cc66cc;">4;
row = (LPBYTE) (bitmap -> firstRow);
srand((<span style="color: #993333;">unsigned)time(<span style="color: #cc66cc;">0));
<span style="color: #b1b100;">for ( y = <span style="color: #cc66cc;">0; y < (<span style="color: #993333;">int) height; y++) {
LPBYTE thisrow = row;
<span style="color: #b1b100;">for ( x = <span style="color: #cc66cc;">0; x < (<span style="color: #993333;">int) width; x++) {
randomx = ((rand() % <span style="color: #cc66cc;">3) + <span style="color: #cc66cc;">1);
randomy = ((rand() % <span style="color: #cc66cc;">3) + <span style="color: #cc66cc;">1);
<span style="color: #b1b100;">if((y > <span style="color: #cc66cc;">0) && ((y + randomy) < (<span style="color: #993333;">int) height) && ((x + randomx) < (<span style="color: #993333;">int) width)) {
LPBYTE newrow = thisrow;
newrow -= (randomy * (width * <span style="color: #cc66cc;">4));
newrow += (randomx * <span style="color: #cc66cc;">4);
thisrow[<span style="color: #cc66cc;">2] = newrow[<span style="color: #cc66cc;">2];
thisrow[<span style="color: #cc66cc;">1] = newrow[<span style="color: #cc66cc;">1];
thisrow[<span style="color: #cc66cc;">0] = newrow[<span style="color: #cc66cc;">0];
thisrow[<span style="color: #cc66cc;">3] = newrow[<span style="color: #cc66cc;">3];
}
<span style="color: #b1b100;">else {
thisrow[<span style="color: #cc66cc;">2] = <span style="color: #cc66cc;">0;
thisrow[<span style="color: #cc66cc;">1] = <span style="color: #cc66cc;">0;
thisrow[<span style="color: #cc66cc;">0] = <span style="color: #cc66cc;">0;
thisrow[<span style="color: #cc66cc;">3] = <span style="color: #cc66cc;">0;
}
thisrow += <span style="color: #cc66cc;">4;
}
row -= rowsize;
}
<span style="color: #b1b100;">return <span style="color: #000000; font-weight: bold;">true;
}
<span style="color: #000000; font-weight: bold;">extern "C" _declspec (dllexport) BOOL Blank(<span style="color: #993333;">long object){
RGSSBMINFO *bitmap = ((RGSSBITMAP*) (object<<<span style="color: #cc66cc;">1)) -> bm -> bminfo;
DWORD rowsize;
DWORD width, height;
LPBYTE row;
<span style="color: #993333;">long x, y;
<span style="color: #993333;">int red, green, blue;
<span style="color: #b1b100;">if(!bitmap) <span style="color: #b1b100;">return <span style="color: #000000; font-weight: bold;">false;
width = bitmap -> infoheader -> biWidth;
height = bitmap -> infoheader -> biHeight;
rowsize = width * <span style="color: #cc66cc;">4;
row = (LPBYTE) (bitmap -> firstRow);
<span style="color: #b1b100;">for ( y = <span style="color: #cc66cc;">0; y < (<span style="color: #993333;">int) height; y++) {
LPBYTE thisrow = row;
<span style="color: #b1b100;">for ( x = <span style="color: #cc66cc;">0; x < (<span style="color: #993333;">int) width; x++) {
red = thisrow[<span style="color: #cc66cc;">2];
green = thisrow[<span style="color: #cc66cc;">1];
blue = thisrow[<span style="color: #cc66cc;">0];
thisrow += <span style="color: #cc66cc;">4;
}
row -= rowsize;
}
<span style="color: #b1b100;">return <span style="color: #000000; font-weight: bold;">true;