Problem with Transparency using PixelGrabbar.

Well, im having a problem.
Im creating a basic 2d game and using images, since im using alot of images and they are being drawn alot i use a class i call "GameSprite", basically it retrieves the file needed and then keeps it in a pixel array, but transparency dosn't seem to work with it. The reason im using this is because say i have 100 images to draw, it dosn't need to keep using the drawImage method because it draws all at once using a set drawing area on which the pixel arrays are possitioned, for example this is the drawing;
public void drawGraphics(int xOffset, Graphics g, int yOffset)
        setImageConsumer();
        g.drawImage(drawingAreaImage, xOffset, yOffset, this);
.private synchronized void setImageConsumer()
        if(imageConsumer != null)
            imageConsumer.setPixels(0, 0, drawingAreaHeight, drawingAreaWidth, colorModel, drawingAreaSize, 0, drawingAreaHeight);
            imageConsumer.imageComplete(2);
    }Here is the basic's of what it does, note i used URL just for a test if you wanted to test (image still is uploaded there);
Image image = Toolkit.getDefaultToolkit().createImage(new URL("http://i166.photobucket.com/albums/u116/the_owner2007/testtrans.png"));
          image = setTransparency(image, new Color(255, 89, 255));
          ImageIcon icon = new ImageIcon(image);
          imageWidth = icon.getIconWidth();
          imageHeight = icon.getIconHeight();
          imagePixels = new int[imageWidth * imageHeight];
          PixelGrabber pixelgrabber = new PixelGrabber(image, 0, 0, imageWidth, imageHeight, imagePixels, 0, imageWidth);
             pixelgrabber.grabPixels();If i use for example a JLabel and set an ImageIcon as the image the transparency works, otherwise i can't figure it out.
Here is the setTransparency method;
public static Image setTransparency(Image im, Color color) {
        //the color to make transparent
        final int markerRGB = color.getRGB() & 0x00FFFFFF;
        ImageFilter filter = new RGBImageFilter() {
            public int filterRGB(int x, int y, int rgb) {
                if ((rgb & 0x00FFFFFF) == markerRGB) {
                    return markerRGB;
                } else {
                    return rgb;
        ImageProducer ip = new FilteredImageSource(im.getSource(), filter);
        return java.awt.Toolkit.getDefaultToolkit().createImage(ip);
If you can think of an alternative solution which would work better and possibly more efficiant please feel free to post that.
Thanks.

drawingAreaImage = component.createImage(this);Note that images created through this method are often times immutable. They will not respond to changes in the underlying ImageProducer. So "drawingAreaImage" is essentially a snapshot of whatever pixels "this" gave it.
An exception to this rule is if you use MemoryImageSource and set the animated flag,
int[] pixels = ....
MemoryImageSource imageProducer = ....
imageProducer.setAnimated(true);
drawingAreaImage = component.createImage(imageProducer);This time, whenever pixels is modified you can call imageProducer.newPixels() and the image will be updated.
On a side note, you are using a very old method of dealing with images (over a decade old since java 1.0 and 1.1). Are you doing this for compatability purposes? I would recommend you drop the ImageProducer/Consumer model entirely and stick with BufferedImages (which as been around since 1.2 and was the "upgrade" from the ImageProducer/Consumer model).

Similar Messages

  • Problem with BAPI_CUSTOMER_CREATEFROMDATA1 using JCo on IDES

    sorry, wrong board - i opened a new post
    Problem with BAPI_CUSTOMER_CREATEFROMDATA1 using JCo on IDES
    Hello everyone,
    we are working on a student project and would like to create customers (debtors) in an SAP IDES system.
    Using the ref-customer to copy from, and some personal-data below, we get the error message
    'Internal error: External no.assignment for reference customer/customer'
    We also tried with BAPI_CUSTOMER_GETINTNUMBER, and ACCOUNTGROUP ZINT (New Internet Customer, others won't work?). But CREATEFROMDATA1 takes no CustomerNo created this way, nor it wants to create one 'internal'?
    Any suggestions? Thanks a lot for your help,
    Greetings,
    Tobias Schmidbauer
              inParams = function.getImportParameterList().getStructure(
                   "PI_COPYREFERENCE");
              inParams.setValue("0000001000", "REF_CUSTMR");
              inParams.setValue("1000", "SALESORG");
              inParams.setValue("10", "DISTR_CHAN");
              inParams.setValue("00", "DIVISION");
              inParams =function.getImportParameterList().getStructure(
                   "PI_PERSONALDATA");
              inParams.setValue("Simpson", "LASTNAME");
              inParams.setValue("Homer", "FIRSTNAME");
              inParams.setValue("Jay","MIDDLENAME");
              inParams.setValue("Springfield", "CITY");
              inParams.setValue("DE", "LANGU_P");
              inParams.setValue("DE", "LANGUP_ISO");
              inParams.setValue("DE", "COUNTRY");
              inParams.setValue("EUR", "CURRENCY");
              inParams.setValue("12345", "POSTL_COD1");
    Message was edited by: Tobias Schmidbauer

    Hello Brian,
    Thanks for your pointer. Actually The customer's reference number i was providing in the PI_COPYREFERENCE structure was a sold-to party customer and it uses external customer number assignment. When i used "New Internet Customer" (that doesnt use external assignment by default) as customer's account group, the customer was created successfully and assigned customer number was returned.
    I want to ask now how could we give a customer number in the BAPI as i am unable to find any such column in any of the tables. (Customer number is an "out" parameter so it can only return the number of created customer). Secondly, how to chnage the external assignment property of a particular account group (like sold-to party). i.e, how could we change the account group configurations through SAP GUI??
    - Umair

  • Problems with transparent objects InDesign CS5.5

    Hi, I have troubles with using transparent objects in InDesign CS5.5 (Win7):
    If there is a transparent object in the background, is problem to move with another objects over this area. The object moving over the area with transparency "erases" objects below: texts, boxes.... They are not in fact erased, this effect tooks  only for the moment of movement and little bit longer. I have to wait for a while and after it is ok, but the work is slower and software is not working fast as I was got used in older versions.
    This trouble is not a problem of my computer (I have a new one with 16GB RAM, i5 processor), the same trouble with the same InDesign is on my laptop.
    Updates of InDesign are automatically installed.
    Can you give me some advice?
    Thanks, Petra
    this is screenshot - I moved with blue object - below you can see trails of "erasing"

    Yes, exactly, looks like glitch in the video. After I stop moving with object, everything is ok again. But not immidiatelly, there is a little delay (1 or 2 seconds). It doesn´t demage my work, it´s only glitch effect. But it delay me in work, it´s not pleasant to work with this glitch effects

  • Having a problem with creating/using a primary key on a view

    I have a problem with a primary key on a view
    I created the view and primary key as follows:
    CREATE OR REPLACE FORCE VIEW "MDD"."ROCK_LU" ("DESCRIPTION",
         UNIQUE ("DESCRIPTION") RELY DISABLE,
         CONSTRAINT "ROCK_LU_PK" PRIMARY KEY ("DESCRIPTION") RELY DISABLE) AS
    SELECT DESCRIPTION
    FROM MRMC_LU
    WHERE ROCK = 'T';
    The view with the primary key appears to have been created as there were no error messages. (The above was from the sql tab in sql developer.)
    When I try to create the foreign key on my mdd_hr table - I get an error
    /* hr_name - foreign key */
    ALTER TABLE mdd_hr add CONSTRAINT hr_name_fk FOREIGN KEY (hr_name) REFERENCES rock_lu(description);
    Error report:
    SQL Error: ORA-02270: no matching unique or primary key for this column-list.
    When I lookup the index in sql developer, rock_lu_pk is not there.
    All my other foreign keys work - but I don't understand what I am doing wrong with this one. Please help.
    glenn
    Background - as to why I want to use a view as a lookup table.
    The MRMC_LU table that the view is created from is structured like:
    DESCRIPTION - MINERAL - ROCK - MODIFIER - COMMODITY
    ANHYDRITE - T - T - T
    APLITE - T - - T
    GRAPHITE - T - - - T
    GREYWACKE - - T
    DESCRIPTION is a list of all names of minerals, rocks, modifiers and commodities. T is entered in each valid field. Often a description name is used for both a mineral and a rock or a mineral and a commodity or any other combination. Because this database is just starting up, it was more efficient to create one table that could be updated (and thereby automatically update the MINERAL_LU, ROCK_LU, MODIFIER_LY, COMMODITY_LU views) rather than create and maintain four separate but similar tables. A primary key cannot be generated for the MRMC_LU table as there are nulls in each column
    except DESCRIPTION.
    Perhaps there is a smarter way to do this?

    http://download-uk.oracle.com/docs/cd/B10501_01/server.920/a96540/statements_85a.htm#2065512
    You can specify constraints on views and object views. You define the constraint at the view level using the out_of_line_constraint clause. You define the constraint as part of column or attribute specification using the inline_constraint clause after the appropriate alias.
    Oracle does not enforce view constraints. However, operations on views are subject to the integrity constraints defined on the underlying base tables. This means that you can enforce constraints on views through constraints on base tables.
    Restrictions on View Constraints
    View constraints are a subset of table constraints and are subject to the following restrictions:
    You can specify only unique, primary key, and foreign key constraints on views. However, you can define the view using the WITH CHECK OPTION clause, which is equivalent to specifying a check constraint for the view.
    Because view constraints are not enforced directly, you cannot specify INITIALLY DEFERRED or DEFERRABLE.
    View constraints are supported only in DISABLE NOVALIDATE mode. You must specify the keywords DISABLE NOVALIDATE when you declare the view constraint, and you cannot specify any other mode.
    You cannot specify the using_index_clause, the exceptions_clause clause, or the ON DELETE clause of the references_clause.
    You cannot define view constraints on attributes of an object column.
    Rgds.

  • Problem with sendRedirect using relative URL in WebLogic 5.1 with SP7 & 8

    I patched to SP 7 (and also 8), and the request.sendRedirect() with relative
              URL failed. The browser simply displayed "404 - Page not found".
              This problem only happens in a cluster environment attached to a web server.
              SP6 or earlier does not have such problem.
              I noticed that the latest SP always formats the URL and returns it as a full
              absolute URL to the browser. The problem is it uses the Weblogic Server host
              URL where the request is processed (not the Web Server host URL) which is
              not visible to the internet.
              Is it possibly a bug in SP?
              

    I patched to SP 7 (and also 8), and the request.sendRedirect() with relative
              URL failed. The browser simply displayed "404 - Page not found".
              This problem only happens in a cluster environment attached to a web server.
              SP6 or earlier does not have such problem.
              I noticed that the latest SP always formats the URL and returns it as a full
              absolute URL to the browser. The problem is it uses the Weblogic Server host
              URL where the request is processed (not the Web Server host URL) which is
              not visible to the internet.
              Is it possibly a bug in SP?
              

  • Problems with text using Photoshop CC on Windows 8.1

    I am using Photoshop CC on Windows 8.1.  I get  flickering on the screen as described by others.  My main problem, however,  is that when I try to use the text tool the layer goes completely black and I cannot see what I am typing or edit the text.  I have tried updating my video card driver and my monitor driver.  I have deleted the font cache file, I have tried using Photoshop without plug ins (I use Nic plug ins).  The only thing that has worked is resetting the preferences by holding down alt+control+shift keys when starting photoshop.  This allows me to enter text normally on one photograph and one only.  Once I have completed that first photograph and load another I get the black layer.  I desperately need help.  If this continues I will have to cancel my membership as I was much better off using my Photoshop Elements 11 disc.
    Any help will be very gratefully appreciated...............help seems to be very difficult to come by Adobe you make it very difficult for your customers!

    Ok,I can appreciate that I may not have given enough information.  You state that without proper system information nobody can help, but I need to know what information is needed.  You also state that I should simply turn off hardware acceleration in the perfs.  What does that mean?  How do I do that? I have tried changing the GPU Drawing Mode to basic and it didn't work.  Is this what you mean?  You may be assuming a level of knowledge I do not have. From research I have done this seems to be a problem with windows 8.1 that Adobe have been aware of for about a year.  I have followed all the online advice I have been able to find but nothing seems to be working.
    Siren2110

  • Problems with navigation using JSF 1.0 RI

    I have a problem with faces in that navigation simply stops working. I have a page which have prev/next buttons on it, and a cancel button. Each button is of the form
    <h:form id="viewxxx">
    <h:commandButton value="XXX" styleClass="buttonInput" action="#{somebean.doSomeAction}"/>
    </h:form>
    The code behind the next/prev button action returns "success", the cancel returns an action string which returns the user to the previous screen.
    After clicking on prev/next a few times one of two possible things happen:-
    (1) the navigation stops working (all buttons do nothing)
    (2) or after pressing a button a few times the navigation starts to work.
    I tried to simplify things to find out if my backing code was causing the problem. I included a very simple button:-
    <h:form id="view_c_getridofme">
         <h:commandButton value="Test" styleClass="buttonInput" action="success"/>
    </h:form>
    and after clicking this a few time it also breaks the navigation. So I suspect something strange is going on inside the Faces implementation.
    I checked the faces-config.xml and this is correct:
    <!-- Stay on View for page next/prev -->
    <navigation-case>
    <from-outcome>success</from-outcome>
    <to-view-id>/viewcorr.jsp</to-view-id>
    <redirect />
    </navigation-case>
    I tried (albeit briefly) MyFaces 1.0.3 and the navigation does not break although it does present some other issues for me. My preference would be to use Sun's JavaFaces implementation if possible.
    Can anyone shed light on this - why this may be happening?

    I experienced the same problem while re-submitting to the same page about 15 times via a command button (a list page that would get updated with every new submit).
    After having turned JSF logging on I discovered that my stylesheet (!) was interpreted by JSF as a Faces view (because of the /faces/-mapping before it) and that this caused the list page to be (incorrectly) added up towards the maximum of 15 views in the session. After 15 reloads JSF would remove the list page from view, re-create it, and I experienced the same problems as you described in the top post - no navigation worked.
    My stylesheet used to be:
    <link rel="STYLESHEET" type="text/css" href="../../css/foo.css">
    ... which kept the /faces/ mapping from the page containing the css reference, and made it look like a faces view to JSF.
    When I switched to:
    <link rel="STYLESHEET" type="text/css" href="/css/foo.css">
    ... the problem disappeared.
    Hope that helps all of you that have this problem. It certainly took me quite a while to figure it out!
    Mattias L

  • Problem with transparent image

    Hi everyone,
    I'm having problem with embedding transparent image to PDF. Thin border appears  when viewing the document with Adobe Reader, Adobe Acrobat Pro and even with Foxit Reader. But there are no such border in the image.
    After some experiments I found that this border appears on the edge of fully transparent black and fully opaque white areas. And changing fully transparent black color to fully transparent white removes the border.
    Is this an expected behaviour of Adobe Reader or is it a bug? Could anyone explain in which other cases such artifacts may appear?
    Thanks in advance.

    It is related to the source from which PDF document is generated. Anyway if writing the image as is without pattern the problem still remains.
    Here is example without pattern http://www.filefactory.com/file/3g711cx94n1b/n/testImage_pdf

  • Problem with scrolling using my touchpad with the new Firefox update

    I just updated Firefox to 9.o.1, I run Windows 7 and I'm using a HP G62 Notebook PC. Ever since I have updated, I can no longer scroll on webpages using my touchpad. If I use an external mouse, I have no problems. I have also not had any problems with other applications, so I assume that this problem is related to the new update. Is there anything that I can do to fix this now, or will I have to wait for the next update?

    I just updated Firefox to 9.o.1, I run Windows 7 and I'm using a HP G62 Notebook PC. Ever since I have updated, I can no longer scroll on webpages using my touchpad. If I use an external mouse, I have no problems. I have also not had any problems with other applications, so I assume that this problem is related to the new update. Is there anything that I can do to fix this now, or will I have to wait for the next update?

  • Problems with output using html2fo function

    Hello,
    I have a problem with output when using html2fo function.
    My sample xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <RTECODE>
    <![CDATA[
    <table border="1">
    <tr>
    <td>row 1, cell 1</td>
    <td>row 1, cell 2</td>
    </tr>
    <tr>
    <td>row 2, cell 1</td>
    <td>row 2, cell 2</td>
    </tr>
    </table>
    ]]>
    </RTECODE>
    Can anybody explain why the rtf template output is different in pdf, rtf, excel ? It looks ok only in pdf.
    Thanks in advance.

    Check these
    http://docs.oracle.com/cd/E23943_01/bi.1111/e22254/create_rtf_tmpl.htm#CHDCEEIJ
    https://blogs.oracle.com/xmlpublisher/entry/html_in_xml_support
    If helps mark
    Edited by: Srini VEERAVALLI on Feb 25, 2013 10:04 AM

  • Problems with "new" used iPhone

    hey guys,
    i have a problem with my new iphone. i bought an iphone on ebay and now i want to use ist with my t-mobile-sim-card, but it doesn't work. First it worked, but i found out, that the iPhone was jailbreaked, so I updated it to firmware 3.1.3 to delete this jailbreak. but it doesn't work now with my simcard (it's not a prepaid) and itunes says, that the card isn't compatible. maybe someone can help me... it makes me very angry. i spend so much time to get the money for the iphone and now this ****...

    When you installed the new 3.1.3 firmware you locked the phone back with att. Previously being jailbroken and unlocked allows you to use other sim cards but now that you updated the firmware its not possible. What you can do is wait for someone to come out with a way to jailbreak the new firmware and unlock it yourself.

  • Problems with Restoring using Migration Assistant

    Hi
    I'm trying to restore my files from time machine using Migration Assistant. I keep getting this message which I don't understand. Can anyone advice ? Thanks.
    +NTFS-3G could not mount /dev/disk1 at Volumes/Untitled because the following problem occured: Error reading bootsector: Input/Output error. Failed to mount 'dev/rdisk1':Input/output error NTFS is either inconsitent or there is a hardware fault or its a SoftRAID/ FakeRAID hardware. In the first case run chdksk/f on Windows then reboot into Windows. The usage of the /f parameter is very important! f the device is a SoftRAID/ FakeRAID thenfirst activate it and mount a different device under the /dev/mapper/ directory, Ie.g. /dev/mapper/nvidia+eahaabcc1). Please see the 'dmraid' documentation for more details.+
    Jojos

    I don't do Windoze, but that looks like you've backed-up a virtual machine via Time Machine, and there's a problem with it.
    First question: why are you restoring, and why are you using +MIgration Assistant?+
    If you want to restore everything from your backups, do a full system restore, per #14 in [Time Machine - Frequently Asked Questions|http://web.me.com/pondini/Time_Machine/FAQ.html] (or use the link in *User Tips* at the top of this forum).
    Most folks exclude those from Time Machine, and back them up separately.
    Your best bet is to skip the contents of the folder they're in while running +MIgration Assistant+, then restore everything else in that folder selectively, via the "Star Wars" display. You may or may not be able to restore the vm file(s), but at least you should be able to get everything else that way.

  • I have problems with my used iphone.

    Hello there. I recently purchased a used iphone from a friend. However he took the sim card out as he needed it for his other phone.
    I have tried inserting my new at&t sim card, as well as a new blank one but when i want to activate the phone itunes keeps saying "there is a problem with your iphone". What can i do in this situation? Thanks.

    Yes, you should go back to AT&T and let them know the SIM card is for an iphone. Only iphone SIM cards will work in the iphone. AT&T sells SIM cards that will work in many different phones, but only the SIM card designed for the iphone will work in it correctly.

  • Problems with transparency settings

    Hello everyone
    I'm having some problems with the transparency settings of my u3d model when I import it in a new Acrobat sheet. I defined an animation with some transparencies in 3D Toolkit and when I import the whole animation into Acrobat 3D the transparency settings disappear, the whole model can be seen. Any ideas why?
    Thank you
    XR

    Xavier,
    I would recommend visiting Right Hemisphere's "Deep Exploration" forum for an answer to this.
    http://www.righthemisphere.com/forum/forumdisplay.php?s=&forumid=16

  • Problems with FullScreen using OSMF 1.5

    Hello. Sorry for my English first of all. =)
    I have interesting and specific problem with osmf. I'm using osmf to play playlist. Here is source code:
    public class VideoPlayer extends SpriteVisualElement
    private var mediaPlayerSprite:MediaPlayerSprite;
    public function VideoPlayer()
    super();
    mediaPlayerSprite = new MediaPlayerSprite();
    mediaPlayerSprite.width = width;
    mediaPlayerSprite.height = height;
    mediaPlayerSprite.scaleMode = ScaleMode.LETTERBOX;
    mediaPlayerSprite.mediaPlayer.autoPlay = true;
    mediaPlayerSprite.mediaPlayer.addEventListener(TimeEvent.COMPLETE, onMediaComplete);
    mediaPlayerSprite.mediaPlayer.addEventListener(MediaErrorEvent.MEDIA_ERROR, onMediaError);
    mediaPlayerSprite.mediaPlayer.addEventListener(MediaPlayerStateChangeEvent.MEDIA_PLAYER_ST ATE_CHANGE, onMediaPlayerStateChange);
    addChild(mediaPlayerSprite);
    public function set playlist(playlist:Vector.<String>):void
    var serialElement:SerialElement = new SerialElement();
    var videoElement:LightweightVideoElement;
    for each(var url:String in playlist)
    videoElement = new LightweightVideoElement();
    videoElement.smoothing = true;
    videoElement.resource = new URLResource(url);
    serialElement.addChild(videoElement);
    mediaPlayerSprite.media = serialElement;
    When flash player is in fullscreen mode and first video file is finished next video starts to play, but there is no picture. If I close fullscreen mode and then go fullscreen again, everything is all right. I've met this problem only in such installation: LG 37LE5300 connected to Acer Veriton N282G with Nvidia NG ION video card via original HDMI 1.3 cable. Windows 7 32 bit, Nvidia display drivers 257,29. In another combination everything works fine.
    So what can be a problem?

    Hi,
    Interesting bug indeed. Can you please log a bug with the details you provided on our bug system, http://bugs.adobe.com/jira/browse/FM so we can better track this issue? It will be also useful if you will give us also the code used for switching to full screen.
    Thanks,
    Gelu

Maybe you are looking for