File indexing completed on 2024-05-05 16:39:02
0001 /* This file is part of the KDE project 0002 Copyright (C) 1998-2001 Carsten Pfeiffer <pfeiffer@kde.org> 0003 0004 This program is free software; you can redistribute it and/or 0005 modify it under the terms of the GNU General Public 0006 License as published by the Free Software Foundation, version 2. 0007 0008 This program is distributed in the hope that it will be useful, 0009 but WITHOUT ANY WARRANTY; without even the implied warranty of 0010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0011 General Public License for more details. 0012 0013 You should have received a copy of the GNU General Public License 0014 along with this program; see the file COPYING. If not, write to 0015 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0016 Boston, MA 02110-1301, USA. 0017 */ 0018 0019 #include "imdata.h" 0020 0021 #include <KConfigGroup> 0022 0023 0024 ImData::ImData() 0025 { 0026 ownPalette = true; 0027 fastRemap = true; 0028 fastRender = true; 0029 dither16bit = false; 0030 dither8bit = true; 0031 smoothScale = false; 0032 maxCache = 10240; 0033 0034 gamma = 0; 0035 brightness = 0; 0036 contrast = 0; 0037 0038 gammaFactor = 10; 0039 brightnessFactor = 10; 0040 contrastFactor = 10; 0041 } 0042 0043 0044 void ImData::load( KSharedConfig::Ptr kc ) 0045 { 0046 ImData def; 0047 0048 KConfigGroup group( kc, "ImlibConfiguration" ); 0049 0050 ownPalette = group.readEntry( "UseOwnPalette", def.ownPalette ); 0051 fastRemap = group.readEntry( "FastRemapping", def.fastRemap ); 0052 fastRender = group.readEntry( "FastRendering", def.fastRender ); 0053 dither16bit = group.readEntry( "Dither16Bit", def.dither16bit ); 0054 dither8bit = group.readEntry( "Dither8Bit", def.dither8bit ); 0055 smoothScale = group.readEntry( "SmoothScaling", def.smoothScale ); 0056 0057 maxCache = group.readEntry( "MaxCacheSize", 10240 ); 0058 0059 gamma = group.readEntry( "GammaDefault", 0 ); 0060 brightness = group.readEntry( "BrightnessDefault", 0 ); 0061 contrast = group.readEntry( "ContrastDefault", 0 ); 0062 0063 gammaFactor = abs( group.readEntry( "GammaFactor", 10 ) ); 0064 brightnessFactor = abs( group.readEntry( "BrightnessFactor", 10 ) ); 0065 contrastFactor = abs( group.readEntry( "ContrastFactor", 10 ) ); 0066 } 0067 0068 0069 void ImData::save( KSharedConfig::Ptr kc ) 0070 { 0071 KConfigGroup group( kc, "ImlibConfiguration" ); 0072 0073 group.writeEntry( "UseOwnPalette", ownPalette ); 0074 group.writeEntry( "FastRemapping", fastRemap ); 0075 group.writeEntry( "FastRendering", fastRender ); 0076 group.writeEntry( "Dither16Bit", dither16bit ); 0077 group.writeEntry( "Dither8Bit", dither8bit ); 0078 group.writeEntry( "MaxCacheSize", maxCache ); 0079 group.writeEntry( "SmoothScaling", smoothScale ); 0080 0081 group.writeEntry( "GammaDefault", gamma ); 0082 group.writeEntry( "BrightnessDefault", brightness ); 0083 group.writeEntry( "ContrastDefault", contrast ); 0084 0085 group.writeEntry( "GammaFactor", gammaFactor ); 0086 group.writeEntry( "BrightnessFactor", brightnessFactor ); 0087 group.writeEntry( "ContrastFactor", contrastFactor ); 0088 0089 kc->sync(); 0090 }