I have made a lua improvement tha changes time from 126ms to 46ms

 local bw = bitmap:Width()
 local bh = bitmap:Height()
 local R = bitmap.r
 local G = bitmap.g
 local B = bitmap.b
 for j=0,bitmap:Height()-1 do
  local offset = j*bw
  for i=0,bw-1 do
   R[offset +i ] = 255
   G[offset +i ] = 0
   B[offset +i ] = 0
  end
 end

the important part is  local R = bitmap.r

Hope you get a good holiday ;-)
victor bombi
  ----- Original Message ----- 
  From: Antonio Scuri 
  To: IUP discussion list. 
  Sent: Friday, January 24, 2014 8:56 PM
  Subject: Re: [Iup-users] drawing pixel per pixel


  No, there isn't. 


  But we could implement something similar in IM. But only when I get back from 
vacation in mid Feb.


  Best,
  Scuri





  On Fri, Jan 24, 2014 at 5:22 PM, Victor Bombi <[email protected]> wrote:

    Hello,

    I am trying to use CD and IM from lua for drawing  pixel per pixel.

    I have tried 3 mechanisms for "clearing" the canvas with a red color

    1- IM  as image[0][i][j] = 255    (313 ms)
    2- CD canvas with canvas:Pixel (200 ms)
    3- CD with cdBitmap image.r[j*w+i] = 255 (164 ms)

    The best would be third mechanism but it is still to slow for me.

    In processing, for example I can use
    loadPixels();
    for(...){
        pixels[x+y*width] = color;
    }
    updatePixels();
    and is extremely fast

    Is there another way to do it?

    Best
    victor bombi


    
------------------------------------------------------------------------------
    CenturyLink Cloud: The Leader in Enterprise Cloud Services.
    Learn Why More Businesses Are Choosing CenturyLink Cloud For
    Critical Workloads, Development Environments & Everything In Between.
    Get a Quote or Start a Free Trial Today.
    http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
    _______________________________________________
    Iup-users mailing list
    [email protected]
    https://lists.sourceforge.net/lists/listinfo/iup-users





------------------------------------------------------------------------------


  ------------------------------------------------------------------------------
  CenturyLink Cloud: The Leader in Enterprise Cloud Services.
  Learn Why More Businesses Are Choosing CenturyLink Cloud For
  Critical Workloads, Development Environments & Everything In Between.
  Get a Quote or Start a Free Trial Today. 
  http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk


------------------------------------------------------------------------------


  _______________________________________________
  Iup-users mailing list
  [email protected]
  https://lists.sourceforge.net/lists/listinfo/iup-users
------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Iup-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/iup-users

Reply via email to