Improve documentation

This commit is contained in:
Elias Batek 2023-12-24 00:01:48 +01:00
parent 0d81bbff41
commit d57ecc9cb9
1 changed files with 12 additions and 8 deletions

View File

@ -160,10 +160,11 @@ import arsd.simpledisplay;
- Minimum window size - Minimum window size
- or something similar - or something similar
- to ensure `Scaling.integer` doesnt break unexpectedly - to ensure `Scaling.integer` doesnt break unexpectedly
- Add my fast&accurate int8 alphaBlending()
- add unittests
- benchmark vs. CPUblit
*/ */
private enum hasTimer = is(Timer == class);
/// ///
alias Pixel = Color; alias Pixel = Color;
@ -179,6 +180,9 @@ alias Point = arsd.color.Point;
// verify assumption(s) // verify assumption(s)
static assert(Pixel.sizeof == uint.sizeof); static assert(Pixel.sizeof == uint.sizeof);
// is the Timer class available on this platform?
private enum hasTimer = is(Timer == class);
/// casts value `v` to type `T` /// casts value `v` to type `T`
auto ref T typeCast(T, S)(auto ref S v) { auto ref T typeCast(T, S)(auto ref S v) {
return cast(T) v; return cast(T) v;
@ -266,13 +270,13 @@ struct PixelBuffer {
return (width * int(Pixel.sizeof)); return (width * int(Pixel.sizeof));
} }
/// Clears the buffers contents (by setting each pixel to the same color) /// Clears the buffers contents (by setting each pixel to the same color)
void clear(Pixel value) { void clear(Pixel value) {
data[] = value; data[] = value;
} }
} }
@safe pure nothrow @nogc { private @safe pure nothrow @nogc {
// keep aspect ratio (contain) // keep aspect ratio (contain)
bool karContainNeedsDownscaling(const Size drawing, const Size canvas) { bool karContainNeedsDownscaling(const Size drawing, const Size canvas) {
@ -361,10 +365,10 @@ enum Scaling {
keepAspectRatio = contain, /// keepAspectRatio = contain, ///
// CSS `object-fit` style aliases // CSS `object-fit` style aliases
cssNone = none, /// cssNone = none, /// equivalent CSS: `object-fit: none;`
cssContain = contain, /// cssContain = contain, /// equivalent CSS: `object-fit: contain;`
cssFill = stretch, /// cssFill = stretch, /// equivalent CSS: `object-fit: fill;`
cssCover = cover, /// cssCover = cover, /// equivalent CSS: `object-fit: cover;`
} }
/// ///