-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ebf885d
Showing
22 changed files
with
1,890 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
*~ | ||
*.d | ||
*.exe | ||
*.o | ||
*.obj |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
======================================================================================= | ||
2005/01/01 | ||
|
||
WINICO had been released as Open Souce under the GNU GPL License. | ||
|
||
The source code had been included on this file (source.zip) and it is compiled used VACC 4.0. | ||
|
||
Special Thanks to Leonardo Pino for releasing the source code of this program. | ||
|
||
|
||
======================================================================================= | ||
|
||
|
||
|
||
This program is to convert icons from the Win32 format into the OS/2 format (v 1.2). | ||
Multiples images are supported but only on 16x16 and/or 32x32 sizes. | ||
|
||
Usage: | ||
|
||
winico <win file> <OS/2 file> (*.ico extension is expected) | ||
|
||
or | ||
|
||
winico -d <dir name> (here the program grabs all *.ico files it finds in the directory and converts them into the OS/2 format placing the files with the same name under a directory that is created at the place where winico was executed) | ||
|
||
History | ||
|
||
0.92 | ||
- Rewrote the code using C++ (VAC++ 4.0) | ||
- The program creates images for 20x20 and 40x40 sizes (centering the image) | ||
- Flexible design to make easier developing new features | ||
- Some exception handling | ||
|
||
0.91 | ||
- Fix some minor bugs | ||
|
||
0.9 | ||
- Inicial public release | ||
|
||
To do | ||
|
||
- Find an easy algorithm to scale images. | ||
- Support for OS/2 icon format 2.0 | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
#include <os2.h> | ||
|
||
class BitmapHeader{ | ||
|
||
ULONG biSize; | ||
ULONG biWidth; | ||
ULONG biHeight; | ||
USHORT biPlanes; | ||
USHORT biBitCount; | ||
ULONG biCompression; | ||
ULONG biSizeImage; | ||
ULONG biXPelsPerMeter; | ||
ULONG biYPelsPerMeter; | ||
ULONG biCirUsed; | ||
ULONG biClrImportant; | ||
|
||
public: | ||
|
||
BitmapHeader(){ | ||
biSize =0; | ||
biWidth =0; | ||
biHeight =0; | ||
biPlanes =0; | ||
biBitCount =0; | ||
biCompression =0; | ||
biSizeImage =0; | ||
biXPelsPerMeter=0; | ||
biYPelsPerMeter=0; | ||
biCirUsed =0; | ||
biClrImportant =0; | ||
} | ||
|
||
// Setters | ||
|
||
void setBiSize(ULONG valor){ | ||
biSize = valor; | ||
} | ||
void setBiWidth(ULONG valor){ | ||
biWidth = valor; | ||
} | ||
void setBiHeight(ULONG valor){ | ||
biHeight = valor; | ||
} | ||
void setBiPlanes(USHORT valor){ | ||
biPlanes = valor; | ||
} | ||
void setBiBitCount(USHORT valor){ | ||
biBitCount = valor; | ||
} | ||
void setBiCompression(ULONG valor){ | ||
biCompression = valor; | ||
} | ||
void setBiSizeImage(ULONG valor){ | ||
biSizeImage = valor; | ||
} | ||
void setBiXPelsPerMeter(ULONG valor){ | ||
biXPelsPerMeter = valor; | ||
} | ||
void setBiYPelsPerMeter(ULONG valor){ | ||
biYPelsPerMeter = valor; | ||
} | ||
void setBiCirUsed(ULONG valor){ | ||
biCirUsed = valor; | ||
} | ||
void setBiClrImportant(ULONG valor){ | ||
biClrImportant = valor; | ||
} | ||
|
||
//Getters | ||
|
||
ULONG getBiSize(){ | ||
return biSize; | ||
} | ||
ULONG getBiWidth(){ | ||
return biWidth; | ||
} | ||
ULONG getBiHeight(){ | ||
return biHeight; | ||
} | ||
USHORT getBiPlanes(){ | ||
return biPlanes; | ||
} | ||
USHORT getBiBitCount(){ | ||
return biBitCount; | ||
} | ||
ULONG getBiCompression(){ | ||
return biCompression; | ||
} | ||
ULONG getBiSizeImage(){ | ||
return biSizeImage; | ||
} | ||
ULONG getBiXPelsPerMeter(){ | ||
return biXPelsPerMeter; | ||
} | ||
ULONG getBiYPelsPerMeter(){ | ||
return biYPelsPerMeter; | ||
} | ||
ULONG getBiCirUsed(){ | ||
return biCirUsed; | ||
} | ||
ULONG getBiClrImportant(){ | ||
return biClrImportant; | ||
} | ||
}; |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,177 @@ | ||
int Os2Icon::ipow(int b, int e){ | ||
int p=b; | ||
while(--e) | ||
p*=b; | ||
return p; | ||
} | ||
|
||
void Os2Icon::setDataImage(PBYTE datos, int tamanio){ | ||
pImgData = (PBYTE)malloc(tamanio); | ||
memcpy(pImgData, datos, tamanio); | ||
} | ||
|
||
void Os2Icon::setMaskData(PBYTE datos){ | ||
maskSize = getSizeMaskImage(); | ||
pMaskData = (PBYTE)calloc(maskSize*2,1); | ||
memset(pMaskData,0,maskSize); | ||
memcpy(pMaskData+maskSize,datos,maskSize); | ||
} | ||
ULONG Os2Icon::getSizeImage(){ | ||
ULONG ret,res; | ||
int divisor,potencia; | ||
divisor = ibih->getCx()/4; | ||
if(ibih->getCBitCount() > 1){ | ||
potencia = ibih->getCBitCount()/8; | ||
ret = ibih->getCx() * ibih->getCy() * potencia; | ||
} | ||
else{ | ||
if(ibih->getCx()==20 || ibih->getCx()==40) | ||
ret = (ibih->getCx()/5) * (ibih->getCx()*2); | ||
else | ||
ret = (ibih->getCx()*ibih->getCy())/divisor; | ||
} | ||
return ret; | ||
} | ||
|
||
ULONG Os2Icon::getSizeMaskImage(){ | ||
ULONG ret,res; | ||
switch(Mibih->getCx()){ | ||
case 16: | ||
ret=64; | ||
break; | ||
case 20: | ||
ret=80; | ||
break; | ||
case 32: | ||
ret=128; | ||
break; | ||
case 40: | ||
ret=320; | ||
break; | ||
default: | ||
break; | ||
} | ||
/* if(Mibih->getCx()==16) | ||
ret=64; | ||
else | ||
if(Mibih->getCx()==20) | ||
ret=80; | ||
else | ||
if(Mibih->getCx()==32) | ||
ret=128; | ||
else | ||
if(Mibih->getCx()==40) | ||
ret=320; | ||
*/ | ||
// cout << "getSizeMaskImage: X=" << Mibih->getCx() << " ret=" << ret << endl; | ||
return ret; | ||
} | ||
|
||
ULONG Os2Icon::sizePaleta(){ | ||
ULONG buffer; | ||
int porte; | ||
int numbits = getIbih()->getCPlanes()*getIbih()->getCBitCount(); | ||
if(numbits != 24) | ||
porte = ipow(2,numbits); | ||
else | ||
porte = 0; | ||
buffer = porte*sizeof(RGB); | ||
return buffer; | ||
} | ||
|
||
void Os2Icon12::convPal(RgbQuad *bpaleta, int colores){ | ||
int i, j; | ||
pPaletaColor = (RGB*)malloc(colores*sizeof(RGB)); | ||
for(i=0;i<colores;i++){ | ||
pPaletaColor[i].bRed = bpaleta[i].getBlue(); | ||
pPaletaColor[i].bGreen = bpaleta[i].getGreen(); | ||
pPaletaColor[i].bBlue = bpaleta[i].getRed(); | ||
} | ||
} | ||
|
||
IconBIH* Os2Icon::getIbih(){ | ||
return ibih; | ||
} | ||
|
||
int Os2Icon12::setPalBW(){ | ||
pPaletaBW = (RGB*)malloc(sizeof(RGB)*2); | ||
pPaletaBW[0].bBlue = 0x00; | ||
pPaletaBW[0].bGreen = 0x00; | ||
pPaletaBW[0].bRed = 0x00; | ||
pPaletaBW[1].bBlue = 0xff; | ||
pPaletaBW[1].bGreen = 0xff; | ||
pPaletaBW[1].bRed = 0xff; | ||
|
||
return 0; | ||
} | ||
|
||
Os2Icon12::Os2Icon12(IconImage *imagenWin){ | ||
bih = new BITMAPINFOHEADER; | ||
pArray = new BITMAPARRAYFILEHEADER; | ||
pHead = new BITMAPFILEHEADER; | ||
//No configuro la paleta de colores si es un icono de 24 bits | ||
if(imagenWin->getBitsXPixel() != 24) | ||
convPal(imagenWin->getIcColors(),imagenWin->getNumColores()); | ||
setNumBitsColores(imagenWin->getBitsXPixel()); | ||
setPalBW(); | ||
setDataImage(imagenWin->getIcXor(),imagenWin->getNumBytes()); | ||
setArray(); | ||
setDatos(imagenWin); | ||
setXorAnd(imagenWin); | ||
setMaskData(imagenWin->getIcAnd()); | ||
} | ||
|
||
ULONG Os2Icon12::getSizePicture(){ | ||
ULONG size; | ||
int n1 = sizeof(BITMAPARRAYFILEHEADER); | ||
int n2 = sizeof(BITMAPFILEHEADER); | ||
int n3 = sizeof(RGB); | ||
size = n1+n2+(n3*2)+sizePaleta(); | ||
return size; | ||
} | ||
|
||
int Os2Icon12::setXorAnd(IconImage *datos){ | ||
// BITMAPFILEHEADER xheader = pArray->bfh; | ||
pArray->bfh.usType = BFT_COLORICON; | ||
pArray->bfh.cbSize = sizeof(BITMAPFILEHEADER); | ||
pArray->bfh.xHotspot = datos->getBitmapHeader()->getBiWidth()/2; | ||
pArray->bfh.yHotspot = datos->getBitmapHeader()->getBiHeight()/4; | ||
pArray->bfh.offBits = 0; | ||
pArray->bfh.bmp.cbFix = sizeof(BITMAPINFOHEADER); | ||
pArray->bfh.bmp.cx = datos->getBitmapHeader()->getBiWidth(); | ||
pArray->bfh.bmp.cy = datos->getBitmapHeader()->getBiHeight(); | ||
pArray->bfh.bmp.cPlanes = datos->getBitmapHeader()->getBiPlanes(); | ||
pArray->bfh.bmp.cBitCount = 1; | ||
Mibih->setIBIH(&pArray->bfh.bmp); | ||
return 0; | ||
} | ||
|
||
int Os2Icon12::setDatos(IconImage *datos){ | ||
pHead->usType =0x4943; | ||
pHead->cbSize =sizeof(BITMAPFILEHEADER); | ||
pHead->xHotspot =datos->getBitmapHeader()->getBiWidth()/2; | ||
pHead->yHotspot =datos->getBitmapHeader()->getBiHeight()/4; | ||
pHead->offBits =0; | ||
pHead->bmp.cbFix =sizeof(BITMAPINFOHEADER); | ||
pHead->bmp.cx =datos->getBitmapHeader()->getBiWidth(); | ||
pHead->bmp.cy =datos->getBitmapHeader()->getBiHeight()/2; | ||
pHead->bmp.cPlanes =datos->getBitmapHeader()->getBiPlanes(); | ||
// pHead->bmp.cBitCount =datos->getBitmapHeader()->getBiBitCount(); | ||
pHead->bmp.cBitCount =datos->getBitsXPixel(); | ||
ibih->setIBIH(&pHead->bmp); | ||
return 0; | ||
} | ||
|
||
int Os2Icon12::setArray(){ | ||
pArray->usType =0x4142; | ||
pArray->cbSize =sizeof(BITMAPARRAYFILEHEADER); | ||
pArray->offNext =1; | ||
pArray->cxDisplay =0; | ||
pArray->cyDisplay =0; | ||
return 0; | ||
} | ||
|
||
int Os2Icon12::getAlto(){ | ||
return pHead->bmp.cy; | ||
} | ||
|
Oops, something went wrong.