Transparency - 8bit w/ alpha vs. 32bit

Hi, we are designing a pretty graphics heavy site right now. It's a very rough, organic design, and uses transparency quite a bit (mostly solid color boxes letting the background texture show through a bit).
So we know we'll have to do some serious optimization to make sure this site isn't a complete slug. We plan on using sprites as much as possible. But we need to figure out how to approach all the transparency.
- Can anyone verify from experience the file-size savings you would get if saving relatively simple graphics (mostly solid tones, large color blocks, type, etc.) with transparency as 8bit w/ alpha transparency vs. full 32bit??
We are not really concerned about the IE6 compatibility aspect of it, just the file-size savings part.
The main reason for the question is that the design is done in Illustrator CS4 and we would love to just export the slices from there. Illustrator does support full 32bit PNGs (calls it PNG-24 of course). But we do have a copy of Fireworks CS4 that we don't use too much. Just want to make sure it will be worth all the effort of properly bringing all the elements in from Illustrator and making sure nothing gets messed up in the migration.
THANKS!

Thanks. We did end up using Fireworks to create a large sprite of all the Home page background elements (some will be used elsewhere). We were able to get a roughly 1800px square file with the equivalent of what would have been 34 individual grahpics saved as one 100kb image sprite! Considering all elements had partial opacity, and a lot had soft glows and/or drop-shadows, that's a HUGE savings!
UNFORTUNATELY, Fireworks CS4 slowed to an absolute crawl on my ol' G5 Dual 2Ghz Mac Pro (with 6GB RAM). Even just selecting and element would cause a few seconds of spinning beachball. So I had to 'borrow' my bosses newer MacBook Pros to get anything done (not ideal!). And even with that, I had to install a demo of Fireworks CS5 for it to really work without a lot of delays.
And the Illustrator CS4 file DID NOT come in very nicely either. I pretty much had to rebuild most of it from scratch. According to the Adobe documentation, most everything I was doing 'should' have come in fine (I wasn't really doing anything that was listed as not compatible). Nice in theory...
It's too bad Fireworks seems to be Adobes ugly stepchild that doesn't get much attention. If they fixed performance and import issues, added a useful color/swatches implementation (from Illustrator/InDesign), and added at least simple paragraph/character styles (again - Illustrator/InDesign), we would definitely love to use this for website comps and graphics creation instead of Illustrator. But for now, unless we absolutely need Fireworks' 8-bit PNGs w/ alpha-transparency, we'll stick with Illustrator. It's too bad, I'm originally a Macromedia guy and was using Fireworks back in v.2/3.

Similar Messages

  • Can't get RescaleOp to retain transparancy (it sets alpha to black)

    Got my code here, the operation fills in the transparancy with black:
    public static BufferedImage brighten(BufferedImage bi) {
                RenderingHints hints = new RenderingHints(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
             RescaleOp op = new RescaleOp(scaleFactor, 0, hints);
             BufferedImage copy = op.createCompatibleDestImage(bi, bi.getColorModel());
             op.filter(bi, copy);
             return copy;
    }Ive looked on the web, but i only found one reference to this here - http://forums.sun.com/thread.jspa?threadID=568146 - , and I tried doing what solved it for them (as far as i can tell setting the source and destination to the same thing) but that didn't work - any help would be much appreciated!
    Joe
    Edited by: 794057 on 27-Oct-2010 06:36
    for some reason links arnt working
    Edited by: 794057 on 27-Oct-2010 06:38
    actually they are - just not if you use the "link" button! crazy

    I think I was passing it an incorrect image, but now i get an empty image:
            public static ImageIcon changeBrightnessContrast(Icon icon, float brighness, float contrast)
              ImageIcon ret = new ImageIcon();
              BufferedImage image = (BufferedImage) iconToImage(icon);
              BufferedImage imagecopy = copy(image, BufferedImage.TYPE_INT_RGB);
            image = brighten(imagecopy);
            ret.setImage(image);
              return ret;
            public static BufferedImage copy(BufferedImage bi, int type) {
              BufferedImage result = new BufferedImage(bi.getWidth(), bi.getHeight(), type);
              Graphics2D g = result.createGraphics();
              g.drawRenderedImage(bi, null);
              g.dispose();
              return result;
            public static BufferedImage brighten(BufferedImage bi) {
              float scaleFactor = 1.2f;
              //RenderingHints hints = new RenderingHints(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
              RescaleOp op = new RescaleOp(scaleFactor, 0, null);
              BufferedImage copy = op.createCompatibleDestImage(bi, bi.getColorModel());
              op.filter(bi, copy);
              return copy;
         }here is how I use it, the above code set transparancy to black (understandably, as the image its copying to has no alpha channel) however, if i set it to have one:
    BufferedImage imagecopy = copy(image, BufferedImage.TYPE_INT_ARGB);
    the image I get not is not there! (or all transparent??)
    Edited by: 794057 on 27-Oct-2010 06:58
    for some reason chanel is ***** out C H A N E L (as a misspelled channel)
    Edited by: 794057 on 27-Oct-2010 07:01

  • Alpha-mask vs. merged-Transparency in PSD format

    Hi,
    I'm trying to read merged RGBA data from PSD format. "Image data" section contains channels (RGBAA... where first A might be a merged transparency or Alpha mask). Can someone tell me how to know what is stored in first A? I noticed that:
    when image contains no transparency, but has at least one Alpha mask, then first Alpha channel will contain that alpha mask
    when image contains transparency, then first Alpha channel will contain merged transparency and other Alpha channels will contain alpha masks
    So how do I reliably differentiate between Transparency and Alpha mask in first Alpha channel?
    Regards,
    Paulius Liekis
    Unity Technologies

    This forum is to discuss the forums, not products
    You need to ask your question in the forum for the Adobe product you are using
    How to Select a Forum http://forums.adobe.com/docs/DOC-1015

  • Import Image Sequence and Alpha Channel Transparency?

    Hello --
    I need to go from PNG sequence (with alpha channel transparency) to FLV (with alpha retained), and am trying to do this in QuickTime Pro. Seems like this should be possible.
    When I import a sequence of PNG images into QuickTime Pro, the alpha channel displays as solid black. When I export the movie as FLV (using On2 VP6 Codec, which supports alpha transparency), there is still a solid black background, and no transparency. I have looked everywhere in QT Pro for transparency settings, but to no avail. Any tips would be hugely appreciated. Thanks in advance!
    Mike

    Thanks, but something is not working.
    Going back to your original post, when I do Cmd-J, then set transparency to "Straight Alpha," the movie background immediately changes from black to white. So far so good. But if I export that movie as MOV (Animation, no compression, millions of colors+), then bring it back in, and confirm with Cmd-J, the transparency setting is gone. Am I missing something?

  • Alpha channel in Adobe Media Encoder output

    Hello, I would like to know how to get the same result in Adobe Media Encoder as you get from AE rendering using Quicktime container and PNG + alpha codec.
    On the left is the SS from playing AME rendered video in any player, even Win preview, on the rigth is how it is played if rendered from AE with same settings. (AME has 32bit. AE has RGB + alpha)
    Even the file sizes are different so this clearly isn't equivalent to AEs render. And yes, if you import what AME rendered into AE, it looks ok, but I need this to look OK in video players.
    Am I missing something, or this simply isn't possible?
    Thank you for your time.
    Sandi

    I want to do in "AME", the functions that have After Effects.
    Are they?
    RGB - Opaque = Colors / Transparent = black.
    Alpha - Opaque = White / Transparent = Black.
    RGB+Alpha - Opaque = Colors / Transparent = Transparent.
    As in After Effects.

  • Looking for transparency clarification

    Hello all,
    I just spent some time trying to figure out what AI CS4 (Mac 10.5.7) does or does not with placed transparent bitmap images. I started with a grayscale TIFF scan and worked my way through several options, using the GraphicConverter as a bitmap image tool, consulting resources on the web from time to time. This is what I found:
    Palette-based transparency (1 colour declared transparent) is ignored, regardless of images colour depth.
    Alpha channel transparency is supported (only) if the image mode is 32 bit RGB (tried PNG, TIFF and TIFF w/ LZW compression, all work fine).
    No transparency at all is supported for CMYK images (even if alpha channel included, regardless of image format & colour depth)
    Is this the same you observe? Could I have found this information anywhere in the AI documentation? Should someone be shot for introducing such a vast array of colour and transparency options? (Ignore the last q. Probably it was the Swiss that invented it, like everything else )
    Cheers,
    Lutz

    Pattern is a native AI pattern with bitmaps placed above it. PSD, TIFF, and PDF images are CMYK. PNG and GIF created via Save for Web in Photoshop. TIFF images are layered TIFFs. File created by opening new PS document with transparent background and a simple brush stroke was created, then the file was saved. No special alpha channel consideration was taken into account. This also doesn't take into account the use of clipping paths -- which would further extend the range of transparency in bitmaps, albeit masked transparency rather than alpha transparency. In addition, the 16bit images are flattened to 8bit upon placing into Illustrator, but as you can see, the transparency holds up.
    All this is somewhat moot due to the fact that PSD files work flawlessly for 99.9% of files and there's never any reason to use another format anymore, especially if you are working within only the Creative Suite applications. If you are bound to Graphics Converter,some limitations you are seeing may be due to that application, not Illustrator. The only thing I use GC for is multi-page TIFF images (which Photoshop REALLY needs to add support for.)

  • Exported clip with alpha - no setting produces composited output

    1. launch Motion v3
    2. choose any resolution / media preset
    3. put some scrolling text into a layer
    4. export the clip out as H.264, 8bit color, +alpha (this info from Motion itself)
    5. import the clip into FCP v 6
    6. bring into any simple slideshow, composite text over slides
    7. render - no compositing
    8. cmd-9 change alpha properties to any of the other three (default is to none) = still no compositing

    H.264 does NOT allow for alpha channel on export. You need to select a codec capable of embedding the alpha channel.
    You should not be editing H.264 in FCP anyway. It's a web delivery codec, not an editing one.
    your easiest solution is to import the Motion project file into FCP and add it to your sequence like a clip. Transparency will be observed without any exporting necessary.
    In addition, you can open the clip in editor to make changes to the Motion project which will be updated in FCP as soon as you save.
    Andy

  • Premiere Pro is not interpreting transparency correctly with the Adobe Creative Cloud 1.8.0.447 update

    Yesterday, I updated to Adobe Creative Cloud 1.8.0.447. I found that after the update, both Premiere Pro CC (2014) and Premiere Pro CC are not ready transparency layers and alpha layers correctly. I have some lower third logos that I use on multiple projects and they are showing up more opaque than they should. Additionally, I have an export preset that uses a watermark. This watermark is showing up more opaque than it should too. I have checked both graphics in After Effects with the new Creative Cloud update and all graphics look fine. It seems to be an issue that is isolated in Premiere. The issue only happens when there is a video layer underneath the graphics. When the graphics are viewed with no video layer underneath, the transparency looks as it should. I have attached a few images showing the problems. They show graphics with and without video layers beneath.

    I was able to resolve the issue by going into File>Project Settings>General and changing the Render from GPU Acceleration (OpenCL) to Software Only. It appears there is an issue with the AMD FirePro D500 graphics card. I was told by a call tech at Adobe that there are issues with the D300, D500, and D700 Graphics cards. However, I have an Intel Iris graphics card on my MacBook Pro and was having the same transparency issue. So, I'm skeptical that the issue is just with the graphics card. The transparency issue did not start on BOTH computers until the latest CC upgrade. For now, the Software Only renderer option fixes the issue. I hope to see a fix in the next CC update. FYI: The Renderer needs to be changed to Software Only in both Premiere Pro Project Settings and Media Encoder Preferences.

  • How do I save a PNG file with an alpha channel in Photoshop CS5?

    I have a PNG file created in Photoshop and I need to save it with an alpha channel for web purposes. I tried 'Save for Web & Devices' and selecting the Transparent box. Then, after saving, when I select 'get info' for the file it says there is no alpha channel. I'm stumped I can't seem to create an alpha channel from within Photoshop while I'm editing. Help!

    If you save as a 24bit png with transparent checked photoshop will save the png with transparent background (ie alpha transparency).  The png will appear transparent in a web browser.

  • Alpha Channel Video Preloader

    We are creating a project that includes a number of alpha channel videos of the course narrator and other characters.  Playback works well however, before each video plays, there is a brief "loading" message and then the video pops onto the screen and plays.
    I understand the need for the pre-loader, however, I am hoping there is a way to add a "poster frame" to avoid the jarring impact of a person suddenly appearing over a realistic background.  A little too much like a magic trick. 
    We would like to try a poster frame similar to the commonly used "Flash Media Playback" player provided by adobe for flash video on websites found here http://www.adobe.com/products/flashmediaplayback/index.html
    Flash media playback allow the use of a jpg file that loads immediately before the video buffers. 
    Alternatively, are there any other "tricks" to make it appear that the video is present on the screen before it begins to play?
    Appreciate any ideas on this.
    Thanks
    Jeff

    Probably because you're not actually encoding "nothing" when creating transparency. An alpha channel is an additional 8-bit grayscale channel, and it probably can't or isn't compressed as much as the RGB channels, or else the transparency would not be clean. The only way to decrease the file size is to lower the total bitrate, which will subsequently have an impact on the quality of the "visible" video.

  • Problem with a method to modify the transparency of a Label UILabel

    HI
    I Have create a small project which can modify the brightness ( or the transparency ) of a label
    UIlabel
    So the code
    File .m
    ControlBoxCookeAppDelegate.m
    Code :
    Code:
    *// ControlBoxCookeAppDelegate.m*
    *// Control Box Cooke*
    *// Created by Bruno on 1/11/10.*
    *// Copyright _MyCompanyName_ 2010. All rights reserved.*
    *#import "SerialManager.h"*
    *#import "ControlBoxCookeAppDelegate.h"*
    *#import "PickerViewController.h"*
    *#include <fcntl.h>*
    *#include "Led.h"*
    *@implementation ControlBoxCookeAppDelegate*
    *@synthesize window;*
    *- (void)applicationDidFinishLaunching:(UIApplication *)application {*
    *// Override point for customization after application launch*
    *[window makeKeyAndVisible];*
    //RootViewController.m
    *- (void)applicationDidFinishLaunching:(UIApplication *)application {*
    * pvController = [[PickerViewController alloc] initWithNibName:@"pickerview"/@"MainWindow"*//@"Control Box Cooke"//*@"PickerView"/ bundle:[NSBundle mainBundle]];*
    * Led_Operateur= [[Led alloc] initWithFrame:CGRectMake(20,50,280,20)];*
    * Led_Operateur.text=@" ";*
    * [Led_Operateur setBackgroundColor: [ UIColor colorWithWhite:1.0 alpha: 0.5]];*
    * [pvController.view addSubview:Led_Operateur];*
    * [window addSubview:pvController.view];*
    * // Override point for customization after application launch*
    * [window makeKeyAndVisible];*
    *- (void)dealloc {*
    * [Led_Operateur release];*
    * [pvController release];*
    *[window release];*
    *[super dealloc];*
    -(void)Modifie_luma:(CGFloat)luma
    * pvController = [[PickerViewController alloc] initWithNibName:@"pickerview" bundle:[NSBundle mainBundle]];*
    * Led_Operateur= [[UILabel alloc] initWithFrame:CGRectMake(20,50,280,20)];*
    * Led_Operateur.text=@" ";*
    * [Led_Operateur setBackgroundColor: [ UIColor colorWithWhite:1.0 alpha: luma]];*
    * [pvController.view addSubview:Led_Operateur];*
    * [window addSubview:pvController.view];*
    * [window makeKeyAndVisible];*
    @end
    file.h
    Code :
    Code:
    *// ControlBoxCookeAppDelegate.h*
    *// Control Box Cooke*
    *// Created by Bruno on 1/11/10.*
    *// Copyright _MyCompanyName_ 2010. All rights reserved.*
    *#import <UIKit/UIKit.h>*
    *#import "SerialManager.h"*
    *#import "led.h"*
    *@class PickerViewController;*
    *@interface ControlBoxCookeAppDelegate : NSObject <UIApplicationDelegate> {*
    *UIWindow window;
    * PickerViewController pvController;
    * SerialManager portCunima;
    * int portin,portout; // numero de port de com in-out*
    * UILabel Led_Operateur;
    -(void)Modifie_luma:(CGFloat)luma;
    *@property (nonatomic, retain) IBOutlet UIWindow window;
    @end
    To the initialization no problem my label UILabel display itself very well with the transparency
    of 50% ( alpha=0.5)
    But when I modify this transparency with a button, in my window iPhone
    the program call the method Modifie_Luma witch is the class
    ControlBoxCookeAppDelegate
    the program go on to this method, (I have fixe a breakpoint) but impossible to various this transparency.
    So if I change in method (void)applicationDidFinishLaunching
    the transparency
    example alpha =0,5 => alpha =0,8
    Code :
    Code:
    * [Led_Operateur setBackgroundColor: [ UIColor colorWithWhite:1.0 alpha: 0.8]];*
    this example go on
    resume
    when I change the transparency in the method
    (void)applicationDidFinishLaunching it 's OK
    when I change the transparency in the method
    -(void)Modifie_luma it's not OK
    Have you an explanation ?

    So the code , sorry but no marker for the code in post
    How do you do ?
    // ControlBoxCookeAppDelegate.h
    // Control Box Cooke
    // Created by Bruno on 1/11/10.
    // Copyright _MyCompanyName_ 2010. All rights reserved.
    #import <UIKit/UIKit.h>
    #import "SerialManager.h"
    #import "led.h"
    @class PickerViewController;
    @interface ControlBoxCookeAppDelegate : NSObject <UIApplicationDelegate> {
    UIWindow *window;
    PickerViewController *pvController;
    SerialManager *portCunima;
    int portin,portout; // numero de port de com in-out
    UILabel *Led_Operateur;
    -(void)Modifie_luma:(CGFloat)luma;
    @property (nonatomic, retain) IBOutlet UIWindow *window;
    @end
    // ControlBoxCookeAppDelegate.m
    // Control Box Cooke
    // Created by Bruno on 1/11/10.
    // Copyright _MyCompanyName_ 2010. All rights reserved.
    #import "SerialManager.h"
    #import "ControlBoxCookeAppDelegate.h"
    #import "PickerViewController.h"
    #include <fcntl.h>
    #include "Led.h"
    @implementation ControlBoxCookeAppDelegate
    @synthesize window;
    - (void)applicationDidFinishLaunching:(UIApplication *)application {
    // Override point for customization after application launch
    [window makeKeyAndVisible];
    //RootViewController.m
    - (void)applicationDidFinishLaunching:(UIApplication *)application {
    pvController = [[PickerViewController alloc] initWithNibName:@"pickerview"/@"MainWindow"*//@"Control Box Cooke"//*@"PickerView"/ bundle:[NSBundle mainBundle]];
    Led_Operateur= [[Led alloc] initWithFrame:CGRectMake(20,50,280,20)];
    Led_Operateur.text=@" ";
    [Led_Operateur setBackgroundColor: [ UIColor colorWithWhite:1.0 alpha: 0.5]];
    [pvController.view addSubview:Led_Operateur];
    [window addSubview:pvController.view];
    Led *ZoneA;
    CGRect Dimension;
    ZoneA = [[Led alloc]initWithFrame:Dimension];
    [pvController.view addSubview:ZoneA];
    [window addSubview:pvController.view];
    [ZoneA Modifie_luma:0.5];
    [ZoneA release];
    // Override point for customization after application launch
    [window makeKeyAndVisible];
    Led *Led1;
    CGRect frame;
    Led1=[[Led alloc] initWithFrame:frame];
    [pvController.view addSubview:Led1];
    [window addSubview:pvController.view];
    [Led1 release];
    [label release];
    [Error_message release];
    [path_port release];
    - (void)dealloc {
    [Led_Operateur release];
    [pvController release];
    [window release];
    [super dealloc];
    -(void)Modifie_luma:(CGFloat)luma
    pvController = [[PickerViewController alloc] initWithNibName:@"pickerview" bundle:[NSBundle mainBundle]];
    Led_Operateur= [[UILabel alloc] initWithFrame:CGRectMake(20,50,280,20)];
    Led_Operateur.text=@" ";
    [Led_Operateur setBackgroundColor: [ UIColor colorWithWhite:1.0 alpha: luma]];
    [pvController.view addSubview:Led_Operateur];
    [window addSubview:pvController.view];
    [window makeKeyAndVisible];
    @end

  • PNG premultiplied Alpha

    Has anyone come up with a solution for exporting PNGs with premultiplied alpha?
    SuperPNG used to do this in older versions by using the Photoshop alpha channel for transparency, but the new version appears to use layer transparency (much like Photoshop's PNG & Save For Web PNG export).
    The old version also appears to be incompatible with CS3+

    Hello Mr Cox,
    Thank You for your reply.
    Chris Cox wrote:
    PNGs are not premultiplied, and are saved as straight color/alpha from Photoshop.
    PNG does not support alpha channels, only transparency.
    Do you mean that PNGs dont support alpha channels at all? Or just in Photoshop? These two sentences are confusing.
    I understand that transparency and alpha channels are different thing, but I want to make files transparent and with alpha channels.
    If PNG is not premultiplied why video export has an option to premultiply PNG alpha with black/other color? Its really confusing!
    What I have been doing to this day:
    1) I have made a graphic "x" on transparent background.
    2) I selected the layer and ran action "Alpha Channel from Visible Layers".
    3) Then I have made full black layer under the graphic "x".
    4) Then used superPNG plugin to intergrate Alpha 1 channel(made by action) within png file.
    Programmer i work with says that the files I gave him worked like premultiplied alpha pngs, he wrote custom scripts and shaders and he says that these were ok. I am really confused now.
    So as You see I'm really torn right now! I have red parts of PNG speciffication, everything on wikipedia about PNGs and alpha composing etc. and some other articles around web and I feel just stupidier. Could You recommend me a good read about this topic or elaborate more? It could be a book or anything.
    Best regards,
    Peter

  • Transparency in Windows

    I have created a desktop Estimating program written in Java. One feature (measuring off drawings onscreen) requires a transparent window sitting over the drawing on which the user clicks the start and end points of the item to measure. I make the window transparent using the alpha component of the Color() class (e.g. setBackground(new Color(0,0,255,30))).
    This works perfectly when running on a single/multiple screen on a macintosh running OS X, but the window does not appear transparent on PC's running Windows.
    Can anybody tell me why and/or how to achieve this on both platforms

    I would not use a transparent window at all, but take a screen shot (using Robot) and display a window with the screen shot image as the background.
    edit: I vaguely remember there is a way to get translucent windows in Java. There may be an article in the news letter about it.
    edit: [http://java.sun.com/developer/technicalArticles/GUI/translucent_shaped_windows/]

  • Problem with multiple transparent JPanels

    Hi,
    I'm currently trying to implement some kind of message box that can fade in and out. This message box is a subclass of JComponent, the message it contains can be an arbitrary Swing-Component.
    The message container and the message itself have the same background color. When fading, the (partly transparent) colors of the of the container and the message are added, which I do not want.
    Here are two images to illustrate my problem:
    What I have: http://www.inf.tu-dresden.de/~ab023578/javaforum/reality.gif
    What I want: http://www.inf.tu-dresden.de/~ab023578/javaforum/wish.gif
    Here is the code:
    import java.awt.*;
    import javax.swing.*;
    public class Main {
        static float transparency = 0f;
        public static void main(String[] args) {
            JPanel jpBack = new JPanel() {
                protected void paintComponent(Graphics g) {
                    Graphics2D g2d = (Graphics2D)g;
                    g2d.clearRect(0, 0, getWidth(), getHeight());
                    g2d.setColor(getBackground());
                    AlphaComposite alpha = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, transparency);
                    g2d.setComposite(alpha);
                    g2d.fillRect(0, 0, getWidth(), getHeight());
            jpBack.setBackground(Color.WHITE);
            jpBack.setLayout(null);
            JPanel jpContainer = new JPanel();
            jpContainer.setBackground(Color.RED);
            jpContainer.setLayout(null);
            JPanel jpMessage = new JPanel();
            jpMessage.setBackground(Color.RED);
            JLabel jlMessage = new JLabel("MESSAGE");
            jpBack.add(jpContainer);
            jpContainer.add(jpMessage);
            jpMessage.add(jlMessage);
            jpContainer.setBounds(10, 10, 120, 100);
            jpMessage.setBounds(10, 10, 100, 50);
            JFrame frame = new JFrame();
            frame.setBounds(0, 0, 150, 150);
            frame.setBackground(Color.WHITE);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setContentPane(jpBack);
            frame.setVisible(true);
            for (double a = 0; true; a += 0.01D) {
                try {
                    Thread.sleep(10);
                catch (InterruptedException e) {}
                transparency = (float)Math.abs(Math.sin(a));
                jpBack.repaint();
    }I understand that the Porter-Duff-Rule SRC_OVER causes the container to be drawn over the message (or vice versa) and both of them over the background. I think what I need is a way to handle the whole jpContainer-Panel and all its subcomponents as a single source image. Is that possible?

    Thank you for your answer, Sarcommand. Unfortunately the test program I provided is a bit too simple as your solution works here but not for my original problem. :|
    Let me explain what I want to achieve and why.
    I'm writing a tool for algorithm visualisation. Currently I am dealing with a parsing algorithm (having compontents such as an automaton with an input tape, output tape and a stack). Those components (containers) can contain multiple JComponents (GraphicalObjects), which display a BufferedImage that can be altered during the animation.
    I want to create my message windows the same way. A container that contains GraphicalObjects (or, if necessary, any other Swing component). One GraphicalObject has a very limited field of responsibility: mereley displaying its information.
    Aligning the GraphicalObject is one of the container's responsibilities.
    What I'm currently trying to do is to put my GraphicalMessage into the center of a container, leaving an offset on the left/right/upper/lower side. This is why I need the same background color for both the GraphicalMessage and the MessageContainer, I don't want the user to see that there are actually two JComponents on top of each other.
    While I could use another approach for text messages I prefer this one as I would be able to fade arbitrary Containers and their GraphicalObjects .
    Here is the code:
    import java.awt.*;
    import javax.swing.*;
    import java.awt.image.BufferedImage;
    public class Main {
        static float transparency = 0f;
        public static void main(String[] args) {
            JPanel jpBack = new JPanel() {
                protected void paintComponent(Graphics g) {
                    Graphics2D g2d = (Graphics2D)g;
                    g2d.clearRect(0, 0, getWidth(), getHeight());
                    g2d.setColor(getBackground());
                    AlphaComposite alpha = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, transparency);
                    g2d.setComposite(alpha);
                    g2d.fillRect(0, 0, getWidth(), getHeight());
                    super.paintComponent(g);
            jpBack.setBackground(Color.WHITE);
            jpBack.setLayout(null);
            JPanel jpContainer = new JPanel();
            jpContainer.setBackground(Color.RED);
            jpContainer.setLayout(null);
            GraphicalMessage msg = new GraphicalMessage();
            jpBack.add(jpContainer);
            jpContainer.add(msg);
            jpContainer.setBounds(10, 10, 120, 100);
            msg.setBounds(10, 10, 160, 60);
            JFrame frame = new JFrame();
            frame.setBounds(0, 0, 150, 150);
            frame.setBackground(Color.WHITE);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setContentPane(jpBack);
            frame.setVisible(true);
            float stepSize = 0.01f;
            float step = stepSize;
            for (float a = 0; true; a += step) {
                try {
                    Thread.sleep(10);
                catch (InterruptedException e) {}
                if (a >= 1) {
                    step = -stepSize;
                    a -= stepSize;
                if (a <= 0) {
                    step = stepSize;
                    a += stepSize;
                    msg.updateInternalContent();
                    msg.redraw();
                transparency = a;
                jpBack.repaint();
    class GraphicalMessage extends JComponent {
        private String text;
        private Graphics2D ig2d;
        private BufferedImage image;
        public GraphicalMessage() {
            setLayout(null);
            image = new BufferedImage(100, 50, BufferedImage.TYPE_INT_ARGB);
            ig2d = image.createGraphics();
            ig2d.setColor(Color.BLACK);
            ig2d.setBackground(Color.RED);
            ig2d.setFont(new Font("Courier New", Font.BOLD, 20));
            updateInternalContent();
            redraw();
        public void paintComponent(Graphics g) {
            super.paintComponent(g);
            Graphics2D g2d = (Graphics2D)g;
            g2d.drawImage(image, 0, 0, null);
        public void redraw() {
            ig2d.clearRect(0, 0, image.getWidth(), image.getHeight());
            ig2d.drawString(text, 0, 20);
        public void updateInternalContent() {
            text = String.valueOf((int)(Math.random() * 10000));
    }A possibility to erase the text from the BufferedImage without having to draw a rectangle would help me as well.

  • Loading transparent swf through swf REFdn3005773759

    How to load a swf from another swf (I mean, from another AS code, not from html code), in order to be transparent? What properties should I have in loaded swf and how should I load it in order to be transparent?
    With word transparent, I mean, the color of the stage of the loaded swf must be transparent.
    Also, with this way of load, it is possible to play with “alpha” property?

    Hi, thank you for your reply.
    I did it, I work now with SWFLoader, but the stage still remains not transparent. Bellow is the mxml code of the loaded swf.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="598" height="200"  cornerRadius="20" >
      <mx:Image width="128" height="130" scaleContent="true" x="10" y="10">
        <mx:source>http://www.infodyn.com/images/info_invent_main_logo_300.jpg</mx:source>
      </mx:Image>
      <mx:Canvas x="146" y="10" width="444" height="180" backgroundColor="#646464" borderStyle="solid" borderThickness="3" borderColor="#CECECE">
        <mx:Label x="10" y="10" text="Info" fontFamily="Arial" fontSize="34" color="#BFBFBF"/>
        <mx:Label x="10" y="50" text="constructions" fontFamily="Arial" fontSize="18" color="#BFBFBF"/>
      </mx:Canvas>
    </mx:Application>
    I do not apply any background color (I think so). Note that the Canvas is a simple container that doesn't cover the whole stage!
    Here is the code where I load the swf:
              aboutInfo = new SWFLoader();
              aboutInfo.load("form_about_info.swf");
              aboutInfo.alpha=50;
              aboutInfo.addEventListener(MouseEvent.CLICK, HandleCloseAboutInfo);
              mxmlApp.addChild(aboutInfo);
    The swf is loaded and appeared succefully but the its stage is not transparent.
    The "alpha" also didn't work at all!
    I am working Adobe Flex Builder 3, the colors of the Stage of the loaded swf is the default blue color. Where does this color defined?
    Best regards
    Dn

Maybe you are looking for

  • SAP 8.82 para SAP 9.0, SAP 9.1

    Bom dia pessoal, Atualmente utilizo o SAP 8.82 na empresa, estava pensando mais para o começo do ano que vem fazer a migração para SAP 9.0 ou até o mesmo o SAP 9.1 (para esta versão tenho que esperar os add'ons nacionais terem versão funcionando). Po

  • USB Device Not Recognized on Windows 7 - USB mouse

    I have a 4 week old Inspiron 1545 with Windows 7 Home premium that has developed an error: USB errors while trying to install a Microsoft USB mouse on this Laptop.   Interestingly, my Microsoft USB Mouse installed perfectly first time and worked for

  • How to print envelopes hp laser jet pro mfp m225dw

    Can you please advise as to how I can print invitation style (4 3/8 x 5 2/4) envelopes on the Laser Jet Pro MFP M225dw?  Also, if my template is set up for a horizontal mail merge configuration, how should the envelope be inserted into the printer?

  • CS5 apps crash during launch in XP

    Hi, I just bought and installed CS5 Design Premium and can't get it to work, including Photoshop.  Most of the apps crash.  They crash during launch (splash screen) and therefore never get going.  Each app seems to display different error messages. 

  • How do create query in SAP?

    Dear Expert How do create query report in SAP? thanks for advance