Search found 73 matches

by Thorham
Oct 31, 2013 18:38
Forum: Sources, Examples, Tips and Tricks
Topic: Convert Bitmap to Data statements
Replies: 6
Views: 3411

Re: Convert Bitmap to Data statements

One thing you could do to reduce the number of data statements is convert the data to base 85. With that you can encode groups of four bytes in just five characters. With that you can efficiently encode 24 bit images as well, or just about anything, really. Article about Ascii85: http://en.wikipedia...
by Thorham
Nov 22, 2012 21:38
Forum: General
Topic: Hold and modify conversion.
Replies: 6
Views: 970

Re: Hold and modify conversion.

If one pixel is far from it's neighbours then it may be better to consider how to get past the following three pixels rather than satisfying the immediate pixel. This is a bit like a Viterbi decoder where all possible tree branches are considered for say the next 4 or 6 pixels. The decision for thi...
by Thorham
Nov 20, 2012 3:10
Forum: General
Topic: Hold and modify conversion.
Replies: 6
Views: 970

Re: Hold and modify conversion.

how are a current pixel are calculated from the last pixel is it a difference or what ? As said, you take the RGB values from the previous pixel, and then modify red, green or blue, or you ignore the previous pixel and set the current pixel to a gray value. When converting a 24 bit image, the basic...
by Thorham
Nov 20, 2012 2:12
Forum: General
Topic: Hold and modify conversion.
Replies: 6
Views: 970

Hold and modify conversion.

I have a graphics format where for each pixel the previous pixel's RGB value is used (for the first pixel on a line black is used), and then red, green or blue can be modified, or, a pixel can be set to any gray value (previous pixel's value isn't used). All this has been implemented (the easy part)...
by Thorham
Jan 31, 2012 20:08
Forum: General
Topic: For next behavior.
Replies: 49
Views: 8058

Re: For next behavior.

If people would make a reasonable selection for a counter variable, which normally means a signed 32 or 64-bit integer, then they would have little reason to care about these details. That's what I did with my first example (my second example is fabricated), where I use a uinteger (because I don't ...
by Thorham
Jan 31, 2012 11:03
Forum: General
Topic: For next behavior.
Replies: 49
Views: 8058

Re: For next behavior.

Consider: For var1 = var2 To var3 Step var4 in FB source code. Consider also that each varx can independently be any one of the following: A literal constant, Byte, Ubyte, Short, Ushort, Integer, Uinteger, Long, Ulong, LongInt, Ulongint, Single or Double. That makes 13^4 = 28,561 combinations possi...
by Thorham
Jan 31, 2012 3:04
Forum: General
Topic: For next behavior.
Replies: 49
Views: 8058

Re: For next behavior.

@thorham: I disagree but sympathise with you. What you're wanting is the more Pythonesque "for i in range(0, n)" (which to be clear is {0..n-1} but that's not the point), where the loop clearly and explicitly runs over each value in the given range and then exits. Sounds about right. It c...
by Thorham
Jan 29, 2012 21:07
Forum: General
Topic: For next behavior.
Replies: 49
Views: 8058

Re: For next behavior.

I can’t understand why people keep pointing out this “bug”, and expecting a developer to fix it, when in 32-bit (x86) code there is no good reason to use an iterator smaller than 32 bits. Instead of worrying about the “bug”, the time would be better spent analyzing your coding practices. And what I...
by Thorham
Jan 29, 2012 18:44
Forum: General
Topic: For next behavior.
Replies: 49
Views: 8058

Re: For next behavior.

1. Because For:Next has always behaved like that and it is expected by experienced programmers. Interesting to learn that experienced programmers accept this bad behavior. 2. Because legacy code using For:Next is fast. Changing the behaviour will slow it down. Why? At the assembler level you still ...
by Thorham
Jan 29, 2012 6:30
Forum: General
Topic: For next behavior.
Replies: 49
Views: 8058

Re: For next behavior.

You don't use a Ford Festiva to haul a room full of furniture. The use of an 8 bit value for that range is not appropriate to the task. No, it is appropriate simply because all the possible values fit in an unsigned byte. This behavior is a bug, and it should be fixed. The compiler clearly tests fo...
by Thorham
Jan 29, 2012 0:49
Forum: General
Topic: For next behavior.
Replies: 49
Views: 8058

Re: For next behavior.

Driving a car safely requires defensive driving. That means anticipating and checking the things that may affect your progress later. Likewise, FB requires that while you write your program you anticipate the implications of your choice of variable types, algorithms and order of evaluation. No matt...
by Thorham
Jan 27, 2012 16:25
Forum: General
Topic: For next behavior.
Replies: 49
Views: 8058

Re: For next behavior.

Okay, clearly it's bad behavior. The compiler should check the type of the counter variable and use a suitable test condition instead of one that only works for signed values.
by Thorham
Jan 27, 2012 8:19
Forum: General
Topic: For next behavior.
Replies: 49
Views: 8058

For next behavior.

Hi, I've encountered some strange FOR NEXT loop behavior: Dim As UInteger t For t=9 To 0 Step -1 Print t Next Sleep Clearly, this should count from 9 to 0, but instead it continues after 0 and starts counting down from 2^32-1. This doesn't happen when t is a signed integer. Is this a bug or is this ...
by Thorham
Jan 23, 2012 14:59
Forum: Sources, Examples, Tips and Tricks
Topic: Floyd Steinberg dithering
Replies: 12
Views: 6664

Re: Floyd Steinberg dithering

Coolman wrote:the best software for this kind of conversion is IrfanView ...
It shouldn't be that hard to match IrfanView's quality, and the big advantage of writing your own code is that you can add features that IrfanView doesn't have.