00001 /* 00002 libwt - Vassilis Virvilis Toolkit - a widget library 00003 Copyright (C) 2006 Vassilis Virvilis <vasvir2@fastmail.fm> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public 00007 License as published by the Free Software Foundation; either 00008 version 2.1 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Lesser General Public License for more details. 00014 00015 You should have received a copy of the GNU Lesser General Public 00016 License along with this library; if not, write to the 00017 Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00018 Boston, MA 02111-1307, SA. 00019 */ 00020 00021 #include "sdlpixelformat.h" 00022 00023 namespace Wt { 00024 00025 SDLColor SDLPixelFormat::mapToColor(int v) const { 00026 Uint8 r, g, b, a; 00027 //SDL breakage 00028 SDL_PixelFormat *f = const_cast<SDL_PixelFormat *>(sdl_pixelformat); 00029 SDL_GetRGBA(v, f, &r, &g, &b, &a); 00030 00031 return SDLColor(r, g, b, a); 00032 } 00033 00034 int SDLPixelFormat::mapToPixelValue(const SDLColor& c) const { 00035 //SDL breakage 00036 SDL_PixelFormat *f = const_cast<SDL_PixelFormat *>(sdl_pixelformat); 00037 return SDL_MapRGBA(f, c.red(), c.green(), c.blue(), c.alpha()); 00038 } 00039 00040 SDLColor SDLPixelFormat::transparentColor() const { 00041 return mapToColor(sdl_pixelformat->colorkey); 00042 } 00043 00044 } // namespace
This document is licensed under the terms of the GNU Free Documentation License and may be freely distributed under the conditions given by this license.