11 releases (2 stable)

2.0.1 Jul 19, 2023
2.0.0 Jul 1, 2023
1.6.0-dev Jun 4, 2023
0.7.4 Feb 19, 2023
0.4.0 Dec 22, 2022

#227 in Math

Download history 3/week @ 2024-02-21 3/week @ 2024-02-28 2/week @ 2024-03-13 17/week @ 2024-03-27 34/week @ 2024-04-03

51 downloads per month
Used in lexsdl

Zlib license

285KB
7.5K SLoC

C 6K SLoC // 0.1% comments Rust 1K SLoC // 0.1% comments C++ 142 SLoC // 0.0% comments

LexLib

aLexevier's Library
is a C/Rust library with miscellaneous things that the C stdlib is missing and some other things that can be useful.

also works on C++ without hassle.

features

  • os abstractions for linux and windows.
  • image manipulation.
  • color manipulation.
  • raw C strings manipulation.
  • simd vector math.
  • small math things.
  • timing.
  • vector (growable array).

Rust

for C functions that have a equivalent or better options in the Rust stdlib are not expected to be wrapped around a safe interface.

right now a rust compiler is not necessary but in the future it might.

some features (like vector math) are not available yet in the rust side.

Documentation

C: in the header files.

Rust: https://docs.rs/lexlib/latest/lexlib/

Dependencies

  • libc
  • win32api (kernel32)

License

Licensed under the zlib license.

Changelog

2.0.1

  • fix LEXLIB_VEC2I/3I_ZERO.
  • fix cfile mode in windows.
  • LexlibVec(T).
  • lexlibStrNew().

2.0.0

  • changed license to zlib.
  • rust bindings and wrappers.
  • gray_scale with alpha support.
  • structs are not typedef'd anymore.
  • SIMD support.
  • reworked Vec4 math.
  • reworked image loading.
  • LexlibColorFlt -> LexlibColorF.
  • LexlibImage.depth -> LexlibImage.bpc.
  • lexlibImagePixelGet() -> lexlibImagePixel().
  • lexlibImagePixel16Get() -> lexlibImagePixel16().
  • lexlibMillis() -> lexlibTimeMillis().
  • lexlibSeconds() -> lexlibTimeSeconds().
  • lexlibStrcat() -> lexlibStrCat().
  • added typedef.h.
  • added vec.h (growable array).
  • removed path.
  • removed aabb.
  • removed LexlibBytes.
  • removed lexlibFileToString().
  • removed lexlibStringToFile().
  • removed lexlibFileBytes().
  • removed lexlibPrintTimed().
  • removed lexlibVersion().
  • removed LEXLIB_UNREACHABLE.
  • LexlibBool.
  • lexlibStrFile().
  • LEXLIB_STRING().
  • lexlibCFileMap().
  • lexlibCFileMode().
  • lexlibCFileSize().
  • lexlibCFileType().
  • lexlibColorGrayAlpha().
  • lexlibTimeNanos().
  • lexlibTimeMicros().
  • lexlibThrdNanos().
  • lexlibThrdMicros().
  • lexlibThrdMillis().
  • lexlibThrdSeconds().
  • lexlibProcNanos().
  • lexlibProcMicros().
  • lexlibProcMillis().
  • lexlibProcSeconds().
  • lexlibTimerAdd().
  • LEXLIB_CLAMP().
  • lexlibRad().
  • lexlibDeg():
  • lexlibFloatCmp().
  • lexlibMemUnmap().
  • lexlibMemReverse16().
  • lexlibMemReverse32().
  • lexlibMemReverse64().
  • lexlibImageCopy().
  • lexlibImageFillArea().
  • lexlibImageLoadBmpMem().
  • lexlibVecNew().
  • lexlibVecDelete().
  • lexlibVecGet().
  • lexlibVecPush().
  • lexlibVecPop().
  • lexlibVecInsert().
  • lexlibVecRemove().
  • lexlibVecResize().
  • lexlibVecFind().
  • lexlibVecSwap().
  • lexlibVecClear().
  • lexlibVecLen().
  • lexlibVecCap().

1.5.0

  • lexlibFileBytes();
  • lexlibPowu();
  • lexlibColor16Blend();
  • lexlibImagePixelSet();
  • lexlibImagePixelGet();
  • lexlibImagePixel16Set();
  • lexlibImagePixel16Get();
  • lexlibImageProfileChange();
  • lexlibImageLoadBmp();
  • lexlibImageSaveBmp();
  • lexlibImageSaveBmpEx();
  • LexlibImage.data is officially native to the machine endianness.
  • fixed strPath buffer overflows.
  • fixed imageFlip X buffer overflow.
  • fixed linkedList memleaks.

1.4.0

  • function lexlibStrCopy().
  • removed path.h from default includes.
  • renamed LEXLIB_C_EXTERN to LEXLIB_EXTERN.
  • functions lexlibClamp().
  • struct LexlibColor8.
  • struct LexlibColor16.
  • struct LexlibColorFtl.
  • functions lexlibColorBlend().
  • functions lexlibColorGray().
  • functions lexlibColorPremultiply().
  • functions lexlibColorTo8().
  • functions lexlibColorTo16().
  • functions lexlibColorToFlt().
  • function lexlibColorFltClamp().

1.3.1

  • deprecation attribute.
  • removed PKGBUILD from package.
  • fixed a scope problem with clang.

1.3.0

  • LexlibImage.
  • support for loading and saving pngs.
  • lexlibStrPath.
  • LexlibPath is deprecated in favor of lexlibStrPath.
  • changed all _Bool for uint8_t.

1.2.0

  • lexlibRandom(), gets a secure random number.

For the full Changelog check CHANGELOG.md at the project root.

Dependencies

~230KB