Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / Powerbasic

ArtStamper3D for All in One

0.00/5 (No votes)
4 Sep 2013CPOL7 min read 8.5K  
Draw pictures using much simpler means, including the good old fashioned Stamping technique.

This article is an entry in our AppInnovation Contest. Articles in this sub-section are not required to be full articles so care should be taken when voting.

Create Art in a different way

Most people don't consider themselves artists, so why not create an art drawing program which does things a bit differently. Rather than the typical art software which emulates drawing on paper, why not create an application which allows you to express your artistic side, but without the need for any talent at all.

ArtStamper is an application which would be designed for the All in One PC for the Entertainment category which would allow you to draw pictures using much simpler means, including the good old fashioned Stamping technique. Yes, you can select a predefined background image and then stamp predrawn objects any where you like, to build a complete picture. This would be welled suited to younger children, but even adults would enjoy this application.

The application would also provide more advanced means of drawing, including those often found in normal drawing programs. This application would lend itself to a drag and drop design, well suited to a touch based PC. It could even be used for more practical purposes for design and layout by adults. Imagine mom and dad using the application to layout the landscaping for the house. Dad could even use it for work to lay out the new offices.

What will make this software different ?

The application will also include animation capabilities. Objects (stamps) need not be fixed images, but can also support frame animation. Your pictures can come alive. How about overlaying real 3D objects right on top of the picture ? The goal of this software would be to push the limits of art and design, but while still making it so easy to do that even a small child can produce exciting pictures and animations.

The real difference of this software

The real difference in this software is how it would be developed and its unique ability to run on minimal hardware, with a minimal footprint. While the All in One PC used in this contest will have some powerful hardware behind it, imagine what could be done with future "lite weight" All in One PC's, which run using the Intel Atom based SOC's (system on a chip) ! Imagine a graphic application which could easily perform just as well on an Atom CPU/GPU with only 2 gigabytes of memory and with so small a footprint that a much smaller SDD (Solid State Drive) can be used !

The goal of this software would be "fast and fluid", even on minimal hardware.

The development tools to be used

The software would be created using the PowerBasic native code 32 bit compiler for Windows. PowerBasic is specifically designed for building fast and small applications for Intel based Windows computers. Powerbasic is one of the few modern day compilers which was written in assembler, for fast compile speeds. Fast compile speed is important for faster development using a more agile approach. Executables created with Powerbasic do not require any runtimes, no dot.net framework and only use the WIN32 API's

The biggest challenge for such a project is all the low level graphics and the need for a RAD development system. This would be handled by using the EZGUI 5.0 Professional development system. This tool is a GUI framework specifically designed for use with the PowerBasic compiler and itself was written in PowerBasic. The GUI engine comes as a couple small DLL's. The core runtime DLL is only about 700 Kilobytes in size and the 3D graphic control is a DLL which is about 225 kilobytes in size. No DirectX is used by the framework, but instead if uses the WIN32 GDI and uses OpenGL 2.0 for 3D animation.

The author of this article is also the developer of this GUI framework so he will have written all the code in the application, even though a external GUI framework is being used.

So what does this development system provide which would make this application not only possible, but also capable of being built in a short time ?

The core of the application will be graphics, so two custom controls in the application would be used for most of the user interface. The first is the frameworks Canvas control. This control provides a unique basis for development. It supports double buffers for working with two buffers per image. The buffers can be defined as DDB's (device dependent bitmap) for faster display or as DIB's (device independent bitmap) for more low level control. The DIB engine allows low level access to all the pixels without calling any GDI functions. By using low level pointers direct access to pixels allow more choices in building a draw engine.

The Canvas control also has a 2D proprietary Sprite engine built in, so 2D sprites can be moved/shown/hidden , animated (frame animation), flipped and even antialiased and alphablended. The sprite engine can animate hundreds of sprites with decent frame rates even on minimal hardware and without the need for DirectX.

Image 1

The framework also has a graphic engine for drawing a variety of typical graphic elements, including bitmaps, icons, imagelists, richtext, gradients, text, shapes and more. There is also an effects engine in the Canvas control so the drawing commands can draw on an effects buffer first and then be alphablended and antialiased to the Canvas.

To add real 3D animation, the software would use the glCanvas control instead of the normal Canvas control. The glCanvas control is based on OpenGL 2.0 and has its own 3D scripting language built in. This control is quite unique in that it is a hybrid control, based on the 2D Canvas control. It does everything the 2D Canvas does, plus it adds a 3D layer on top for displaying 3D objects. The 3D engine supports the STL file format for high polygon count 3D models, typically used in 3D printing. It also supports a variety of 3D primitives.

Image 2

The GUI framework also has a Turtle Graphics engine for defining vector based images, using an easy to use Turtle Graphics scripting language. Children especially will enjoy designing their own Turtle Graphic objects which can then be used in any drawing they do with the application.

The Turtle Graphics scripting language can be exposed to the end user for defining your own Turtle Graphic vector images). The scripts are easy to define like this:

VB
CASE 0
    ' Draw Lines
    D$="V1,602,322;"
    D$=D$+"U0;F0;P3;M10,10;L590,10;P10;W30;M20,40;L580,40;W4;P5;M10,70;L100,90,90,4;"
    D$=D$+"P6;M220,70;W20;L100,150,120,3;P1;W15;M320,70;L40,90,45,8;"
    D$=D$+"P3;W12;M500,100;L40,180,60,6;P1;W15;M10,210;L110,310;M110,210;L10,310;"
    D$=D$+"P9;W50;M200,210;L570,290;P13;L200,250;P14;L400,290;"
    D$=D$+"P2;W15;M530,200;L45,180,30,12,2;W3;M50,47;P1;L20,45,90,36,1;"
CASE 1
    ' DRAW CIRCLES
    D$="V1,602,322;"
    D$=D$+"U0;P1;F0;B4;W8;M10,10;E300,200,0;H13;M50,50;P2;W3;E300,200;H0;P2;M340,10;B14;W15;E100,100;"
    D$=D$+"H3;P2;W1;M360,130;B10;E80,120;H0;W5;P1;B3;M10,210;E400,100,4;M450,30;E121,121,7;"
    D$=D$+"M480,200;E100,100,17;M495,215;E70,70,12;W3;B15;M503,220;E15,15;M543,220;E15,15;"
    D$=D$+"X1;M530,45;P1;B5;E120,80;P2;B16;E60,40;"
CASE 2
    ' Draw Rectangles
    D$="V1,602,322;"
    D$=D$+"U0;P1;F0;B4;W4;M10,10;R300,200;H13;M50,50;P2;W3;R300,200;H0;P6;M400,10;B3;W15;R100,100,10,10;"
    D$=D$+"H3;P2;W1;M400,130;B10;R80,120;H0;W2;P1;B15;M10,270;R500,45,100,20;"
CASE 3
    ' Draw Scalable Text
    D$="V1,602,322;"
    D$=D$+"P1;C0,0,128;P2;C200,200,255;G1,2,1;P1;C255,255,255;"
    ' fonts supported are:
    ' Arial
    ' Courier New
    ' Times New Roman
    ' The R macro draws the text last defined by the T macro
    ' instead of a rectangle
    ' EZGUI will center the text within the rectangle
    D$=D$+"M30,30;TTimes New Roman,BI|Hello There!;R542,266;"

Image 3

Graphic Libraries

An application like this also should come with some kind of graphic library of predefined images and stamps. Both my wife and I have artistic capabilities and we have a good set of graphic art development programs for quickly creating unique art content for use with the application. We can use applications like Corel Draw, Corel Paint, Anime Studio and others to create the initial content for the application. One of my favorites for producing unique realistic backgrounds using 3D is Vista Pro 4.0. For example it can create realistic landscapes like this:

Image 4

Image 5

The Developer

I have been programming for over 25 years. My first exposure to programming was in 1975 and in the 1980's I taught myself programming on an Texas Instruments TI-99 home computer. The Commodore 64 was my first real use a compiler for development and I even used the compiler (Abacus Basic compiler) to write my own compiler just so I could build my first family friendly video game. I learned 6502 machine language in the process. My first programming for business started on CPM using the Kaypro portable PC's and then later on IBM compatibles. I wrote custom software for local businesses for small mom and pop operations like a furniture store, a video rental store, auto repair shops and even the local sheriffs department. I also wrote software for local industry as well. I wrote applications for quality control, engineering, accounting, point of sale and job tracking.

In recent years my business develops tools for programmers in the PowerBasic market. For over ten years I have been an advanced WIN32 API programmer developing GUI engines and drag and drop visual designers/code generators for programming. My GUI engine is the backbone of a number of commercial software products. Some major corporations are using software developed by my customers, who use my GUI framework for developing their software. One good example can be found in this YouTube video:

Pause the video at about 4 minutes and 33 seconds and notice the software being used on the laptop which is a control application for some of the hardware they are using.

The software was develop by Fathom Systems in the UK.

They use my EZGUI Professional development tools and my GUI engine is the backbone of a number of applications they have written for use with the products they develop for their customers, including Chevron in the above video.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)