Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Accessing individual pixels on a canvas (q for john or anyone else)

 
Lance Titchkosky
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi John,
Do you happen to know of any way to look at the current pixels that are drawn on a canvas object? I'm trying to implement a transparent menu system, which requires I get the current values of the pixels where my menu will overlap.
Is there anyway to do this? I've checked the api and nothing is jumping out at me as a solution.
thanks,
lance
 
john muchow
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Lance,
Unfortunately, there is no way to access the individual pixels on a Canvas, in MIDP 1.0
John
Core J2ME
 
Lance Titchkosky
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I pretty much figured that. I made my own Graphics class that stores a 100x96 (or widthxheight) array of ints (rgb pixels). Then to paint the buffer I call g.drawLine(x,y,x,y) (a line of size 1 pixel, only way I know of drawing a single pixel).
Anyways this works, but it is killer slow (10 sec refresh of a full screen repaint).
I've thought of another way of doing it, generating a png image from the pixel array and then just calling drawImage, but I suspect it will be too slow as well.
Too bad there isn't a fast way of drawing many pixels to the screen with midp 1.0..
lance
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic