Error when creating BufferedImage with IndexColorModel from a byte array.

Hi, I have a 1-dimentional byte array and an IndexColorTable, and I can't figure out how to combine the 2 into an BufferedImage without unnecessary copying/reallocating of the image buffer.
The color model I have is:
int [] cmap = new int [numColors];
cmap[i++] = 0xffa0f000;  /etc.
new IndexColorModel(8, 22, cmap, 0, true,  transparentIndex,  DataBuffer.TYPE_BYTE );Thanks for your help
-Ben
Ps.
I've was looking at some example code (http://javaalmanac.com/egs/java.awt.image/Mandelbrot2.html?l=rel), and can't figure out how to go from the color model they're using to the one I have (the 8 bit one specified above). When I replace the 4bit colormodel in the code below with the 8bit color model specified above, I get the following error:
[java] java.lang.IllegalArgumentException: Raster ByteInterleavedRaster: width = 5120 height = 3520 #numDataElements 1 dataOff[0] = 0 is incompatible with ColorModel IndexColorModel: #pixelBits = 8 numComponents = 4 color space = java.awt.color.ICC_ColorSpace@c51355 transparency = 2 transIndex = 22 has alpha = true isAlphaPre = false
[java] at java.awt.image.BufferedImage.<init>(BufferedImage.java:613)
Code:
byte[] pixelArray = (byte[]) getData_CHAR();                
int width = 5120;
int height = 3520;
int numbytes = width*height;
//create DataBuffer using byte buffer of pixel data.
DataBuffer dataBuffer = new DataBufferByte(pixelArray, numbytes, 0);
//prepare a sample model that specifies a storage 8-bits of pixel data in an 8-bit data element
int bitMasks[] = new int[]{0xf};
SinglePixelPackedSampleModel sampleModel = new SinglePixelPackedSampleModel(DataBuffer.TYPE_BYTE, width, height, bitMasks);
//create a raster using the sample model and data buffer
WritableRaster writableRaster = Raster.createWritableRaster(sampleModel, dataBuffer, new Point(0,0));
//generate 16-color model
byte[] r = new byte[16];
byte[] g = new byte[16];
byte[] b = new byte[16];
r[0] = 0; g[0] = 0; b[0] = 0;
r[1] = 0; g[1] = 0; b[1] = (byte)192;
r[2] = 0; g[2] = 0; b[2] = (byte)255;
r[3] = 0; g[3] = (byte)192; b[3] = 0;
r[4] = 0; g[4] = (byte)255; b[4] = 0;
r[5] = 0; g[5] = (byte)192; b[5] = (byte)192;
r[6] = 0; g[6] = (byte)255; b[6] = (byte)255;
r[7] = (byte)192; g[7] = 0; b[7] = 0;
r[8] = (byte)255; g[8] = 0; b[8] = 0;
r[9] = (byte)192; g[9] = 0; b[9] = (byte)192;
r[10] = (byte)255; g[10] = 0; b[10] = (byte)255;
r[11] = (byte)192; g[11] = (byte)192; b[11] = 0;
r[12] = (byte)255; g[12] = (byte)255; b[12] = 0;
r[13] = (byte)80; g[13] = (byte)80; b[13] = (byte)80;
r[14] = (byte)192; g[14] = (byte)192; b[14] = (byte)192;
r[15] = (byte)255; g[15] = (byte)255; b[15] = (byte)255;
//create buffered image    
ColorModel colorModel = new IndexColorModel(4, 16, r, g, b);
BufferedImage image = new BufferedImage(colorModel, writableRaster, false, null);Message was edited by:
ben_weisburd
Message was edited by:
ben_weisburd

I had the same problem too.
anyone found the solution for this problem?
thanks
Bruno Rabino
When I try to make a MD-form, where the base-table for the detail contains a column with a BLOB-datatype. I get following error when I finish creation of the form.
Error: Exception from wwv_generate_component.build_procedure (WWV-01821)
Error creating module: ORA-01403: no data found (WWV-16042)
When I use the table with the BLOB as master or in a form, it works fine.
Has anyone else experienced this problem? Or knows a way to fix or work around it. Thanks in advance.
Portal version: 3.0.6.6.5
null

Similar Messages

  • Error when create JLabel with ImageIcon from server

    Hi!
    When I run applet that contain JLabel(String, ImageIcon, int) from server I get follow error: "java.security.AccessControlException: access denied (java.io.FilePermission middle-1.gif read)". .gif-file and .class-file are located in the same directory. From local disk this applet run successfully. Who can help me?
    Thanks.

    Look at the docs for Applet class, and use getImage()
    from there. Running in browser is quite different
    than to run locally...
    Better yet to pack image and classes in jar file,
    and read from there with getResourceAsStream()
    ( search forums, there were examples )

  • Error when creating link to documents from material

    Hi all,
    while creating the purchase order the error message "Error when creating link to documents from material 61260224060" is displayed.
    why this error message is displayed.?
    Regards,
    GaneshRaja

    Hello Ganesh
    Please check material master - view 'Bases data 2'.
    There is checkbox 'No link'. You can activate this checkbox if you are not storing any drawing/designe docuemnt for this material.
    Try to do this and check out again.....
    If this helps you in resolving your issue, i would appreciate if you reward the answer with suitable points.
    Best Regards
    Avinash

  • Error when creating index with parallel option on very large table

    I am getting a
    "7:15:52 AM ORA-00600: internal error code, arguments: [kxfqupp_bad_cvl], [7940], [6], [0], [], [], [], []"
    error when creating an index with parallel option. Which is strange because this has not been a problem until now. We just hit 60 million rows in a 45 column table, and I wonder if we've hit a bug.
    Version 10.2.0.4
    O/S Linux
    As a test I removed the parallel option and several of the indexes were created with no problem, but many still threw the same error... Strange. Do I need a patch update of some kind?

    This is most certainly a bug.
    From metalink it looks like bug 4695511 - fixed in 10.2.0.4.1

  • Error when creating PO with reference to PR

    Hello Expert,
    When creating PO with reference to PR I encountered with one error i.e. system is taking into consideration one to one relation of PR line item to PO line item. For example: I have created PR with one line item for XYZ value and with reference to PR line item I am creating one PO but with two line items in PO that means I am splitting PR value into two line items in PO, 1st line item with zero tax and second one is with tax.
    So there is one PR line item but in PO I am creating two line items with reference to single PR item. In this case system is giving error saying Item 001 WBS element XXXXXXXXXX budget exceeded. message no: BP604. However if I create single line item in PO then it wont give any error.
    Please suggest any customization setting is done for such kind of behavior of the system.
    Thanks
    Shyam

    Hi,
    SAP creates the requisition with item category "U" even in case of cross-company (intercompany) purchase requisition.
    When converting it to PO the item category becomes blank - as I tried and I got no error message.
    Please check your settings under SPRO > MM > Purchasing > Purchase Order > Define Document Types (V_T161). You will see (if standard settings have not been changed) that NB requisition type with "U" item category is allowed for NB purchase order type with " " (empty) item category.
    Regards,
    Csaba

  • Error when creating MD with a blob on detail

    When I try to make a MD-form, where the base-table for the detail contains a column with a BLOB-datatype. I get following error when I finish creation of the form.
    Error: Exception from wwv_generate_component.build_procedure (WWV-01821)
    Error creating module: ORA-01403: no data found (WWV-16042)
    When I use the table with the BLOB as master or in a form, it works fine.
    Has anyone else experienced this problem? Or knows a way to fix or work around it. Thanks in advance.
    Portal version: 3.0.6.6.5
    null

    I had the same problem too.
    anyone found the solution for this problem?
    thanks
    Bruno Rabino
    When I try to make a MD-form, where the base-table for the detail contains a column with a BLOB-datatype. I get following error when I finish creation of the form.
    Error: Exception from wwv_generate_component.build_procedure (WWV-01821)
    Error creating module: ORA-01403: no data found (WWV-16042)
    When I use the table with the BLOB as master or in a form, it works fine.
    Has anyone else experienced this problem? Or knows a way to fix or work around it. Thanks in advance.
    Portal version: 3.0.6.6.5
    null

  • Error when creating a Proxy Object from WSDL

    Hi,
    when creating a proxy object in abap based on the [WSDL|http://download.mapandguide.com/EN/dev/xserver/XLocate-1.6.0.3.wsdl] i get the error 'Incorrect value: Unknown Type Referencens0:ArrayOfString'.
    1- Is there a conflict with the type 'String' that's also a type in ABAP
    <complexType name="ArrayOfString">
      <sequence>
      <element name="String" type="xsd:string" minOccurs="0" maxOccurs="unbounded" nillable="true" />
      </sequence>
      </complexType>
    2- Is it a name space problem?
    xmlns:ns0="http://types.xlocate.xserver.ptvag.com"
    type="ns0:ArrayOfString"
    3- Something else?
    Please Help!
    Thank
    Fouad

    Hi Isaias,
    we are working with this versions:
    SAP_BASIS     700     0015     SAPKB70015     SAP Basiskomponente
    SAP_AP                     700     0013     SAPKNA7013     SAP Application Platform
    We are not working with developer studio, only with the regular tools of the abap development workbench Transaction SE80.
    Thanks,
    Fouad

  • Error when creating connection with SSO Authentication mode

    Hi All,
    when I am creating the connection with Authentication Mode as SSO, I get error "Unable to connect to SAP BW Server User abc has no RFC Authorization for function group SYST".
    When I am craeting connection with specific user id and Password it works fine.
    Pls. let me know whats the problem with creating connection with SSO.
    System Info: BOXIR.3.1 Sp3, SAP 7.1
    Regards,
    Nisha

    Yes, I have installed Integration Kit, and configured the SSO.
    I am able to login into designer with Authentication as SAP.
    But, the Problem is with connection creation with SSo authentication mode.
    Is there any property or role needs to be defined for the universe designer Group or user, so that SSO is allowed in authentication mode?
    Regards,
    Nisha

  • ORA-28113 policy predicate has error when created VO with some tables

    When I created a VO with just SQL statements(no EO), if the sql statements included some special tables or views such as:
    hz_locations
    oe_order_headers_v
    when testing the validation of the sql statement, I encountered the following errors:
    SQL Query Error Message: ORA-28113 policy predicate has error
    and I can't continue to create this VO.
    Does JDeveloper have some special rules to check some tables or views behind the scenes?
    I used the apps/apps to connect and the following sql to create the VO:
    select state from hz_locations
    Can anyone give some help?
    Many thanks in advance!

    Hi prasannaj,
    Thanks for your prompt response.
    I find the solution and would like to share with all.
    As I guessed, this is related to the policy.Execute the following sql:
    select * from dba_policies where object_name ='hz_locations'
    you'll find the point.
    So I run policy manager with oracle database client, and find the policy related to the table 'hz_locations' , and disable this policy.
    At this time, with the original sql:
    select * from hz_locaitons
    created VO and everything goes fine and passed the validation.
    But in fact I wondered if this is the best workaround for this issues.
    If anyone has the same problem, you can refer to my solution.
    If you have better solution, also let me know.
    Thanks!

  • Got error when creating a standby DB from rman:  no backup or copy... Why?

    We try to create standby database from a production DB on another server (10.2.0.4). The RMAN backup is in the nfs file system which is also mounted to the target server (the DR box). So, the access path for the rman backup is the same look from primary DB server and DR DB server. I started the RMAN run:
    RMAN> RUN
    2> {
    3> ALLOCATE AUXILIARY CHANNEL aux1 DEVICE TYPE DISK;
    4> ALLOCATE AUXILIARY CHANNEL aux2 DEVICE TYPE DISK;
    5> DUPLICATE TARGET DATABASE for standby
    6> nofilenamecheck
    7> dorecover;
    8> }
    9>
    10> exit
    using target database control file instead of recovery catalog
    allocated channel: aux1
    channel aux1: sid=582 devtype=DISK
    allocated channel: aux2
    channel aux2: sid=584 devtype=DISK
    Starting Duplicate Db at 21-JUN-12
    contents of Memory Script:
    set until scn 12198261770353;
    restore clone standby controlfile;
    sql clone 'alter database mount standby database';
    executing Memory Script
    executing command: SET until clause
    Starting restore at 21-JUN-12
    released channel: aux1
    released channel: aux2
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03002: failure of Duplicate Db command at 06/21/2012 16:33:36
    RMAN-03015: error occurred in stored script Memory Script
    RMAN-06026: some targets not found - aborting restore
    RMAN-06024: no backup or copy of the control file found to restore
    ===========================================================================
    The backups should have controlfile. There is rman show all display:
    RMAN configuration parameters are:
    CONFIGURE RETENTION POLICY TO REDUNDANCY 1;
    CONFIGURE BACKUP OPTIMIZATION OFF;
    CONFIGURE DEFAULT DEVICE TYPE TO DISK;
    CONFIGURE CONTROLFILE AUTOBACKUP ON;
    CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/backup/inbound/online/controlfile_auto%F';
    CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET;
    CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1;
    CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1;
    CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT '/backup/inbound/online/%d_%T_%t_%s';
    CONFIGURE MAXSETSIZE TO UNLIMITED;
    CONFIGURE ENCRYPTION FOR DATABASE OFF;
    CONFIGURE ENCRYPTION ALGORITHM 'AES128';
    CONFIGURE ARCHIVELOG DELETION POLICY TO NONE;
    CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/backup/inbound/online/snapcf_inbound.f';
    Why and how to fix? Thanks for help!

    Here is the list of command:
    RMAN> list backup of controlfile ;
    List of Backup Sets
    ===================
    BS Key Type LV Size Device Type Elapsed Time Completion Time
    5518 Full 4.57M DISK 00:00:07 17-JUN-12
    BP Key: 5518 Status: AVAILABLE Compressed: NO Tag: TAG20120617T035926
    Piece Name: /backup/inbound/online/controlfile_autoc-2080040856-20120617-00
    Control File Included: Ckp SCN: 12197994840698 Ckp time: 17-JUN-12
    BS Key Type LV Size Device Type Elapsed Time Completion Time
    5522 Full 4.57M DISK 00:00:00 18-JUN-12
    BP Key: 5522 Status: AVAILABLE Compressed: NO Tag: TAG20120618T010158
    Piece Name: /backup/inbound/online/controlfile_autoc-2080040856-20120618-00
    Control File Included: Ckp SCN: 12198041382572 Ckp time: 18-JUN-12
    BS Key Type LV Size Device Type Elapsed Time Completion Time
    5526 Full 4.57M DISK 00:00:01 19-JUN-12
    BP Key: 5526 Status: AVAILABLE Compressed: NO Tag: TAG20120619T010352
    Piece Name: /backup/inbound/online/controlfile_autoc-2080040856-20120619-00
    Control File Included: Ckp SCN: 12198090424606 Ckp time: 19-JUN-12
    BS Key Type LV Size Device Type Elapsed Time Completion Time
    5530 Full 4.57M DISK 00:00:02 20-JUN-12
    BP Key: 5530 Status: AVAILABLE Compressed: NO Tag: TAG20120620T010304
    Piece Name: /backup/inbound/online/controlfile_autoc-2080040856-20120620-00
    Control File Included: Ckp SCN: 12198146424201 Ckp time: 20-JUN-12
    BS Key Type LV Size Device Type Elapsed Time Completion Time
    5534 Full 4.57M DISK 00:00:02 21-JUN-12
    BP Key: 5534 Status: AVAILABLE Compressed: NO Tag: TAG20120621T010357
    Piece Name: /backup/inbound/online/controlfile_autoc-2080040856-20120621-00
    Control File Included: Ckp SCN: 12198210334547 Ckp time: 21-JUN-12
    ==================================================================
    I tried to catalog the controlfile:
    RMAN> catalog controlfilecopy '/backup/inbound/online/controlfile_autoc-2080040856-20120621-00';
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03009: failure of catalog command on default channel at 06/21/2012 17:24:32
    ORA-19563: control file header validation failed for file /backup/inbound/online/controlfile_autoc-2080040856-20120621-00
    ====================================================================
    We have level 1 backup everyday, except Sunday. I have level 0 backup on Sunday. I alos tried the metalink note RMAN Duplicate For Standby Fails with Rman-06024: No Backup Or Copy Of The Control File Found To Restore [ID 466321.1]. It does not work.
    Thanks for help!

  • Strange error when creating an iCal event from Addressbook

    Hi all,
    When I drag/drop an Addressbook vCard on a specific date/time in iCal, iCal automatically creates a 1hour event, e.g "Meeting with CompanyName", iCal also inserts the mail address of the Contact person, but the Location (physical Address) is missing, even if its in the Addressbook vCard. Can someone explain whats wrong?
    I have a few Addressbook plug-ins: BT Google Directions, BT Google Maps etc. Can this be causing the error?
    Thanks for your help! / Paul

    I really don't think it's the page since web pages can't "manipulate" built-in iOS views. At least I can't find an example where it actually does work the way it should and used to work in iOS 7. Here's another example: http://www.premierleague.com/en-gb/matchday/matches.html?paramClubId=ALL&paramCo mp_100=true&view=.dateSeason (click the Calendar icon)
    Also tried it now on a iPhone with iOS 8. There it still works because there's a Done button in the upper right corner which can close the calendar view, so I'd say this is definitely a iPad/iOS8 bug.

  • Error when creating table with nested table of object

    Dear all,
    I tried to create a table that contains nested table of an object but got an error:
    create or replace type some_obj is object (
      a number, b blob
      4  /
    Type created.
    create or replace type some_type is table of some_obj;
      2  /
    Type created.
    SQL>
    create table test (obj_id number, temp some_type) nested table temp store as nes_tab;
    Table created.
    SQL> create table test (obj_id number, temp some_type) nested table temp store as nes_tab
    ERROR at line 1:
    ORA-00955: name is already used by an existing objectWhat is causing the error? How can I troubleshoot this?
    best regards,
    Val

    Valerie Debonair wrote:
    never mind, I put "/" at the end of the create statement that makes executing create table twice....Yep. If I'm writing a script, I tend to just stick with "/" for all my statements, including the SQL as well as the DDL, otherwise it can be confusing whether a ";" is needed or not or whether it will try and execute it twice like you found.
    "/" works for all.

  • Error when creating Z*BSP component from BSP_WD_CMPWB

    Hi,
    I have created a BSP component with one view. But, alwayz it is saying one message : "View is not loaded into runtime repository".
    Can you please tell me, what I need to do to remove this message?
    Thanks,
    Sandeep

    Hi Sandeep,
               The message will come up as long as you have not assigned the view to any of the window/view sets in the repository. You can of course safely ignore it if it's not meant to be(for example interface views that are meant to be used as popups)
    Regards,
    Arun Prakash

  • Creating object with names from a String Array

    Hi all,
    This might be a stupid question .. I have the following method:
         public OptionInputPanel(Option newO, String [] parameter){
              super(new BorderLayout());
              o = newO;
              for (int i = 0; i < parameter.length; i++){
                   testB = BorderFactory.createTitledBorder(parameter);
                   JFormattedTextField parameter[i] = new JFormattedTextField(); // problem
    as you can see I would like to name my text fields with the strings that I have in the parameters array so that I can get their values later on. How can I do it?
    Thanks for help
    Stan

                   JFormattedTextField parameter[i] = new JFormattedTextField(); // problemYou are declare an array of size i, and assigning a single JFormattedTextField to it.
         public OptionInputPanel(Option newO, String [] parameter){
              super(new BorderLayout());
              o = newO;
              JFormattedTextField params[ i ] = new JFormattedTextField();
              for (int i = 0; i < parameter.length; i++){
                   testB = BorderFactory.createTitledBorder(parameter[ i ]);
                   param[ i ] = new JFormattedTextField(parameter[ i ]);
    Resources for Beginners
    Sun's basic Java tutorial
    Sun's New To Java Center. Includes an overview of what Java is, instructions for setting up Java, an intro to programming (that includes links to the above tutorial or to parts of it), quizzes, a list of resources, and info on certification and courses.
    http://javaalmanac.com. A couple dozen code examples that supplement The Java Developers Almanac.
    jGuru. A general Java resource site. Includes FAQs, forums, courses, more.
    JavaRanch. To quote the tagline on their homepage: "a friendly place for Java greenhorns." FAQs, forums (moderated, I believe), sample code, all kinds of goodies for newbies. From what I've heard, they live up to the "friendly" claim.
    Bruce Eckel's Thinking in Java (Available online.)
    Joshua Bloch's Effective Java
    Bert Bates and Kathy Sierra's Head First Java. This one has been getting a lot of very positive comments lately.

  • Error when creating delivery referenced by STO doc. from vl10b

    Hi All,
    We are getting an error when creating delivery as background from vl10b t-code referenced by STO. The error message " Global official numbering: Input parameter incomplete " .
    Please give me a hand for this problem.
    Thanks in advance for your helps.
    Regards,

    Hi,
    One of the possibilities of the error could be
    if i_BuKrs eq space or i_BuPla eq space or i_PostDate eq space.
    i.e Compnay code or Posting date ro Business Place is Blank.
    Please Take help of ABAPEr to resolve the isssue
    Thanks
    Murtuza

Maybe you are looking for