Click here to Skip to main content
15,881,172 members
Home / Discussions / C#
   

C#

 
AnswerRe: bitmap lockbits/unlockbits Pin
Kornfeld Eliyahu Peter22-Jul-14 22:55
professionalKornfeld Eliyahu Peter22-Jul-14 22:55 
GeneralRe: bitmap lockbits/unlockbits Pin
V.22-Jul-14 23:10
professionalV.22-Jul-14 23:10 
AnswerRe: bitmap lockbits/unlockbits Pin
Kornfeld Eliyahu Peter22-Jul-14 23:21
professionalKornfeld Eliyahu Peter22-Jul-14 23:21 
GeneralRe: bitmap lockbits/unlockbits Pin
V.23-Jul-14 2:05
professionalV.23-Jul-14 2:05 
AnswerRe: bitmap lockbits/unlockbits Pin
Kornfeld Eliyahu Peter23-Jul-14 2:56
professionalKornfeld Eliyahu Peter23-Jul-14 2:56 
AnswerRe: bitmap lockbits/unlockbits Pin
Kornfeld Eliyahu Peter22-Jul-14 3:24
professionalKornfeld Eliyahu Peter22-Jul-14 3:24 
GeneralRe: bitmap lockbits/unlockbits Pin
V.22-Jul-14 19:55
professionalV.22-Jul-14 19:55 
AnswerRe: bitmap lockbits/unlockbits Pin
Kornfeld Eliyahu Peter22-Jul-14 20:06
professionalKornfeld Eliyahu Peter22-Jul-14 20:06 
It may be hard to explain, as no images allowed here, but I will give a try...
When you are copy only the part of an bitmap image the byte array that you holds only the part you asked for - that obvious I think and expected too...
But! That also mean that you have to compute the stride for that part only, as the lock method will provide you with scans (lines) padded to stride and not of length of width!
You can compute the stride like this:
C#
int bitsPerPixel = ((int)format & 0xff00) >> 8;
int bytesPerPixel = (bitsPerPixel + 7) / 8;
int stride = 4 * ((width * bytesPerPixel + 3) / 4);

You may consider one of these options too:
1. Lock all the bitmap and use x,y,width,height as an index inside it (no extra computations of stride as BitmapInfo already have it)
2. Create a new bitmap out of the wanted portion and go back to 1
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)

GeneralRe: bitmap lockbits/unlockbits Pin
V.22-Jul-14 20:13
professionalV.22-Jul-14 20:13 
QuestionClasses Pin
AnilUppala22-Jul-14 1:52
AnilUppala22-Jul-14 1:52 
AnswerRe: Classes Pin
Ravi Bhavnani22-Jul-14 2:06
professionalRavi Bhavnani22-Jul-14 2:06 
GeneralRe: Classes Pin
AnilUppala22-Jul-14 2:12
AnilUppala22-Jul-14 2:12 
QuestionHELP!!!! Pin
Member 1094467922-Jul-14 1:22
Member 1094467922-Jul-14 1:22 
AnswerRe: HELP!!!! Pin
Dave Kreskowiak22-Jul-14 2:16
mveDave Kreskowiak22-Jul-14 2:16 
SuggestionRe: HELP!!!! Pin
Richard Deeming22-Jul-14 2:18
mveRichard Deeming22-Jul-14 2:18 
AnswerRe: HELP!!!! Pin
OriginalGriff22-Jul-14 3:08
mveOriginalGriff22-Jul-14 3:08 
QuestionNo column found exception occourd Pin
vishavajeet21-Jul-14 1:56
vishavajeet21-Jul-14 1:56 
AnswerRe: No column found exception occourd Pin
Kornfeld Eliyahu Peter21-Jul-14 1:59
professionalKornfeld Eliyahu Peter21-Jul-14 1:59 
GeneralRe: No column found exception occourd Pin
vishavajeet21-Jul-14 2:06
vishavajeet21-Jul-14 2:06 
AnswerRe: No column found exception occourd Pin
Kornfeld Eliyahu Peter21-Jul-14 2:21
professionalKornfeld Eliyahu Peter21-Jul-14 2:21 
GeneralRe: No column found exception occourd Pin
vishavajeet21-Jul-14 2:50
vishavajeet21-Jul-14 2:50 
AnswerRe: No column found exception occourd Pin
Kornfeld Eliyahu Peter21-Jul-14 2:51
professionalKornfeld Eliyahu Peter21-Jul-14 2:51 
GeneralRe: No column found exception occourd Pin
vishavajeet21-Jul-14 3:08
vishavajeet21-Jul-14 3:08 
GeneralRe: No column found exception occourd Pin
Eddy Vluggen21-Jul-14 3:02
professionalEddy Vluggen21-Jul-14 3:02 
SuggestionRe: No column found exception occourd Pin
Richard Deeming21-Jul-14 3:53
mveRichard Deeming21-Jul-14 3:53 

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.