Internet / PC / Mobile Sofware

 Home | About us | Contacts | Privacy policy
      Products
 Products | Online demos | Downloads | Buy online | Support forum
      Services
 Showcase | Our services | Affiliate partners program  
Perl WBMP Generator 1.1   $60.00
Direct download from LorisSoft.com
Add to cart

Product: Perl WBMP Generator 1.1
Key features:
    - Load/save/generate to devices WBMP images
    - Bult-in layering and masking functions
    - Drawing functions
Demonstration:
Send email to info @ LorisSoft.com for demo
Price: 60 USD

Quick Start
Working with masks

The library allows to easily dynamically generate WBMP images from within Perl CGI script. No modules installation is required - just include the library to your own code with
require "wbmp_lib.pl";

Quick Start

Step 0: 
require "wbmp_lib.pl";

Step 1: - background 
(my $background)=CreateNewWbmp($width,$height,$color);

where $width, $height - integers, $color - 1 or 0 for black or white OR

(my $background)=LoadWbmpFile('background.wbmp');

Step 2: - Loading Images 
(my $image1)=LoadWbmpFile('image1.wbmp'); 
(my $image2)=LoadWbmpFile('image2.wbmp');

Step 3: - Combinig images
($background)=Combine2A($background,$image1,$x,$y,$mask); 
Now image1 is put on the background at $x, $y coords, using $mask (integer 0 to 15). Egz. $mask=7 makes "white" color in image1 transparent, $mask=6 makes image1 opaque, etc.

($background)=Combine2A($background,$image2,$x,$y,$mask); 
Now image2 is put on the background (image1 already there)

etc.etc.

You can also 
DrawPixel($background,$x,$y,$color,$mask);
DrawLine($background,$start_x,$start_y,$end_x,$end_y,$color,$mask);
DrawRectangle($background,$start_x,$start_y, $end_x,$end_y,$color,$mask);

Step 4 - deploying 
After you are finished with layering images, lines, etc. you can deploy the resulted image

SaveWbmpFile($background,"New_image.wbmp"); 
(saves resulted image on disk) or send it to telephone with
PrintWbmpFile($background); 
sets WBMP header and sends to telephone.

Working with masks

Masks
0 – Black
1 – White

0 1 0 1 Bottom image
0 1 1 0
Top picture
0 0 0 0 Mask 0
0 0 0 1 Mask 1
0 0 1 0 Mask 2
0 0 1 1 Mask 3
0 1 0 0 Mask 4
0 1 0 1 Mask 5
0 1 1 0 Mask 6
0 1 1 1 Mask 7
1 0 0 0 Mask 8
1 0 0 1 Mask 9
1 0 1 0 Mask 10
1 0 1 1 Mask 11
1 1 0 0 Mask 12
1 1 0 1 Mask 13
1 1 1 0 Mask 14
1 1 1 1 Mask 15

In the table above you can see bit addition results of different masks usage in library’s
Combine2A($image_1,$image_2,$x,$y,$mask) function.

Colour of a pixel on the resulting image will depend on Bottom picture colour of the same pixel, Top image colour of the same pixel and Mask.

Egz. 1

Suppose we use Mask #5. Possible pictures’ pixels addition combinations: 0-0 (Bottom picture’s pixel colour is black, and the same top picture’s), 1-1 (both pixels are white), 0-1 (black pixel of the bottom picture and white pixel of the top picture) and 1-0 (vice versa).

Mask #5 result array is 0101. This means that 0-0 addition case will result in 0 color (i.e. if bottom pixel is black and top pixel is black, pixel on resulting image will be also black). 1-1 addition case will result in 1 (if both pixels added are white, resulted pixel will be white). 0-1 case will result in 0 (bottom pixel: black, top:white, result:black) and 1-0 case will end up with 1 (bottom white, top: black, result:white)

Egz. 2

We’re looking for mask that allows “transparent” additions, i.e. white areas on top image, which is added to the bottom image, should be transparent. This means that resulted image pixels should have black colour, if top image pixels are black and have same colour as of bottom image, if top image pixels are white. So we’re looking for the mask with the following properties:

Bottom pixel:0, top pixel:0, result: 0 (we want black, since top pixel is black {nontransparent})

Bottom pixel:1, top pixel:1, result: 1 (we take bottom’s pixel{1}, which is white, since top pixel is white{transparent})

Bottom pixel:0, top pixel:1, result: 0 (we take bottom’s pixel{0}, which is white, since top pixel is white{transparent})

Bottom pixel:1, top pixel:0, result: 0 (we want black, since top pixel is black {nontransparent})

So the mask will be 0100 or Mask 4.

  © Loris Ltd. 1998-2006                   office @ LorisSoft . com