Archived:How to calculate the transparency for icons in PySymbian

From Nokia Developer Wiki
Jump to: navigation, search

Archived.pngAquivado: Este artigo foi arquivado, pois o conteúdo não é mais considerado relevante para se criar soluções comerciais atuais. Se você achar que este artigo ainda é importante, inclua o template {{ForArchiveReview|escreva a sua justificativa}}.

All PySymbian articles have been archived. PySymbian is no longer maintained by Nokia and is not guaranteed to work on more recent Symbian devices. It is not possible to submit apps to Nokia Store.

Article Metadata
Created: User:Kandyfloss (19 Apr 2008)
Last edited: hamishwillee (31 May 2013)

Here is a piece of source that calculates the transparency for icons in Python

    ## This code Calculates the mask for the list icon.
# Here is the list of parameters and function return values.
# All white point are transformed to transparent.
# Parameter : self The object pointer.
# Parameter : aImg An image object.
# Returns : Image mask object.
def _autoMask( self, aImg ):
width, height = aImg.size
mask = Image.new( aImg.size, '1' )
tran = (255,255,255)
for y in range( height ):
line = aImg.getpixel( [( x, y ) for x in range( width )] )
for x in range( width ):
if line[x] == tran:
mask.point( ( x, y ), 0 )
## Icon mask for dealing with transparency
self._iDefaultIconMask = mask
This page was last modified on 31 May 2013, at 04:03.
40 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.