Library
Home arrow Euphoria Dev arrow graphex
graphex simple graphics library for win32lib PDF Print E-mail
graphex.ew is a Euphoria language library for drawing simple double buffered line oriented graphics and images in a win32lib program.
>> with canvas
gcanvas.ew is a graphex based canvas (scrollable object management).
(If you don't see Links on the left and screenshots on the right, please click here )

graphex.ew
The idea behind graphex.ew is to create a 'pseudo control' in a win32lib program which maintains its own double buffered drawing, event handling, and geometry management1.

Synopsis:

integer gfx -- image stored in a 'gfx' sequence
-- assume Window1 created big enough for a 600x400 gfx
gfx = newGfx(Window1, 0, 0, 600, 400)
-- create a gfx in the window
gfx_draw(gfx, GP_ELLIPSE_SOLID, Red, {0, 0, 600, 400})
-- draw a big red solid ellipse the size of the gfx
gfxTextOutAt(gfx, 320, 240, "Euphoria", BrightWhite)

-- write "Euphoria" (near) the middle of the ellipse
-- in the default line font.

Now whatever else you add to the window, the graphic will look after itself. You can either rely on it to display anything else you draw later on, or update the whole thing first and call the drawing routine whenever you like.


gcanvas.ew
The idea behind a graphex canvas is to allow a much larger graphex to be viewed through a smaller "view port" with scroll bars etc. You can attach events to to the canvas, and add a basic dot grid.
Synopsis:
integer canvas,  -- id of canvas to be created
        object1_id, -- id of object 1
        object2_id -- id of object 2
canvas = newGfxCanvas(Window1, 0, 0, 100, 100) -- create a canvas at 0,0 in (win32lib id) Window1 of size 100 x 100 pixels
-- add a 30x30 green gfx rectangle outline at 10, 10
object1_id = gfxCanvasAddObject(canvas, 10, 10, Green, GP_RECT, {10, 10, 40, 40})
-- add a 50x50 blue solid rectangle off the canvas (scroll bars will appear unless suppressed)
object2_id = gfxCanvasAddObject(canvas, 150, 150, Blue, GP_RECT_SOLID, {150, 150, 200, 200})
drawGfxCanvas(canvas) -- make it show
As an extenstion to graphex the documentation is referenced from below and its development will probably remain linked to the graphex system itself.

Documentation

Download
graphex.zip v0.10.5 27-Dec-2006 814,867 bytes changelog

previous version 0.10.0 24-June-2006 78,881 bytes

SCREENSHOT:
Demo #4:
wave form display using the shape system, lines, and font.


1. By "geometry management" I mean, using gfx_draw(...) at {10, 10} always means {10,10} in the image. Coordinates from a mouse event of {10,10} always means {10,10} in the image, etc. Eg in Demo4 above, the three coloured areas are made up of three gfx objects, so drawing the waveforms is much easier. Point it to the starting point and let the gfx_draw(.."shape") draw it.





Reddit!Del.icio.us!Facebook!Slashdot!Netscape!Technorati!StumbleUpon!Newsvine!Furl!Yahoo!Free social bookmarking plugins and extensions for Joomla! websites! title=
 
Comments
Add comments: graphex simple graphics library for...

Enter your comment below:

(required)

(optional)

Your email will not be displayed on the site; only to our administrator.




graphex Screenshots

graphex.ew
Demo #1: Stepwise demonstration of the system and a brief overview of its drawing capabilities.

graphex.ew
Demo #2:
The "shape" pen based system

graphex.ew
Demo #7:
Updated "Asteroids"-type game using images, mouse events, and crude bounding-box collision detection.

Screenshot of Demo 7

gcanvas.ew
Canvas Demo: A simple canvas with random objects and scroll bars.

Canvas demo

Web Search

Newsflash

3D Pinball Simulation
Added a 3D pinball simulation in the Online Games section.  This is a simple pinball layout and game with a vehicular theme.
 
Online 3D Game
My first serious attempt at a 3D game compatible with the blender web plugin. Unfortunately only works on Windows in Internet Explorer. 3D Asteroids is based on the 2D variety of the game, except that it's in 3D and there are no pesky aliens. Also it is a race-against-time game instead of a 'survive as long as you can', because colliding with the asteroids is actually challenging, not a common occurrence. See "Online Games" section on the left.
 
X-plane: Interview with Austin Meyer
X-plane.org interviews Austin Meyer, the creator of X-Plane about Version 9 and the future of X-plane.
 

 

Links


win32lib - the current cornerstone of my interest in Euphoria


Euphoria - the best RAD language I've seen in a long time, and it has been around a long time ... another gem :)


Examples
(bound versions not in archive )

Depending on what kind of security you are running you may or may not be able to run or download these.

demo1-simple src
demo2-shapes src
demo3-asteroid src
source of demo4
demo5-sizing src

 


The name "graphex" is both a play on the word "graphics" and an indication of the "Ex"-ness of the functionality this provides on top of win32lib (eg like createEx, etc)


graphex.ew is released under the same terms as win32lib.
Copyright (c) 2006 Gary Shingles

X-Plane Model

Airborne Carrier