Create a new Buffered Image using Raster and ColorModel

Sorry , I crosspost this message,because no one reply.
Recently,I write a programme combining C++ and Java .
The C++ part create a array containing image data in form of BI_RGB and biBitCount==32.
The java part create a image using Raster and ColorModel like this:
   static int[] data ;
   DataBuffer db = new DataBufferInt(data, data.length);
   WritableRaster wr =Raster.createPackedRaster(db, 1024,768, 32, null);
   ColorModel cm = new DirectColorModel(32,0xff0000,0x00ff00,0x0000ff);
   img = new BufferedImage(cm, wr, false, null);But it doesn't work .
it report this:
Exception in thread "main" java.lang.IllegalArgumentException: Raster sun.awt.im
age.SunWritableRaster@dff3a2 is incompatible with ColorModel DirectColorModel: r
mask=ff0000 gmask=ff00 bmask=ff amask=0
at java.awt.image.BufferedImage.<init>(BufferedImage.java:549)
at monitor.test.Perform2.main(Perform2.java:39)

hey epico
compiles & runs 4 me
see javadocs for SinglePixelPackedSampleModel
import java.awt.image.*;
public class Tester {
DataBuffer db;
WritableRaster wr;
ColorModel cm;
BufferedImage im;
int[] data;
int[] masks;
int w = 768;
int h = 576;
  public Tester() {
    data = new int[768*576];
    for (int i = 0;i < w*h ;i++ ) {
      data[i] = 0;
    masks = new int[3];
    masks[0] = 0xff0000;
    masks[1] = 0x00ff00;
    masks[2] = 0x0000ff;
    db = new DataBufferInt(data,data.length);
    SinglePixelPackedSampleModel sm = new SinglePixelPackedSampleModel(DataBuffer.TYPE_INT,w,h,masks);
    cm = new DirectColorModel(32,0xff0000,0x00ff00,0x0000ff);
    wr = Raster.createWritableRaster(sm,db,null);
    im = new BufferedImage(cm,wr,false,null);
  public static void main(String[] args) {
    Tester tester1 = new Tester();
}

Similar Messages

  • Problem in creating client side PDF with image using flex and AlivePD

    I need a favor I am creating client side PDF with image using flex and AlivePDF for a web based application. Images have been generated on that pdf but it is creating problem for large size images as half of the image disappeared from that pdf.I am taking the image inside a canvas . How do i control my images so that they come fit on that pdf file for any image size that i take.
    Thanks in advance
    Atishay

    I am having a similar and more serious problem. It takes a
    long time to execute, but even attaching a small image balloons the
    pdf to 6MB plus. After a few images it gets up to 20MB. These are
    100k jpeg files being attached. The resulting PDF is too large to
    email or process effectively. Does anyone know how to reduce
    size/processing?

  • I want to create a new itunes account for myself and leave the current one for my wife. Is that possible?

    Ok. My wife uses itunes for her work and she has asked me to open my own account without erasing the one we currently have so that our music can be seperate. I have my own pc and sync to my own itunes program but our purchases still download to the same account and the money comes from the same account. Can I open a new account and not lose everything? Thanks!

    I hope this isn't too wordy but I want to be as clear and explicit as I can for you.
    You can't transfer purchases from one account to another account. Apple doesn't allow it.
    You can continue to use your daughter's Apple ID in order to continue to use the apps that you purchased with her ID and you will need to use her ID and password any time that you want to update those apps. What you do want to avoid is having to download any of those purchased apps again on any other devices - if you create a new Apple ID.
    If you create a new ID and then you sign into her ID in order to download a previous purchase-  you will lock yourself out of the new ID for 90 days and there is nothing that you can do about it. So as long as you do NOT download any past purchases with her ID - you will not lock yourself out of the new ID. So you can keep using the apps that were bought with her ID, you can also update those apps using her ID (you have to sign into her account in Settings>Store) but you can't download past purchases without messing things up with your new ID.
    When you download a past purchase with a different ID - you associate that device with the different ID for 90 days. This is one way that Apple hopes to cut down on pirating of apps - friends using other friends IDs in order to download apps without patting for them.
    This explains it in a little more detail.
    http://support.apple.com/kb/ht4627
    The bottom line is that you can create a new ID, still use her ID - judiciously - but you really want to avoid downloading past purchases with her ID. Transfer all of those purchases into iTunes so that if something happens and you need the purchased content again, you can just sync it again rather than downloading it.
    This explains transferring purchases.
    http://support.apple.com/kb/HT1848

  • How to create a new document type for PO and Requisition

    Hi All
    Can you please help me with the steps of creating a new document type for PO and PR. Also the steps that need to be update for the procure pay cycle to work properly. 
    Once the document type is been created. I want to create the PO referecing the new PR and PO document type.I am new in MM.
    Thanks, Ros

    Hi,
    1. You can create new PR and PO docu types at the following path:
    For PR docu type:
    First you need to create number range for docu type or you can use existing number range also. The path for creation of no. range is
    SPRO>Materials Management->Purchasing->Purchase Requisition->Define Number Ranges
    Then create PR docu type at below path and assign no. range to PR docu type here only
    SPRO>Materials Management->Purchasing->Purchase Requisition->Define Document Types
    For PO docu type:
    Follow same procedure as mentioned for PR docu type. Path is
    SPRO>Materials Management->Purchasing->Purchase Order->Define Number Ranges
    SPRO>Materials Management>Purchasing->Purchase Order->Define Document Types
    If you want to create PO referencing new PR docu type, link the PR docu type to PO docu type at below path:
    SPRO>Materials Management->Purchasing->Purchase Requisition->Define Document Types--> Link purchase requisition - document type
    Regards
    Chetan

  • Problem creating a new row when using tabbed regions

    I am new to JHeadstart and ADF and have been using the evaluation version of JHeadstart (in JDev 11.1.1.3) to judge its efficacy for a new significantly-sized application. As part of that evaluation I have created a small application (you can do this with HR schema using say the Departments table) with a single entity and VO. On JHeadstart I have then placed some of the fields into multiple Item regions within a Tabbed region on the same page and below the Group (layout style Table, Table Overflow Style below With Splitter). Existing rows display fine and I can view the data on the separate tabs.
    However, if I try to create a row, I can fill in the data on the main region, but if I fill in data on the first tabbed region I cannot switch to the next tab without an error being generated.
    e.g. using Departments - fill in DepartmentId and DepartmentName on main region, fill in ManagerId on first tabbed region and try to switch to second tabbed region to fill in LocationId:
    Missing mandatory attributes for a row with key null of type HRModule.DepartmentsView1
    Attribute DepartmentId in HRModule.DepartmentsView1 is required.
    Attribute DepartmentName in HRModule.DepartmentsView1 is required.
    If you save, then you can navigate.
    You can also demonstrate something similar (different error message but probably the same root cause) on the myJHSTutorial demo. If you navigate to an employee off the regions page and try and create a new employee (using the '+' button below the 'Employees' label), then the tabs are not refreshed and any attempt to change the tabs results in an error
    Failed to validate a row with key oracle.jbo.Key[999 ] in HRModule.EmployeesView3
    Attribute Salary in HRModule.EmployeesView3 is required.
    Salary must be between 6000 and 12000 for this job.
    The JHS devguide does not help. Any thoughts? I can send the HR sample if you wish.

    OK, I was able to reproduce this. The problem is that when you switch tabs, a partial page request is send to the server which does not include the items filled in the table row itself, hence these items are not updated in the underlying view object row.
    Solution is to have a partial trigger at the table or group level listening to tab events. We will add that to the next release, but you can also apply the fix yourself by adding the following lines to the stackedRegionContainer.vm template:
    #if (${JHS.current.pageComponent.tableLayout} && !(${JHS.current.pageComponent.hasOverflowInline}))
    ## when creating a new row in a table, and using overflow right/below, when switching overflow tabs
    ## the items filled in the table itself must also be processed as part of JSF model update phase, to
    ## prevent required item error when clicking another tab in overflow area
    ## we can enforce this by making the whole group listen to tab events
    #ADD_CUR_GROUP_PARTIAL_TRIGGER("#REGION_ID()Tabs")
    #end
    Add these lines just before the line starting with
    <af:${elemName}
    Steven Davelaar,
    JHeadstart team.

  • Problems creating a new folder when using webmail

    Hi, has anyone else out there encountered problems when trying to create a new folder when using webmail ?
    It just seems to create a new folder called 'New Folder' and misses out the step that would normally allow you to rename it to a title of your choice.
    A whole list of folders called 'New Folder' is about as useful as an ashtray on a motorbike.
    It did used to work as I've used it many times in the past.....but then so did a lot of things before the 'new' and 'improved' version of BT Mail came along.
    Any help or suggestions gratefully received (apart from the obvious solution, switch to a mail client).
    Maybe it needs flagging to the 'techies'......they must be really busy trying to sort out all the so called teething problems.
    Solved!
    Go to Solution.

    What should happen is that when you click on the + for add a new folder a box should appear, somewhere amongst the folder list. (The list is in alphabetical order so if you have a number of folders previous to the letter N it maybe out of view ) .
    The box will have the text " New folder-X," ( see below for the explantion for the -X ) you then delete the text, type in the name you want, hit enter and there it is.
    If you don't notice the box, possibly because it's off screen further down the list, you then open and close the list, or log out the next time you view the list it, or they, are simply named New folder.
    So you now have umpteen " New folders ", here's how to rename them.
    Place your cursor on the word New Folder in your folder list, you will see a little box appear with" New folder-X,"  x being the number of the new folders you have created., eg -0, -1, -2 etc.
    Then double click on it, you should then get a larger box with New folder-X.
    Delete the text in the box, type in the name you want for the new folder, hit enter there's you newly named folder.

  • Oracle 10g - Creating a new Application Server using standalone OC4J 10g

    I have some issues in creating a new app. server using standalone oc4j 10g 10.1.3 instance. After I created the app. server instance, I tested the connection and it says connection refused. I used the userid as oc4jadmin and the password as welcome. I am getting a message connection refused. For connection, I used the default hostname "localhost" and I didn't mention anything in the URL path.

    Thanks Steve..
    Here is what I am trying to do.. I want to create a new app server instance (i.e.) stand alone oc4j server, where I can deploy my web service and run a test.
    Oracle JDeveloper 10g:
    Under Connection Navigator, Application Server --
    1) Right click to 'Create New Application Server Connection'
    2) Connection type as 'Standalone OC4J 10 g 10.1.3',
    3) Username ==> oc4jadmin, Password ==>welcome, checked the Deploy password.
    4) Hostname: localhost RMI Port: 23791
    URL path: <<blank>>
    5) Test Connection ==> getting a error message...
    Error while getting remote MBeanServer for url: ormi://localhost:23791/default:
    Error reading application-client descriptor: Error communicating with server: Connection refused: connect; nested exception is:
         javax.naming.CommunicationException: Connection refused: connect [Root exception is java.net.ConnectException: Connection refused: connect]
    Any input you can provide would be of great help.

  • How do I create a new document in Photoshop CC and have it 300 dpi?

    How do I create a new document in Photoshop CC and have it 300 dpi? I am doing digital scrapbooking and need to have my layout in Photoshop 12 x 12 so it is a scrapbook page and 300 dpi and I hope this doesn't sound stupid but I don't even know what dpi means.
    Thank you

    File>New
    Set preset to print or US Paper
    (typing width and height values will change the preset to custom)
    Set width to 12 inches
    set height to 12 inches
    set ppi to 300 (should already be this if you used the print preset)
    Click OK

  • Select images using keywords and view slideshow...using what?

    I have a library full of jpeg images that were created either using the export command from LR or by editing in Br/Ps and then savedAs jpeg. Now I want to watch slideshows on my monitor (30" Apple HD Cinema Display). Now I have the following Dilemma:
    - I can start a Search Command in Bridge and narrow it down to exactly the images I want in my slide show. Then from the View menu select Slideshow. The IQ is terrible. True sharpness is only revealed when zooming in 100% but that's not the idea of a slide show.
    - I can also use Apple OS's (Tiger) built-in slide show and start it from the finder. That way I get high quality, fast dissolving slide shows, that are unfortunately limited to the first 100 images in the Finder view. However, in the Finder I cannot select my images using keywords and IPTC info.
    So could there be a simple solution to the problems I'm running into with Bridge?
    Or could there be a nice viewer for MacOS that features the search option I want and renders good images and dissolve option?
    Thanks.

    @Ann Shelbourne: Thanks for your reply. I'm hesitant to upgrade to CS4 at this point. That would mean my only option is to look for a jpeg viewer other than Adobe that can select images based on keywords and iptc data. Would you know one that does?
    @Ramon G Castaneda: I apologise for being an inexperienced forum visitor. I will take note of your advice and follow the posting instructions.
    I checked FAQ's both here and at Adobe, as well as the knowledge base. No results. I also searched the forum.
    My setup: MPB dual core Intel, 2GB RAM, 30GB free disk space. Adobe CS3, just updated to Bridge version 2.1.1.9. No improvement at all so far. According to Ann only CS4 will solve the problem.
    Thank you.

  • How to create a new excel file using Excel Destination when Destination file not exists.

    how to create a new excel file using Excel Destination when Destination file not exists.

    Just need to set an expression for excel connectionstring and set delay validation to true and it will create it on the fly.
    The expression should return the full path with dynamic filename in each case.
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Created three new users without Apple IDs and they can't log into either of my Macbook Pro or Mac Mini running Mountain Lion.

    I have created three new users without Apple IDs and they can't log into either of my Macbook Pro or Mac Mini running Mountain Lion.  These accounts are for my kids and originally were setup with parental controls and time constraints.  Thinking this was the problem I removed the time constraints, removed the parental controls, deleted and re-added them, and made them standard users.  I have reinstalled, used disk utility to repair permissions, and made them admins.   Any help is appreciated.

    Users don't need Apple ID's. That's not the issue. Have you tried repairing permissions their accounts?
    http://osxdaily.com/2011/11/15/repair-user-permissions-in-mac-os-x-lion/
    Repairing User Permissions in OS X Lion
    You’ll need to reboot to perform this, and then use the same resetpassword utility that is used to change passwords in Lion, but instead choosing a hidden option.
    When you use the Disk Utility app and Repair Permissions — it doesn’t actually repair the permission settings on folders and files in your Home folder where your documents and personal applications reside.
    In Lion, there is an additional Repair Permissions application utility hidden away. This tool is located inside boot Repair Utilities. Here’s how to access it.
    Restart Lion and hold down the Command and R keys.    You will boot into the Repair Utilities screen. On top, in the Menu Bar click the Utilities item then select Terminal.
    In the Terminal window, type resetpassword and hit Return.
    The Password reset utility launches, but you’re not going to reset the password. Instead, click on the icon for your Mac’s hard drive at the top. From the drop-down below it, select the user account where you are having issues.
    At the bottom of the window, you’ll see an area labeled ‘Reset Home Directory Permissions and ACLs’. Click the Reset button there.
    The reset process takes a couple of minutes. When it’s done, quit the programs you’ve opened and restart your Mac. Notice that ‘Spotlight’ starts re-indexing immediately.

  • How can I create a new entry without using LOV for foreign keys.

    Referring to TUHRA sample application based on HR database schema. JDeveloper 10.1.3.0.4
    How can I create a new employee without using LOV for the foreign key "job_id".
    On the first page I would like to choose the job_title from adf read-only table.
    After clicking on the "create new employee button" a creation form appears in which the job_id field is set with previous selection.
    Regards M.Winkler
    Edited by: user3541283 on 06.10.2008 03:44
    Edited by: user3541283 on 06.10.2008 03:50

    Hi,
    usually the foreign key is only set if the VO you select is dependent from a master. If e.g. you have DepartmentsVO1 that has an EmployeeVO3 as its nested VO, then creating a new instance of employees automatically add the foreign key. If you add EmployeesVO1, which is not dependent to DepartmensVO1, then the foreign key is not set. So if this is the case in THURA (keep in mind that this is not an Oracle demo but a sample used in a book about ADF) then all you need is to take the independent VO when building the new employee form.
    Frank

  • How can I create accurate decimal dimensions when creating a new document or using the art board in Illustrator CS6? When I type in a number with a decimal, it automatically rounds the number up.

    How can I create accurate decimal dimensions when creating a new document or using the art board in Illustrator CS6? When I type in a number with a decimal, it automatically rounds the number up.

    For my part you are welcome, sdowers.
    Unfortunately, the uncertainty arising from the rounding has been up several times here in this forum.
    I just came to remember a warning that needs to be given:
    The rounding of the representation of a numerical value may be harmless in itself, but if you use it for any operation that changes the value, such as multiplication or whatever, things will go wrong because the operation will be made on the basis of the rounded value instead of the true value. So, as in your first case in post #2, 39.625 rounded to 39.63 will become 79.26 instead of 79.25.

  • To create a new file in application server and transfer data to ti

    i am doing the following where i have to create a new file in application server and transfer data to tht file from an internal table.but its saying file cant be opened.the path i am giving to parameter p_prefil is /tmp/prachi.txt.
    wats the prob..can anyone help.
    DATA:L_WA_FINAL TYPE TY_FINAL,
         l_wa_string type string.
    OPEN DATASET P_PREFIL FOR OUTPUT IN text mode encoding default.
    if sy-subrc <> 0.
    write: ' file cannot be opened'.
    stop.
    endif.
    LOOP AT P_I_FINAL INTO L_WA_FINAL.
    move l_wa_final to l_wa_string.
    TRANSFER l_wa_string TO P_PREFIL.
    if sy-subrc <> 0.
    write: 'file can not be written'.
    stop.
    endif.
    clear l_wa_final.
    ENDLOOP.
    CLOSE DATASET P_PREFIL.
    if sy-subrc <> 0.
    write: ' file cannot be closed'.
    stop.
    endif.

    DATA:L_WA_FINAL TYPE TY_FINAL,
    l_wa_string type string.
    OPEN DATASET P_PREFIL FOR OUTPUT IN text mode encoding default.
    if sy-subrc ne 0.
    write: ' file cannot be opened'.
    stop.
    endif.
    LOOP AT P_I_FINAL INTO L_WA_FINAL.
    move l_wa_final to l_wa_string.
    TRANSFER l_wa_string TO P_PREFIL.
    write: 'file can not be written'.
    clear l_wa_final.
    ENDLOOP.
    CLOSE DATASET P_PREFIL.
    if sy-subrc ne  0.
    write: ' file cannot be closed'.
    stop.
    endif.

  • I am creating a slideshow with elements using photos and videos but the video sound doesnt play?

    I am creating a slideshow with elements using photos and videos but the video sound doesnt play?

     Hello jive
         I am playing it back in the slideshow editor/setting up part of
    programme where you determine photos/video to be included gaps between
    slides, music to play etc This goes through each phot and when comes
    to a video the background sound doesnt play, I am using windows 7 and
    elements 10.
         regards gins51

Maybe you are looking for

  • How does swap in Linux work?

    I thought I knew, but I am not so sure anymore. I have 4GB ram and 2GB swap (I know it works because I even have hibernation), fast SATA HDD and Core 2 Duo. On occasions I run opera (~1GB), and two virtual machines. As soon as RAM utilization goes in

  • Import/Export Data Form

    Hi, i copy my production planning application (ver 9.3.1)to a new one for testing usage. I use the FormDefUtil utility to manage the DataForm. Can i recreate the folder structure that contains the data form automatically? Infact i have a lot of folde

  • Again same problem with quotes, but cant find a proper sol

    I've gone thru so many posts, but cud'nt really find a solution. someone please help me here. I have a single insert function, which does all inserts for many tables, so cant use ppdstmt.setString(1, "value"). I am trying to insert some data into SQL

  • SCCM 2012 Reporting Services Website

    Can someone point me to a how-to for configuring the Reporting Services website?  The URL for our 2007 server is http://<server name>/SMSReporting_<site code>, but I can't figure out how to access the reporting website for SCCM 2012.

  • Apex_web_service.make_request throws ORA-29273: HTTP request failed. How to get the soap fault XML?

    I am trying to call a web service using apex_web_service.make_request function. It works fine when all the parameters are correct. However, when something is wrong in the request XML, it throws an exception instead of returning the soap:fault message