diff options
author | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2008-04-06 12:18:01 +0000 |
---|---|---|
committer | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2008-04-06 12:18:01 +0000 |
commit | 93f69ff9a0c9b05dfbbdcf6f7d737a68fc4d3bd1 (patch) | |
tree | 2e78e1b8acb099c952ff1c4931dcc0e4d013900d /Game/Code/Classes/UTexture.pas | |
parent | b2a824d8f4fcf4d9038e2a360ac586fb0279e739 (diff) | |
download | usdx-93f69ff9a0c9b05dfbbdcf6f7d737a68fc4d3bd1.tar.gz usdx-93f69ff9a0c9b05dfbbdcf6f7d737a68fc4d3bd1.tar.xz usdx-93f69ff9a0c9b05dfbbdcf6f7d737a68fc4d3bd1.zip |
- removed (linux incompatible) PngImage. In addition it was rather outdated (from 2003, newest version is from 2006)
- introduced UImage-unit for JPG/PNG/BMP image saving
- the png part uses the libpng12-0.dll (part of SDL_Image) so
- the jpg part uses either Delphi's Jpeg unit or FPC's base/pasjpeg unit
-> so no additional libs are needed.
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1007 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r-- | Game/Code/Classes/UTexture.pas | 55 |
1 files changed, 8 insertions, 47 deletions
diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index f9f0cc10..35757a8e 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -18,6 +18,7 @@ uses OpenGL12, Classes, SysUtils, UCommon, + UImage, SDL, sdlutils, SDL_Image; @@ -139,46 +140,6 @@ uses ULog, {$ENDIF} StrUtils; -const - fmt_rgba: TSDL_Pixelformat = ( - palette: nil; - BitsPerPixel: 32; - BytesPerPixel: 4; - Rloss: 0; - Gloss: 0; - Bloss: 0; - Aloss: 0; - Rshift: 0; - Gshift: 8; - Bshift: 16; - Ashift: 24; - Rmask: $000000ff; - Gmask: $0000ff00; - Bmask: $00ff0000; - Amask: $ff000000; - ColorKey: 0; - Alpha: 255 - ); - fmt_rgb: TSDL_Pixelformat = ( - palette: nil; - BitsPerPixel: 24; - BytesPerPixel: 3; - Rloss: 0; - Gloss: 0; - Bloss: 0; - Aloss: 0; - Rshift: 0; - Gshift: 8; - Bshift: 16; - Ashift: 0; - Rmask: $000000ff; - Gmask: $0000ff00; - Bmask: $00ff0000; - Amask: $00000000; - ColorKey: 0; - Alpha: 255 - ); - Constructor TTextureUnit.Create; begin @@ -388,14 +349,14 @@ var TempSurface: PSDL_Surface; NeededPixFmt: PSDL_Pixelformat; begin - NeededPixFmt:=@fmt_rgba; - if (Typ = TEXTURE_TYPE_PLAIN) then NeededPixFmt:=@fmt_rgb - else - if (Typ = TEXTURE_TYPE_TRANSPARENT) or - (Typ = TEXTURE_TYPE_COLORIZED) - then NeededPixFmt:=@fmt_rgba + NeededPixFmt:=@PixelFmt_RGBA; + if (Typ = TEXTURE_TYPE_PLAIN) then + NeededPixFmt:=@PixelFmt_RGB + else if (Typ = TEXTURE_TYPE_TRANSPARENT) or + (Typ = TEXTURE_TYPE_COLORIZED) then + NeededPixFmt:=@PixelFmt_RGBA else - NeededPixFmt:=@fmt_rgb; + NeededPixFmt:=@PixelFmt_RGB; if not pixfmt_eq(TexSurface^.format, NeededPixFmt) then |