____                _       __
    / __ )____  _____   | |     / /___ ___________
   / __  / __ \/ ___/   | | /| / / __ `/ ___/ ___/
  / /_/ / /_/ (__  )    | |/ |/ / /_/ / /  (__  )
 /_____/\____/____/     |__/|__/\__,_/_/  /____/

       A futuristic real-time strategy game.
          This file is part of Bos Wars.
(C) Copyright 2001-2007 by the Bos Wars and Stratagus Project. Distributed under the "GNU General Public License"

png.cpp File Reference

The png graphic file loader. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <png.h>
#include "stratagus.h"
#include "video.h"
#include "iolib.h"
#include "iocompat.h"

Go to the source code of this file.

Functions

static void CL_png_read_data (png_structp png_ptr, png_bytep data, png_size_t length)
int LoadGraphicPNG (CGraphic *g)
 Make an OpenGL texture.
void SaveScreenshotPNG (const std::string &name)
 Set the current callbacks.


Detailed Description

The png graphic file loader.

Definition in file png.cpp.


Function Documentation

static void CL_png_read_data ( png_structp  png_ptr,
png_bytep  data,
png_size_t  length 
) [static]

png read callback for CL-IO.

Parameters:
png_ptr png struct pointer.
data byte address to read to.
length number of bytes to read.

Definition at line 60 of file png.cpp.

References CFile::read().

Referenced by LoadGraphicPNG().

int LoadGraphicPNG ( CGraphic g  ) 

Make an OpenGL texture.

Load a png graphic file. Modified function from SDL_Image

Parameters:
g graphic to load.
Returns:
0 for success, -1 for error.

Definition at line 81 of file png.cpp.

References CL_OPEN_READ, CL_png_read_data(), CFile::close(), CGraphic::File, CGraphic::GraphicHeight, CGraphic::GraphicWidth, int(), LibraryFileName(), CFile::open(), and CGraphic::Surface.

Referenced by CGraphic::Load().

void SaveScreenshotPNG ( const std::string &  name  ) 

Set the current callbacks.

Save a screenshot to a PNG file.

Parameters:
name PNG filename to save.

Definition at line 314 of file png.cpp.

References CVideo::Depth, CVideo::Height, CVideo::LockScreen(), TheScreen, CVideo::UnlockScreen(), UseOpenGL, Video, and CVideo::Width.

Referenced by Screenshot().


Generated on Sat Feb 21 00:28:18 2009 for Bos Wars by  doxygen 1.5.6