03-23-2010 12:46 PM
ive been looking through the available links but havent seen anything specific to graphics tutorials. i have somewhere between basic/intermediate programming experience -- as far as the logic and data portions of my application go, I dont forsee any problems getting my app to do what i need. I'm slowly getting there on screen layouts / managers and I think I can do what I need with them as well. One thing I have no experience with is specifically with graphics/images - terms like "alpha" and "rop" are all new to me. Specifically I am trying to get images to be transparent, which i have seen a few threads on in here but havent had any luck.
Would I be able to learn from standard J2ME graphics tutorials, or are these issues ill need to deal with specific to blackberry ? or do I just need to try to learn more about graphics/images in general?
I can't wait for the new proposed wiki, i think it would be great for newbies like me
Thanks for any guidance!
03-24-2010 09:25 AM
I haven't really worked with UI, so I don't have any links, but I can tell you that "Alpha" is the dgree of transparency that an object has. For example, 100% transparency means that the object is invisible, 0% being opaque (completely solid). I have no idea what "rop" means.
If you check the Javadocs (5.0), you can find a few methods relating to Alpha in the Bitmap and related classes. I'd suggest hitting up the index and searching for the terms "alpha" or "transparency". You'll get a lot you can't use, but I'm sure there's something you can.
Hope that helps,
03-24-2010 10:31 AM
ROP is Raster Operation. A grid of pixels (Bitmap, EncodedImage, "screen", etc) is a raster image. If you do 255 & 128 the result is 128, if you do a "AND" ROP on a image, it does the same thing per pixel.
When you draw using graphics you can set the alpha for drawing. Just to add on to @DAquilina, 100% alpha is 0, 0% alpha is 255.
03-24-2010 11:55 AM
Thanks for the responses
I have bitmaps that are PNGs that are transparent ... in photoshop they are transparent, when i load them as bitmaps and do hasAlpha it says true. ive been trying to change the paint and paintbackground methods for the bitmapfield and the manager its going on, but no matter what i do the image has a white background instead of being able to see the image behind it (regardless if its focused or not). i keep trying different combinations of setting different backgrounds for managers/fields/etc, and nothing seems to work. so im assuming there is just something i should know that im missing ...
03-24-2010 12:04 PM
the screens of an uiapplication are always white (and not transparent)
03-24-2010 12:45 PM
For testing ... Im extending MainScreen. i set background to blue. then i add MyManager which extends Manager and contains bitmapfields. The bitmaps all show up with a white square around them. even if i set the background of MyManager to a color, the square is still white. so then i try setting a background to the bitmapfields themselves, but still the square is white.
I understand that the underlying screen is white, but should i be able to set a background to either the screen or a manager thats in the screen, and then have that background show through the transparent parts of the bitmapfield on top of that ?
03-24-2010 02:05 PM
Rex - when you say to add spacing in the image, do you mean on the bb or to edit the image and add it there? right now when i open the png in photoshop, i can copy and paste it on top of something else it it looks right -- i see the background image fine through the transparent spots.
03-24-2010 02:23 PM
Something must be wrong with my heirarchy of screens/managers, because the image is good. i did this test on a completely new mainscreen and it gives me the correct display .. so something im doing with my manager must be causing a problem..
Background bg = BackgroundFactory.createLinearGradientBackground(C
olor.BLACK, Color.BLUE, Color.RED, Color.CORAL); this.getMainManager().setBackground( bg ); // get bitmap Bitmap bm = Bitmap.getBitmapResource( SEARCH_ICON ); BitmapField bmf = new BitmapField( bm ); this.add( bmf );
03-24-2010 02:46 PM
Ok sorry for posting so many messages in a row ... but i think i found the problem (but not the solution). im continuously re-sizing/scaling the image as it moves. before scaling it, it works, but i guess the new image created after scaling isnt transparent. to scale im using the following ...
Bitmap bitmapScaled = new Bitmap(scale, scale); bm.scaleInto( bitmapScaled, Bitmap.FILTER_BILINEAR ); bitmapScaled.createAlpha( Bitmap.ALPHA_BITDEPTH_8BPP );
I'm trying different combinations of different filters and SCALE types but not having luck yet. Is there another way to scale that would keep the transparency?