CapeSoft.Com
Clarion Accessories
Draw
Documentation
DrawTutorials
CapeSoft Logo

CapeSoft DrawTutorials
Documentation

Installed Version Latest Version  

Introduction

This section of the Draw documentation covers the examples that ship with Draw, along with tutorials and "JumpStart" guides, which are aimed at getting you started as quickly and simply as possible.

Examples and Walkthroughs

Demo Draw 2.10 ships with a new Demo application that is a great place to get a feel for some of the things that are possible to do quite simply using Draw. This application demonstrates all the basic functions in Draw as well as some neat effects like drop shadows, pie slices, shaded bars etc.
Draw LayersThe new Draw example application that ships with Draw 2.00 and later. Allows you to Draw to an image control and shows off a few of Draw's layer features.
DrawImageUses the DrawImage methods provided by Draw to demonstrate loading an saving many different file formats (JPEG, PNG, BMP etc.) as well as various image manipulating options provided.
DrawPaintDrawPaint is a powerful additional class provide by Draw, which extends Draw and provides the ability for the user to manipulate the objects on Draw control. This provides persistent objects (boxes, text, pictures and so on) that can be selected dragged, moved, modified, deleted and added to by the user.
DrawAlphaThis demonstrates using Alpha Layers in Draw to provide "soft" transparency effects quickly and simply. If you are familiar with Layers Masks in Photoshop, you will be right at home with Draw!
PatternA simple application that allows you to build patterns for use with Draw's built in support for pattern based fills.
3DMapAn application that demonstrates Draw creating a 3D map from polygons in wireframe, or shaded, and allowing the map to be rotated and manipulated in real-time.

Notes on Getting Started

Unlike the Clarion drawing functions, the Draw control does not display the result as each function is called, you need to call the Draw.Display() method to update the Draw control. Before drawing, you can call the Blank method to erase everything on the Draw control, or simply draw over the existing image. This allows you to do real-time animation, simply by calling all the drawing commands before calling Display to update the control, and Blank between each frame of the animation. Note that Blank does not take effect until Display is called

Like the Clarion image control, the origin of the Draw control is the top left corner and is (1,1). See the image below.


A typical usage of the Draw methods would be:

!--- Call draw methods and call Display() to display the result
Drawer.Blank()            ! Blanks image control
Drawer.
SetPenColor(COLOR:Red)
Drawer.
Ellipse(1, 1, Drawer.width, Drawer.height, COLOR:Green)
Drawer.
Display()        ! Redraws image control with new contents

This would display an ellipse with red line and a green fill that is the width and height of the Draw control.

You can draw to any image control on a window or a report, however when drawing to a report, you need to call the Clarion SetTarget(Report) function before calling any Draw methods. You can call SetTarget() with no parameters to make the current topmost window the current target. See the section on Using Draw on a Report

There are a number of examples in your \Clarion\3rdParty\Examples\Draw directory. The examples are a great way to get started and see a few of the ways you can use CapeSoft Draw. Draw ships with the following examples:

JumpStart

Keen to get started? Or just don't like wading through all the documentation? This section is just for you - the basics on how to get Draw working as quickly and simply as possible.

This jump start will show you how to place a Draw control on a window and draw a red rectangle into the control. The completed app is in the /3rdparty/examples/Draw/JumpStart/ directory in you Clarion directory (QuickDraw.app is the ABC version and QuickLegacy is the Legacy version).

Draw basic jump start


Useful Information