Search Results

Search found 34 results on 2 pages for 'loadimage'.

Page 1/2 | 1 2  | Next Page >

  • argv[1] loadImage problem xcode 3.2 and snow leopard

    - by ignacionieto
    Hi Im on mac snow leopard and test these code on xcode3.2 of the Learning OpenCV everything works fine but the image doesnt appear and in the windows. I had try to understand searching for two days what does argv[1] means, but Im still no clear. Im a newbie en C++. I had the image in the same directory where the main.cpp is #include <OpenCV/cv.h> #include <OpenCV/highgui.h> int main(int argc, char** argv) { IplImage* interest_img; CvRect interest_rect; if( argc == 7 && ((interest_img= cvLoadImage( argv[1],1) ) != 0 )) { A more easy example is here: http://books.google.cl/books?id=seAgiOfu2EIC&pg=PA17&lpg=PA17&dq=cvLoadImage%28argv[1]&source=bl&ots=hRJ5bhkAOf&sig=gyYAqZBnS6lCCXJz9Fz7vzOsF-U&hl=es&ei=dvdvS-fWG8eWtgePy_WCBg&sa=X&oi=book_result&ct=result&resnum=6&ved=0CBwQ6AEwBTgK#v=onepage&q=cvLoadImage%28argv[1]&f=false both I have test it but they dont work. Please help me

    Read the article

  • how to load an image to a grid using pygame, instead of just using a fill color?

    - by yao jiang
    I am trying to create a "map of a city" using pygame. I want to be able to put images of buildings in specific grid coords rather than just filling them in with a color. This is how I am creating this map grid: def clear(): for r in range(rows): for c in range(rows): if r%3 == 1 and c%3 == 1: color = brown; grid[r][c] = 1; else: color = white; grid[r][c] = 0; pygame.draw.rect(screen, color, [(margin+width)*c+margin, (margin+height)*r+margin, width, height]) pygame.display.flip(); Now how do I put images of buildings in those brown colored grids at those specific locations? I've tried some of the samples online but can't seem to get them to work. Any help is appreciated. If anyone have a good source for free sprites that I can use for pygame, please let me know. Thanks!

    Read the article

  • ArgumentError: Error #2015: Invalid BitmapData.

    - by numerical25
    I am having problems loading a bitmapData. I am getting the following error Engine Init //trace loadimage//trace ArgumentError: Error #2015: Invalid BitmapData. at flash.display::BitmapData() Below is my code. it appears it happens after the trace loadimage package com.objects { import flash.display.Sprite; import flash.display.BitmapData; import flash.display.Bitmap; import flash.geom.Point; import flash.geom.Rectangle; import flash.display.Loader; import flash.net.URLRequest; import flash.net.*; import flash.events.*; import flash.display.LoaderInfo; public class gameObject extends Sprite { protected var w:Number; protected var h:Number; protected var image:BitmapData; protected var canvas:Bitmap; protected var px:Number; protected var py:Number; public function gameObject():void { init(); } private function init():void { } public function loadImage(imageDir:String, w:Number, h:Number, px:Number, py:Number):void { this.w = w; this.y = y; this.px = px; this.py = py; trace("loadimage"); var loader:Loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE,imageComplete); loader.load(new URLRequest(imageDir)); } private function imageComplete(e:Event):void { var loader:LoaderInfo = LoaderInfo(e.target); image = Bitmap(loader.content).bitmapData; drawImage(); } private function drawImage():void { var tilePoint:Point = new Point(0,0); var tileRect = new Rectangle(py,px,w,h); trace(loader.content); var canvasData:BitmapData = new BitmapData(w,h); trace("got canvas data"); canvasData.copyPixels(image,tileRect,tilePoint); trace("copied pixels"); canvas = new Bitmap(canvasData); } } } And my call the the method is like so balls = new Array(); balls[0] = new gameObject(); balls[0].loadImage("com/images/ball.gif", 15,15,0,0); When I trace the Loader.content, below is what shows Engine Init loadimage [object Bitmap] ArgumentError: Error #2015: Invalid BitmapData. at flash.display::BitmapData()

    Read the article

  • How do you keep code with continuations/callbacks readable?

    - by Heinzi
    Summary: Are there some well-established best-practice patterns that I can follow to keep my code readable in spite of using asynchronous code and callbacks? I'm using a JavaScript library that does a lot of stuff asynchronously and heavily relies on callbacks. It seems that writing a simple "load A, load B, ..." method becomes quite complicated and hard to follow using this pattern. Let me give a (contrived) example. Let's say I want to load a bunch of images (asynchronously) from a remote web server. In C#/async, I'd write something like this: disableStartButton(); foreach (myData in myRepository) { var result = await LoadImageAsync("http://my/server/GetImage?" + myData.Id); if (result.Success) { myData.Image = result.Data; } else { write("error loading Image " + myData.Id); return; } } write("success"); enableStartButton(); The code layout follows the "flow of events": First, the start button is disabled, then the images are loaded (await ensures that the UI stays responsive) and then the start button is enabled again. In JavaScript, using callbacks, I came up with this: disableStartButton(); var count = myRepository.length; function loadImage(i) { if (i >= count) { write("success"); enableStartButton(); return; } myData = myRepository[i]; LoadImageAsync("http://my/server/GetImage?" + myData.Id, function(success, data) { if (success) { myData.Image = data; } else { write("error loading image " + myData.Id); return; } loadImage(i+1); } ); } loadImage(0); I think the drawbacks are obvious: I had to rework the loop into a recursive call, the code that's supposed to be executed in the end is somewhere in the middle of the function, the code starting the download (loadImage(0)) is at the very bottom, and it's generally much harder to read and follow. It's ugly and I don't like it. I'm sure that I'm not the first one to encounter this problem, so my question is: Are there some well-established best-practice patterns that I can follow to keep my code readable in spite of using asynchronous code and callbacks?

    Read the article

  • Using NSThread to solve waiting for image from URL on the iPhone

    - by james.ingham
    So I have the following code in a method which I want to set a UIImageView image to that of one from an online source: [NSThread detachNewThreadSelector:@selector(loadImage) toTarget:self withObject:nil]; Then in the method called by the thread I have this: - (void) loadImage { NSURL *url = [NSURL URLWithString:logoPath]; // logoPath is an NSString with path details NSData *data = [NSData dataWithContentsOfURL:url]; logoImage.image = [UIImage imageWithData:data]; } This works great however I get many warnings within the Debugger Console along the lines of: 2010-05-10 14:30:14.052 ProjectTitle[2930:633f] * _NSAutoreleaseNoPool(): Object 0x169d30 of class NSHTTPURLResponse autoreleased with no pool in place - just leaking This occurs many times each time I call the new thread and then eventually, under no pattern, after calling a few of these threads I get the classic 'EXC_BAD_ACCESS' run-time error. I understand that this is happening because I'm not retaining the object but how can I solve this with the code in 'loadImage' shown above? Thanks

    Read the article

  • How do I fix "java.lang.OutOfMemoryError at sun.misc.Unsafe.allocateMemory(Native Method)"?

    - by Jephir
    I'm making a Java application that uses the Slick library to load images. However, on some computers, I get this error when trying to run the program: Exception in thread "main" java.lang.OutOfMemoryError at sun.misc.Unsafe.allocateMemory(Native Method) at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:99) at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:288) at org.lwjgl.BufferUtils.createByteBuffer(BufferUtils.java:60) at org.newdawn.slick.opengl.PNGImageData.loadImage(PNGImageData.java:692) at org.newdawn.slick.opengl.CompositeImageData.loadImage(CompositeImageData.java:62) at org.newdawn.slick.opengl.CompositeImageData.loadImage(CompositeImageData.java:43) My VM options are: -Djava.library.path=lib -Xms1024M -Xmx1024M -XX:PermSize=256M -XX:MaxPermSize=256M The program loads a few large images (1024 x 768 resolution) at the beginning. Any help to solve this problem would be greatly appreciated.

    Read the article

  • How to load an image in matlab from java

    - by Ian
    Basically I am trying to create a little program that will allow me to make calls in matlab from a jave GUI It's mainly going to be used for image manipulation and deblurring but I am struggling to find a way that will effectively give me full matlab control from the java end I am hoping to have it work like so: { //create matlab execution call String loadImage = " image1 = imread ('imageOnComputer.jpg'); "; //send instruction to matlab and save the path to it so java can //use the newly created variable resultingVariablePath = java.sendInstructionToMatlab(loadImage); //display on the screen java.displayImage(resultingVariablePath); } Basically I am just trying to find out if there is a plugin for matlab (or some java package) that will grant you (pretty much) full control over matlab.

    Read the article

  • How to Enable JavaScript file API in IE8 [closed]

    - by saeed
    i have developed a web application in asp.net , there is a page in this project which user should choose a file in picture format (jpeg,jpg,bmp,...) and i want to preview image in the page but i don't want to post file to server i want to handle it in client i have done it with java scripts functions via file API but it only works in IE9 but most of costumers use IE8 the reason is that IE8 doesn't support file API is there any way to make IE8 upgrade or some patches in code behind i mean that check if the browser is IE and not support file API call a function which upgrades IE8 to IE9 automatically. i don't want to ask user to do it in message i want to do it programmatic !! even if it is possible install a special patch that is required for file API because customers thought it is a bug in my application and their computer knowledge is low what am i supposed to do with this? i also use Async File Upload Ajax Control But it post the file to server any way with ajax solution and http handler but java scripts do it all in client browser!!! following script checks the browser supports API or not <script> if (window.File && window.FileReader && window.FileList && window.Blob) document.write("<b>File API supported.</b>"); else document.write('<i>File API not supported by this browser.</i>'); </script> following scripts do the read and Load Image function readfile(e1) { var filename = e1.target.files[0]; var fr = new FileReader(); fr.onload = readerHandler; fr.readAsText(filename); } HTML code: <input type="file" id="getimage"> <fieldset><legend>Your image here</legend> <div id="imgstore"></div> </fieldset> JavaScript code: <script> function imageHandler(e2) { var store = document.getElementById('imgstore'); store.innerHTML='<img src="' + e2.target.result +'">'; } function loadimage(e1) { var filename = e1.target.files[0]; var fr = new FileReader(); fr.onload = imageHandler; fr.readAsDataURL(filename); } window.onload=function() { var x = document.getElementById("filebrowsed"); x.addEventListener('change', readfile, false); var y = document.getElementById("getimage"); y.addEventListener('change', loadimage, false); } </script>

    Read the article

  • Problem creating levels using inherited classes/polymorphism

    - by Adam
    I'm trying to write my level classes by having a base class that each level class inherits from...The base class uses pure virtual functions. My base class is only going to be used as a vector that'll have the inherited level classes pushed onto it...This is what my code looks like at the moment, I've tried various things and get the same result (segmentation fault). //level.h class Level { protected: Mix_Music *music; SDL_Surface *background; SDL_Surface *background2; vector<Enemy> enemy; bool loaded; int time; public: Level(); virtual ~Level(); int bgX, bgY; int bg2X, bg2Y; int width, height; virtual void load(); virtual void unload(); virtual void update(); virtual void draw(); }; //level.cpp Level::Level() { bgX = 0; bgY = 0; bg2X = 0; bg2Y = 0; width = 2048; height = 480; loaded = false; time = 0; } Level::~Level() { } //virtual functions are empty... I'm not sure exactly what I'm supposed to include in the inherited class structure, but this is what I have at the moment... //level1.h class Level1: public Level { public: Level1(); ~Level1(); void load(); void unload(); void update(); void draw(); }; //level1.cpp Level1::Level1() { } Level1::~Level1() { enemy.clear(); Mix_FreeMusic(music); SDL_FreeSurface(background); SDL_FreeSurface(background2); music = NULL; background = NULL; background2 = NULL; Mix_CloseAudio(); } void Level1::load() { music = Mix_LoadMUS("music/song1.xm"); background = loadImage("image/background.png"); background2 = loadImage("image/background2.png"); Mix_OpenAudio(48000, MIX_DEFAULT_FORMAT, 2, 4096); Mix_PlayMusic(music, -1); } void Level1::unload() { } //functions have level-specific code in them... Right now for testing purposes, I just have the main loop call Level1 level1; and use the functions, but when I run the game I get a segmentation fault. This is the first time I've tried writing inherited classes, so I know I'm doing something wrong, but I can't seem to figure out what exactly.

    Read the article

  • Flash As3 Loader Problem

    - by Hadar
    Hi iam trying to load a few external jpegs in As3. It works fine locally in Flash, but it dosen't work at all ion my server. My app also loads a youtube video simultaneously. function drawResult(index,videoID,song_title,thumbnail:String=null) { var theClip:resultRowClip=new resultRowClip (); _clip.addChild(theClip); myArray[index] = new Array(videoID,theClip); theClip.y=0+(43*(index-1)); theClip.rowText.text = song_title; theClip.rowBack.visible = false; if (thumbnail != ""){ theClip.tHolder.visible=true; loadImage(thumbnail,index); } } function loadImage(url:String,index):void { //this.myClip.myText.text += "load image"; // Set properties on my Loader object var imageLoader:Loader = new Loader(); imageLoader.load(new URLRequest(url)); imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, function (evt:Event){imageLoaded(evt,index)}); } function imageLoaded(evt,id):void { //this.myClip.myText.text += "id : evt : " + evt.status; // Load Image var image:Bitmap = new Bitmap(evt.target.content.bitmapData); myArray[id][1].tHolder.addChild(image); myArray[id][1].tHolder.width=myArray[id][1].tHolder.width*0.35; myArray[id][1].tHolder.height=myArray[id][1].tHolder.height*0.35; } Does anyone knows what the problem is ? ** I added two Evenet listeners from io Error : imageLoader.addEventListener(IOErrorEvent.IO_ERROR,ioErrorHandler); imageLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,ioErrorHandler); This is the function for handling the errors : private function ioErrorHandler(event:IOErrorEvent):void { this.myClip.myText.text +=("ioErrorHandler: " + event); } anyway, I got no errors... I also tried to move the listeners before imageLoader.load but it's still the same...no errors and no data loaded.. I change my code to patrikS suggestion : function loadImage(url:String,index):void { //this.myClip.myText.text += "load image"; // Set properties on my Loader object //if (index != 1) return; var imageLoader:Loader = new Loader(); imageLoader.name = index.toString(); //myArray[index][1].addChild(imageLoader); //imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, function (evt:Event){imageLoaded(evt,index)}); imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,completeHandler); imageLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,ioErrorHandler); imageLoader.load(new URLRequest(url)); } My current completeHandler function(tnx patrikS ) : private function completeHandler(evt:Event):void{ //this.myClip.myText.text += "id : evt : " + evt.status; // Load Image trace("evt target loader name : "+ evt.target.loader.name ); evt.target.removeEventListener(Event.COMPLETE, completeHandler ); var image:Bitmap = new Bitmap(evt.target.content.bitmapData); myArray[evt.target.loader.name][1].tHolder.addChild(image); myArray[evt.target.loader.name][1].tHolder.width=myArray[evt.target.loader.name][1].tHolder.width*0.35; myArray[evt.target.loader.name][1].tHolder.height=myArray[evt.target.loader.name][1].tHolder.height*0.35; //trace (hadar.y + "Y / X" + hadar.x); } It still work only on flash IDE and dosent work on any browser...

    Read the article

  • RubyQT QGraphicsview scale images to fit window

    - by shadowskill
    I'm trying to make an image scale inside of a QGraphicsView and having zero success. I did find this C++ question with what seemed to be the same problem:http://stackoverflow.com/questions/2489754/qgraphicsview-scrolling-and-image-scaling-cropping I borrowed the approach of overriding the drawback/foreground. However when I run the script I'm greeted with a method_missing error: method_missing: undefined method drawPixmap for #<Qt::Painter:0x7ff11eb9b088> QPaintDevice: Cannot destroy paint device that is being painted What should I be doing to get the QGraphicsView to behave the way I want? class Imageview < Qt::GraphicsView attr_reader :pixmap def initialize(parent=nil) # @parent=parent super() @pixmap=pixmap Qt::MetaObject.connectSlotsByName(self) end def loadimage(pixmap) @pixmap=pixmap end def drawForeground(painter, rect) #size=event.size() #item= self.items()[0] #Qt::GraphicsPixmapItem.new #pixmap=@pixmap #painter=Qt::Painter.new [email protected](Qt::Size.new(rect.width,rect.height),Qt::KeepAspectRatio, Qt::SmoothTransformation) # painter.begin(self) painter.drawPixmap(rect,sized,Qt::Rect.new(0.0, 0.0, sized.width,sized.height)) #painter.end() # item.setPixmap(sized) #painter.end self.centerOn(1.0,1.0) #item.scale() # item.setTransformationMode(Qt::FastTransformation) # self.fitInView(item) end def updateSceneRect painter=Qt::Painter.new() drawForeground(painter,self.sceneRect) end end app=Qt::Application.new(ARGV) #grview=Imageview.new pic=Qt::Pixmap.new('pic') grview=Imageview.new() grview.loadimage(pic) scene=Qt::GraphicsScene.new #scene.addPixmap(pic) grview.setScene(scene) #grview.fitInView(scene) grview.renderHint=Qt::Painter::Antialiasing | Qt::Painter::SmoothPixmapTransform grview.backgroundBrush = Qt::Brush.new(Qt::Color.new(230, 200, 167)) grview.show app.exec

    Read the article

  • Optimized Image Loading in a UIScrollView

    - by Michael Gaylord
    I have a UIScrollView that has a set of images loaded side-by-side inside it. You can see an example of my app here: http://www.42restaurants.com. My problem comes in with memory usage. I want to lazy load the images as they are about to appear on the screen and unload images that aren't on screen. As you can see in the code I work out at a minimum which image I need to load and then assign the loading portion to an NSOperation and place it on an NSOperationQueue. Everything works great apart from a jerky scrolling experience. I don't know if anyone has any ideas as to how I can make this even more optimized, so that the loading time of each image is minimized or so that the scrolling is less jerky. - (void)scrollViewDidScroll:(UIScrollView *)scrollView{ [self manageThumbs]; } - (void) manageThumbs{ int centerIndex = [self centerThumbIndex]; if(lastCenterIndex == centerIndex){ return; } if(centerIndex >= totalThumbs){ return; } NSRange unloadRange; NSRange loadRange; int totalChange = lastCenterIndex - centerIndex; if(totalChange > 0){ //scrolling backwards loadRange.length = fabsf(totalChange); loadRange.location = centerIndex - 5; unloadRange.length = fabsf(totalChange); unloadRange.location = centerIndex + 6; }else if(totalChange < 0){ //scrolling forwards unloadRange.length = fabsf(totalChange); unloadRange.location = centerIndex - 6; loadRange.length = fabsf(totalChange); loadRange.location = centerIndex + 5; } [self unloadImages:unloadRange]; [self loadImages:loadRange]; lastCenterIndex = centerIndex; return; } - (void) unloadImages:(NSRange)range{ UIScrollView *scrollView = (UIScrollView *)[[self.view subviews] objectAtIndex:0]; for(int i = 0; i < range.length && range.location + i < [scrollView.subviews count]; i++){ UIView *subview = [scrollView.subviews objectAtIndex:(range.location + i)]; if(subview != nil && [subview isKindOfClass:[ThumbnailView class]]){ ThumbnailView *thumbView = (ThumbnailView *)subview; if(thumbView.loaded){ UnloadImageOperation *unloadOperation = [[UnloadImageOperation alloc] initWithOperableImage:thumbView]; [queue addOperation:unloadOperation]; [unloadOperation release]; } } } } - (void) loadImages:(NSRange)range{ UIScrollView *scrollView = (UIScrollView *)[[self.view subviews] objectAtIndex:0]; for(int i = 0; i < range.length && range.location + i < [scrollView.subviews count]; i++){ UIView *subview = [scrollView.subviews objectAtIndex:(range.location + i)]; if(subview != nil && [subview isKindOfClass:[ThumbnailView class]]){ ThumbnailView *thumbView = (ThumbnailView *)subview; if(!thumbView.loaded){ LoadImageOperation *loadOperation = [[LoadImageOperation alloc] initWithOperableImage:thumbView]; [queue addOperation:loadOperation]; [loadOperation release]; } } } } EDIT: Thanks for the really great responses. Here is my NSOperation code and ThumbnailView code. I tried a couple of things over the weekend but I only managed to improve performance by suspending the operation queue during scrolling and resuming it when scrolling is finished. Here are my code snippets: //In the init method queue = [[NSOperationQueue alloc] init]; [queue setMaxConcurrentOperationCount:4]; //In the thumbnail view the loadImage and unloadImage methods - (void) loadImage{ if(!loaded){ NSString *filename = [NSString stringWithFormat:@"%03d-cover-front", recipe.identifier, recipe.identifier]; NSString *directory = [NSString stringWithFormat:@"RestaurantContent/%03d", recipe.identifier]; NSString *path = [[NSBundle mainBundle] pathForResource:filename ofType:@"png" inDirectory:directory]; UIImage *image = [UIImage imageWithContentsOfFile:path]; imageView = [[ImageView alloc] initWithImage:image andFrame:CGRectMake(0.0f, 0.0f, 176.0f, 262.0f)]; [self addSubview:imageView]; [self sendSubviewToBack:imageView]; [imageView release]; loaded = YES; } } - (void) unloadImage{ if(loaded){ [imageView removeFromSuperview]; imageView = nil; loaded = NO; } } Then my load and unload operations: - (id) initWithOperableImage:(id<OperableImage>) anOperableImage{ self = [super init]; if (self != nil) { self.image = anOperableImage; } return self; } //This is the main method in the load image operation - (void)main { [image loadImage]; } //This is the main method in the unload image operation - (void)main { [image unloadImage]; }

    Read the article

  • java.lang.Error: "Not enough storage is available to process this command" when generating images

    - by jhericks
    I am running a web application on BEA Weblogic 9.2. Until recently, we were using JDK 1.5.0_04, with JAI 1.1.2_01 and Image IO 1.1. In some circumstances (we never figured out exactly why), when we were processing large images (but not that large - a few MB), the JVM would crash without any error message or stack trace or anything. This didn't happen much in production, but enough to be a nuisance and eventually we were able to reproduce it. We decided to switch to JRockit90 1.5.0_04 and we were no longer able to reproduce the problem in our test environment, so we thought we had it licked. Now, however, after the application server has been up for a while, we start getting the error message, "Not enough storage is available to process this command" during image operations. For example: java.lang.Error: Error starting thread: Not enough storage is available to process this command. at java.lang.Thread.start()V(Unknown Source) at sun.awt.image.ImageFetcher$1.run(ImageFetcher.java:279) at sun.awt.image.ImageFetcher.createFetchers(ImageFetcher.java:272) at sun.awt.image.ImageFetcher.add(ImageFetcher.java:55) at sun.awt.image.InputStreamImageSource.startProduction(InputStreamImageSource.java:149) at sun.awt.image.InputStreamImageSource.addConsumer(InputStreamImageSource.java:106) at sun.awt.image.InputStreamImageSource.startProduction(InputStreamImageSource.java:144) at sun.awt.image.ImageRepresentation.startProduction(ImageRepresentation.java:647) at sun.awt.image.ImageRepresentation.prepare(ImageRepresentation.java:684) at sun.awt.SunToolkit.prepareImage(SunToolkit.java:734) at java.awt.Component.prepareImage(Component.java:3073) at java.awt.ImageMediaEntry.startLoad(MediaTracker.java:906) at java.awt.MediaEntry.getStatus(MediaTracker.java:851) at java.awt.ImageMediaEntry.getStatus(MediaTracker.java:902) at java.awt.MediaTracker.statusAll(MediaTracker.java:454) at java.awt.MediaTracker.waitForAll(MediaTracker.java:405) at java.awt.MediaTracker.waitForAll(MediaTracker.java:375) at SfxNET.System.Drawing.ImageLoader.loadImage(Ljava.awt.Image;)Ljava.awt.image.BufferedImage;(Unknown Source) at SfxNET.System.Drawing.ImageLoader.loadImage(Ljava.net.URL;)Ljava.awt.image.BufferedImage;(Unknown Source) at Resources.Tools.Commands.W$zw(Ljava.lang.ClassLoader;)V(Unknown Source) at Resources.Tools.Commands.getContents()[[Ljava.lang.Object;(Unknown Source) at SfxNET.sfxUtils.SfxResourceBundle.handleGetObject(Ljava.lang.String;)Ljava.lang.Object;(Unknown Source) at java.util.ResourceBundle.getObject(ResourceBundle.java:320) at SoftwareFX.internal.ChartFX.wxvw.yxWW(Ljava.lang.String;Z)Ljava.lang.Object;(Unknown Source) at SoftwareFX.internal.ChartFX.wxvw.vxWW(Ljava.lang.String;)Ljava.lang.Object;(Unknown Source) at SoftwareFX.internal.ChartFX.CommandBar.YWww(LSoftwareFX.internal.ChartFX.wxvw;IIII)V(Unknown Source) at SoftwareFX.internal.ChartFX.Internet.Server.xxvw.YzzW(LSoftwareFX.internal.ChartFX.Internet.Server.ChartCore;Z)LSoftwareFX.internal.ChartFX.CommandBar;(Unknown Source) at SoftwareFX.internal.ChartFX.Internet.Server.xxvw.XzzW(LSoftwareFX.internal.ChartFX.Internet.Server.ChartCore;)V(Unknown Source) at SoftwareFX.internal.ChartFX.Internet.Server.ChartCore.OnDeserialization(Ljava.lang.Object;)V(Unknown Source) at SoftwareFX.internal.ChartFX.Internet.Server.ChartCore.Zvvz(LSoftwareFX.internal.ChartFX.Base.wzzy;)V(Unknown Source) Has anyone seen something like this before? Any clue what might be happening?

    Read the article

  • Win32 C/C++ Load Image from memory buffer

    - by Bruno
    I want to load a image (.bmp) file on a Win32 application, but I do not want to use the standard LoadBitmap/LoadImage from Windows API: I want it to load from a buffer that is already in memory. I can easily load a bitmap directly from file and print it on the screen, but this issue is making me stuck :( What I'm looking for is a function that works like this: HBITMAP LoadBitmapFromBuffer(char* buffer, int width, int height); Thanks.

    Read the article

  • java gui changing picture causes heapspace error

    - by pie154
    I have a java programme than when a button is clicked it updates the image on screen to the according image. this will work for the first 15 or so clicks then it causes a java heapspace error. I think it is because of the way I am updating the jpanel that contains the bufferedimage but not sure what the reason is. My code to get make the JPanel contain the new image is, public class extraScreenPanel { static JPanel screenPanel = new JPanel(new BorderLayout()); public static JPanel extraScreenPanel(int dispNum) { JLabel label = new JLabel("" + dispNum + ""); label.setPreferredSize(new Dimension(800, 600)); //label.setUI( new VerticalLabelUI(true) ); label.setVerticalAlignment( SwingConstants.TOP ); screenPanel = imgDisp(dispNum); label.setForeground(Color.white); label.setFont(new Font("Serif", Font.BOLD, 200)); screenPanel.add(label, BorderLayout.PAGE_END ); return screenPanel; } public static JPanel imgDisp(int picNum) { /* String url[] = new String[5000]; String part1; url[0] = "C:/PiPhotoPic/pic16.jpg"; for(Integer i=1;i<5000;i++){ if(i<10){part1 = "C:/temp/new0000000";} else if(i<100){part1 = "C:/temp/new000000";} else if(i<1000){part1 = "C:/temp/new00000";} else {part1 = "C:/temp/new00000";} String num = Integer.toString(i); url[i]= part1 + num + ".jpg"; } if(picNum<0){picNum=0;} String ref = url[picNum];*/ //this code is just to get specific ref for image location BufferedImage loadImg = loadImage(ref); JImagePanel panel = new JImagePanel(loadImg, 0, 0); panel.setPreferredSize(new Dimension(800, 600)); return panel; } public static class JImagePanel extends JPanel{ private BufferedImage image; int x, y; public JImagePanel(BufferedImage image, int x, int y) { super(); this.image = image; this.x = x; this.y = y; } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); g.drawImage(image, x, y, null); } } public static BufferedImage loadImage(String ref) { BufferedImage bimg = null; try { bimg = javax.imageio.ImageIO.read(new File(ref)); } catch (Exception e) { e.printStackTrace(); } BufferedImage bimg2 = resize(bimg,800,600); return bimg2; } public static BufferedImage resize(BufferedImage img, int newW, int newH) { int w = img.getWidth(); int h = img.getHeight(); BufferedImage dimg = dimg = new BufferedImage(newW, newH, img.getType()); Graphics2D g = dimg.createGraphics(); g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); g.drawImage(img, 0, 0, newW, newH, 0, 0, w, h, null); g.dispose(); return dimg; } } And the code that updates my gui is, it works by removing the panel from its containg panel and then readding it to it. picPanel = imgDisp.imgDisp(num); repaintPicPanel(); public static void repaintPicPanel() { picPanel.removeAll(); menuPanel.remove(picPanel);; menuPanel.add(picPanel, BorderLayout.LINE_START); }

    Read the article

  • python: os.system does not execute shell comand

    - by capoluca
    I need to execute shell command in python program (I have ubuntu). More specifically I want to create graph using graphviz in python script. My code is os.system("dot -Tpng graph.dot -o graph.png") It does not work, but if I just type dot -Tpng graph.dot -o graph.png in command line then everything is fine. Do you know what the problem? Thank you! Edit: Does not work means that nothing happens, there are no errors. Output from dot -v -Tpng graph.dot -o graph.png: dot - graphviz version 2.26.3 (20100126.1600) Activated plugin library: libgvplugin_pango.so.6 Using textlayout: textlayout:cairo Activated plugin library: libgvplugin_dot_layout.so.6 Using layout: dot:dot_layout Using render: cairo:cairo Using device: png:cairo:cairo The plugin configuration file: /usr/lib/graphviz/config6 was successfully loaded. render : cairo dot fig gd map ps svg tk vml vrml xdot layout : circo dot fdp neato nop nop1 nop2 osage patchwork sfdp twopi textlayout : textlayout device : canon cmap cmapx cmapx_np dot eps fig gd gd2 gif gv imap imap_np ismap jpe jpeg jpg pdf plain plain-ext png ps ps2 svg svgz tk vml vmlz vrml wbmp x11 xdot xlib loadimage : (lib) eps gd gd2 gif jpe jpeg jpg png ps svg

    Read the article

  • How to use Win32 SetCursor() with WPF resource and HwndHost

    - by Hank
    We have an HwndHost UIElement in our WPF application which is used to display Direct3d graphics, and the only way I have found to set a cursor for the HwndHost UIElment is to call the Win32 API SetCursor(). All of our cursors are resources in managed assemblies, and I would prefer to not change that, but I have not been able to find a way to load one of these cursors via any Win32 APIs like LoadImage(). Does anybody know how to get a handle(hCursor) to a cursor which is a resource in a managed assembly? Or, is there another way to set a cursor on an HwndHost displaying Direct3D graphics?

    Read the article

  • load images dynamically on scroll in blackberry

    - by Maneesh
    How to display images in the form of pages where only one page is displayed at a time on blackberry screen. On scrolling down subsequent images will load at run time. So that loading of images do not consume time at startup. Edit: I am using loadimage function which loads images from blackberry device memory which loads images from specified path and resizing them.As number of images increases, it increases the startup time during opening of window.There is an in-built application(Media) in blackberry phone, where images load without taking any extra time. My idea is to display particular number of images which fit to the blackberry screen. As user scroll down to bottom of screen, application will then load and display more images. So my question is how to detect when user reached to bottom of blackberry screen and display one more row images.

    Read the article

  • Strange error with CreateCompatibleDC

    - by sevaxx
    Maybe this is a foolish question, I can't see why I can not get a DC created in the following code : HBITMAP COcrDlg::LoadClippedBitmap(LPCTSTR pathName,UINT maxWidth,UINT maxHeight) { HBITMAP hBmp = (HBITMAP)::LoadImage(NULL, pathName, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION); if (!hBmp) return NULL; HDC hdc = (HDC)GetDC(); HDC hdcMem = CreateCompatibleDC(hdc); if (!hdcMem) { DWORD err = GetLastError(); } ... ... ... The bitmap hBmp is loaded fine and hdc has a valid value. But the call to CreateCompatibleDC() returns a NULL pointer. Then, GetLastError() returns 0 ! Anybody can guess what's going on here , please ? PS : There are no memory allocations or GDI routines called before this one...so I think memory leaks should be ruled out.

    Read the article

  • Adding a transparent bitmap to a windows button

    - by cmaughan
    It's a while since I've done this, but I'm trying to add a custom button graphic to a windows button, with some transparent areas. I've tried various schemes but can't seem to get the transparent areas to show. Here's my code: hbmpUpDisabled = LoadImage(instance,MAKEINTRESOURCE(IDB_UPARROWDISABLED), IMAGE_BITMAP, 0, 0, LR_DEFAULTSIZE | LR_LOADTRANSPARENT | LR_LOADMAP3DCOLORS ); SendMessage(GetDlgItem(hWndDlg, IDC_MOVEUP),BM_SETIMAGE,(WPARAM)IMAGE_BITMAP,(LPARAM)hbmpUpDisabled); Does anyone notice any problems here? It works if my bitmap is a 1-bit bitmap. I couldn't get a 32 bit bitmap to work, and I'm not sure how to setup a 24 bit or 8 bit bitmap to do it.... I tried a custom 255,0,255 color (which IIRC is a default transparent value), but so far no joy....

    Read the article

  • Images to video - converting to IplImage makes video blue

    - by user891908
    I want to create a video from images using opencv. The strange problem is that if i will write image (bmp) to disk and then load (cv.LoadImage) it it renders fine, but when i try to load image from StringIO and convert it to IplImage, it turns video to blue. Heres the code: import StringIO output = StringIO.StringIO() FOREGROUND = (0, 0, 0) TEXT = 'MY TEXT' font_path = 'arial.ttf' font = ImageFont.truetype(font_path, 18, encoding='unic') text = TEXT.decode('utf-8') (width, height) = font.getsize(text) # Create with background with place for text w,h=(600,600) contentimage=Image.open('0.jpg') background=Image.open('background.bmp') x, y = contentimage.size # put content onto background background.paste(contentimage,(((w-x)/2),0)) draw = ImageDraw.Draw(background) draw.text((0,0), text, font=font, fill=FOREGROUND) pi = background pi.save(output, "bmp") #pi.show() #shows image in full color output.seek(0) pi= Image.open(output) print pi, pi.format, "%dx%d" % pi.size, pi.mode cv_im = cv.CreateImageHeader(pi.size, cv.IPL_DEPTH_8U, 3) cv.SetData(cv_im, pi.tostring()) print pi.size, cv.GetSize(cv_im) w = cv.CreateVideoWriter("2.avi", cv.CV_FOURCC('M','J','P','G'), 1,(cv.GetSize(cv_im)[0],cv.GetSize(cv_im)[1]), is_color=1) for i in range(1,5): cv.WriteFrame(w, cv_im) del w

    Read the article

  • C++ and SDL resource management for 2D game

    - by KuruptedMagi
    My first question is about stateManagers. I do not use the singleton pattern (read many random posts with various reasons not to use it), I have gameStateManager which runs the pointer cCurrentGameState-render(), etc. I want to make a transitioning game, this engine should ideally cover both a platformer and a bird's eye RPG (with some recoding, I just mean the base engine), both of which will load different levels and events, such as world map, dungeon, shops, etc. So I then thought, rather then having to store all this data within all the states, I would break the engine into gameStates, and playStates... when gameState reaches gameStatePlay(), gameStatePlay simply runs the usual handleInput, logic, and render for the playStates, just as the low level gameStateManager does. This lets me store all the player data within the base playstate class without storing useless data in the gameStates. Now I have added a seperate mapEditor, which uses editorStates from gameStateEditor. Is this too much usage of the gameState concept? It seems to work pretty well for me, so I was wondering if I am too far off a common implementation of this. My second question is on image resources. I have my sprite class with nothing but static members, mainly loadImage, applySurface, and my screen pointer. I also have a map pairing imageName enums with actual SDL_Surface pointers, and one pairing clipNumber enums with a wrapper class for a vector of clips, so that each reference in the map can have different amounts of clips with different sizes. I thought it would be better to store all these images, and screen within one static body, since 20 different goblins all use the same sprite sheet, and all need to print to the same screen, and of course, this way I do not need to pass my screen reference to every little entity. The imageMap seems to work very well, I can even add the ability to search through the map at creation of entity type to see if a particular image at creation, creating if it doesnt exist, and destroying the image if the last entity that needs it was just destroyed. The vectored clip map however, seems to take too long to initialize, so if i run past the state that initializes them to fast, the game crashes <. Plus, the clip map call is half of this line =P SPRITE::applySurface( cEditorMap.cTiles[x][y].iX, cEditorMap.cTiles[x][y].iY, SPRITE::mImages[ IMAGE_TILEMAP ], SPRITE::screen, SPRITE::mImageClips[IMAGE_TILEMAP]->clips.at( cEditorMap.cTiles[x][y].iTileType ) ); Again, do I have the right idea? I like the imageMap, but am I better off with each entity storing its own clips? My last question is about collision detection. I only grasp the basics, will look at per-pixel and circular soon, but how can I determine which side the collision comes from with just the basic square collision detection, I tried breaking each entity into 4 collision zones, but that just gave me problems with walking through walls and the like <. Also, is per-pixel color collision a good way to decide what collision just occured, or is checking multiple colors for multiple entities too taxing each cycle?

    Read the article

  • How to Draw Lines on the Screen

    - by Geertjan
    I've seen occasional questions on mailing lists about how to use the NetBeans Visual Library to draw lines, e.g., to make graphs or diagrams of various kinds by drawing on the screen. So, rather than drag/drop causing widgets to be added, you'd want widgets to be added on mouse clicks, and you'd want to be able to connect those widgets together somehow. Via the code below, you'll be able to click on the screen, which causes a dot to appear. When you have multiple dots, you can hold down the Ctrl key and connect them together. A guiding line appears to help you position the dots exactly in line with each other. When you go to File | Print, you'll be able to preview and print the diagram you've created. A picture that speaks 1000 words: Here's the code: public final class PlotterTopComponent extends TopComponent { private final Scene scene; private final LayerWidget baseLayer; private final LayerWidget connectionLayer; private final LayerWidget interactionLayer; public PlotterTopComponent() { initComponents(); setName(Bundle.CTL_PlotterTopComponent()); setToolTipText(Bundle.HINT_PlotterTopComponent()); setLayout(new BorderLayout()); this.scene = new Scene(); this.baseLayer = new LayerWidget(scene); this.interactionLayer = new LayerWidget(scene); this.connectionLayer = new LayerWidget(scene); scene.getActions().addAction(new SceneCreateAction()); scene.addChild(baseLayer); scene.addChild(interactionLayer); scene.addChild(connectionLayer); add(scene.createView(), BorderLayout.CENTER); putClientProperty("print.printable", true); } private class SceneCreateAction extends WidgetAction.Adapter { @Override public WidgetAction.State mousePressed(Widget widget, WidgetAction.WidgetMouseEvent event) { if (event.getClickCount() == 1) { if (event.getButton() == MouseEvent.BUTTON1 || event.getButton() == MouseEvent.BUTTON2) { baseLayer.addChild(new BlackDotWidget(scene, widget, event)); repaint(); return WidgetAction.State.CONSUMED; } } return WidgetAction.State.REJECTED; } } private class BlackDotWidget extends ImageWidget { public BlackDotWidget(Scene scene, Widget widget, WidgetAction.WidgetMouseEvent event) { super(scene); setImage(ImageUtilities.loadImage("org/netbeans/plotter/blackdot.gif")); setPreferredLocation(widget.convertLocalToScene(event.getPoint())); getActions().addAction( ActionFactory.createExtendedConnectAction( connectionLayer, new BlackDotConnectProvider())); getActions().addAction( ActionFactory.createAlignWithMoveAction( baseLayer, interactionLayer, ActionFactory.createDefaultAlignWithMoveDecorator())); } } private class BlackDotConnectProvider implements ConnectProvider { @Override public boolean isSourceWidget(Widget source) { return source instanceof BlackDotWidget && source != null ? true : false; } @Override public ConnectorState isTargetWidget(Widget src, Widget trg) { return src != trg && trg instanceof BlackDotWidget ? ConnectorState.ACCEPT : ConnectorState.REJECT; } @Override public boolean hasCustomTargetWidgetResolver(Scene arg0) { return false; } @Override public Widget resolveTargetWidget(Scene arg0, Point arg1) { return null; } @Override public void createConnection(Widget source, Widget target) { ConnectionWidget conn = new ConnectionWidget(scene); conn.setTargetAnchor(AnchorFactory.createCircularAnchor(target, 10)); conn.setSourceAnchor(AnchorFactory.createCircularAnchor(source, 10)); connectionLayer.addChild(conn); } } ... ... ... Note: The code above was written based on the Visual Library tutorials on the NetBeans Platform Learning Trail, in particular via the "ConnectScene" sample in the "test.connect" package, which is part of the very long list of Visual Library samples referred to in the Visual Library tutorials on the NetBeans Platform Learning Trail. The next steps are to add a reconnect action and an action to delete a dot by double-clicking on it. Would be interesting to change the connecting line so that the length of the line were to be shown, i.e., as you draw a line from one dot to another, you'd see a constantly changing number representing the current distance of the connecting line. Also, once lines are connected to form a rectangle, would be cool to be able to write something within that rectangle. Then one could really create diagrams, which would be pretty cool.

    Read the article

  • Resizing and saving an image in WinMobile and .NET CF throws OutOfMemoryException

    - by devguy
    I have a WinMobile app which allows the user the snap a photo with the camera, and then use for for various things. The photo can be snapped at 1600x1200, 800x600 or 640x480, but it must always be resized to 400px for the longest size (the other is proportional of course). Here's the code: private void LoadImage(string path) { Image tmpPhoto = new Bitmap(path); // calculate new bitmap size... double width = ... double height = ... // draw new bitmap Image photo = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format24bppRgb); using (Graphics g = Graphics.FromImage(photo)) { g.FillRectangle(new SolidBrush(Color.White), new Rectangle(0, 0, photo.Width, photo.Height)); int srcX = (int)((double)(tmpPhoto.Width - width) / 2d); int srcY = (int)((double)(tmpPhoto.Height - height) / 2d); g.DrawImage(tmpPhoto, new Rectangle(0, 0, photo.Width, photo.Height), new Rectangle(srcX, srcY, photo.Width, photo.Height), GraphicsUnit.Pixel); } tmpPhoto.Dispose(); // save new image and dispose photo.Save(Path.Combine(config.TempPath, config.TempPhotoFileName), System.Drawing.Imaging.ImageFormat.Jpeg); photo.Dispose(); } Now the problem is that the app breaks in the photo.Save call, with an OutOfMemoryException. And I don't know why, since I dispose the tempPhoto (with the original photo from the camera) as soon as I can, and I also dispose the Graphics obj. Why does this happen? It seems impossible to me that one can't take a photo with the camera and resize/save it without making it crash :( Should I restor t C++ for such a simple thing? Thanks.

    Read the article

  • Problem pulling data from website in .NET and C#

    - by Cptcecil
    I have written a web scraping program to go to a list of pages and write all the html to a file. The problem is that when I pull a block of text some of the characters get written as '?'. How do I pull those characters into my text file? Here is my code: string baseUri = String.Format("http://www.rogersmushrooms.com/gallery/loadimage.asp?did={0}&blockName={1}", id.ToString(), name.Trim()); // our third request is for the actual webpage after the login. HttpWebRequest request = (HttpWebRequest)WebRequest.Create(baseUri); request.Method = "GET"; request.UserAgent = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)"; //get the response object, so that we may get the session cookie. HttpWebResponse response = (HttpWebResponse)request.GetResponse(); StreamReader reader = new StreamReader(response.GetResponseStream()); // and read the response string page = reader.ReadToEnd(); StreamWriter SW; string filename = string.Format("{0}.txt", id.ToString()); SW = File.AppendText("C:\\Share\\" + filename); SW.Write(page); reader.Close(); response.Close();

    Read the article

1 2  | Next Page >