Re: Embedding Graphics.
------ =_NextPart_000_01BD5BCC.86CA41E0
Content-Transfer-Encoding: quoted-printable
> I want tamper-proof graphics for my programs
I've been musing about this, as well. It might be nice if someone would =
write a routine that would convert a list of bytes into text format that =
would be easy to place into programs by including the file - something =
along the lines of what UUE does.
Win32 programs typically expect bitmaps will be in a resource file - =
something not typically available to dynamically created Win32 Euphoria =
programs.
For example, you could have a series of number such as:
{ 0, 1, 2, 3, 4 }
and convert it to something like:
"01234"
To convert a byte to it's value, you would just subtract the ASCII '0' =
from it. If you limited the character set to '0'..'z', you could fit the =
range of bytes into 3 groups: { 0-85, 86-170, 171-255 }.=20
The '+' character could be used to denote that the next byte's value =
should have 85 added on to it, and the '*' character indicates the next =
byte would need 170 added to it.=20
Obviously, the '\' character would need to be translated into '\\' in =
the string.
Even with an average of 2 characters per byte, it seems that storing the =
data in the program in something like:
Bitmap1 =3D uncompress(
"H+lj+sd+sdfjhs+ghsdJ" &
"T+yu+w+7hj+s+fjb+sd8" &
"sdfjkh8jJKiutmbSIUDg" )
is more space efficient than:
Bitmap1 =3D
{ 32, 88, 213, 23, 123, ... }
If you added a compression flag that marked that the following byte was =
to be repeated n times, you might get even better efficiency. Something =
along the lines of:
<flag><repetition><byte>
So if '%' marked the repetition flag,=20
"%87"
would say that eight bytes of value 7 followed.
As it stands, the scheme is fairly tamper-proof from the casual =
observer.
Any takers?
-- David Cuny
------ =_NextPart_000_01BD5BCC.86CA41E0
|
Not Categorized, Please Help
|
|