Problem: How To use color bitmaps in your application
Solution: Color bitmaps are possible if you follow the required image naming convention listed below.
Satellite Forms has supported color bitmaps since V4.1. Unfortunately the documentation for this support has been difficult to come by. Here is the relevant information for using color bitmaps in your SatForms application.
2.1 Color Support
======================================================================
You can now embed color images into Satellite Forms applications. App
Designer can read standard Windows BMP files and convert them into
Palm bitmap resources.
To achieve great looking graphics on devices with different color
capabilities, you can provide multiple bit-depth versions of any
image. Satellite Forms runtime engine will use the image that is most
suitable for the device.
2.1.1 Specifying Multiple Bit-depth Images
----------------------------------------------------------------------
- Create or open an existing form with App Designer
- Insert a Bitmap Control onto the form
- Double-click on the new bitmap control
- Browse or type the location of a black and white BMP file
- Close the control's property dialog box
Satellite Forms supports 5 bit depths: 1-bit, 2-bit, 4-bit, 8-bit and
16-bit. However, you must always supply a 1-bit (black and white)
version of the image. This will ensure that your application will
always look right on black and white Palm devices.
Once you have associated a black and white image with a bitmap
control, App Designer will use a predefined file naming convention to
locate the other versions of the image file.
App Designer will use the suffix "-2", "-4", "-8" and "-16" to locate
the color versions of the black and white image. The number
corresponds to the bit-depth of the file.
For example: if the bitmap control is associated with "Photo.bmp", App
Designer will look for "Photo-2.bmp", "Photo-4.bmp", etc.
You don't have to specify images for all bit-depths. Sometimes the
lower bit images are good enough. Higher bit images occupy a larger
memory footprint.
When building the project files, App Designer will use a dithering
algorithm to transform 2, 4, 8 and 16-bit images so that they will use
the correct Palm's color palettes, so your images may look different
on the device. To avoid this transformation effect, you may want to
use a graphic editing tool to make sure that the images are already
using the correct Palm color palettes. For your reference, Satellite
Forms installs "PalmPalettes.bmp" in the Templates directory.
Bitmap images used by bitmap controls in a Satellite Forms project
will end up as resources in a new target file. This new file uses the
following naming convention: ExxxxMMnn#AppName.prc, where xxxx denotes
the creator ID of your application, MM and nn are major and minor
versions of your application.
You can use Microsoft Paint to create your images. You can usually
find this program in \Program Files\Accessories\.
Note: using Microsoft Paint, 1-bit BMP file must be saved as
Monochrome Bitmap and other BMP files must be saved as 24-bit Bitmap.
See the about box in any of Satellite Forms sample projects for
examples.
Note: There is a limit of 64K for each bitmap family (all bit depths
combined).
2.1.2 Using Bitmaps in Tables
----------------------------------------------------------------------
- Create, import or open an existing table
- Add a new "BINARY" column
- Create or open an existing form
- Double-click the form
- Link the table to the form
- Close the form's property dialog
- Insert a Bitmap Control onto the form
- Double-click on the new bitmap control
- Change the "Image Source" from File to Table
- Choose the "BINARY" column
- Close the control's property dialog box
Satellite Forms' runtime engine will use the content of the current
record to render the image. Only binaries of type "Tbmp" (Palm bitmap)
are currently supported by Satellite Forms runtime engine. Future
third party extensions may support other binary types.
See the "Deliveries" sample project to see how this is done.
Note: A Palm record can only be 64K in size. This limitation directly
impacts the size of your binary fields.
2.1.3 Populating a BINARY column in a Table with a Palm bitmap family
----------------------------------------------------------------------
A bitmap control can be linked to a binary column in a table.
Satellite Forms engine will then load the "Tbmp" (Palm bitmap) object
contained in the record and render it on the screen.
For this process to work, you will need to fill in the linked-column
with the proper "Tbmp" objects in advance.
Satellite Forms 4.1 has a new feature that can assist in putting Palm
bitmaps into binary columns.
When Satellite Forms translates tables from desktop databases
(DBF/MDB ) to Palm databases (PDB), it will automatically convert
embedded pathnames in the binary columns into binary objects.
Translation happens when App Designer builds your project or when
Satellite Forms conduit runs.
Pathnames must be embedded in binary columns using the following
formats:
HSBM<full pathname>
- or -
HSRW<full pathname>
HSBM and HSRW denote the type of file that follows.
<full pathname> denotes the location of the file on your desktop PC.
If HSBM is specified, the pathname must point to a black and white BMP
file. Satellite Forms uses the file naming convention discussed in
section 2.1.1 to discover the color BMP files.
If HSRW is specified, the pathname can point to any file. During
translation, Satellite Forms will simply embed the content of the file
into the column without any modifications. Note: the current built-in
bitmap control can only recognize Palm bitmap. However, third
party extensions may use this same mechanism to move other data types
onto the device. E.g. you can embed MP3 files to be used by a future
MP3 extension.
Note: On Palm devices, a record is limited to 64K, so embedding large
files will fail.
Examples:
HSBMC:\My Documents\Vacation\Photo.bmp
HSRWC:\Music\Tune.mp3
See the "Deliveries" sample project to see how this is done.
The "Deliveries" sample also demonstrates how to embed pathnames using
scripts.
Note: When assembling a record, Satellite Forms makes sure that a
record will not exceed 64K in size. Satellite Forms will omit binary
contents that will cause the record to grow beyond 64K.
2.1.4 Populating a BINARY column in a Table with a Resource Locator
----------------------------------------------------------------------
Satellite Forms can also render Palm bitmaps that already exist on
existing Palm databases.
In this case, you need to embed a resource locator. A resource locator
uses the following format:
SFRLRSRC:<PRC name>:Tbmp:<id>
where,
<PRC name> is the name of the resource database (PRC)
<id> is the resource ID of the Palm bitmap family
Example:
SFRLRSRC:MyLogoResDb:Tbmp:1001
2.1.5 Using the App Designer Table Editor to Populate BINARY Columns
----------------------------------------------------------------------
You can enter strings with the format specified in section 2.1.3 and
2.1.4 using the built-in table editor in App Designer. When the
project is built, App Designer will convert any valid entry to the
proper Palm bitmap family.
Note: App Designer will not embed bitmaps that would cause a record to
exceed 64K.
Warning: Using "Upload Tables..." feature in App Designer will clear
the contents of these binary columns. You will need to reenter the
strings again. You could consider adding a CHAR column to your
table to save the pathname strings, in addition to entering them into
the BINARY column, thus making it easier to repopulate the contents
of the BINARY column if you use the Upload Tables function, by copying
and pasting the pathname strings from the CHAR column to the BINARY
column in the table editor.
Keywords: bitmap, color, image, graphic, logo
KB ID: 10010
Updated: 2005-11-17
Satellite Forms KnowledgeBase Online