VS 2010 Optimizing Merging Of An Image?
Apr 6, 2011
I'm having a speed issue with some drawing in a program I am working on. I have narrowed down the speed issues to a single function. The cost of this function is such that I really need to find a way to make it faster, and that should be possible.
The function is this:
Public Shared Sub SuperImposeFishAni(ByVal bckGrnd As Drawing.Bitmap, ByVal dtop As Integer, ByVal dleft As Integer, ByVal dwidth As Integer, ByVal dheight As Integer, ByVal ImageInQuestion As FishImages)
Dim tp As Integer = 0
[code]....
This is actually a holdover from an earlier design that included animation, but that's probably irrelevant. What is happening here is that a bitmap (bckGrnd) is passed to the method along with the left, top, width, and height that are to be drawn, and a single variable to select which image to draw.The image to draw is chosen in the select statement, which makes up the bulk of the method. The guts of the issue are the last few lines.
Through profiling, I was able to determine that if this method is called, the drawing takes over .25 seconds, whereas if this method is not called the same exact drawing takes less than .07 seconds. Therefore, I am getting a significant slowdown from this one method, which surprises me, as it is pretty straightforward. It pretty much has to be this method, too, because I can perform the same actions with or without this method being called. It is called if a Boolean is True, which is about as fast a test as can be performed. If the Boolean is False, this method is not called. The >3x difference in timing is with or without this method.
The point behind the method is that the image from the select statement has to be superimposed onto the background image, and the size of the area, as well as the location, that it gets superimposed onto is almost totally arbitrary, which is why the size and location has to passed to the method.Technically, choosing the bitmap to merge in (the select statement), could be avoided, but I doubt that is the issue.
View 21 Replies
ADVERTISEMENT
Jan 10, 2011
I created an app which loads specified image to the picturebox and allows to draw on it:
PictureBox.ImageLocation = "dummy.jpg"
Dim g As System.Drawing.Graphics
Dim pen1 As New System.Drawing.Pen(System.Drawing.Color.Green, 4)
[code].....
View 2 Replies
Feb 4, 2011
below is a byte array to string encoder. It uses the yEnc algorithm that is used for Usenet binaries (Usenet only supports text).
Doing a performance analysis in VS2010 shows that this is the most CPU intensive part of the application.
The encoder function is used thousands of times, so I'd like to optimize it as much as possible.
I'm using 'ReDim Preserve' instead of 'Take()ToArray', because I'm targeting .NET Framework 2.0. Is there a more efficient way of getting only a part of a byte array?
vb.net
'Values for yEnc Encoder
Public Structure EncoderValues
Public lChar As Byte
[Code].....
View 15 Replies
Sep 22, 2010
I'm looking to achieve merging of two images. Right now I can get the desired output but its slow for bigger images than 640*480 since it will actually be operating on video frames at least @25FPS.What I'm doing right now is copy both images pixel by pixel, like this. Actually its in c++ but I've converted it to vb code for understanding..
Dim image3 As Pointer(Of Char) = New Char(w * h * 4 )
Dim image1 As Pointer(Of Char) = img1.getPixels()
Dim image2 As Pointer(Of Char) = img2.getPixels()
[code].....
View 13 Replies
Oct 25, 2010
i have made 2 seprate programs, is it possable to make a link between them. i have a "launcher" which is mainly for launching games and a web browser, soon i will have a music player also but at the moemnt i just want to merge the 2 progs i have atm... i have tryed opening 1 solution (launcher) and then i clicked file > open project and changed the option to "add to solution" instead os "close solution"
View 2 Replies
Dec 1, 2011
I need to take an existing HTML file, which we want to use as a template, and insert another HTML, like an email signature, somewhere in the middle of it. Does .net have any classes that would make this possible?
View 1 Replies
Apr 14, 2012
we are new to Visual Basic Programing, We are working on a project, which has modules. My team worked on these modules and prepared 3 separate Visual Studio Projects. Now, I want to combine then into one Visual Studio Project for Integration purposes
View 2 Replies
Nov 30, 2011
I have a parent MDI form and several MDI children. All have menustrips and toolstrips. The merging of the menustrips was no problem at all but I'm trying to do the same thing for the toolstrips, but now it's a no go. The toolstrips are staying separated. Is it possible to merge toolstrips?
View 1 Replies
Oct 17, 2011
The only way I can think of to display this moustache is by creating a new form and locking it to a certain point, that all works.My problem is with all the events surrounding this. E.g. minimizing the actual application etc...I know how to handle those in code but that is painstaking as I have to think of every possible event which would result in a problem then manually code for the moustaches relative actions. So, I would like to know:
View 2 Replies
Aug 11, 2010
I'm building a GUI that displays a lot of thumbnails. I'm currently using PictureBoxes that I dynamically allocate to do this. In the worst case I may need to display as much as 1000 of these thumbnails at once. I need the thumbnails to move around and animate fluidly. PictureBoxes hog a lot of memory.
View 16 Replies
Apr 27, 2009
I have a function which is executed a lot of time during a flat file (txt) import. (50 000+)using a profiling tool the attached function where identified as 40% of the runtime..The code works as is.. But should be a lot quicker..
The code converts the following format 5710.436' N to the double representation.
DMS -> DD
MS Degrees:Minutes:Seconds (4930'00"N, 12330'00"W)
[code]....
View 3 Replies
Aug 10, 2009
I am using SQl data reader to get value from SQL database.Language VB.NET.After getting data into reader, i run a while loop
While reader.Read
If reader.HasRows() Then
/* Proessing of data *[code]....
View 3 Replies
Nov 11, 2011
I'm working on a FTP Client, I started loading the local directories of my PC. I'm a university student of Computer Science. I had problems with my code, because it takes approximately 35 seconds to load all the directories and sub directories to a TreeView that in the future I will use to navigate thru my computer folders and pass files & olders to the FTP.
Option Strict On
Option Explicit On
Imports System.Collections.ObjectModel
[code].....
View 3 Replies
Jun 2, 2011
Say I have something like this
Dim Level1 as Integer = 83
Dim Goal as String
Goal = InputBox(" What level is your goal?")
[code].....
View 7 Replies
Apr 15, 2010
I've inherited a Visual Studio/VB.Net numerical simulation project that has a likely inefficient calculation. Profiling indicates that the function is called a lot (1 million times plus) and spends about 50% of the overall calculation within this function. Here is the problematic portion
Result = (A * (E ^ C)) / (D ^ C * B) (where A-C are local double variables and D & E global double variables)
Result is then compared to a threshold which might have additional improvements as well, but I'll leave them another day
View 4 Replies
Apr 8, 2010
I have a lengthy query..always it shows timeout..I am filling it in a dataset, not using command execute.Is there anyway to solve this rather than optimizing the code? any way to solve the timeout..
View 3 Replies
Feb 23, 2009
Merging Two PDF files OR Merging Two Binary files
View 2 Replies
Sep 9, 2011
I have this code that works. it goes down a range and deletes the empty rows, seperates the first character into a different column if its not a number or negative sign.This code WORKS. but it is too SLOW for the amount of data i need it to deal with. I have already turned off automatic calculations. screen updating.and visibility of application.
[Code]...
View 3 Replies
Sep 8, 2010
I have code that increments an array of numbers. However, due to performance issues, I need to optimize it.
Here is the code:
Public Sub increment(ByRef Index() As UInt16)
Dim N As Integer = Index.Length - 1
If (Index(0) = 65535) Then
Index(0) = 0
[Code] .....
View 18 Replies
Dec 28, 2011
I have this code that works. it goes down a range and deletes the empty rows, seperates the first character into a different column if its not a number or negative sign
View 1 Replies
Aug 4, 2009
As I was starting on my lil project i realized that I would have a tonne of repetitive code. But wasn't sure how best to go around to just only have it in there once and just call on it. Not entirely sure how to do this as I havnt done it before, I was trying to mess around with it in a Function type thing but I had declaration issues which put me off course. Basically they'll be a few labels lbl8Beats(on click it loads the table in the datagrid (dgvCompositions)) is the first, and all the code from Dim conn As MySqlConnection to data = New DataTable, will be repeated.When i was messing around and thought I'd open the connection on form load, and I just had a bunch of declaration issues, and was unsure how best to go about this. Also since the Adapter = "would be changing on each label it just made me more confused.[code]
View 1 Replies
Aug 1, 2008
I'm developing a VB.Net 2008 application which uses background images (in jpg format) in some forms and controls, but this makes the application to use a lot of ram. My question is how to make it to use the less possible.
View 3 Replies
Sep 17, 2010
I made a picture box and imported an image named Title.jpg. Later I made adjustments to the picture and imported it again without deleting the original(mistake). The new one had the name automatically changed to Title1.jpg. So I deleted the original image from resources and renamed Title1.jpg back to Title.jpg.
Now I got two problems. First, only Title.jpg is on the solution explorer, but Title1.jpg(along with Title.jpg) still pops up on the resource list when I click on Image property of the picture box. There's only the name and no picture, and I don't see a delete option. How do I get rid of it? Second, even though I changed the image to the new Title.jpg in the picture box, the old one is displayed when running the app. What's up with that?
View 5 Replies
Feb 16, 2011
I am trying to make an Image wrapper class or something. The reason for this is that I need to output a bunch of images only, without pictureboxes. I don't want an imagelist, because I need the images along with their associated image properties which an imagelist cannot provide. I ended up with this :
[Code]...
View 2 Replies
Nov 19, 2011
I have a specific image that I want my application to look for on a specific window. I've done something similar to this along time ago with VB6, but it was slow, and it was checking for specific points in the picture rather than the whole image itself (for speed reasons). I named this image "Image1.jpg" and I want to compare it to the window with the handle "001C08F2" and class "SunAwtCanvas"
View 19 Replies
Sep 9, 2011
this code was not done by me originally and there are some thigns here i dont quite understand i have altered it a bit from my coworkers code to suit my data and it works. but too slow. and when i have 4000+kb excel files it might freeze altogether. ( I have checked tho that when and after this transposer runs it will still be within the excel row limit, i had done calculations before and made a macro to automatically split excel files based on number of columns and rows to make sure this is so ). This code seems to start out fast then goes slower the longer it runs. at least this is what it seems liek to me.
[Code]....
View 2 Replies
Feb 8, 2011
i want to make a program merge 2 .png images, like the layers in Photoshop, if you know what i mean.. cause i want to create a sprite generator in RMVX.
also i want to use .net framework 2.0.
View 1 Replies
Jul 28, 2010
In .net MDI application the menu of child form automatically is merged to the menu of parent form.Is there a way to do similar thing with the tool bars.The concept is to send the toolbar of active child to the parent toolbar stripe
View 1 Replies
Dec 26, 2010
I wrote an application which converts .doc files into .pdf. Now I would like to add one more thing: before converting the .doc file, which is selected by the user, I would like to add the content of an other (default) .doc file, which will not be selected by the user but the directory where the file is will be already in the code, in front of the file selected by the user. So after the two files are merged I will have the merged file converted to PDF.
View 6 Replies
Jun 7, 2012
I have a Main Table that contains all the distinct values in a DataTable.DataColumn. also have a Child Table that contains distinct values created by the user.I want to merge the Child Table DataRows that match on the Value column with theMain Table DataRows to create the New Table (shown below).I want to preserve the values in the Selected column of the Child Table.Here is my problem, if I use the DataTable.Merge method the DataRow that contains "888" in the Child Table is added to the New Table, but it doesn't contain a RowState = Added, thus I can't filter for added rows to remove them.
View 4 Replies