Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import -> new_module_from(STD_GRAPHICS_DRIVER::DIRECT_WRITE_BUFFER) as gfx
- put_pixel_safe(h:hex, x:float, y:float) -> int! @ALWATS -> true # @_ERROR_ENCOUNTER defer return 1
- {
- bounds:map<float,float> = cast(map<float,float>)->gfx::WindowBorder<x,'width>.conjoinedWith(gfx::WindowBorder<y,'height>);
- defer delete(bounds);
- if(x -> bounds->bounds<x>::fitsAsPart(x, bounds, bounds->bounds<x>)) {
- if(y -> bounds->bounds<y>::fitsAsPart(y, bounds, bounds->bounds<y>)) {
- defer return 0;
- (gfx -> PIXL_POS_X -> bounds -> x) ?set;
- (gfx -> PIXL_POS_Y -> bounds -> y) ?set;
- with (gfx -> GDrawEffects::asColor(h:hex)->PUTCOLOR( @x | @y )) as putcolor_at(h:hex,x:float,y:float);
- defer (un_glue_s(*gfx::&gfx -> #GDrawEffects, de_macro_s('gfx, ALL_WITH_STATEMENTS)));
- #init_gfx_memdriver $ putcolor_at(h , PIXL_POS_X , PIXL_POS_Y ) -> catch(e:Error)$set_error(e:Error);
- #test_gfx_memdriver $ putcolor_at(gfx::colorInvert(h), PIXL_POS_Y , PIXL_POS_X ) -> catch(e:Error)$set_error(e:Error);
- #test_gfx_memdriver $ putcolor_at(h , @PIXL_POS_X /2, @PIXL_POS_Y /2) -> catch(e:Error)$set_error(e:Error);
- #test_gfx_memdriver $ putcolor_at(gfx::colorInvert(h), @PIXL_POS_Y /2, @PIXL_POS_X /2) -> catch(e:Error)$set_error(e:Error);
- #test_gfx_memdriver $ putcolor_at(h , @PIXL_POS_X , @PIXL_POS_Y ) -> catch(e:Error)$set_error(e:Error);
- putcolor_at(gfx::colorInvert(h), @PIXL_POS_Y , @PIXL_POS_X ) -> catch(e:Error)$set_error(e:Error);
- }
- }
- }
- main(void) -> void
- {
- gfx->safe_callmem_s(bh:BufferHandler, FrameBuffer::new() -> window());
- window:Buffer = gfx::makeBuffer(bh -> pid, bh -> write_direct(true));
- gfx::moveBuffer(window, GFX_WINDOW);
- put_pixel(0xF00, 275, 200);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement