Introduction to Symbian FBS cfbsbitmap

Source: Internet
Author: User

FBS server Overview
Font and bitmap Server is an important service of Symbian OS, which is mainly usedManagementFonts and bitmaps, written using highly optimized assembly code, can provide good and fast drawing capabilities, can be shared among all threads in the system, and can be accessed through the rfbssession class. It is generated by the window server and operated through the cfbsfont and cfbsbitmap classes. cfbsbitmap and cfbsfont are both client handles of FBS, and they provide methods to manage fonts and bitmaps, the actual data is stored on FBS. Only one copy of the data is retained, and the client handle can have multiple references.
Bitmap in ROM can be directly used. file-based bitmap must be loaded to ram before it can be used. bitmap and font in RAM have only one instance, it is referenced by multiple clients by referencing the counter. For most applications, the font and bitmap server are hidden in the window server, and the server has initialized the FBS server by default. Users of EXE programs or other working threads can connect to the server through rfbssession: connect.
FBS server access
The most common application of the service is Paster, and operations such as Paster and plotting are implemented through the cfbsbitmap FBS client object, which is somewhat similar to hbitmap on Windows. Generally, cfbsbitmap: dataaddress is used to obtain the memory address and getscanline is used to obtain a specified Scan Line. Bitmap is also divided into two different heaps on FBS based on their 4 kb boundary. The heap located in largebitmap can perform automatic disk fragmentation (other threads may perform heap sorting when some special system events occur, resulting in data dislocation ), therefore, this heap needs to be locked/unlocked. In the s60 SDK of earlier versions, tbitmaputil is provided to lock and unlock the heap. When bitmap content is edited, we need to lock the heap. The later versions of the SDK provide lockheap and unlockheap to complete this operation. Internal operations such as drawing and copy of cfbsbitmap provide the automatic locking function.

Method 0.9 provided by s60 in earlier versions ~ 1.2:
// Lockheap
Tbitmaputil BMP L1 (iimage );
Tbitmaputil BMP util2 (abmp );
BMP util1.begin (tpoint (0, 0 ));
BMP util2.begin (tpoint (0, 0), BMP util1 );

// Getaddress
Tuint16 * pdata2 = (tuint16 *) iimage-> dataaddress (); // source Image
Tuint16 * pdata = (tuint16 *) abmp-> dataaddress (); // target BMP

// Scanline
Tint nlinelen = abmp-> scanlinelength (abmp-> sizeinpixels (). iwidth, ecolor4k)/2;
Tint nlinelen2 = iimage-> scanlinelength (// line length in 16bit word
Iimage-> sizeinpixels (). iwidth,
Ecolor64m );

// Add your code here:
Tuint16 * P = pdata;
Tuint16 * P2 = pdata2;
...

// Unlockheap
BMP util2.end ();
BMP util1.end ();

Method for s60 2.0:
// Lockheap
If (iimage-> islargebitmap ())
Iimage-> lockheap ();
// Getaddress
Tuint16 * pdata = (tuint16 *) iimage-> dataaddress (); // source Image

// Add your code here:
Tuint16 * P = pdata + noffsety * abmp-> sizeinpixels (). iwidth + noffsetx;
...
// Unlockheap
If (iimage-> islargebitmap ())
Iimage-> unlockheap ();

Precautions for operating cfbsbitmap:
1. No lock/unlock is added when reading and writing bitmap data blocks;
2. Bitmap locks cannot be performed twice (each lock is a global FBS heap );
3. You do not need to lock a small image (the small image has been optimized in heap );
4. Other bitmap operations are not allowed in lock/unlock pairs;
5. Lock/unlock must be strictly paired, especially in case of an error, if the pair is not properly matched, the system Panic may occur;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.