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

Oh yeah...maybe i'm not as awake as I thought.

This version doesn't work either, since it tries to grab onscreen data from a window that may be partly offscreen, resulting in blank tiles (or in the present case, a segfault).

EDIT:
Everything I try seems to have at least one issue...some things break, some things cause blank tiles, some things cause the image to be skewed (that seems to be an issue with fl_draw_image when you set dimensions smaller than the original image), and some things seem to work fine for RGB images but not for indexed, such as the following:

Code:
function set_tile_images()
--[[
-- crop the image to iw,ih
win:make_current()
imageString = fltk.fl_read_image(0, 0, iw, ih)
image = fltk:Fl_RGB_Image(imageString, iw, ih, 3)
--]]

  img_data = img:data()
  collectgarbage()
--  offScreenBuffer = murgaLua.createOffscreenBuffer(img:w(), img:h())
  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)
--[[
  imageString = fltk.fl_read_image(offScreenBuffer, 0, 0, iw, ih)
  image = fltk:Fl_RGB_Image(imageString, iw, ih, 3, 0)
--]]
  image = offScreenBuffer:getOffScreenImage()
  offScreenBuffer:endOffScreenDrawing()

-- tile it up
imgtiles = image:getTiles(tw,th)
for i,_ in pairs(tile) do
  tile[i]:image(imgtiles[i+1])
end
box:image(image)
box:hide()
end


These lines are probably a good place to find the GIF problem, but I've run out of ideas:

Code:
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)

This post was last modified: 01-10-2011 06:39 AM by mikshaw.

01-10-2011 05:17 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: