You Are Here:

Community: Developer Discussion Boards

#1 Old Is there a 'setpixel' for image objects? - 2007-08-24, 17:40

Join Date: Jul 2007
Posts: 18
savago
Offline
Registered User
Friends


I had googled around and it seems that starting from PyS60 1.2 there is a new function for image objects ('getpixel') that returns pixels values from one image in a given coordinate.

I was wondering if there is an equivalente 'setpixel' function to change/add pixels in an image object? If not, is there a way to create an image with a given dimension (say, 640 x 480) and fill in the pixel values of it?

It would be nice to being able to set whole lines and/or columns at just 1 function call too!
:-)


Best regards


Savago
Reply With Quote

#2 Old Re: Is there a 'setpixel' for image objects? - 2007-08-24, 23:21

Join Date: Aug 2007
Posts: 41
Location: Norway
Jan Rune Johansen
Offline
Registered User
You can load an image into canvas. And use the point() method to "setpixel"...

Something like this:

Code:
x = 10
y = 10
color = 0x000000
appuifw.app.body.point((x, y), color)
Reply With Quote

#3 Old Re: Is there a 'setpixel' for image objects? - 2007-08-24, 23:27

Join Date: Aug 2007
Posts: 41
Location: Norway
Jan Rune Johansen
Offline
Registered User
I actually have a little example of the point method here that i used for a test:

Code:
import e32
import appuifw
import graphics

fullscreen = 1
x = 10
y = 10
color = 0xFFFFFF
bg_color = 0x000000

def exit():
	global fullscreen
	fullscreen = 0


appuifw.app.screen = 'full'
canvas = appuifw.Canvas()
appuifw.app.body = canvas

canvas.clear(bg_color) 

appuifw.app.exit_key_handler= exit

while fullscreen:
	appuifw.app.body.point((x, y), color)
	e32.ao_sleep(0.5)
Reply With Quote

#4 Old Re: Is there a 'setpixel' for image objects? - 2007-08-26, 21:45

Join Date: Jul 2007
Posts: 18
savago
Offline
Registered User
Dear Jan Rune Johansen

Thanks a lot for your message. I will test the code and report back later.

The only problem that I can see with this approach is that its a bit cpu intensive (i.e. for a typical display of 320x240 pixels it will require 76800 functions calls to fill in an image of the same size).

Is there a way to fill one row or column with *just* 1 function call? Or even better, present one array with all raw pixel data (say RGB, RGB, etc..) and fill in the canvas/image object at once?

Best regards


Savago
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
Stroring Objects into RecordStore does degrades performance? rohitverma81 Mobile Java General 1 2006-11-08 06:04
Active objects in EXE second thread inguvaseshu Symbian Networking & Messaging 8 2006-08-10 06:35
Bubble sort a list of linked objects! hclemson General Symbian C++ 2 2005-05-15 14:39
panicking active objects kratom General Symbian C++ 0 2003-04-18 08:20
How do I use Find() method of CArrayPtrFlat holding CBase objects? nawkboy General Symbian C++ 0 2003-02-27 21:28

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia