×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Jul 2007
    Posts
    18

    Is there a 'setpixel' for image objects?

    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

  2. #2
    Registered User
    Join Date
    Aug 2007
    Location
    Norway
    Posts
    41

    Re: Is there a 'setpixel' for image objects?

    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)

  3. #3
    Registered User
    Join Date
    Aug 2007
    Location
    Norway
    Posts
    41

    Re: Is there a 'setpixel' for image objects?

    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)

  4. #4
    Registered User
    Join Date
    Jul 2007
    Posts
    18

    Re: Is there a 'setpixel' for image objects?

    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

Similar Threads

  1. Stroring Objects into RecordStore does degrades performance?
    By rohitverma81 in forum Mobile Java General
    Replies: 1
    Last Post: 2006-11-08, 05:04
  2. Active objects in EXE second thread
    By inguvaseshu in forum Symbian Networking & Messaging (Closed)
    Replies: 8
    Last Post: 2006-08-10, 05:35
  3. Bubble sort a list of linked objects!
    By hclemson in forum Symbian
    Replies: 2
    Last Post: 2005-05-15, 13:39
  4. panicking active objects
    By kratom in forum Symbian
    Replies: 0
    Last Post: 2003-04-18, 07:20
  5. Replies: 0
    Last Post: 2003-02-27, 20:28

Posting Permissions

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