[Oberon] How to combine raster image and text in Pictures.Picture of ETHOberon
Dieter
d.gloetzel at web.de
Thu Oct 11 17:18:03 CEST 2018
Good afternoon!
I am trying to combine raster image and text in a Pictures.Picture.
I can write something into the picture with "Display3.String", but I
cannot store it in the Picture.
I would need some PROCEDURE like "Pictures.String", if it existed.
Here is the code (ETHOberon on Windows)
===========================================================
MODULE PictText;
(* How to write text in a Pictures.Picture *)
IMPORT Oberon, Texts, Out, Display, Display3, Pictures, Fonts, Files;
VAR P : Pictures.Picture;
PROCEDURE plot*;
VAR x,y,xmax,ymax : INTEGER; fnt : Fonts.Font; mask : Display3.Mask; fP
: Files.File; len, pos : LONGINT;
BEGIN
xmax := 1016; ymax := 533;
NEW(mask); Display3.Open(mask);
Display3.Add(mask,0,0,xmax,ymax);
NEW(P); Pictures.Create(P, xmax,ymax,8);
FOR y := 0 TO ymax - 1 DO (* jpg bereinigen *)
FOR x := 0 TO xmax - 1 DO Pictures.Dot(P, x * y MOD 256,
x, y, Display.replace ) END
END;
Pictures.DisplayBlock( P, 0, 0, xmax, ymax, 180, 20,
Display.replace );
fnt := Fonts.This( "Syntax14.Scn.Fnt" );
Display3.String( mask, 15, 500, 250, fnt, "This is
Text!!!!!", Display.filled );
(* Pictures.Update(P,0,0,1016,533); has no effect.
Pictures.DisplayBlock( P, 0, 0, xmax, ymax, 180, 20,
Display.replace ); *)
fP := Files.New("textwrite.Pict");
len := Pictures.Address( P ); Out.Int( len, 10 );
pos := 0; Pictures.Store( P, fP, pos, len ); Files.Register( fP );
Files.Close( fP );
END plot;
BEGIN
END PictText.plot
System.Free PictText ~
===============================================
Regards Dieter
____________________________________
Dr. Dieter Glötzel
More information about the Oberon
mailing list