The Translation Kit: BTranslationUtils

The Translation Kit Table of Contents | The Translation Kit Index

# BTranslationUtils

Derived from: none

Declared in: be/translation/TranslationUtils.h

Library: libtranslation.so

###### Summary

BTranslationUtils contains a set of static functions which load bitmap images. The functions use the Translation Kit to convert the data from its native format to a `BBitmap` via a `BBitmapStream`, the upshot of which is that if you can convert the data to a translator bitmap, you can successfully use these functions. The image may come from a file, resource, or `BPositionIO`. The application is always responsible for deallocating the returned BBitmap.

## Static Functions

### GetBitmap()

static BBitmap *`GetBitmap(`const char *name, BTranslatorRoster *use = NULL`) `
static BBitmap *`GetBitmap(`entry_ref *ref, BTranslatorRoster *use = NULL`) `
static BBitmap *`GetBitmap(`uint32 type, int32 id, BTranslatorRoster *use = NULL`) `
static BBitmap *`GetBitmap(`uint32 type, const char * name, BTranslatorRoster *use = NULL`) `
static BBitmap *`GetBitmap(`BPositionIO *stream, BTranslatorRoster *use = NULL`) `

The first version of the function returns the image held in the file name if it exists. Otherwise, it returns the application resource of type `B_TRANSLATOR_BITMAP` named name. The second version does the same thing, but uses an entry_ref, ref, to locate the file.

The third and fourth versions of the function search for the specified resource and return the bitmap contained therein.

The final version returns the bitmap found in stream. This form of the function is particularly useful when used with `BMemoryIO`.

In all cases, use specifies the BTranslatorRoster to use in translating the image. If use is `NULL`, the default translator (as returned by `BTranslatorRoster::Default()`) is used.

If the file or stream doesn't contain a suitable bitmap, the functions return `NULL`.

See also: `BTranslatorRoster::Default()`

### GetBitmapFile()

static BBitmap *`GetBitmapFile(`const char *name, BTranslatorRoster *use = NULL`) `

Returns the image held in the file name. If the file doesn't contain a suitable image, the function returns `NULL`. use specifies the BTranslatorRoster used to translate the image. If use is `NULL`, the default translator (as returned by `BTranslatorRoster::Default()`) is used.

See also: `BTranslatorRoster::Default()`

The Translation Kit Table of Contents | The Translation Kit Index

The Be Book,
...in lovely HTML...
for BeOS Release 5.

Copyright © 2000 Be, Inc. All rights reserved..