BTranslationUtils

Derived from: none

Declared in: be/translation/TranslationUtils.h

Library: libtranslation.so


Overview

[method 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(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 and third 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 Be Book, in lovely HTML, for BeOS Release 4.

Copyright © 1998 Be, Inc. All rights reserved.

Last modified February 11, 1998.