* graphical output with claw
@ 2005-04-19 19:45 Duke Luke
2005-04-19 21:29 ` tmoran
0 siblings, 1 reply; 2+ messages in thread
From: Duke Luke @ 2005-04-19 19:45 UTC (permalink / raw)
Hello!
Can somebody show me an example program with claw that draws just one
pixel in a defined color into a window?
The example programs that come with claw are quite complicated and I
don't really understand them. Especially I didn't find a procedure
that draws one pixel on a canvas - they draw poly-lines and such
"high-level" things, but those are useless for my application.
greetings,
Lukas K�nig
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: graphical output with claw
2005-04-19 19:45 graphical output with claw Duke Luke
@ 2005-04-19 21:29 ` tmoran
0 siblings, 0 replies; 2+ messages in thread
From: tmoran @ 2005-04-19 21:29 UTC (permalink / raw)
>Can somebody show me an example program with claw that draws just one
>pixel in a defined color into a window?
How about 50 pixels (a single pixel is hard to see)
with Claw,
Claw.Basic_Window,
Claw.Canvas;
package Pixels is
type Window_Type is new Claw.Basic_Window.Basic_Window_Type with private;
-- an open window of this type shows a cloud of random red dots
procedure Open(Window : in out Window_Type;
Title : in String);
private
type Window_Type is new Claw.Basic_Window.Basic_Window_Type with record
Is_Active : Boolean := False;
end record;
procedure When_Draw(Window : in out Window_Type;
Easel : in out Claw.Canvas.Basic_Canvas_Type'Class;
Erase_Background : in Boolean;
Area : in Claw.Rectangle_Type);
end Pixels;
-----------------
with Ada.Numerics.Float_Random,
Claw.Bitmaps;
package body Pixels is
Gen : Ada.Numerics.Float_Random.Generator;
procedure Open(Window : in out Window_Type;
Title : in String) is
begin
Create(Window, Title);
Show(Window, Claw.Codes.Show_Startup);
Window.Is_Active := True;
Update(Window);
end Open;
procedure When_Draw(Window : in out Window_Type;
Easel : in out Claw.Canvas.Basic_Canvas_Type'Class;
Erase_Background : in Boolean;
Area : in Claw.Rectangle_Type) is
use Ada.Numerics.Float_Random;
begin
if Window.Is_Active then
for i in 1 .. 50 loop
Claw.Bitmaps.Set_Pixel(Easel,
(X=>Claw.Int(10.0+40.0*Random(Gen)),
Y=>Claw.Int(10.0+20.0*Random(Gen))),
Claw.Colors.RGB(Red=>255,Blue=>0,Green=>0));
end loop;
end if;
end When_Draw;
end Pixels;
-----------------
with Claw,
Pixels;
procedure Showdots is
A_Window : Pixels.Window_Type;
begin
Pixels.Open(A_Window,"Simple Example");
delay 10.0;
end Showdots;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-04-19 21:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-19 19:45 graphical output with claw Duke Luke
2005-04-19 21:29 ` tmoran
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox