]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/mac/_gdi.py
Include wx/msw/wrap*.h according to pch support (with other minor cleaning).
[wxWidgets.git] / wxPython / src / mac / _gdi.py
index e8683448ef57d6e9efa54a3cb9fb1e3fa96ad2be..e339904088d72830894b6eb79164a78a363be80c 100644 (file)
@@ -243,6 +243,8 @@ class Colour(_core.Object):
     __safe_for_unpickling__ = True
     def __reduce__(self):               return (Colour, self.Get(True))
 
+    Pixel = property(GetPixel,doc="See `GetPixel`") 
+    RGB = property(GetRGB,SetRGB,doc="See `GetRGB` and `SetRGB`") 
 _gdi_.Colour_swigregister(Colour)
 
 def NamedColour(*args, **kwargs):
@@ -475,6 +477,9 @@ class Brush(GDIObject):
         return _gdi_.Brush_MacSetTheme(*args, **kwargs)
 
     def __nonzero__(self): return self.Ok() 
+    Colour = property(GetColour,SetColour,doc="See `GetColour` and `SetColour`") 
+    Stipple = property(GetStipple,SetStipple,doc="See `GetStipple` and `SetStipple`") 
+    Style = property(GetStyle,SetStyle,doc="See `GetStyle` and `SetStyle`") 
 _gdi_.Brush_swigregister(Brush)
 
 def BrushFromBitmap(*args, **kwargs):
@@ -661,6 +666,13 @@ class Bitmap(GDIObject):
         """__ne__(self, Bitmap other) -> bool"""
         return _gdi_.Bitmap___ne__(*args, **kwargs)
 
+    Depth = property(GetDepth,SetDepth,doc="See `GetDepth` and `SetDepth`") 
+    Height = property(GetHeight,SetHeight,doc="See `GetHeight` and `SetHeight`") 
+    Mask = property(GetMask,SetMask,doc="See `GetMask` and `SetMask`") 
+    Palette = property(GetPalette,doc="See `GetPalette`") 
+    Size = property(GetSize,SetSize,doc="See `GetSize` and `SetSize`") 
+    SubBitmap = property(GetSubBitmap,doc="See `GetSubBitmap`") 
+    Width = property(GetWidth,SetWidth,doc="See `GetWidth` and `SetWidth`") 
 _gdi_.Bitmap_swigregister(Bitmap)
 
 def EmptyBitmap(*args, **kwargs):
@@ -728,29 +740,26 @@ def _BitmapFromBuffer(*args, **kwargs):
 def BitmapFromBuffer(width, height, dataBuffer, alphaBuffer=None):
     """
     Creates a `wx.Bitmap` from the data in dataBuffer.  The dataBuffer
-    parameter must be a Python object that implements the buffer interface, or
-    is convertable to a buffer object, such as a string, array, etc.  The
-    dataBuffer object is expected to contain a series of RGB bytes and be
-    width*height*3 bytes long.  A buffer object can optionally be supplied for
-    the image's alpha channel data, and it is expected to be width*height
-    bytes long.  On Windows the RGB values are 'premultiplied' by the alpha
-    values.  (The other platforms appear to already be premultiplying the
-    alpha.)
-
-    Unlike `wx.ImageFromBuffer` the bitmap created with this function does not
-    share the memory buffer with the buffer object.  This is because the
-    native pixel buffer format varies on different platforms, and so instead
-    an efficient as possible copy of the data is made from the buffer objects
-    to the bitmap's native pixel buffer.  For direct access to a bitmap's
-    pixel buffer see `wx.NativePixelData` and `wx.AlphaPixelData`.
+    parameter must be a Python object that implements the buffer
+    interface, such as a string, array, etc.  The dataBuffer object is
+    expected to contain a series of RGB bytes and be width*height*3
+    bytes long.  A buffer object can optionally be supplied for the
+    image's alpha channel data, and it is expected to be width*height
+    bytes long.  On Windows the RGB values are 'premultiplied' by the
+    alpha values.  (The other platforms do the multiplication
+    themselves.)
+
+    Unlike `wx.ImageFromBuffer` the bitmap created with this function
+    does not share the memory buffer with the buffer object.  This is
+    because the native pixel buffer format varies on different
+    platforms, and so instead an efficient as possible copy of the
+    data is made from the buffer objects to the bitmap's native pixel
+    buffer.  For direct access to a bitmap's pixel buffer see
+    `wx.NativePixelData` and `wx.AlphaPixelData`.
 
     :see: `wx.Bitmap`, `wx.BitmapFromBufferRGBA`, `wx.NativePixelData`,
           `wx.AlphaPixelData`, `wx.ImageFromBuffer`
     """
-    if not isinstance(dataBuffer, buffer):
-        dataBuffer = buffer(dataBuffer)
-    if alphaBuffer is not None and not isinstance(alphaBuffer, buffer):
-        alphaBuffer = buffer(alphaBuffer)
     if alphaBuffer is not None:
         return _gdi_._BitmapFromBufferAlpha(width, height, dataBuffer, alphaBuffer)
     else:
@@ -763,25 +772,24 @@ def _BitmapFromBufferRGBA(*args, **kwargs):
 def BitmapFromBufferRGBA(width, height, dataBuffer):
     """
     Creates a `wx.Bitmap` from the data in dataBuffer.  The dataBuffer
-    parameter must be a Python object that implements the buffer interface, or
-    is convertable to a buffer object, such as a string, array, etc.  The
-    dataBuffer object is expected to contain a series of RGBA bytes (red,
-    green, blue and alpha) and be width*height*4 bytes long.  On Windows the
-    RGB values are 'premultiplied' by the alpha values.  (The other platforms
-    appear to already be premultiplying the alpha.)
-
-    Unlike `wx.ImageFromBuffer` the bitmap created with this function does not
-    share the memory buffer with the buffer object.  This is because the
-    native pixel buffer format varies on different platforms, and so instead
-    an efficient as possible copy of the data is made from the buffer object
-    to the bitmap's native pixel buffer.  For direct access to a bitmap's
-    pixel buffer see `wx.NativePixelData` and `wx.AlphaPixelData`.
+    parameter must be a Python object that implements the buffer
+    interface, such as a string, array, etc.  The dataBuffer object is
+    expected to contain a series of RGBA bytes (red, green, blue and
+    alpha) and be width*height*4 bytes long.  On Windows the RGB
+    values are 'premultiplied' by the alpha values.  (The other
+    platforms do the multiplication themselves.)
+
+    Unlike `wx.ImageFromBuffer` the bitmap created with this function
+    does not share the memory buffer with the buffer object.  This is
+    because the native pixel buffer format varies on different
+    platforms, and so instead an efficient as possible copy of the
+    data is made from the buffer object to the bitmap's native pixel
+    buffer.  For direct access to a bitmap's pixel buffer see
+    `wx.NativePixelData` and `wx.AlphaPixelData`.
 
     :see: `wx.Bitmap`, `wx.BitmapFromBuffer`, `wx.NativePixelData`,
           `wx.AlphaPixelData`, `wx.ImageFromBuffer`
     """
-    if not isinstance(dataBuffer, buffer):
-        dataBuffer = buffer(dataBuffer)
     return _gdi_._BitmapFromBufferRGBA(width, height, dataBuffer)
 
 class PixelDataBase(object):
@@ -837,53 +845,41 @@ class NativePixelData(PixelDataBase):
         return _gdi_.NativePixelData___nonzero__(*args, **kwargs)
 
     def __iter__(self):
-        """Create and return an iterator object for this pixel data object."""
-        return self.PixelIterator(self)
-
-    class PixelIterator(object):
-        """
-        Sequential iterator which returns pixel accessor objects starting at the
-        the top-left corner, and going row-by-row until the bottom-right
-        corner is reached.
-        """
-
-        class PixelAccessor(object):
-            """
-            This class is what is returned by the iterator and allows the pixel
-            to be Get or Set.
-            """
-            def __init__(self, data, pixels, x, y):
-                self.data = data
-                self.pixels = pixels
-                self.x = x
-                self.y = y
-            def Set(self, *args, **kw):
-                self.pixels.MoveTo(self.data, self.x, self.y)
-                return self.pixels.Set(*args, **kw)
+        """
+        Create and return an iterator object for this pixel data
+        object.  (It's really a generator but I won't tell if you
+        don't tell.)
+        """
+        width  = self.GetWidth()
+        height = self.GetHeight()
+        pixels = self.GetPixels()
+        
+
+
+
+        class PixelFacade(object):
             def Get(self):
-                self.pixels.MoveTo(self.data, self.x, self.y)
-                return self.pixels.Get()
-
-        def __init__(self, pixelData):
-            self.x = self.y = 0
-            self.w = pixelData.GetWidth()
-            self.h = pixelData.GetHeight()
-            self.data = pixelData
-            self.pixels = pixelData.GetPixels()
-
-        def __iter__(self):
-            return self
-
-        def next(self):
-            if self.y >= self.h:
-                raise StopIteration
-            p = self.PixelAccessor(self.data, self.pixels, self.x, self.y)
-            self.x += 1
-            if self.x >= self.w:
-                self.x = 0
-                self.y += 1
-            return p
+                return pixels.Get()
+            def Set(self, *args, **kw):
+                return pixels.Set(*args, **kw)
+            def __str__(self):
+                return str(self.Get())
+            def __repr__(self):
+                return 'pixel(%d,%d): %s' % (x,y,self.Get())
+            X = property(lambda self: x)
+            Y = property(lambda self: y)
+            
+        pf = PixelFacade()        
+        for y in xrange(height):
+            for x in xrange(width):
+
+
+
+                yield pf    
+                pixels.nextPixel()
+            pixels.MoveTo(self, 0, y)
 
+    Pixels = property(GetPixels,doc="See `GetPixels`") 
 _gdi_.NativePixelData_swigregister(NativePixelData)
 
 class NativePixelData_Accessor(object):
@@ -965,53 +961,41 @@ class AlphaPixelData(PixelDataBase):
         return _gdi_.AlphaPixelData___nonzero__(*args, **kwargs)
 
     def __iter__(self):
-        """Create and return an iterator object for this pixel data object."""
-        return self.PixelIterator(self)
-
-    class PixelIterator(object):
-        """
-        Sequential iterator which returns pixel accessor objects starting at the
-        the top-left corner, and going row-by-row until the bottom-right
-        corner is reached.
-        """
-
-        class PixelAccessor(object):
-            """
-            This class is what is returned by the iterator and allows the pixel
-            to be Get or Set.
-            """
-            def __init__(self, data, pixels, x, y):
-                self.data = data
-                self.pixels = pixels
-                self.x = x
-                self.y = y
-            def Set(self, *args, **kw):
-                self.pixels.MoveTo(self.data, self.x, self.y)
-                return self.pixels.Set(*args, **kw)
+        """
+        Create and return an iterator object for this pixel data
+        object.  (It's really a generator but I won't tell if you
+        don't tell.)
+        """
+        width  = self.GetWidth()
+        height = self.GetHeight()
+        pixels = self.GetPixels()
+        
+
+
+
+        class PixelFacade(object):
             def Get(self):
-                self.pixels.MoveTo(self.data, self.x, self.y)
-                return self.pixels.Get()
-
-        def __init__(self, pixelData):
-            self.x = self.y = 0
-            self.w = pixelData.GetWidth()
-            self.h = pixelData.GetHeight()
-            self.data = pixelData
-            self.pixels = pixelData.GetPixels()
-
-        def __iter__(self):
-            return self
-
-        def next(self):
-            if self.y >= self.h:
-                raise StopIteration
-            p = self.PixelAccessor(self.data, self.pixels, self.x, self.y)
-            self.x += 1
-            if self.x >= self.w:
-                self.x = 0
-                self.y += 1
-            return p
+                return pixels.Get()
+            def Set(self, *args, **kw):
+                return pixels.Set(*args, **kw)
+            def __str__(self):
+                return str(self.Get())
+            def __repr__(self):
+                return 'pixel(%d,%d): %s' % (x,y,self.Get())
+            X = property(lambda self: x)
+            Y = property(lambda self: y)
+            
+        pf = PixelFacade()        
+        for y in xrange(height):
+            for x in xrange(width):
+
+
+
+                yield pf    
+                pixels.nextPixel()
+            pixels.MoveTo(self, 0, y)
 
+    Pixels = property(GetPixels,doc="See `GetPixels`") 
 _gdi_.AlphaPixelData_swigregister(AlphaPixelData)
 
 class AlphaPixelData_Accessor(object):
@@ -2798,7 +2782,7 @@ def EncodingConverter_CanConvert(*args, **kwargs):
 # to the default catalog path.
 if wx.Platform == "__WXMSW__":
     import os
-    _localedir = os.path.join(os.path.split(__file__)[0], "locale")
+    _localedir = os.path.join(os.path.split(__file__)[0], "i18n")
     Locale.AddCatalogLookupPathPrefix(_localedir)
     del os
 
@@ -4265,6 +4249,35 @@ class DC(_core.Object):
            raise ValueError('backgrounds and coords must have same length')
         return  self._DrawTextList(textList, coords, foregrounds, backgrounds)
 
+    Background = property(GetBackground,SetBackground,doc="See `GetBackground` and `SetBackground`") 
+    BackgroundMode = property(GetBackgroundMode,SetBackgroundMode,doc="See `GetBackgroundMode` and `SetBackgroundMode`") 
+    BoundingBox = property(GetBoundingBox,doc="See `GetBoundingBox`") 
+    Brush = property(GetBrush,SetBrush,doc="See `GetBrush` and `SetBrush`") 
+    CharHeight = property(GetCharHeight,doc="See `GetCharHeight`") 
+    CharWidth = property(GetCharWidth,doc="See `GetCharWidth`") 
+    ClippingBox = property(GetClippingBox,doc="See `GetClippingBox`") 
+    ClippingRect = property(GetClippingRect,SetClippingRect,doc="See `GetClippingRect` and `SetClippingRect`") 
+    Depth = property(GetDepth,doc="See `GetDepth`") 
+    DeviceOrigin = property(GetDeviceOrigin,SetDeviceOrigin,doc="See `GetDeviceOrigin` and `SetDeviceOrigin`") 
+    Font = property(GetFont,SetFont,doc="See `GetFont` and `SetFont`") 
+    FullTextExtent = property(GetFullTextExtent,doc="See `GetFullTextExtent`") 
+    LogicalFunction = property(GetLogicalFunction,SetLogicalFunction,doc="See `GetLogicalFunction` and `SetLogicalFunction`") 
+    LogicalOrigin = property(GetLogicalOrigin,SetLogicalOrigin,doc="See `GetLogicalOrigin` and `SetLogicalOrigin`") 
+    LogicalScale = property(GetLogicalScale,SetLogicalScale,doc="See `GetLogicalScale` and `SetLogicalScale`") 
+    MapMode = property(GetMapMode,SetMapMode,doc="See `GetMapMode` and `SetMapMode`") 
+    MultiLineTextExtent = property(GetMultiLineTextExtent,doc="See `GetMultiLineTextExtent`") 
+    Optimization = property(GetOptimization,SetOptimization,doc="See `GetOptimization` and `SetOptimization`") 
+    PPI = property(GetPPI,doc="See `GetPPI`") 
+    PartialTextExtents = property(GetPartialTextExtents,doc="See `GetPartialTextExtents`") 
+    Pen = property(GetPen,SetPen,doc="See `GetPen` and `SetPen`") 
+    Pixel = property(GetPixel,doc="See `GetPixel`") 
+    PixelPoint = property(GetPixelPoint,doc="See `GetPixelPoint`") 
+    Size = property(GetSize,doc="See `GetSize`") 
+    SizeMM = property(GetSizeMM,doc="See `GetSizeMM`") 
+    TextBackground = property(GetTextBackground,SetTextBackground,doc="See `GetTextBackground` and `SetTextBackground`") 
+    TextExtent = property(GetTextExtent,doc="See `GetTextExtent`") 
+    TextForeground = property(GetTextForeground,SetTextForeground,doc="See `GetTextForeground` and `SetTextForeground`") 
+    UserScale = property(GetUserScale,SetUserScale,doc="See `GetUserScale` and `SetUserScale`") 
 _gdi_.DC_swigregister(DC)
 
 #---------------------------------------------------------------------------