Commit graph

388 commits

Author SHA1 Message Date
Gered 80d3ae91e7 use bitmap sampling method instead of manually calculating it 2023-04-01 00:50:56 -04:00
Gered ed58dc39cd add Bitmap texture coordinate sampling convenience method
his has some off-by-one issues ... ? looks like it mostly works fine,
but i need to investigate more
2023-04-01 00:49:52 -04:00
Gered a106228517 sample in the middle of pixels, instead of the top-left 2023-04-01 00:40:05 -04:00
Gered 832daefbda add initial triangle_2d_textured method 2023-03-31 23:27:15 -04:00
Gered 69bb0c4830 this should be a mutable reference argument
to be honest, i'm not sure how this compiled successfully before, since
the value being passed in via Bitmap::triangle_2d_custom is clearly of
type `&mut PixelType` ... ? either way, this is now written consistently
and we get to remove an unnecessary unsafe block
2023-03-31 22:16:32 -04:00
Gered 4fcb6a9f0f add basic triangle_2d rendering criterion benchmark
just so i have it here for when i try to implement optimizations (again)
2023-03-31 22:11:37 -04:00
Gered 2b4c4d91dc fix broken criterion benchmarks 2023-03-31 22:10:42 -04:00
Gered ff9960d325 add basic 2d triangle rendering
only solid color support so far. and using an un-optimized algorithm
2023-03-31 22:01:02 -04:00
Gered ad1dbee5fd add RgbaBitmap::from_bytes with some limited pixel format support 2023-03-30 17:56:40 -04:00
Gered 1815a2236c update examples and doc comments code to reflect recent changes 2023-03-29 15:50:30 -04:00
Gered cfd7d479ec add variable_screen_size example project
not a super exciting project. might be removed later on when i
eventually get to adding more exciting examples
2023-03-29 15:43:58 -04:00
Gered f2f1d83edf update Standard system resource with variable screen size support 2023-03-29 15:40:37 -04:00
Gered 7143430769 update DosLike system resource with variable screen size support
also re-did DosLikeConfig at the same time, making usage a bit clearer
2023-03-29 15:38:39 -04:00
Gered e18238405c
add actions workflow to do cargo check and test
not sure if this will work. first time trying github actions and this is entirely based on what github suggested for this action.
2023-03-28 21:03:09 -04:00
Gered 7f19f4e7d4 fix a bunch of clippy warnings
but not all of them. just the easy ones for now!
2023-03-28 16:29:44 -04:00
Gered aa22786d43 update dependencies 2023-03-28 14:04:48 -04:00
Gered 6973d5e039 add rustfmt.toml to the project root
rather than just relying on $HOME/.rustfmt.toml ...
2023-03-27 18:46:33 -04:00
Gered ceaefad030 lets try using rustfmt again ...
i unfortunately feel like i should really force myself to use rustfmt
even though i very much dislike it. most rust developers seem to use it
so i should probably get used to it ...

however, case-in-point for me is the amount of times i used either
#[rustfmt::skip] or adding a blank `//` comment to force separate
lines, etc, really proves how terrible basing almost all of your
formatting rules on arbitrary length thresholds really is. code
formatting is far more subjective than that.
2023-03-27 18:43:41 -04:00
Gered 36c4cc1a41 remove these two unneeded extern crate lines
i'm going to guess this was added early on automatically by clion
and i just never caught it. they'd been here since the project was
first committed to a git repo. oh well.
2023-03-27 16:59:55 -04:00
Gered e503cfb718 remove old display size constants as well as cargo feature flags
we'll be introducing variable display size features next, so these
screen dimension compile-time constants are not going to be useful.

the "low_res" and "wide" features were also tied to the idea of
compile-time constants for display sizing so these need to go too,
and will be brought back via runtime configuration
2023-03-27 16:58:37 -04:00
Gered 806725654a fix lingering compile errors in the example projects 2023-03-27 16:46:04 -04:00
Gered e4608dee82 add visual tests for RgbaBitmap color tinted blit methods 2023-03-26 18:34:58 -04:00
Gered cf021aa1de add RgbaBitmap color tinted blit methods
BlendFunction has a tinted blend that is similar, but it is also
useful to be able to color tint without blending
2023-03-26 18:34:18 -04:00
Gered 7209907193 change to a better tint color used in visual test
figure it is best to use a color that contains all different and
non-zero RGB components
2023-03-26 17:59:42 -04:00
Gered b94ef4df4e add visual tests for BlendFunction blending 2023-03-26 17:45:22 -04:00
Gered d2bc28754f add visual tests for RgbaBitmap blended drawing primitives 2023-03-26 16:57:22 -04:00
Gered f233f810e6 add RgbaBitmap blended drawing primitives 2023-03-26 16:36:53 -04:00
Gered 5c2571755a update blended_pixel_drawing visual test to test an unchecked method too 2023-03-26 16:29:55 -04:00
Gered d238031166 update blended_rect visual test to reflect bug fix
the previous commit fixed a minor 1-pixel-off issue related to
clipping
2023-03-26 16:29:07 -04:00
Gered 3864f36706 update IndexedBitmap blended primitives to use new generic functions 2023-03-26 16:27:14 -04:00
Gered a667a657d2 add generic primitive drawing methods accepting custom pixel functions 2023-03-26 16:26:15 -04:00
Gered 847149607d some cleanups and fixes 2023-03-26 13:49:16 -04:00
Gered 48a76a59e0 add visual tests for the new blending RgbaBitmap blit methods
note that we're not testing all of the different blend combinations
for each blit method. specific BlendFunction visual tests will be added
2023-03-26 13:15:56 -04:00
Gered 0345571851 reorder blit method enums in a different and still arbitrary order 2023-03-26 12:37:54 -04:00
Gered b38a4b55bc add RgbaBitmap blending blit methods 2023-03-25 19:09:01 -04:00
Gered 050c2ac6e9 add color blending and tinting functions
this is definitely one of those things where i wonder if there are
probably better names (more standardized names) that could be used
here instead
2023-03-25 19:08:20 -04:00
Gered a087c35024 add pixel format option to RgbaBitmap png saving 2023-03-24 20:11:08 -04:00
Gered 29ab739323 update IndexedBitmap graphics visual tests to match the rgb tests 2023-03-21 21:20:35 -04:00
Gered 9dcfa91502 add graphics visual tests for RgbaBitmap drawing operations
obviously only for the operations implemented so far. there are going
to be more in the near future.
2023-03-21 21:19:37 -04:00
Gered bb4a3655dc update graphics visual test references images that used the vga palette
necessary after the previous change fixing the 6-bit to 8-bit
conversion
2023-03-21 18:21:26 -04:00
Gered 1f232c51bb fix 6-bit to 8-bit palette conversion
this now produces "full range" results, e.g. VGA color 15 (bright white)
now converts to 255,255,255 instead of 252,252,252.
2023-03-21 18:20:36 -04:00
Gered ba75ae04f1 set default pixel color for new Bitmap's differently based on type
this is mainly to prevent RgbaBitmap's from being initialized by
default to all black with alpha=0. this can still be manually done if
desired, but the assumption is that most of the time you'd want
alpha=255.

for the most part this doesn't matter one way or the other except when
we get to blending (not yet done for RgbaBitmaps, but coming soon) and
saving RgbaBitmap's to PNG files where it becomes blatantly obvious
when you have a bitmap with all/mostly alpha=0 pixels!
2023-03-21 16:55:57 -04:00
Gered 6a0be2756a add some useful rgba color constants
copied from the default VGA/EGA palette
2023-03-21 16:53:00 -04:00
Gered ec437974ee add RgbaBitmap::load_file 2023-03-21 15:40:31 -04:00
Gered 04f57cf8da convert graphics visual tests reference images to png
this just makes it a lot easier to open up in whatever graphics tool
is available during development
2023-03-21 15:25:25 -04:00
Gered b6e69ca084 allow png files to be loaded via IndexedBitmap::load_file 2023-03-21 15:23:47 -04:00
Gered 6829800caa organize test assets a little bit better 2023-03-21 15:09:47 -04:00
Gered 3d9d97db08 rename to avoid compiler warning
for now until we later fully implement this function and use these
arguments
2023-03-20 22:19:14 -04:00
Gered 11625f58a5 add png save tests 2023-03-20 22:18:15 -04:00
Gered a5c8af67ad set alpha component consistently with other colours during palette read
when reading palette files/streams, we set up the colour entries
using helper functions that automatically set an alpha component of 255.
however, we were first initializing the palette with 0 (alpha component
of 0 too).

this meant that if a palette of less than 256 colours was loaded, the
remaining entries (since Palette is always sized for 256 colours), were
black (0,0,0) with alpha components of 0.

this change makes all palette entries have a consistent alpha value
(which is never really used anyway ...) when loaded.
2023-03-20 22:18:02 -04:00