mirror of
https://github.com/greenshot/greenshot
synced 2025-07-14 17:13:44 -07:00
(forgotten checkin) Added a getter to the bitmap
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1649 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
dede5cf292
commit
cbf2fae360
1 changed files with 21 additions and 2 deletions
|
@ -34,6 +34,25 @@ namespace GreenshotPlugin.Core {
|
||||||
private bool clone;
|
private bool clone;
|
||||||
private Bitmap bitmap;
|
private Bitmap bitmap;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the bitmap, you will always need to dispose the returned bitmap!!
|
||||||
|
/// Only works, and makes sense, if cloned and not locked!
|
||||||
|
/// </summary>
|
||||||
|
public Bitmap Bitmap {
|
||||||
|
get {
|
||||||
|
if (bitsLocked) {
|
||||||
|
throw new NotSupportedException("Can't get a locked bitmap!");
|
||||||
|
}
|
||||||
|
if (!clone) {
|
||||||
|
throw new NotSupportedException("Can't return a not cloned bitmap!");
|
||||||
|
} else {
|
||||||
|
// Make sure the bitmap isn't disposed when this object is closed
|
||||||
|
clone = false;
|
||||||
|
return bitmap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[NonSerialized]
|
[NonSerialized]
|
||||||
private BitmapData bmData;
|
private BitmapData bmData;
|
||||||
[NonSerialized]
|
[NonSerialized]
|
||||||
|
@ -201,7 +220,7 @@ namespace GreenshotPlugin.Core {
|
||||||
/**
|
/**
|
||||||
* Unlock the System Memory
|
* Unlock the System Memory
|
||||||
*/
|
*/
|
||||||
private void Unlock() {
|
public void Unlock() {
|
||||||
if (bitsLocked) {
|
if (bitsLocked) {
|
||||||
bitmap.UnlockBits(bmData);
|
bitmap.UnlockBits(bmData);
|
||||||
bitsLocked = false;
|
bitsLocked = false;
|
||||||
|
@ -301,7 +320,7 @@ namespace GreenshotPlugin.Core {
|
||||||
int a = (aIndex==-1) ? 255 : (int)pointer[aIndex+offset];
|
int a = (aIndex==-1) ? 255 : (int)pointer[aIndex+offset];
|
||||||
return new int[]{a, pointer[rIndex+offset], pointer[gIndex+offset], pointer[bIndex+offset]};
|
return new int[]{a, pointer[rIndex+offset], pointer[gIndex+offset], pointer[bIndex+offset]};
|
||||||
} else {
|
} else {
|
||||||
return new int[]{255,255,255,255};
|
return new int[]{0,0,0,0};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue