diff --git a/src/WNT/WNT.cdl b/src/WNT/WNT.cdl index 670a39876e..0942dd6367 100755 --- a/src/WNT/WNT.cdl +++ b/src/WNT/WNT.cdl @@ -20,7 +20,6 @@ -- Modifications: DCB at March 1998 Porting MFT for Windows NT (95) -- PLOTNIKOV Eugeny at July 1998 (BUC60286) --- VKH at October 1999 (class PixMap added) package WNT @@ -75,10 +74,6 @@ package WNT ---Purpose: Creates the Window drawable. ---Category: Classes - class PixMap; - ---Purpose: Creates a windows bitmap - ---Category: Classes - class WClass; ---Purpose: Creates a Windows NT window class. ---Category: Classes diff --git a/src/WNT/WNT_PixMap.cdl b/src/WNT/WNT_PixMap.cdl deleted file mode 100755 index ea8479880c..0000000000 --- a/src/WNT/WNT_PixMap.cdl +++ /dev/null @@ -1,108 +0,0 @@ --- Created on: 1999-10-27 --- Created by: VKH --- Copyright (c) 1999 Matra Datavision --- Copyright (c) 1999-2012 OPEN CASCADE SAS --- --- The content of this file is subject to the Open CASCADE Technology Public --- License Version 6.5 (the "License"). You may not use the content of this file --- except in compliance with the License. Please obtain a copy of the License --- at http://www.opencascade.org and read it completely before using this file. --- --- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its --- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. --- --- The Original Code and all software distributed under the License is --- distributed on an "AS IS" basis, without warranty of any kind, and the --- Initial Developer hereby disclaims all such warranties, including without --- limitation, any warranties of merchantability, fitness for a particular --- purpose or non-infringement. Please see the License for the specific terms --- and conditions governing the rights and limitations under the License. - --- Updated: SZV IMP100701 Add the "depth" field and method --- to the pixmap object. - -class PixMap from WNT - - ---Version: - - ---Purpose: This class defines a windows bitmap - - ---Keywords: Bitmap, Pixmap - -inherits - Transient from Standard - -uses - Handle from Aspect, - Color from Quantity, - Window from Aspect - -raises - PixmapDefinitionError from Aspect, - PixmapError from Aspect - -is - - Create ( aWindow : Window from Aspect; - aWidth, anHeight : Integer from Standard; - aCDepth : Integer from Standard = 0 ) - returns mutable PixMap from WNT - raises PixmapDefinitionError from Aspect; - ---Level: Public - ---Purpose: Warning! When is NULL , the pixmap is created - -- with the SAME depth than the window - - --------------------------------------------------- - -- Category: Methods to modify the class definition - --------------------------------------------------- - - Destroy ( me : mutable ) - ---Level: Advanced - ---Purpose: Destroies the Bitmap - ---C++: alias ~ - -- Trigger: Raises if Bitmap is not defined properly - raises PixmapError from Aspect is virtual; - - Dump ( me; aFilename : CString from Standard ; - aGammaValue: Real from Standard = 1.0 ) - returns Boolean - ---Level: Advanced - ---Purpose: - -- Dumps the Bitmap to an image file with - -- an optional gamma correction value - -- and returns TRUE if the dump occurs normaly. - ---Category: Methods to modify the class definition - raises PixmapError from Aspect is virtual; - - PixelColor ( me : in; - theX, theY : in Integer from Standard ) - returns Color from Quantity - is virtual; - ---Purpose: - -- Returns the pixel color. - - ---------------------------- - -- Category: Inquire methods - ---------------------------- - - PixmapID ( me ) returns Handle from Aspect is virtual; - ---Level: Advanced - ---Purpose: Returns the ID of the just created bitmap - ---Category: Inquire methods - - ---------------------------- - -- Category: Private methods - ---------------------------- - - PreferedDepth( me ; aWindow: Window from Aspect; - aDepth: Integer from Standard) - returns Integer from Standard is private; - -fields - myDC : Handle from Aspect is protected; - myBitmap : Handle from Aspect is protected; - myWND : Window from Aspect; - myWidth : Integer from Standard is protected; - myHeight : Integer from Standard is protected; - myDepth : Integer from Standard is protected; -end PixMap; diff --git a/src/WNT/WNT_PixMap.cxx b/src/WNT/WNT_PixMap.cxx deleted file mode 100755 index 8140d371a3..0000000000 --- a/src/WNT/WNT_PixMap.cxx +++ /dev/null @@ -1,156 +0,0 @@ -// Created on: 1999-12-20 -// Created by: VKH -// Copyright (c) 1999 Matra Datavision -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - -// SZV/GG IMP100701 Add the "depth" field and method -// to the pixmap object. - - -//-Version - -// include windows.h first to have all definitions available -#include - -#include - -#include - -extern int DumpBitmapToFile (HBITMAP, const char* ); - -#include - -Standard_Integer WNT_PixMap::PreferedDepth( - const Handle(Aspect_Window)& aWindow, - const Standard_Integer aCDepth) const -{ - Standard_Integer theDepth = 32; - if (aCDepth <= 1) theDepth = 1; - else if (aCDepth <= 4) theDepth = 4; - else if (aCDepth <= 8) theDepth = 8; - else if (aCDepth <= 16) theDepth = 16; - else if (aCDepth <= 24) theDepth = 24; - - return theDepth; -} - -/////////////////////////////////////////////////////////////////////////////////////// -WNT_PixMap::WNT_PixMap (const Handle(Aspect_Window)& theWindow, - const Standard_Integer theWidth, - const Standard_Integer theHeight, - const Standard_Integer theDepth) -: myWND (theWindow), - myWidth (theWidth), - myHeight (theHeight), - myDepth (PreferedDepth (theWindow, theDepth)) -{ - const Handle(WNT_Window)& hWindow = Handle(WNT_Window)::DownCast(theWindow); - HDC hdc = GetDC ( (HWND)(hWindow->HWindow()) ); - HDC hdcMem = CreateCompatibleDC ( hdc ); - ReleaseDC ( (HWND)(hWindow->HWindow()), hdc ); - myDC = hdcMem; - - Standard_Integer theNbColors = 0, theFormat = PFD_TYPE_RGBA; - -#ifdef BUG // Our OpenGl driver supports only RGB mode. - //WIL001: Color table can not be initialized - do not use - if (myDepth <= 8) - { - theNbColors = (1 << myDepth); - theFormat = PFD_TYPE_COLORINDEX; - } -#endif - - Standard_Integer sizeBmi = Standard_Integer(sizeof(BITMAPINFO)+sizeof(RGBQUAD)*theNbColors); - PBITMAPINFO pBmi = (PBITMAPINFO)(new char[sizeBmi]); - ZeroMemory ( pBmi, sizeBmi ); - - pBmi->bmiHeader.biSize = sizeof (BITMAPINFOHEADER); //sizeBmi - pBmi->bmiHeader.biWidth = myWidth; - pBmi->bmiHeader.biHeight = myHeight; - pBmi->bmiHeader.biPlanes = 1; - pBmi->bmiHeader.biBitCount = myDepth; //WIL001: was 24 - pBmi->bmiHeader.biCompression = BI_RGB; - - LPVOID ppvBits; - HBITMAP hBmp = CreateDIBSection ( hdcMem, pBmi, DIB_RGB_COLORS, &ppvBits, NULL, 0 ); - if ( !hBmp ) - Aspect_PixmapDefinitionError::Raise ( "CreateDIBSection" ); - SelectBitmap ( hdcMem, hBmp ); - myBitmap = hBmp; - - delete[] pBmi; - - if (myDepth > 1) { - - PIXELFORMATDESCRIPTOR pfd; - ZeroMemory ( &pfd, sizeof (PIXELFORMATDESCRIPTOR) ); - pfd.nSize = sizeof (PIXELFORMATDESCRIPTOR); - pfd.nVersion = 1; - pfd.dwFlags = PFD_SUPPORT_OPENGL | PFD_DRAW_TO_BITMAP; - pfd.iPixelType = theFormat; //WIL001: was PFD_TYPE_RGBA - pfd.cColorBits = myDepth; //WIL001: was 24 - pfd.cDepthBits = 24;// - pfd.iLayerType = PFD_MAIN_PLANE; - - Standard_Integer iPf = ChoosePixelFormat(hdcMem, &pfd); - if ( !iPf ) - Aspect_PixmapDefinitionError::Raise ( "ChoosePixelFormat" ); - - if ( !DescribePixelFormat ( hdcMem, iPf, sizeof(PIXELFORMATDESCRIPTOR), &pfd ) ) - Aspect_PixmapDefinitionError::Raise ( "DescribePixelFormat" ); - - if ( !SetPixelFormat(hdcMem, iPf, &pfd) ) - Aspect_PixmapDefinitionError::Raise ( "SetPixelFormat" ); - } -} - -/////////////////////////////// -void WNT_PixMap::Destroy () -{ - if ( myDC ) DeleteDC ( (HDC)myDC ); - if ( myBitmap ) DeleteObject ( (HBITMAP)myBitmap ); -} - -//////////////////////////////////////////////////////////// -Standard_Boolean WNT_PixMap::Dump (const Standard_CString theFilename, - const Standard_Real theGammaValue) const -{ - // *** gamma correction must be implemented also on WNT system ... - const Handle(WNT_Window) hWindow = Handle(WNT_Window)::DownCast(myWND); - - Handle(WNT_GraphicDevice) dev = - Handle ( WNT_GraphicDevice )::DownCast ( hWindow->MyGraphicDevice ); - if ( dev.IsNull() ) return Standard_False; - //Aspect_PixmapError::Raise ( "WNT_GraphicDevice is NULL" ); - - return DumpBitmapToFile ((HBITMAP)myBitmap, theFilename); -} - -//////////////////////////////////////////////////////////// -Standard_Address WNT_PixMap::PixmapID() const -{ - return myDC; -} - -Quantity_Color WNT_PixMap::PixelColor (const Standard_Integer , - const Standard_Integer ) const -{ - Aspect_PixmapError::Raise ("PixelColor() method not implemented!"); - return Quantity_Color (0.0, 0.0, 0.0, Quantity_TOC_RGB); -} diff --git a/src/WNT/WNT_Window.cdl b/src/WNT/WNT_Window.cdl index b1ae092110..21a5cfe4c9 100755 --- a/src/WNT/WNT_Window.cdl +++ b/src/WNT/WNT_Window.cdl @@ -591,7 +591,6 @@ class Window from WNT inherits Window from Aspect friends class WDriver from WNT, - class IconBox from WNT, - class PixMap from WNT + class IconBox from WNT end Window; diff --git a/src/Xw/FILES b/src/Xw/FILES index 9d2dee506f..a16b8c2eb2 100755 --- a/src/Xw/FILES +++ b/src/Xw/FILES @@ -1,5 +1,3 @@ -Test.com -Test_deb.com Xw_Extension.h Xw_Cextern.hxx Xw_alloc_color.cxx diff --git a/src/Xw/Test.com b/src/Xw/Test.com deleted file mode 100755 index 8f2f48f7ad..0000000000 --- a/src/Xw/Test.com +++ /dev/null @@ -1,3 +0,0 @@ -#csh -../drv/MEM/$STATION/Test$1 - diff --git a/src/Xw/Test_deb.com b/src/Xw/Test_deb.com deleted file mode 100755 index 1564d56b3b..0000000000 --- a/src/Xw/Test_deb.com +++ /dev/null @@ -1,3 +0,0 @@ -#csh -$DEBUG ../drv/MEM/$STATION/Test$1 - diff --git a/src/Xw/Xw.cdl b/src/Xw/Xw.cdl index 2487f773f7..7c93708584 100755 --- a/src/Xw/Xw.cdl +++ b/src/Xw/Xw.cdl @@ -56,10 +56,6 @@ is ---Purpose: Creates the X Window drawable. ---Category: Classes - class PixMap; - ---Purpose: Creates a X pixmap - ---Category: Classes - class ColorMap; ---Purpose: Creates the X Colormap ---Category: Classes diff --git a/src/Xw/Xw_PixMap.cdl b/src/Xw/Xw_PixMap.cdl deleted file mode 100755 index 799339a9ef..0000000000 --- a/src/Xw/Xw_PixMap.cdl +++ /dev/null @@ -1,103 +0,0 @@ --- Created on: 1999-10-14 --- Created by: VKH --- Copyright (c) 1999 Matra Datavision --- Copyright (c) 1999-2012 OPEN CASCADE SAS --- --- The content of this file is subject to the Open CASCADE Technology Public --- License Version 6.5 (the "License"). You may not use the content of this file --- except in compliance with the License. Please obtain a copy of the License --- at http://www.opencascade.org and read it completely before using this file. --- --- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its --- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. --- --- The Original Code and all software distributed under the License is --- distributed on an "AS IS" basis, without warranty of any kind, and the --- Initial Developer hereby disclaims all such warranties, including without --- limitation, any warranties of merchantability, fitness for a particular --- purpose or non-infringement. Please see the License for the specific terms --- and conditions governing the rights and limitations under the License. - --- Updated: GG IMP100701 Add the "depth" field and method --- to the pixmap object. - -class PixMap from Xw - - ---Version: - - ---Purpose: This class defines a X11 pixmap - - ---Keywords: Bitmap, Pixmap, X11 - -inherits - Transient from Standard -uses - Handle from Aspect, - Color from Quantity, - Window from Aspect, - Window from Xw -raises - PixmapDefinitionError from Aspect, - PixmapError from Aspect -is - Create ( aWindow : Window from Aspect; - aWidth, anHeight : Integer from Standard; - aDepth : Integer from Standard = 0 ) - returns mutable PixMap from Xw - raises PixmapDefinitionError from Aspect; - ---Level: Public - ---Purpose: Warning! When is NULL , the pixmap is created - -- with the SAME depth than the window - - --------------------------------------------------- - -- Category: Methods to modify the class definition - --------------------------------------------------- - - Destroy ( me : mutable ) - ---Level: Advanced - ---Purpose: Destroies the Pixmap - -- Trigger: Raises if Pixmap is not defined properly - raises PixmapError from Aspect is virtual; - - Dump ( me ; aFilename : CString from Standard; - aGammaValue: Real from Standard = 1.0 ) - returns Boolean - is virtual; - ---Level: Advanced - ---Purpose: - -- Dumps the Bitmap to an image file with - -- an optional gamma correction value - -- and returns TRUE if the dump occurs normaly. - ---Category: Methods to modify the class definition - - PixelColor ( me : in; - theX, theY : in Integer from Standard ) - returns Color from Quantity - is virtual; - ---Purpose: - -- Returns the pixel color. - - ---------------------------- - -- Category: Inquire methods - ---------------------------- - - PixmapID ( me ) returns Handle from Aspect is virtual; - ---Level: Advanced - ---Purpose: Returns the ID of the just created pixmap - ---Category: Inquire methods - - ---------------------------- - -- Category: Private methods - ---------------------------- - - PreferedDepth( me ; aWindow : Window from Aspect; - aDepth : Integer from Standard) - returns Integer from Standard is private; - -fields - myPixmap : Handle from Aspect is protected; - myWindow : Window from Xw; - myWidth : Integer from Standard is protected; - myHeight : Integer from Standard is protected; - myDepth : Integer from Standard is protected; -end PixMap; diff --git a/src/Xw/Xw_PixMap.cxx b/src/Xw/Xw_PixMap.cxx deleted file mode 100755 index 7512f42364..0000000000 --- a/src/Xw/Xw_PixMap.cxx +++ /dev/null @@ -1,184 +0,0 @@ -// Created on: 1999-10-14 -// Created by: VKH -// Copyright (c) 1999 Matra Datavision -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - -// Updated GG 06/03/00 Xw_PixMap MUST creates a Pixmap and no more an Image !!! -// GG IMP100701 Add the "depth" field and method -// to the pixmap object. - - - -//-Version - -#define xTRACE 1 - -#include -#include - -#include -#include - -#include - -#include -#include - -XW_STATUS Xw_save_xwd_image ( void*, void*, char* ); -XW_STATUS Xw_save_bmp_image ( void*, void*, char* ); -XW_STATUS Xw_save_gif_image ( void*, void*, char* ); - -Standard_Integer Xw_PixMap::PreferedDepth( - const Handle(Aspect_Window)& aWindow, - const Standard_Integer aDepth) const { - Handle(Xw_Window) hwindow = Handle(Xw_Window)::DownCast(aWindow); - XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*) hwindow->ExtendedWindow(); - if( aDepth <= 0 ) return _DEPTH; -// Gets the nearest depth from possible screen depths - Standard_Integer i,j; - Screen *scr = DefaultScreenOfDisplay(_DISPLAY); - for( i=j=0 ; indepths ; i++ ) { - if( Abs(aDepth - scr->depths[i].depth) < - Abs(aDepth - scr->depths[j].depth) ) { - j = i; - } - } - return scr->depths[j].depth; -} - - -////////////////////////////////////////////////////////////////////////////////////////// -Xw_PixMap::Xw_PixMap (const Handle(Aspect_Window)& theWindow, - const Standard_Integer theWidth, - const Standard_Integer theHeight, - const Standard_Integer theDepth) -: myWindow (Handle(Xw_Window)::DownCast(theWindow)), - myWidth (theWidth), - myHeight (theHeight), - myDepth (PreferedDepth (theWindow, theDepth)) -{ - XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*) myWindow->ExtendedWindow(); - - Xw_print_error(); - if( !Xw_get_trace() ) Xw_set_synchronize(_DISPLAY,True); - myPixmap = XCreatePixmap( _DISPLAY, _WINDOW, myWidth, myHeight, myDepth); - if( !Xw_get_trace() ) Xw_set_synchronize(_DISPLAY,False); - - if ( !myPixmap || Xw_print_error() ) { - char errstring[256]; - sprintf(errstring," *** Xw_PixMap : Cann't allocates pixmap of size %d x %d, request failed with errno : '%s'",myWidth, myHeight,strerror(errno)); - Aspect_PixmapDefinitionError::Raise ( errstring ); - } -} - -/////////////////////////////// -void -Xw_PixMap::Destroy () -{ - if( myPixmap ) { -#ifdef TRACE - printf(" $$$ Xw_PixMap::Destroy() %x\n",myPixmap); -#endif - XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*) myWindow->ExtendedWindow(); - XFreePixmap(_DISPLAY,myPixmap); - } -} - -//////////////////////////////////////////////////////////// -Standard_Boolean Xw_PixMap::Dump (const Standard_CString theFileName, - const Standard_Real theGammaValue) const -{ - // the attributes - XWindowAttributes winAttr; - XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*) myWindow->ExtendedWindow(); - XGetWindowAttributes (_DISPLAY, _WINDOW, &winAttr); - if (winAttr.visual->c_class != TrueColor) - { - std::cerr << "Visual Type not supported!"; - return Standard_False; - } - - Image_AlienPixMap anImage; - bool isBigEndian = Image_PixMap::IsBigEndianHost(); - const Standard_Size aSizeRowBytes = Standard_Size(winAttr.width) * 4; - if (!anImage.InitTrash (isBigEndian ? Image_PixMap::ImgRGB32 : Image_PixMap::ImgBGR32, - Standard_Size(winAttr.width), Standard_Size(winAttr.height), aSizeRowBytes)) - { - return Standard_False; - } - anImage.SetTopDown (true); - - XImage* anXImage = XCreateImage (_DISPLAY, winAttr.visual, - 32, ZPixmap, 0, (char* )anImage.ChangeData(), winAttr.width, winAttr.height, 32, int(aSizeRowBytes)); - anXImage->bitmap_bit_order = anXImage->byte_order = (isBigEndian ? MSBFirst : LSBFirst); - if (XGetSubImage (_DISPLAY, myPixmap, - 0, 0, winAttr.width, winAttr.height, - AllPlanes, ZPixmap, anXImage, 0, 0) == NULL) - { - anXImage->data = NULL; - XDestroyImage (anXImage); - return Standard_False; - } - - // destroy the image - anXImage->data = NULL; - XDestroyImage (anXImage); - - // save the image - if (Abs (theGammaValue - 1.0) > 0.001) - { - anImage.AdjustGamma (theGammaValue); - } - - // save the image - return anImage.Save (theFileName); -} - -//////////////////////////////////////////////////////////// -Aspect_Handle Xw_PixMap::PixmapID() const -{ - return myPixmap; -} - -Quantity_Color Xw_PixMap::PixelColor (const Standard_Integer theX, - const Standard_Integer theY) const -{ - // the attributes - XWindowAttributes winAttr; - XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*) myWindow->ExtendedWindow(); - XGetWindowAttributes (_DISPLAY, _WINDOW, &winAttr); - - // find the image - XImage* pximage = XGetImage (_DISPLAY, myPixmap, - 0, 0, myWidth, myHeight, - AllPlanes, ZPixmap); - if (pximage == NULL) - { - return Quantity_Color (0.0, 0.0, 0.0, Quantity_TOC_RGB); - } - - XColor aColor; - aColor.pixel = XGetPixel (pximage, theX, theY); - XDestroyImage (pximage); - - XQueryColor (_DISPLAY, myWindow->XColorMap(), &aColor); - return Quantity_Color (Quantity_Parameter (aColor.red) / 65535.0, - Quantity_Parameter (aColor.green) / 65535.0, - Quantity_Parameter (aColor.blue) / 65535.0, - Quantity_TOC_RGB); -} diff --git a/src/Xw/Xw_Window.cdl b/src/Xw/Xw_Window.cdl index 282bdedf48..7f3043bf89 100755 --- a/src/Xw/Xw_Window.cdl +++ b/src/Xw/Xw_Window.cdl @@ -677,7 +677,6 @@ fields friends class Driver from Xw, - class IconBox from Xw, - class PixMap from Xw + class IconBox from Xw end Window ;