On Wed, Apr 5, 2017 at 12:02 PM, <[email protected]> wrote:

> This is exactly what I was looking for, thank you so much for taking the
> time to help me out, Steve! :) I'd like to ask a few more questions if
> that's okay, just to get some clarification on a few things!
>
> Is there any documentation regarding the performance of the low-level
> drawing routines? One thing I like is how pixel-perfect the scaling on
> pixel art turns out when using drawImage and manually specifying a width
> and height. The result is so much more crisp than what can be achieved with
> multi-resolution images. As a Codename One developer, do you think it is
> way more expensive handle rendering this way instead of using muti-res, or
> is it about the same?
>

I haven't don't any profiling on this myself, so I'm not sure the
difference in performance.  The performance will likely vary by platform a
little bit.


>
> How performant is it to do something like, say, an array of images? Would
> this be undefined behavior? drawImage(testimage[3],objx,objy), for
> example.
>

Keeping images in an array should not impact performance in any way (vs
just keeping them in variables). While accessing an array index is an extra
lookup vs using a local variable, that lookup is negligible compared to the
task of drawing the image.


>
> Finally, Image.getWidth and Image.getHeight: how expensive are these? Do
> they have to poll the GPU, or are image width and height stored on the CPU
> and these are light operations? I ask because I noticed that scale(x,y)
> isn't 100% portable yet due to limited Affine support, so instead of
> setting scale(logicalsize,logicalsize) to change the logical draw size, a
> developer could do something like drawImage(testimage,objx*
> logicalsize,objy*logicalsize,testimage.getWidth*logicalsize,testimage.getHeight*logicalsize)
> as an alternative. But only if these are not expensive and/or slow
> operations to perform?
>

getWidth() and getHeight() should be fast.  It doesn't need to hit the GPU.


Best regards

Steve

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/CAGOYrKVe%2B6ZjVRk%3DtZ0OHo6rw1Db0wkiom9S2VYZq7TPNWBksw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to