BlackBerry Forums Support Community
              

Closed Thread
 
LinkBack Thread Tools
Old 09-17-2009, 12:36 AM   #1 (permalink)
Knows Where the Search Button Is
 
Join Date: Jul 2009
Model: 8800
PIN: N/A
Carrier: Vodafone
Posts: 15
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default pushRegion, pushContext and popContext - how do they work?

Please Login to Remove!

I'm trying to port an application from J2ME to the Blackberry API. I tried to use pushRegion to replace setClip from J2ME but it seems that these two methods behave different. I have an image with 7 buttons, one on top of another, each of them having a fixed height of 13 pixels, and the only different thing is their collor, each one is lighter than the previous one. I want to set the clip to draw a certain button, but the way that I use pushRegion is not correct and only a small piece is drawn sometimes, sometimes nothing is drawn. If I make pushRegion for the whole screen than all the image is drawn. Here is my code:

Code:
graphics.pushRegion(new XYRect(0, positionY, screenWidth, buttonHeight));

graphics.drawBitmap((screenWidth - buttonImage.getWidth()) / 2, positionY - buttonFrame[i] * buttonHeight, buttonImage.getWidth(), buttonImage.getHeight(), buttonImage, 0, 0);

graphics.popContext();
Should I use pushContext instead of pushRegion?

And one more problem: after several drawings ( I make the drawing in a for loop) I get "out of memory" error on the emulator, I suppose it's because of the pushRegion and popContext because I don't create other objects.
Offline  
Old 09-17-2009, 02:11 AM   #2 (permalink)
Knows Where the Search Button Is
 
Join Date: Jul 2009
Model: 8800
PIN: N/A
Carrier: Vodafone
Posts: 15
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

I had to use pushContext instead of pushRegion and everything is ok. But maybe someone can tell me the difference between these two methods.
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

VOPILI SMB FXSFXO VoIP IP PBX System
$49.99
VOPILI SMB FXSFXO VoIP IP PBX System  pictureCisco SPA504G 4-Line IP VoIP Telephone Phone PoE IP Phone
$49.99
Cisco SPA504G 4-Line IP VoIP Telephone Phone PoE IP Phone pictureSamsung OfficeServ / SCM SMT-i3105 Black Business VoIP Internet Telephone v1.64
$129.0
Samsung OfficeServ / SCM SMT-i3105 Black Business VoIP Internet Telephone v1.64 picture vcs754 erisstation conference phone with 4 wireless microphones voip and device
$420.51
 vcs754 erisstation conference phone with 4 wireless microphones voip and device pictureCisco 7960 IP Phone CP-7960G VoIP Phone and Handset IP Telephone NO AC Adapter
$25.0
Cisco 7960 IP Phone CP-7960G VoIP Phone and Handset IP Telephone NO AC Adapter picture






Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.