Click here to Skip to main content
15,879,326 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
AnswerRe: setup in silent mode with *.msi? Pin
rwestgraham28-Sep-05 9:59
rwestgraham28-Sep-05 9:59 
QuestionError logging for application Pin
ravibabu_kanaparthi27-Sep-05 22:50
ravibabu_kanaparthi27-Sep-05 22:50 
AnswerRe: Error logging for application Pin
rwestgraham28-Sep-05 17:05
rwestgraham28-Sep-05 17:05 
QuestionInstall Shield Pin
_mubashir27-Sep-05 21:53
_mubashir27-Sep-05 21:53 
QuestionError while opening DotNet project Pin
vinidimple27-Sep-05 19:22
vinidimple27-Sep-05 19:22 
QuestionInstaller Problem.. Pin
_mubashir27-Sep-05 18:58
_mubashir27-Sep-05 18:58 
AnswerRe: Installer Problem.. Pin
rwestgraham28-Sep-05 9:17
rwestgraham28-Sep-05 9:17 
Questionimaging code; looking for optimization Pin
sarabjs27-Sep-05 9:23
sarabjs27-Sep-05 9:23 
Hi folks,
The following piece of C#.NET code creates an A4 size binary image by reading values from a two-dimensional byte array iPage[][].
Is there anyway I can further optimize the nested for loop inside the unsafe block? It is taking ~2.2s, and I'd love to bring it down further.
Sarab.

// page dimensions
iwd=iPage.Length;
iht=iPage[0].Length;

// create new bitmap
bMap=new Bitmap(iwd, iht, PixelFormat.Format24bppRgb);

// create bitmap data
bData=bMap.LockBits(new Rectangle (0,0,iwd,iht),ImageLockMode.WriteOnly,PixelFormat.Format24bppRgb);

// get bitmap position
Scan0 = bData.Scan0;
iStride=bData.Stride;

unsafe
{
// initialize pointer
byte *p = (byte*)(void*)Scan0;
int nOffset = iStride-iwd*3;

for(int y=0;y<iht;++y)
{
for(int x=0;x<iwd;++x)
{
if (iPage[x][y]==0) p[0]=p[1]=p[2]=255;
else p[0]=p[1]=p[2]=0;
p += 3;
}
p += nOffset;
}
}

PS. the code above is inspired from the article(s): http://www.codeproject.com/cs/media/csharpgraphicfilters11.asp
AnswerRe: imaging code; looking for optimization Pin
Dave Kreskowiak27-Sep-05 12:01
mveDave Kreskowiak27-Sep-05 12:01 
GeneralRe: imaging code; looking for optimization Pin
sarabjs28-Sep-05 11:26
sarabjs28-Sep-05 11:26 
AnswerRe: imaging code; looking for optimization Pin
Daniel Grunwald30-Sep-05 22:56
Daniel Grunwald30-Sep-05 22:56 
GeneralRe: imaging code; looking for optimization Pin
sarabjs3-Oct-05 6:30
sarabjs3-Oct-05 6:30 
Question.NET locking DLLs Pin
Gilad Kapelushnik26-Sep-05 23:48
Gilad Kapelushnik26-Sep-05 23:48 
Questiondrawing text on an image Pin
sarabjs26-Sep-05 5:30
sarabjs26-Sep-05 5:30 
AnswerRe: drawing text on an image Pin
Guido_d26-Sep-05 23:18
Guido_d26-Sep-05 23:18 
GeneralRe: drawing text on an image Pin
Guido_d26-Sep-05 23:34
Guido_d26-Sep-05 23:34 
GeneralRe: drawing text on an image Pin
sarabjs27-Sep-05 8:50
sarabjs27-Sep-05 8:50 
Question Strange behaviour with a System.Net.Sockets.Socket Pin
Guido_d26-Sep-05 3:53
Guido_d26-Sep-05 3:53 
QuestionWhat API can be used to access MS Project? Pin
kurdi1926-Sep-05 3:14
kurdi1926-Sep-05 3:14 
QuestionXmlSerializer question Pin
Ivanets26-Sep-05 1:13
Ivanets26-Sep-05 1:13 
QuestionFind RichTextBox BackColor in VB.NET Pin
lupus canus25-Sep-05 23:56
lupus canus25-Sep-05 23:56 
AnswerRe: Find RichTextBox BackColor in VB.NET Pin
lupus canus26-Sep-05 7:12
lupus canus26-Sep-05 7:12 
QuestionIL and MSIL Pin
Rajesh_K_Sharma25-Sep-05 20:12
Rajesh_K_Sharma25-Sep-05 20:12 
AnswerRe: IL and MSIL Pin
Saqib Shakil25-Sep-05 21:28
Saqib Shakil25-Sep-05 21:28 
AnswerRe: IL and MSIL Pin
Dave Kreskowiak26-Sep-05 3:09
mveDave Kreskowiak26-Sep-05 3:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.