Re: Help again
- Posted by "M. Schut" <m.schut at TWI.TUDELFT.NL> Apr 10, 1999
- 511 views
Thee were some errors in your type definitions and the creation of the blank WIF: 1. RGB_Trip -> Forgot to return 1 when it is a valid RGB-color 2. The creation of the BlankWIF: 2.1 You've used | temp = {0,0,0} | for count = 2 to MaxPal do | temp = append(temp, {0,0,0}) | end for This creates an sequence: {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,... } Where you would want to get { {0,0,0}, {0,0,0}, {0,0,0} ... } Solution modified temp into: temp = { {0,0,0} } or (easier) : temp = repeat({0,0,0}, MaxPal) -- And erase the for-loop 2.2 BlankWIF = append(append(append(BlankWIF, temp), 0), 0) Here you set the size of the image to 0x0 However in the type-check for a valid image you check whether it is at least 1x1. So you could change the type-check, or you can substitute the 0's by 1's. (BlankWIF = append(append(append(BlankWIF, temp), 1), 1) 2.3 temp2 = temp [See point 2.1] Change this to: temp2 = { temp } for count = 2 to MaxWidth -- Instead of MaxHeight . for count = 2 to MaxHeight -- Instead of MaxWidth Or easier substitute: | temp = {0} | for count = 2 to MaxHeight do | temp = append(temp, 0) | end for | temp2 = { temp } ----------- | for count2 = 2 to MaxWidth do | temp2 = append(temp2, temp) | end for with: | temp2 = repeat(repeat(0,MaxHeight),MaxWidth) You did originally create a image with horizontal scanlines, however when you checked the type of the image you checked vertical scanlines. With this modifications it still doesn't work -> File header exceeds 1K in prepfile()... But it should give you a direction. Just some questions: Why do you always create an image of 64x64? Even when your image is only 15x15 it creates internally an image of 64x64. So why don;t you use a 'constructor'. So you can do something like CreateWIFImage(x-size, y-size) to create the image. > Okay, I fixed the bug with the variables being uninitialized, and it still crashes, any ideas? Martin Schut P.S. <G> I love that trace-function :)