📜 ⬆️ ⬇️

Omegicus Digest: Antialiasing Fonts and Encryption and Compression Library

Good day! At the moment, I am completing the alpha version of my OS ( tyts ), which will be - it will be, then there is no possibility and time to do it further, but I’ll bring it to some state, which I will inform in a separate post.

In principle, in my code description one way or another, everything revolves around the axis, i.e. OS. Sometimes it is spat out into separate micro-projects, which I will now tell you about.

The first thing is font smoothing (antialiasing).


My fonts go raster, 8x8. Why not otherwise, just like that. Since glamor is a necessary thing, I wanted to smooth out the font output a bit. But, as usual, I would not be me if the anti-aliasing code turned out to be very large or consuming a lot of memory. By this, I decided to just see what the smoothed letter looks like and reproduce it. Speech, by the way, is not about subpixel smoothing, but about simple - i.e. anti-aliasing.

So, how it is made at me.
')
When displaying a character, we go through every bit and output correspondingly. pixel We are joining this process from the second line above (we skip the first one). We process not a single pixel, but a group of four (current, right, top, and right-top). Those. we process a square of four pixels.

The resulting "matrix" is transferred to the processing procedure and already, depending on the resulting combination, it changes the color of each of these pixels. I note that not all combinations are processed, only 6 is enough. In the second picture (ie, the one on the right), all the processed combinations are visible (these are generally available combinations, and not specifically for the letter S). If the matrix is ​​the desired one, change the black (i.e., active) pixels to dark gray, and the transparent ones (white, inactive) to light gray.
If the matrix is ​​not among the 6 required, we don’t touch anything at all in it. The colors (black, gray, etc.) are only for the test, of course, the transparent pixel must be taken from the screen, and the “gray” ones are the degree of translucency.

image

And so each pixel is a string. The next line is processed the same way, i.e. Each row (except for the 1st) is processed twice - as the current row and as the row above in the matrix.
But here, in fact, the result. For me - very good minimum resources and effort.

image

Code and compiled example program here .

The second thing is a ready-to-use sourcebook for encryption and compression.


He is here . Actually, everything is clear - the source codes for encryption (GOST (both), RC4, VMPC, RC6, AES, Serpent, Blowfish), hashing (CRC32 \ 64, MD5, GOST (both)) and data compression (LZMA , LZW, LZO).

How to use a cryptographic set is on a githaba and in an example ( test.exe , its source code in the same place).

... and here is how to use compression:


Item number three is my little WinKAR archiver. Based on the above “library”. Corresponding can compress with LZMA (almost 7zip), LZW and LZO. LZW is just for beauty here, because there is no sense in it, although in theory it should have been a compromise between LZMA and LZO.

You can also use encryption in the archiver if a password is specified. For each file in the archive, you can use either your own compression method or your own encryption method (and password).

You can download it here or here . By the way, the archiver weighs 38 kilobytes without any packers.

I did more for myself, so I apologize for the awkward interface.

Source: https://habr.com/ru/post/324946/


All Articles