[Lprof-devel] lprof/src/videoLUTutils LUTutil-NT.cpp, NONE, 1.1 LUTutil-OSX.cpp, NONE, 1.1 LUTutil-
Brought to you by:
hvengel
From: Hal E. <hv...@us...> - 2007-04-05 21:05:02
|
Update of /cvsroot/lprof/lprof/src/videoLUTutils In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv14551/src/videoLUTutils Added Files: LUTutil-NT.cpp LUTutil-OSX.cpp LUTutil-X11.cpp LUTutil.h Log Message: Initial video card gamma frame work. Uses OOP to hide implementation details. Allows the calling application to get and set the video card gamma tables. The scons build scripts select the correct implementation file to include in the build for different OS platforms. The X11 implementation is working but likely alpha at this time. It seems almost too simple once I had it working. The Windows and OSX implementations are currently stubs and do nothing. But should not stop the app from building and running on these platforms. --- NEW FILE: LUTutil-X11.cpp --- // $Id: LUTutil-X11.cpp,v 1.1 2007/04/05 21:04:38 hvengel Exp $ // Little cms Profiler // Copyright (C) 2007 Hal Engel // // THIS SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, // EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY // WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. // // IN NO EVENT SHALL MARTI MARIA BE LIABLE FOR ANY SPECIAL, INCIDENTAL, // INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, // OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, // WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF // LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE // OF THIS SOFTWARE. // // This file is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // // As a special exception to the GNU General Public License, if you // distribute this file as part of a program that contains a // configuration script generated by Autoconf, you may include it under // the same distribution terms that you use for the rest of that program. // // Version 1.11 #include <stdio.h> #include <stdlib.h> #include <math.h> #include <sys/types.h> #include <time.h> #include <string.h> // X11 stuff #include <X11/Xos.h> #include <X11/Xlib.h> #include <X11/Xutil.h> #include <X11/Xlibint.h> #include <X11/Xproto.h> #include <X11/Xatom.h> #include <X11/extensions/xf86vmode.h> #include <X11/extensions/dpms.h> #include <X11/extensions/Xinerama.h> // #include <qapplication.h> // #include "X11/extensions/randr.h" // #include "X11/extensions/randrproto.h" // #include "X11/extensions/Xrandr.h" // #include <X11/extensions/Xrender.h> #include "LUTutil.h" gamma_ramp::gamma_ramp(int Screen) { screen = Screen; size = getGammaRampSize(screen); // now allocate the arrays red = new unsigned short[size]; green = new unsigned short[size]; blue = new unsigned short[size]; } gamma_ramp::~gamma_ramp() { delete[] red; delete[] green; delete[] blue; } int gamma_ramp::getGammaRampSize(int Screen) { int size = 0; int event_base; int error_base; Display *dpy; if ((dpy = XOpenDisplay(":0.0")) == NULL) { printf("failed to open display :0.0\n"); } else { if (XF86VidModeQueryExtension(dpy, &event_base, &error_base) ==0) { printf("XF86VidModeQueryExtension failed\n"); } else { if (!XF86VidModeGetGammaRampSize(dpy, Screen, &size)) { printf("failed to get XF86VidModeGetGammaRampSize\n"); } else { printf("reamdac_size = %i\n", size); } } } return size; // will be 0 if failed } void gamma_ramp::getGammaRamp() { int event_base; int error_base; Display *dpy; if ((dpy = XOpenDisplay(":0.0")) == NULL) { printf("failed to open display :0.0\n"); } else { if (XF86VidModeQueryExtension(dpy, &event_base, &error_base) ==0) { printf("XF86VidModeQueryExtension failed\n"); } else { XF86VidModeGetGammaRamp(dpy, screen, size, red, green, blue); } } } void gamma_ramp::setGammaRamp() { int event_base; int error_base; Display *dpy; if ((dpy = XOpenDisplay(":0.0")) == NULL) { printf("failed to open display :0.0\n"); } else { if (XF86VidModeQueryExtension(dpy, &event_base, &error_base) ==0) { printf("XF86VidModeQueryExtension failed\n"); } else { XF86VidModeSetGammaRamp(dpy, screen, size, red, green, blue); } } } void gamma_ramp::setLinearGammaRamp() { int event_base; int error_base; Display *dpy; gamma_ramp* temp; temp = new gamma_ramp(screen); for (int i=0; i< temp -> size; i++) { temp -> red[i] = temp -> green[i] = temp -> blue[i] = i * 256; } if ((dpy = XOpenDisplay(":0.0")) == NULL) { printf("failed to open display :0.0\n"); } else { if (XF86VidModeQueryExtension(dpy, &event_base, &error_base) ==0) { printf("XF86VidModeQueryExtension failed\n"); } else { temp -> setGammaRamp(); } } delete temp; } --- NEW FILE: LUTutil-OSX.cpp --- // $Id: LUTutil-OSX.cpp,v 1.1 2007/04/05 21:04:38 hvengel Exp $ // Little cms Profiler // Copyright (C) 2007 Hal Engel // // THIS SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, // EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY // WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. // // IN NO EVENT SHALL MARTI MARIA BE LIABLE FOR ANY SPECIAL, INCIDENTAL, // INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, // OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, // WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF // LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE // OF THIS SOFTWARE. // // This file is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // // As a special exception to the GNU General Public License, if you // distribute this file as part of a program that contains a // configuration script generated by Autoconf, you may include it under // the same distribution terms that you use for the rest of that program. // // Version 1.11 // #ifdef __APPLE__ /* Assume OSX Carbon */ // #include <Carbon/Carbon.h> // #include <CoreServices/CoreServices.h> // #include <IOKit/Graphics/IOGraphicsLib.h> // #endif /* __APPLE__ */ gamma_ramp::gamma_ramp(int Screen) { screen = Screen; size = getGammaRampSize(screen); // now allocate the arrays red = new unsigned short[size]; green = new unsigned short[size]; blue = new unsigned short[size]; } gamma_ramp::~gamma_ramp() { delete[] red; delete[] green; delete[] blue; } int gamma_ramp::getGammaRampSize(int Screen) { } void gamma_ramp::getGammaRamp() { } void gamma_ramp::setGammaRamp() { } void gamma_ramp::setLinearGammaRamp() { } --- NEW FILE: LUTutil.h --- class gamma_ramp { public: int screen; int size; unsigned short *red, *green, *blue; gamma_ramp(int); ~gamma_ramp(); void getGammaRamp(); // returns size void setGammaRamp(); void setLinearGammaRamp(); private: int getGammaRampSize(int); }; --- NEW FILE: LUTutil-NT.cpp --- // $Id: LUTutil-NT.cpp,v 1.1 2007/04/05 21:04:38 hvengel Exp $ // Little cms Profiler // Copyright (C) 2007 Hal Engel // // THIS SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, // EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY // WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. // // IN NO EVENT SHALL MARTI MARIA BE LIABLE FOR ANY SPECIAL, INCIDENTAL, // INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, // OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, // WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF // LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE // OF THIS SOFTWARE. // // This file is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // // As a special exception to the GNU General Public License, if you // distribute this file as part of a program that contains a // configuration script generated by Autoconf, you may include it under // the same distribution terms that you use for the rest of that program. // // Version 1.11 // #ifdef NT // #define OEMRESOURCE // #include <windows.h> // // #if(WINVER < 0x0500) // #error Require WINVER >= 0x500 to compile (multi-monitor API needed) // #endif // gamma_ramp::gamma_ramp(int Screen) { screen = Screen; size = getGammaRampSize(screen); // now allocate the arrays red = new unsigned short[size]; green = new unsigned short[size]; blue = new unsigned short[size]; } gamma_ramp::~gamma_ramp() { delete[] red; delete[] green; delete[] blue; } int gamma_ramp::getGammaRampSize(int Screen) { } void gamma_ramp::getGammaRamp() { } void gamma_ramp::setGammaRamp() { } void gamma_ramp::setLinearGammaRamp() { } |