News : The level of daily SPAM has reached insane proportions, all registrations are now manual. I ask you to send me an e-mail (john (at) murga (dot) org), to confirm that you want me to create an account for you.


Post Reply  Post Thread 
puzzle remix
Author Message
mikshaw
Senior Member
****


Posts: 522
Group: Registered
Joined: Apr 2007
Status: Offline
Reputation: 5
Post: #1
RE: puzzle remix

I replaced the Fl_Image:getTiles() with a loop that draws a section of the buffer at a time, according to the coordinates I had already created when laying out the tile buttons. It still doesn't work for GIFs, but there's no pixel shift that you see from getTiles()

John...you may want to look at your tile function some day when you're not doing more important stuff. I think whatever algeryth...algorri...I think whatever is creating them is off by a pixel with each iteration (is that a murgaLua/Fltk mix, or is it a Fltk bug?). Even when using a tile size that divides evenly into height and width of the image, you end up with a pixel shift that increases with each row of tiles. I don't know C++, so I'm not sure what it's doing yet, but "verticalOffset" has me wondering.

EDIT:
Getting a weird line in the top left of some images, at the bottom of the first two tiles. It's not severe, but still means it's not as good as i'd hoped.

Code:
function set_tile_images()
  -- crop the image to iw,ih
  img_data = img:data()
  collectgarbage()
  offScreenBuffer = murgaLua.createOffscreenBuffer(iw, ih)
  offScreenBuffer:startOffScreenDrawing()
  -- On Linux we have to clear the buffer (not on Mac or Win32)
  fltk.fl_color(0)
  -- Linux will segfault unless we set the font before using fl_draw
  fltk.fl_font(0)
  if img:count() > 2 then data = img_data else data = img_data[1] end
  fltk.fl_draw_image(data, 0, 0, img:w(), img:h(), 3)
  image = offScreenBuffer:getOffScreenImage()
  -- tile it up
  for i,_ in pairs(tile) do
    fltk.fl_draw_image(pos[i].col, pos[i].row, tw, th, 3)
    tileString = fltk.fl_read_image(pos[i].col, pos[i].row, tw, th)
    tile[i]:image(fltk:Fl_RGB_Image(tileString, tw, th, 3, 0))
  end
  offScreenBuffer:endOffScreenDrawing()
  box:image(image)
  box:hide()
end

This post was last modified: 01-10-2011 09:24 AM by mikshaw.

01-10-2011 08:28 AM
Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

Messages In This Thread
puzzle remix - mikshaw - 01-08-2011, 04:17 AM
RE: puzzle remix - mikshaw - 01-08-2011, 04:37 AM
RE: puzzle remix - mikshaw - 01-09-2011, 04:16 AM
RE: puzzle remix - mikshaw - 01-09-2011, 01:09 PM
RE: puzzle remix - mikshaw - 01-10-2011, 05:04 AM
RE: puzzle remix - mikshaw - 01-10-2011, 05:17 AM
RE: puzzle remix - mikshaw - 01-10-2011 08:28 AM
RE: puzzle remix - mikshaw - 01-11-2011, 01:02 AM
RE: puzzle remix - jpjacobs - 01-11-2011, 01:28 AM
RE: puzzle remix - mikshaw - 01-11-2011, 05:18 AM
RE: puzzle remix - iGame3D - 02-04-2011, 11:51 AM

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: