reSWIGged

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40932 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn 2006-08-30 19:29:31 +00:00
parent 930a9efaf1
commit 195a89b47c
6 changed files with 162 additions and 240 deletions

View File

@ -829,52 +829,39 @@ 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.
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 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)
class PixelFacade(object):
def Get(self):
self.pixels.MoveTo(self.data, self.x, self.y)
return self.pixels.Get()
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):
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
yield pf
pixels.nextPixel()
pixels.MoveTo(self, 0, y)
_gdi_.NativePixelData_swigregister(NativePixelData)
@ -957,52 +944,39 @@ 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.
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 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)
class PixelFacade(object):
def Get(self):
self.pixels.MoveTo(self.data, self.x, self.y)
return self.pixels.Get()
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):
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
yield pf
pixels.nextPixel()
pixels.MoveTo(self, 0, y)
_gdi_.AlphaPixelData_swigregister(AlphaPixelData)

View File

@ -2961,8 +2961,8 @@ SWIGINTERN bool wxBitmap___ne__(wxBitmap *self,wxBitmap const *other){ return ot
// appears to me that the other platforms are already doing it, so I'll just
// automatically do it for wxMSW here.
#ifdef __WXMSW__
#define wxPy_premultiply(p, a) ((p) * (a) / 256)
#define wxPy_unpremultiply(p, a) ((a) ? ((p) * 256 / (a)) : (p))
#define wxPy_premultiply(p, a) ((p) * (a) / 0xff)
#define wxPy_unpremultiply(p, a) ((a) ? ((p) * 0xff / (a)) : (p))
#else
#define wxPy_premultiply(p, a) (p)
#define wxPy_unpremultiply(p, a) (p)

View File

@ -833,52 +833,39 @@ 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.
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 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)
class PixelFacade(object):
def Get(self):
self.pixels.MoveTo(self.data, self.x, self.y)
return self.pixels.Get()
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):
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
yield pf
pixels.nextPixel()
pixels.MoveTo(self, 0, y)
_gdi_.NativePixelData_swigregister(NativePixelData)
@ -961,52 +948,39 @@ 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.
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 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)
class PixelFacade(object):
def Get(self):
self.pixels.MoveTo(self.data, self.x, self.y)
return self.pixels.Get()
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):
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
yield pf
pixels.nextPixel()
pixels.MoveTo(self, 0, y)
_gdi_.AlphaPixelData_swigregister(AlphaPixelData)

View File

@ -2984,8 +2984,8 @@ SWIGINTERN bool wxBitmap___ne__(wxBitmap *self,wxBitmap const *other){ return ot
// appears to me that the other platforms are already doing it, so I'll just
// automatically do it for wxMSW here.
#ifdef __WXMSW__
#define wxPy_premultiply(p, a) ((p) * (a) / 256)
#define wxPy_unpremultiply(p, a) ((a) ? ((p) * 256 / (a)) : (p))
#define wxPy_premultiply(p, a) ((p) * (a) / 0xff)
#define wxPy_unpremultiply(p, a) ((a) ? ((p) * 0xff / (a)) : (p))
#else
#define wxPy_premultiply(p, a) (p)
#define wxPy_unpremultiply(p, a) (p)

View File

@ -853,52 +853,39 @@ 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.
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 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)
class PixelFacade(object):
def Get(self):
self.pixels.MoveTo(self.data, self.x, self.y)
return self.pixels.Get()
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):
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
yield pf
pixels.nextPixel()
pixels.MoveTo(self, 0, y)
_gdi_.NativePixelData_swigregister(NativePixelData)
@ -981,52 +968,39 @@ 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.
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 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)
class PixelFacade(object):
def Get(self):
self.pixels.MoveTo(self.data, self.x, self.y)
return self.pixels.Get()
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):
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
yield pf
pixels.nextPixel()
pixels.MoveTo(self, 0, y)
_gdi_.AlphaPixelData_swigregister(AlphaPixelData)

View File

@ -2962,8 +2962,8 @@ SWIGINTERN bool wxBitmap___ne__(wxBitmap *self,wxBitmap const *other){ return ot
// appears to me that the other platforms are already doing it, so I'll just
// automatically do it for wxMSW here.
#ifdef __WXMSW__
#define wxPy_premultiply(p, a) ((p) * (a) / 256)
#define wxPy_unpremultiply(p, a) ((a) ? ((p) * 256 / (a)) : (p))
#define wxPy_premultiply(p, a) ((p) * (a) / 0xff)
#define wxPy_unpremultiply(p, a) ((a) ? ((p) * 0xff / (a)) : (p))
#else
#define wxPy_premultiply(p, a) (p)
#define wxPy_unpremultiply(p, a) (p)