Draw a pixel: Difference between revisions

added ReScript
(Draw a pixel en True BASIC)
(added ReScript)
Line 1,550:
my $ctx = $da.add-draw-handler( &rect-do );
$app.run;</lang>
 
=={{header|ReScript}}==
 
<lang rescript>type document // abstract type for a document object
type context = { mutable fillStyle: string, }
 
@bs.val external doc: document = "document"
 
@bs.send external getElementById: (document, string) => Dom.element = "getElementById"
@bs.send external getContext: (Dom.element, string) => context = "getContext"
 
@bs.send external fillRect: (context, int, int, int, int) => unit = "fillRect"
 
let canvas = getElementById(doc, "my_canvas")
let ctx = getContext(canvas, "2d")
 
ctx.fillStyle = "#F00"
fillRect(ctx, 100, 100, 1, 1)</lang>
 
 
<lang html><!DOCTYPE html>
<html>
<head>
<title>Draw a Pixel</title>
<style rel="stylesheet" type="text/css">
body {
background-color:#777;
}
canvas {
background-color:#888;
margin:60px 120px;
border:1px solid #555;
box-shadow: -1px 2px 6px 1px rgba(0,0,0,0.3);
}
</style>
</head>
<body>
 
<canvas id="my_canvas" width="320" height="240">
No support for HTML5 Canvas.<br />
</canvas>
 
<script type="text/javascript" src="_draw.js"></script>
 
<noscript>
No support for Javascript.<br />
</noscript>
 
</body>
</html></lang>
 
=={{header|REXX}}==