PCL
ImageWindow.h
Go to the documentation of this file.
1 // ____ ______ __
2 // / __ \ / ____// /
3 // / /_/ // / / /
4 // / ____// /___ / /___ PixInsight Class Library
5 // /_/ \____//_____/ PCL 2.1.19
6 // ----------------------------------------------------------------------------
7 // pcl/ImageWindow.h - Released 2019-11-07T10:59:34Z
8 // ----------------------------------------------------------------------------
9 // This file is part of the PixInsight Class Library (PCL).
10 // PCL is a multiplatform C++ framework for development of PixInsight modules.
11 //
12 // Copyright (c) 2003-2019 Pleiades Astrophoto S.L. All Rights Reserved.
13 //
14 // Redistribution and use in both source and binary forms, with or without
15 // modification, is permitted provided that the following conditions are met:
16 //
17 // 1. All redistributions of source code must retain the above copyright
18 // notice, this list of conditions and the following disclaimer.
19 //
20 // 2. All redistributions in binary form must reproduce the above copyright
21 // notice, this list of conditions and the following disclaimer in the
22 // documentation and/or other materials provided with the distribution.
23 //
24 // 3. Neither the names "PixInsight" and "Pleiades Astrophoto", nor the names
25 // of their contributors, may be used to endorse or promote products derived
26 // from this software without specific prior written permission. For written
27 // permission, please contact info@pixinsight.com.
28 //
29 // 4. All products derived from this software, in any form whatsoever, must
30 // reproduce the following acknowledgment in the end-user documentation
31 // and/or other materials provided with the product:
32 //
33 // "This product is based on software from the PixInsight project, developed
34 // by Pleiades Astrophoto and its contributors (http://pixinsight.com/)."
35 //
36 // Alternatively, if that is where third-party acknowledgments normally
37 // appear, this acknowledgment must be reproduced in the product itself.
38 //
39 // THIS SOFTWARE IS PROVIDED BY PLEIADES ASTROPHOTO AND ITS CONTRIBUTORS
40 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
41 // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL PLEIADES ASTROPHOTO OR ITS
43 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
44 // EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, BUSINESS
45 // INTERRUPTION; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; AND LOSS OF USE,
46 // DATA OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
47 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
48 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
49 // POSSIBILITY OF SUCH DAMAGE.
50 // ----------------------------------------------------------------------------
51 
52 #ifndef __PCL_ImageWindow_h
53 #define __PCL_ImageWindow_h
54 
56 
57 #include <pcl/Defs.h>
58 
59 #include <pcl/Flags.h>
61 
62 #ifndef __PCL_BUILDING_PIXINSIGHT_APPLICATION
63 
64 #include <pcl/Bitmap.h>
65 #include <pcl/ByteArray.h>
66 #include <pcl/FITSHeaderKeyword.h>
67 #include <pcl/ImageOptions.h>
68 #include <pcl/UIObject.h>
69 #include <pcl/View.h>
70 
71 #endif // !__PCL_BUILDING_PIXINSIGHT_APPLICATION
72 
73 namespace pcl
74 {
75 
76 #ifndef __PCL_BUILDING_PIXINSIGHT_APPLICATION
77 
78 class RGBColorSystem;
79 class ICCProfile;
81 
82 #endif // !__PCL_BUILDING_PIXINSIGHT_APPLICATION
83 
84 // ----------------------------------------------------------------------------
85 
103 namespace ImageMode
104 {
105  enum value_type
106  {
107  Invalid = -1, // Represents an invalid or unsupported mode
108  Readout = 0, // Default mode, click to get real-time readouts
109  ZoomIn, // Click to zoom in the current view
110  ZoomOut, // Click to zoom out the current view
111  Pan, // Click and drag to pan the current view
112  Center, // Click to center the view at the mouse position
113  NewPreview, // Click and drag to define a new preview
114  EditPreview, // Click and drag to change an existing preview
115  DynamicOperation, // Module-defined dynamic operation
116 
117  NumberOfModes,
118 
119  Default = Readout
120  };
121 
126  inline bool IsValidPreviewMode( value_type m )
127  {
128  return m != NewPreview && m != EditPreview;
129  }
130 
135  inline bool IsValidMainViewMode( value_type m )
136  {
137  return !IsValidPreviewMode( m );
138  }
139 }
140 
141 // ----------------------------------------------------------------------------
142 
161 namespace BackgroundBrush
162 {
163  enum value_type
164  {
165  Small, // Small chessboard pattern
166  Medium, // Medium chessboard pattern
167  Large, // Large chessboard pattern
168  SmallCrossPattern, // Small cross pattern
169  MediumCrossPattern, // Medium cross pattern
170  LargeCrossPattern, // Large cross pattern
171  SmallDiagPattern, // Small diagonal pattern
172  MediumDiagPattern, // Medium diagonal pattern
173  LargeDiagPattern, // Large diagonal pattern
174  Solid, // Solid brush with the foreground color
175 
176  NumberOfBrushes,
177 
178  Default = Small
179  };
180 }
181 
182 // ----------------------------------------------------------------------------
183 
195 namespace TransparencyMode
196 {
197  enum value_type
198  {
199  Hide, // Don't show transparencies
200  BackgroundBrush, // Use the transparency background brush
201  Color, // Use an opaque background color
202 
203  NumberOfModes,
204 
205  Default = BackgroundBrush
206  };
207 };
208 
209 // ----------------------------------------------------------------------------
210 
236 namespace UndoFlag
237 {
238  /*
239  * ### TODO: PCL 2.x: Get rid of all project depencies on UndoFlags.
240  */
241  enum mask_type
242  {
243  DefaultMode = 0x00000000, // Save pixel data, astrometric solution and previews
244  PixelData = 0x00000001, // Save pixel data
245  RGBWS = 0x00000002, // RGB Working Space data
246  ICCProfile = 0x00000004, // ICC profile
247  Keywords = 0x00000008, // %FITS keywords
248  //Metadata = 0x00000010, // ### DEPRECATED - Keep unused for now, for compatibility with existing projects
249  FormatData = 0x00000020, // Format-specific data
250  ImageId = 0x00000040, // %Image identifier
251  Resolution = 0x00000080, // %Image resolution
252  AstrometricSolution = 0x00000100, // Save the current astrometric solution
253  All = 0x000FFFFF, // Save all data items
254  ExcludePreviews = 0x80000000, // Don't save state of previews
255  ExcludeMaskRelations = 0x40000000 // Don't save masking dependencies
256  };
257 }
258 
264 
265 // ----------------------------------------------------------------------------
266 
267 #ifndef __PCL_BUILDING_PIXINSIGHT_APPLICATION
268 
269 // ----------------------------------------------------------------------------
270 
280 class PCL_CLASS ImageWindow : public UIObject
281 {
282 public:
283 
288  typedef ImageMode::value_type gui_mode;
289 
295  typedef DisplayChannel::value_type display_channel;
296 
302  typedef MaskMode::value_type mask_mode;
303 
309  typedef BackgroundBrush::value_type background_brush;
310 
316  typedef TransparencyMode::value_type transparency_mode;
317 
322  ImageWindow() = default;
323 
369  ImageWindow( int width, int height, int numberOfChannels = 1,
370  int bitsPerSample = 32, bool floatSample = true, bool color = false,
371  bool initialProcessing = true,
372  const IsoString& id = IsoString() );
373 
374  ImageWindow( int width, int height, int numberOfChannels,
375  int bitsPerSample, bool floatSample, bool color,
376  bool initialProcessing,
377  const IsoString::ustring_base& id ) :
378  ImageWindow( width, height, numberOfChannels, bitsPerSample, floatSample, color, initialProcessing, IsoString( id ) )
379  {
380  }
381 
393  ImageWindow( const ImageWindow& w ) : UIObject( w )
394  {
395  }
396 
400  ImageWindow( ImageWindow&& x ) : UIObject( std::move( x ) )
401  {
402  }
403 
411  virtual ~ImageWindow()
412  {
413  }
414 
426  ImageWindow& operator =( const ImageWindow& window )
427  {
428  Assign( window );
429  return *this;
430  }
431 
435  ImageWindow& operator =( ImageWindow&& x )
436  {
437  Transfer( x );
438  return *this;
439  }
440 
446  static ImageWindow& Null();
447 
522  static Array<ImageWindow> Open( const String& url,
523  const IsoString& id = IsoString(),
524  const IsoString& formatHints = IsoString(),
525  bool asCopy = false,
526  bool allowMessages = true );
527 
528  template <class S1, class S2>
529  static Array<ImageWindow> Open( const String& url,
530  const S1& id,
531  const S2& formatHints,
532  bool asCopy = false,
533  bool allowMessages = true )
534  {
535  return Open( url, IsoString( id ), IsoString( formatHints ), asCopy, allowMessages );
536  }
537 
543  bool IsNew() const;
544 
557  bool IsACopy() const;
558 
568  String FilePath() const;
569 
575  String FileURL() const;
576 
581  bool HasURL() const
582  {
583  return !FileURL().IsEmpty();
584  }
585 
590  ImageOptions FileInfo() const;
591 
597  size_type ModifyCount() const;
598 
603  bool IsModified() const
604  {
605  return ModifyCount() > 0;
606  }
607 
628  bool Close();
629 
637  void ForceClose();
638 
645  View MainView() const;
646 
654  View CurrentView() const;
655 
659  void SelectView( View& );
660 
665  {
666  View v( MainView() ); SelectView( v );
667  }
668 
672  void PurgeProperties();
673 
678  bool IsValidView( const View& ) const;
679 
683  int NumberOfPreviews() const;
684 
689  bool HasPreviews() const
690  {
691  return NumberOfPreviews() > 0;
692  }
693 
699  Array<View> Previews() const;
700 
708  View PreviewById( const IsoString& previewId ) const;
709 
710  View PreviewById( const IsoString::ustring_base& previewId ) const
711  {
712  return PreviewById( IsoString( previewId ) );
713  }
714 
720  bool PreviewExists( const IsoString& previewId ) const
721  {
722  return !IsNull() && !PreviewById( previewId ).IsNull();
723  }
724 
725  bool PreviewExists( const IsoString::ustring_base& previewId ) const
726  {
727  return PreviewExists( IsoString( previewId ) );
728  }
729 
741  View SelectedPreview() const;
742 
748  void SelectPreview( View& );
749 
755  void SelectPreview( const IsoString& previewId )
756  {
757  View v( PreviewById( previewId ) ), SelectPreview( v );
758  }
759 
760  void SelectPreview( const IsoString::ustring_base& previewId )
761  {
762  SelectPreview( IsoString( previewId ) );
763  }
764 
773  View CreatePreview( const Rect& r, const IsoString& previewId = IsoString() )
774  {
775  return CreatePreview( r.x0, r.y0, r.x1, r.y1, previewId );
776  }
777 
778  View CreatePreview( const Rect& r, const IsoString::ustring_base& previewId )
779  {
780  return CreatePreview( r, IsoString( previewId ) );
781  }
782 
802  View CreatePreview( int x0, int y0, int x1, int y1, const IsoString& previewId = IsoString() );
803 
804  View CreatePreview( int x0, int y0, int x1, int y1, const IsoString::ustring_base& previewId )
805  {
806  return CreatePreview( x0, y0, x1, y1, IsoString( previewId ) );
807  }
808 
817  void ModifyPreview( const IsoString& previewId, const Rect& r, const IsoString& newId = IsoString() )
818  {
819  ModifyPreview( previewId, r.x0, r.y0, r.x1, r.y1, newId );
820  }
821 
822  void ModifyPreview( const IsoString::ustring_base& previewId, const Rect& r )
823  {
824  ModifyPreview( IsoString( previewId ), r );
825  }
826 
827  void ModifyPreview( const IsoString::ustring_base& previewId, const Rect& r, const IsoString::ustring_base& newId )
828  {
829  ModifyPreview( IsoString( previewId ), r, IsoString( newId ) );
830  }
831 
854  void ModifyPreview( const IsoString& previewId, int x0, int y0, int x1, int y1,
855  const IsoString& newId = IsoString() );
856 
857  void ModifyPreview( const IsoString::ustring_base& previewId, int x0, int y0, int x1, int y1 )
858  {
859  ModifyPreview( IsoString( previewId ), x0, y0, x1, y1 );
860  }
861 
862  void ModifyPreview( const IsoString::ustring_base& previewId, int x0, int y0, int x1, int y1,
863  const IsoString::ustring_base& newId )
864  {
865  ModifyPreview( IsoString( previewId ), x0, y0, x1, y1, IsoString( newId ) );
866  }
867 
875  Rect PreviewRect( const IsoString& previewId ) const;
876 
877  Rect PreviewRect( const IsoString::ustring_base& previewId ) const
878  {
879  return PreviewRect( IsoString( previewId ) );
880  }
881 
891  void DeletePreview( const IsoString& previewId );
892 
893  void DeletePreview( const IsoString::ustring_base& previewId )
894  {
895  DeletePreview( IsoString( previewId ) );
896  }
897 
904  void DeletePreviews();
905 
917  void GetSampleFormat( int& bitsPerSample, bool& floatSample ) const;
918 
932  void SetSampleFormat( int bitsPerSample, bool floatSample );
933 
938  ImageWindow Mask() const;
939 
948  void SetMask( ImageWindow& w, bool inverted = false );
949 
953  void RemoveMask()
954  {
955  SetMask( Null() );
956  }
957 
961  bool IsMaskInverted() const;
962 
966  void InvertMask( bool invert = true )
967  {
968  ImageWindow mask = Mask();
969  SetMask( mask, invert );
970  }
971 
975  bool IsMaskEnabled() const;
976 
980  void EnableMask( bool = true );
981 
985  void DisableMask( bool disable = true )
986  {
987  EnableMask( !disable );
988  }
989 
993  bool IsMaskVisible() const;
994 
998  void ShowMask( bool = true );
999 
1003  void HideMask( bool hide = true )
1004  {
1005  ShowMask( !hide );
1006  }
1007 
1019  bool IsMaskCompatible( const ImageWindow& );
1020 
1025  bool HasMaskReferences() const;
1026 
1034  void RemoveMaskReferences();
1035 
1041  void UpdateMaskReferences();
1042 
1050  void GetRGBWS( RGBColorSystem& rgbws ) const;
1051 
1058  void SetRGBWS( const RGBColorSystem& rgbws );
1059 
1067  bool UsingGlobalRGBWS() const;
1068 
1075  void UseGlobalRGBWS();
1076 
1089  static void GetGlobalRGBWS( RGBColorSystem& rgbws );
1090 
1101  static void SetGlobalRGBWS( const RGBColorSystem& rgbws );
1102 
1106  bool IsColorManagementEnabled() const;
1107 
1127  void EnableColorManagement( bool = true );
1128 
1138  void DisableColorManagement( bool disable = true )
1139  {
1140  EnableColorManagement( !disable );
1141  }
1142 
1147  bool IsProofingEnabled() const;
1148 
1162  void EnableProofing( bool = true );
1163 
1173  void DisableProofing( bool disable = true )
1174  {
1175  EnableProofing( !disable );
1176  }
1177 
1182  bool IsGamutCheckEnabled() const;
1183 
1197  void EnableGamutCheck( bool = true );
1198 
1210  void DisableGamutCheck( bool disable = true )
1211  {
1212  EnableGamutCheck( !disable );
1213  }
1214 
1232  void SetColorManagementFeatures( bool cmEnabled, bool proofing, bool gamutCheck );
1233 
1240  bool GetICCProfile( ICCProfile& icc ) const;
1241 
1252  void SetICCProfile( const ICCProfile& icc );
1253 
1264  void SetICCProfile( const String& filePath );
1265 
1276  void DeleteICCProfile();
1277 
1283  FITSKeywordArray Keywords() const;
1284 
1295  bool GetKeywords( FITSKeywordArray& keywords ) const
1296  {
1297  keywords = Keywords();
1298  return !keywords.IsEmpty();
1299  }
1300 
1311  void SetKeywords( const FITSKeywordArray& keywords );
1312 
1316  void ResetKeywords();
1317 
1323  bool HasAstrometricSolution() const;
1324 
1345  bool RegenerateAstrometricSolution( bool allowGUIMessages = true, bool notify = true );
1346 
1359  void ClearAstrometricSolution( bool notify = true );
1360 
1374  void UpdateAstrometryMetadata( bool notify = true );
1375 
1394  void GetResolution( double& xRes, double& yRes, bool& metric ) const;
1395 
1410  void SetResolution( double xRes, double yRes, bool metric = false );
1411 
1425  void SetResolution( double r, bool metric = false )
1426  {
1427  SetResolution( r, r, metric );
1428  }
1429 
1451  static void GetDefaultResolution( double& xRes, double& yRes, bool& metric );
1452 
1465  static bool IsDefaultICCProfileEmbeddingEnabledForRGBImages();
1466 
1479  static bool IsDefaultICCProfileEmbeddingEnabledForGrayscaleImages();
1480 
1491  static bool IsDefaultThumbnailEmbeddingEnabled();
1492 
1503  static bool IsDefaultPropertiesEmbeddingEnabled();
1504 
1518  static StringList SwapDirectories();
1519 
1542  static bool SetSwapDirectories( const StringList& directories );
1543 
1558  static int CursorTolerance();
1559 
1566  static gui_mode CurrentMode();
1567 
1578  static void SelectMode( gui_mode mode );
1579 
1586  display_channel CurrentChannel() const;
1587 
1593  {
1594  return CurrentChannel() >= DisplayChannel::Alpha;
1595  }
1596 
1607  {
1608  return CurrentChannel() - DisplayChannel::Alpha;
1609  }
1610 
1625  void SelectChannel( display_channel c );
1626 
1632  mask_mode MaskMode() const;
1633 
1642  void SetMaskMode( mask_mode mode );
1643 
1666  static background_brush GetBackgroundBrush( uint32& fgColor, uint32& bgColor );
1667 
1691  static void SetBackgroundBrush( background_brush brush, uint32 fgColor = 0, uint32 bgColor = 0 );
1692 
1699  transparency_mode TransparencyMode() const;
1700 
1708  RGBA TransparencyColor() const;
1709 
1718  {
1719  return TransparencyMode() != pcl::TransparencyMode::Hide;
1720  }
1721 
1734  void SetTransparencyMode( transparency_mode mode, RGBA color = 0 );
1735 
1744  {
1745  SetTransparencyMode( pcl::TransparencyMode::Hide );
1746  }
1747 
1793  void SetViewport( double cx, double cy, int zoom = 0 );
1794 
1805  void SetViewport( const DPoint& center, int zoom = 0 )
1806  {
1807  SetViewport( center.x, center.y, zoom );
1808  }
1809 
1819  void FitWindow();
1820 
1851  void ZoomToFit( bool optimalFit = true,
1852  bool allowMagnification = true,
1853  bool allowAnimations = true,
1854  bool noLimits = false );
1855 
1862  int ZoomFactor() const;
1863 
1871  void SetZoomFactor( int z );
1872 
1879  void ZoomIn()
1880  {
1881  int z = ZoomFactor() + 1;
1882  SetZoomFactor( (z > 0) ? z : +1 );
1883  }
1884 
1891  void ZoomOut()
1892  {
1893  int z = ZoomFactor() - 1;
1894  SetZoomFactor( (z > 0 || z < -1) ? z : -2 );
1895  }
1896 
1911  void GetViewportSize( int& width, int& height ) const;
1912 
1916  int ViewportWidth() const
1917  {
1918  int w, dum;
1919  GetViewportSize( w, dum );
1920  return w;
1921  }
1922 
1926  int ViewportHeight() const
1927  {
1928  int dum, h;
1929  GetViewportSize( dum, h );
1930  return h;
1931  }
1932 
1942  Point ViewportPosition() const;
1943 
1953  void SetViewportPosition( int x, int y );
1954 
1963  void SetViewportPosition( const Point& p )
1964  {
1965  SetViewportPosition( p.x, p.y );
1966  }
1967 
1975  Rect VisibleViewportRect() const;
1976 
1982  {
1983  return VisibleViewportRect().Width();
1984  }
1985 
1991  {
1992  return VisibleViewportRect().Height();
1993  }
1994 
1998  bool IsVisible() const;
1999 
2015  void Show( bool fitWindow = true );
2016 
2021  void Hide();
2022 
2026  bool IsIconic() const;
2027 
2031  void Iconize();
2032 
2036  void Deiconize();
2037 
2047  void BringToFront();
2048 
2059  void SendToBack();
2060 
2069  static bool IsDynamicSessionActive();
2070 
2085  static ProcessInterface* ActiveDynamicInterface();
2086 
2101  static bool TerminateDynamicSession( bool closeInterface = true );
2102 
2121  void SetDynamicCursor( const char** xpm, int hx = 0, int hy = 0 );
2122 
2135  void SetDynamicCursor( const char** xpm, const Point& p )
2136  {
2137  SetDynamicCursor( xpm, p.x, p.y );
2138  }
2139 
2162  void SetDynamicCursor( const Bitmap& bmp, int hx = 0, int hy = 0 );
2163 
2172  void SetDynamicCursor( const Bitmap& bmp, const Point& p )
2173  {
2174  SetDynamicCursor( bmp, p.x, p.y );
2175  }
2176 
2182  {
2183  SetDynamicCursor( Bitmap::Null() );
2184  }
2185 
2190  Bitmap DynamicCursorBitmap() const;
2191 
2198  Point DynamicCursorHotSpot() const;
2199 
2229  double DisplayPixelRatio() const;
2230 
2237  void ViewportToImage( int& x, int& y ) const;
2238 
2243  void ViewportToImage( double& x, double& y ) const;
2244 
2250  template <typename T>
2252  {
2253  DPoint p1 = p;
2254  ViewportToImage( p1.x, p1.y );
2255  return p1;
2256  }
2257 
2263  template <typename T>
2265  {
2266  DRect r1 = r;
2267  ViewportToImage( r1.x0, r1.y0 );
2268  ViewportToImage( r1.x1, r1.y1 );
2269  return r1;
2270  }
2271 
2283  void ViewportToImage( Point* p, size_type n ) const;
2284 
2294  void ViewportToImage( DPoint* p, size_type n ) const;
2295 
2303  template <typename T>
2305  {
2306  ViewportToImage( a.Begin(), a.Length() );
2307  }
2308 
2322  void ViewportScalarToImage( int* d, size_type n ) const;
2323 
2334  void ViewportScalarToImage( double* d, size_type n ) const;
2335 
2341  double ViewportScalarToImage( double d ) const;
2342 
2348  template <typename T>
2349  double ViewportScalarToImage( T d ) const
2350  {
2351  return ViewportScalarToImage( double( d ) );
2352  }
2353 
2360  void ImageToViewport( int& x, int& y ) const;
2361 
2366  void ImageToViewport( double& x, double& y ) const;
2367 
2377  template <typename T>
2379  {
2380  GenericPoint<T> p1 = p;
2381  ImageToViewport( p1.x, p1.y );
2382  return p1;
2383  }
2384 
2394  template <typename T>
2396  {
2397  GenericRectangle<T> r1 = r;
2398  ImageToViewport( r1.x0, r1.y0 );
2399  ImageToViewport( r1.x1, r1.y1 );
2400  return r1;
2401  }
2402 
2414  void ImageToViewport( Point* p, size_type n ) const;
2415 
2425  void ImageToViewport( DPoint* p, size_type n ) const;
2426 
2434  template <typename T>
2436  {
2437  ImageToViewport( a.Begin(), a.Length() );
2438  }
2439 
2453  void ImageScalarToViewport( int* d, size_type n ) const;
2454 
2465  void ImageScalarToViewport( double* d, size_type n ) const;
2466 
2475  int ImageScalarToViewport( int ) const;
2476 
2482  double ImageScalarToViewport( double ) const;
2483 
2490  void ViewportToGlobal( int& x, int& y ) const;
2491 
2496  Point ViewportToGlobal( const Point& p ) const
2497  {
2498  Point p1 = p;
2499  ViewportToGlobal( p1.x, p1.y );
2500  return p1;
2501  }
2502 
2508  Rect ViewportToGlobal( const Rect& r ) const
2509  {
2510  Rect r1 = r;
2511  ViewportToGlobal( r1.x0, r1.y0 );
2512  ViewportToGlobal( r1.x1, r1.y1 );
2513  return r1;
2514  }
2515 
2522  void GlobalToViewport( int& x, int& y ) const;
2523 
2529  Point GlobalToViewport( const Point& p ) const
2530  {
2531  Point p1 = p;
2532  GlobalToViewport( p1.x, p1.y );
2533  return p1;
2534  }
2535 
2541  Rect GlobalToViewport( const Rect& r ) const
2542  {
2543  Rect r1 = r;
2544  GlobalToViewport( r1.x0, r1.y0 );
2545  GlobalToViewport( r1.x1, r1.y1 );
2546  return r1;
2547  }
2548 
2557  void Reset()
2558  {
2559  SetZoomFactor( ZoomFactor() );
2560  }
2561 
2567  void Regenerate();
2568 
2577  void RegenerateViewportRect( const Rect& r )
2578  {
2579  RegenerateViewportRect( r.x0, r.y0, r.x1, r.y1 );
2580  }
2581 
2596  void RegenerateViewportRect( int x0, int y0, int x1, int y1 );
2597 
2607  {
2608  RegenerateImageRect( r.x0, r.y0, r.x1, r.y1 );
2609  }
2610 
2625  void RegenerateImageRect( double x0, double y0, double x1, double y1 );
2626 
2631  void UpdateViewport();
2632 
2641  void UpdateViewportRect( const Rect& r )
2642  {
2643  UpdateViewportRect( r.x0, r.y0, r.x1, r.y1 );
2644  }
2645 
2660  void UpdateViewportRect( int x0, int y0, int x1, int y1 );
2661 
2670  void UpdateImageRect( const pcl::DRect& r )
2671  {
2672  UpdateImageRect( r.x0, r.y0, r.x1, r.y1 );
2673  }
2674 
2690  void UpdateImageRect( double x0, double y0, double x1, double y1 );
2691 
2695  bool HasPendingUpdates() const;
2696 
2715  void CommitPendingUpdates();
2716 
2721  Rect ViewportUpdateRect() const;
2722 
2731  Bitmap ViewportBitmap( const Rect& r, uint32 flags = 0 ) const
2732  {
2733  return ViewportBitmap( r.x0, r.y0, r.x1, r.y1, flags );
2734  }
2735 
2755  Bitmap ViewportBitmap( int x0, int y0, int x1, int y1, uint32 flags = 0 ) const;
2756 
2765  void BeginSelection( const Point& p, uint32 flags = 0 )
2766  {
2767  BeginSelection( p.x, p.y, flags );
2768  }
2769 
2786  void BeginSelection( int x, int y, uint32 flags = 0 );
2787 
2796  void ModifySelection( const Point& p, uint32 flags = 0 )
2797  {
2798  ModifySelection( p.x, p.y, flags );
2799  }
2800 
2814  void ModifySelection( int x, int y, uint32 flags = 0 );
2815 
2819  void UpdateSelection();
2820 
2824  void CancelSelection();
2825 
2829  void EndSelection();
2830 
2840  Rect SelectionRect( uint32* flags = nullptr ) const;
2841 
2846  bool IsSelection() const;
2847 
2853  static ImageWindow WindowById( const IsoString& id );
2854 
2855  static ImageWindow WindowById( const IsoString::ustring_base& id )
2856  {
2857  return WindowById( IsoString( id ) );
2858  }
2859 
2865  static ImageWindow WindowByFilePath( const String& filePath );
2866 
2877  static ImageWindow ActiveWindow();
2878 
2886  static Array<ImageWindow> AllWindows( bool includeIconicWindows = true );
2887 
2888 private:
2889 
2890  ImageWindow( void* h ) : UIObject( h )
2891  {
2892  }
2893 
2894  friend class View;
2895  friend class ProcessInstance; // for IsMaskable()
2896  friend class ProcessContextDispatcher;
2897  friend class InternalWindowEnumerator;
2898 };
2899 
2900 // ----------------------------------------------------------------------------
2901 
2902 #endif // !__PCL_BUILDING_PIXINSIGHT_APPLICATION
2903 
2904 } // pcl
2905 
2906 #endif // __PCL_ImageWindow_h
2907 
2908 // ----------------------------------------------------------------------------
2909 // EOF pcl/ImageWindow.h - Released 2019-11-07T10:59:34Z
Client-side interface to a PixInsight Bitmap object.
Definition: Bitmap.h:163
ImageWindow(ImageWindow &&x)
Definition: ImageWindow.h:400
uint32 RGBA
Definition: Color.h:92
Format-independent fundamental image stream options.
Definition: ImageOptions.h:97
int VisibleViewportWidth() const
Definition: ImageWindow.h:1981
int ViewportWidth() const
Definition: ImageWindow.h:1916
A collection of history data item specifiers.
A generic point in the two-dimensional space.
Definition: Point.h:99
void DisableColorManagement(bool disable=true)
Definition: ImageWindow.h:1138
bool HasPreviews() const
Definition: ImageWindow.h:689
DisplayChannel::value_type display_channel
Definition: ImageWindow.h:295
void HideMask(bool hide=true)
Definition: ImageWindow.h:1003
Point GlobalToViewport(const Point &p) const
Definition: ImageWindow.h:2529
MaskMode::value_type mask_mode
Definition: ImageWindow.h:302
PCL root namespace.
Definition: AbstractImage.h:76
void HideTransparency()
Definition: ImageWindow.h:1743
void DisableProofing(bool disable=true)
Definition: ImageWindow.h:1173
void UpdateViewportRect(const Rect &r)
Definition: ImageWindow.h:2641
DPoint ViewportToImage(const GenericPoint< T > &p) const
Definition: ImageWindow.h:2251
A colorimetrically defined RGB working color space.
A type-safe collection of enumerated flags.
Definition: Flags.h:84
bool IsEmpty() const
Definition: String.h:785
Bitmap ViewportBitmap(const Rect &r, uint32 flags=0) const
Definition: ImageWindow.h:2731
Root base class for all user interface objects.
Definition: UIObject.h:94
void SetDynamicCursor(const Bitmap &bmp, const Point &p)
Definition: ImageWindow.h:2172
DRect ViewportToImage(const GenericRectangle< T > &r) const
Definition: ImageWindow.h:2264
Client-side interface to a PixInsight process interface window.
bool IsAlphaChannelDisplayed() const
Definition: ImageWindow.h:1592
component x1
Horizontal coordinate of the lower right corner.
Definition: Rectangle.h:334
Rect GlobalToViewport(const Rect &r) const
Definition: ImageWindow.h:2541
Rect ViewportToGlobal(const Rect &r) const
Definition: ImageWindow.h:2508
A generic rectangle in the two-dimensional space.
Definition: Rectangle.h:313
size_t size_type
Definition: Defs.h:543
64-bit floating-point rectangle in the R^2 space.
int VisibleViewportHeight() const
Definition: ImageWindow.h:1990
ImageWindow(const ImageWindow &w)
Definition: ImageWindow.h:393
void ModifyPreview(const IsoString &previewId, const Rect &r, const IsoString &newId=IsoString())
Definition: ImageWindow.h:817
void SelectPreview(const IsoString &previewId)
Definition: ImageWindow.h:755
Unicode (UTF-16) string.
Definition: String.h:7911
void ViewportToImage(Array< GenericPoint< T > > &a) const
Definition: ImageWindow.h:2304
component x
Abscissa (horizontal, or X-axis coordinate).
Definition: Point.h:111
void SetResolution(double r, bool metric=false)
Definition: ImageWindow.h:1425
Platform-independent information on file and directory items.
Definition: FileInfo.h:73
void UpdateImageRect(const pcl::DRect &r)
Definition: ImageWindow.h:2670
void SelectMainView()
Definition: ImageWindow.h:664
bool IsValidMainViewMode(value_type m)
Definition: ImageWindow.h:135
double ViewportScalarToImage(T d) const
Definition: ImageWindow.h:2349
A high-level interface to ICC color profiles.
Definition: ICCProfile.h:234
void RegenerateViewportRect(const Rect &r)
Definition: ImageWindow.h:2577
GenericPoint< T > ImageToViewport(const GenericPoint< T > &p) const
Definition: ImageWindow.h:2378
bool IsNull() const
Definition: UIObject.h:113
static Bitmap & Null()
Dynamic list of Unicode (UTF-16) strings.
void DisableGamutCheck(bool disable=true)
Definition: ImageWindow.h:1210
TransparencyMode::value_type transparency_mode
Definition: ImageWindow.h:316
bool IsValidPreviewMode(value_type m)
Definition: ImageWindow.h:126
Point ViewportToGlobal(const Point &p) const
Definition: ImageWindow.h:2496
virtual ~ImageWindow()
Definition: ImageWindow.h:411
ImageMode::value_type gui_mode
Definition: ImageWindow.h:288
Generic dynamic array.
Definition: Array.h:99
void RegenerateImageRect(const pcl::DRect &r)
Definition: ImageWindow.h:2606
bool HasURL() const
Definition: ImageWindow.h:581
void ImageToViewport(Array< GenericPoint< T > > &a) const
Definition: ImageWindow.h:2435
int ViewportHeight() const
Definition: ImageWindow.h:1926
void SetViewportPosition(const Point &p)
Definition: ImageWindow.h:1963
component x0
Horizontal coordinate of the upper left corner.
Definition: Rectangle.h:332
int CurrentAlphaChannel() const
Definition: ImageWindow.h:1606
High-level interface to a PixInsight view object.
Definition: View.h:167
void InvertMask(bool invert=true)
Definition: ImageWindow.h:966
bool GetKeywords(FITSKeywordArray &keywords) const
Definition: ImageWindow.h:1295
64-bit floating-point point in the R^2 space.
bool IsTransparencyVisible() const
Definition: ImageWindow.h:1717
32-bit integer point on the plane.
void ResetDynamicCursor()
Definition: ImageWindow.h:2181
bool PreviewExists(const IsoString &previewId) const
Definition: ImageWindow.h:720
GenericRectangle< T > ImageToViewport(const GenericRectangle< T > &r) const
Definition: ImageWindow.h:2395
bool IsModified() const
Definition: ImageWindow.h:603
component y0
Vertical coordinate of the upper left corner.
Definition: Rectangle.h:333
High-level interface to a process instance.
component y
Ordinate (vertical, or Y-axis coordinate).
Definition: Point.h:112
void DisableMask(bool disable=true)
Definition: ImageWindow.h:985
void BeginSelection(const Point &p, uint32 flags=0)
Definition: ImageWindow.h:2765
unsigned int uint32
Definition: Defs.h:600
View CreatePreview(const Rect &r, const IsoString &previewId=IsoString())
Definition: ImageWindow.h:773
32-bit integer rectangle on the plane.
void SetDynamicCursor(const char **xpm, const Point &p)
Definition: ImageWindow.h:2135
void ModifySelection(const Point &p, uint32 flags=0)
Definition: ImageWindow.h:2796
High-level interface to an image window object in the PixInsight core application.
Definition: ImageWindow.h:280
component y1
Vertical coordinate of the lower right corner.
Definition: Rectangle.h:335
Dynamic array of FITS header keywords.
void SetViewport(const DPoint &center, int zoom=0)
Definition: ImageWindow.h:1805
BackgroundBrush::value_type background_brush
Definition: ImageWindow.h:309
Eight-bit string (ISO/IEC-8859-1 or UTF-8 string)
Definition: String.h:5387