POV-Ray : Newsgroups : povray.off-topic : Windows Graphic Programming : Re: Windows Graphic Programming Server Time
5 Sep 2024 11:25:37 EDT (-0400)
  Re: Windows Graphic Programming  
From: Darren New
Date: 30 Jul 2009 16:46:15
Message: <4a720697@news.povray.org>
David H. Burns wrote:
> (My thought about Microsoft and all its current software are *very* 
> uncharitable.)

For example, attached is an old Tcl program that draws fractals on the 
screen then saves them as image files. It should still run. (Drawing pixel 
by pixel in Tcl is very slow, by the way. You're supposed to use 
higher-level objects.)

Also attached is an old OLD Java program[1] which calculates a rather 
complex image (sample attached) based on Conway's game of life, but in so 
doing draws it on the screen. The things to note is that the main class 
inherits from Frame, the update() function (near like 550) and the paint 
function (near line 500). The rest is just figuring out what needs to be 
painted.  I don't know if this one will still run as-is, but it's basically 
the same idea used in most lower-level toolkits.  You create a window, and 
when you get the request to paint the window, you get a "graphics" to paint 
on which has a bunch of methods you can use to change what's displayed.

You can look at
http://www.java2s.com/Code/CSharp/2D-Graphics/Setimageresolutionandpaintit.htm
for drawing with .NET.  The thing to note is again the class inherits from 
"Form", Main() calls Application.Run with a new instance of that form, and 
the form overrides the Paint event to also invoke Form1_Paint. Inside the 
Form1_Paint routine, you get out the Graphics object and invoke methods on 
it for filing rectangles, darwing images, lines, etc whatever else you want. 
It's in the docs. Follow the breadcrumbs backwards for examples of how to do 
all kinds of stuff.

What more do you need?



[1] Hence the ".JAVa" extension. ;-)
-- 
   Darren New, San Diego CA, USA (PST)
   "We'd like you to back-port all the changes in 2.0
    back to version 1.0."
   "We've done that already. We call it 2.0."


Post a reply to this message


Attachments:
Download 'fractal.tcl.txt' (4 KB) Download 'cavern.java.txt' (18 KB) Download 'cave7.gif' (82 KB)

Preview of image 'cave7.gif'
cave7.gif


 

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.