~ubuntu-branches/ubuntu/quantal/devil/quantal

« back to all changes in this revision

Viewing changes to src-IL/src/il_convert.c

  • Committer: Bazaar Package Importer
  • Author(s): Bradley Smith
  • Date: 2008-07-23 21:45:53 UTC
  • mfrom: (1.1.1 upstream) (5.1.2 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080723214553-o8629ygxv6d2iijm
Tags: 1.6.8-rc2-3
* Fix typo in 00_misc_fixes.diff.
* Remove broken watch file. Not adding a new one since upstreams
  repository is full of broken versioning.

Show diffs side-by-side

added added

removed removed

Lines of Context:
441
441
                        return IL_FALSE;
442
442
        }
443
443
 
444
 
        if (iCurImage->Bpp == IL_COLOUR_INDEX) {
 
444
        if (iCurImage->Format == IL_COLOUR_INDEX) {
445
445
                for (; i < iCurImage->Pal.PalSize; i += PalBpp) {
446
446
                                Temp = iCurImage->Pal.Palette[i];
447
447
                                iCurImage->Pal.Palette[i] = iCurImage->Pal.Palette[i+2];
591
591
}
592
592
 
593
593
 
594
 
ILfloat KeyRed = 0, KeyGreen = 0, KeyBlue = 0, KeyAlpha = 0;
 
594
//ILfloat KeyRed = 0, KeyGreen = 0, KeyBlue = 0, KeyAlpha = 0;
595
595
 
596
596
ILvoid ILAPIENTRY ilKeyColour(ILclampf Red, ILclampf Green, ILclampf Blue, ILclampf Alpha)
597
597
{
598
 
        KeyRed          = Red;
 
598
        ILfloat KeyRed = 0, KeyGreen = 0, KeyBlue = 0, KeyAlpha = 0;
 
599
        KeyRed          = Red;
599
600
        KeyGreen        = Green;
600
601
        KeyBlue         = Blue;
601
602
        KeyAlpha        = Alpha;
607
608
//      making the image transparent where Key is equal to the pixel.
608
609
ILboolean ilAddAlphaKey(ILimage *Image)
609
610
{
610
 
        ILubyte         *NewData, NewBpp;
 
611
        ILfloat KeyRed = 0, KeyGreen = 0, KeyBlue = 0, KeyAlpha = 0;
 
612
        ILubyte         *NewData, NewBpp;
611
613
        ILfloat         KeyColour[3];
612
614
        ILuint          i = 0, j = 0, c, Size;
613
615
        ILboolean       Same;
817
819
//      Should we maybe add an option that changes the image based on the alpha?
818
820
ILboolean ilRemoveAlpha()
819
821
{
820
 
        ILubyte *NewData, NewBpp;
 
822
        ILubyte *NewData, NewBpp;
821
823
        ILuint i = 0, j = 0, Size;
822
824
 
823
825
        if (iCurImage == NULL) {
952
954
        return IL_TRUE;
953
955
}
954
956
 
955
 
 
 
957
/*
956
958
ILboolean ilFixImage()
957
959
{
958
960
        ILuint NumImages, i;
989
991
 
990
992
        return IL_TRUE;
991
993
}
 
994
*/
 
995
 
 
996
/*
 
997
This function was replaced 20050304, because the previous version
 
998
didn't fix the mipmaps of the subimages etc. This version is not
 
999
completely correct either, because the subimages of the subimages
 
1000
etc. are not fixed, but at the moment no images of this type can
 
1001
be loaded anyway. Thanks to Chris Lux for pointing this out.
 
1002
*/
 
1003
 
 
1004
ILboolean ilFixImage()
 
1005
{
 
1006
        ILuint NumImages, i;
 
1007
        ILuint NumMipmaps,j;
 
1008
        ILuint NumLayers, k;
 
1009
 
 
1010
        NumImages  = ilGetInteger(IL_NUM_IMAGES);
 
1011
        for (i = 0; i <= NumImages; i++) {
 
1012
                ilBindImage(ilGetCurName());  // Set to parent image first.
 
1013
                if (!ilActiveImage(i))
 
1014
                        return IL_FALSE;
 
1015
 
 
1016
                NumLayers = ilGetInteger(IL_NUM_LAYERS);
 
1017
                for (k = 0; k <= NumLayers; k++) {
 
1018
                        ilBindImage(ilGetCurName());  // Set to parent image first.
 
1019
                        if (!ilActiveImage(i))
 
1020
                                return IL_FALSE;
 
1021
                        if (!ilActiveLayer(k))
 
1022
                                return IL_FALSE;
 
1023
 
 
1024
                        NumMipmaps = ilGetInteger(IL_NUM_MIPMAPS);
 
1025
 
 
1026
                        for (j = 0; j <= NumMipmaps; j++) {
 
1027
                                ilBindImage(ilGetCurName());    // Set to parent image first.
 
1028
                                if (!ilActiveImage(i))
 
1029
                                        return IL_FALSE;
 
1030
                                if (!ilActiveLayer(k))
 
1031
                                        return IL_FALSE;
 
1032
                                if (!ilActiveMipmap(j))
 
1033
                                        return IL_FALSE;
 
1034
                                if (!ilFixCur())
 
1035
                                        return IL_FALSE;
 
1036
                        }
 
1037
                }
 
1038
        }
 
1039
        ilBindImage(ilGetCurName());
 
1040
 
 
1041
        return IL_TRUE;
 
1042
}