Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
7a9a30d9
Commit
7a9a30d9
authored
Aug 07, 2007
by
Evan Stade
Committed by
Alexandre Julliard
Aug 08, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Added GdipBitmapLockBits.
parent
5fb1c162
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
197 additions
and
2 deletions
+197
-2
gdiplus.spec
dlls/gdiplus/gdiplus.spec
+2
-2
gdiplus_private.h
dlls/gdiplus/gdiplus_private.h
+3
-0
image.c
dlls/gdiplus/image.c
+141
-0
gdiplusflat.h
include/gdiplusflat.h
+2
-0
gdiplusgpstubs.h
include/gdiplusgpstubs.h
+1
-0
gdiplusimaging.h
include/gdiplusimaging.h
+31
-0
gdiplustypes.h
include/gdiplustypes.h
+17
-0
No files found.
dlls/gdiplus/gdiplus.spec
View file @
7a9a30d9
...
...
@@ -41,10 +41,10 @@
@ stub GdipBitmapGetHistogram
@ stub GdipBitmapGetHistogramSize
@ stdcall GdipBitmapGetPixel(ptr long long ptr)
@ st
ub GdipBitmapLockBits
@ st
dcall GdipBitmapLockBits(ptr ptr long long ptr)
@ stub GdipBitmapSetPixel
@ stub GdipBitmapSetResolution
@ st
ub GdipBitmapUnlockBits
@ st
dcall GdipBitmapUnlockBits(ptr ptr)
@ stub GdipClearPathMarkers
@ stub GdipCloneBitmapArea
@ stub GdipCloneBitmapAreaI
...
...
dlls/gdiplus/gdiplus_private.h
View file @
7a9a30d9
...
...
@@ -143,6 +143,9 @@ struct GpBitmap{
INT
width
;
INT
height
;
PixelFormat
format
;
ImageLockMode
lockmode
;
INT
numlocks
;
BYTE
*
bitmapbits
;
/* pointer to the buffer we passed in BitmapLockBits */
};
struct
GpImageAttributes
{
...
...
dlls/gdiplus/image.c
View file @
7a9a30d9
...
...
@@ -88,6 +88,147 @@ GpStatus WINGDIPAPI GdipBitmapGetPixel(GpBitmap* bitmap, INT x, INT y,
return
NotImplemented
;
}
/* This function returns a pointer to an array of pixels that represents the
* bitmap. The *entire* bitmap is locked according to the lock mode specified by
* flags. It is correct behavior that a user who calls this function with write
* privileges can write to the whole bitmap (not just the area in rect).
*
* FIXME: only used portion of format is bits per pixel. */
GpStatus
WINGDIPAPI
GdipBitmapLockBits
(
GpBitmap
*
bitmap
,
GDIPCONST
GpRect
*
rect
,
UINT
flags
,
PixelFormat
format
,
BitmapData
*
lockeddata
)
{
BOOL
bm_is_selected
;
INT
stride
,
bitspp
=
PIXELFORMATBPP
(
format
);
OLE_HANDLE
hbm
;
HDC
hdc
;
HBITMAP
old
=
NULL
;
BITMAPINFO
bmi
;
BYTE
*
buff
=
NULL
;
UINT
abs_height
;
TRACE
(
"%p %p %d %d %p
\n
"
,
bitmap
,
rect
,
flags
,
format
,
lockeddata
);
if
(
!
lockeddata
||
!
bitmap
||
!
rect
)
return
InvalidParameter
;
if
(
rect
->
X
<
0
||
rect
->
Y
<
0
||
(
rect
->
X
+
rect
->
Width
>
bitmap
->
width
)
||
(
rect
->
Y
+
rect
->
Height
>
bitmap
->
height
)
||
!
flags
)
return
InvalidParameter
;
if
(
flags
&
ImageLockModeUserInputBuf
)
return
NotImplemented
;
if
((
bitmap
->
lockmode
&
ImageLockModeWrite
)
||
(
bitmap
->
lockmode
&&
(
flags
&
ImageLockModeWrite
)))
return
WrongState
;
IPicture_get_Handle
(
bitmap
->
image
.
picture
,
&
hbm
);
IPicture_get_CurDC
(
bitmap
->
image
.
picture
,
&
hdc
);
bm_is_selected
=
(
hdc
!=
0
);
bmi
.
bmiHeader
.
biSize
=
sizeof
(
BITMAPINFOHEADER
);
bmi
.
bmiHeader
.
biBitCount
=
0
;
if
(
!
bm_is_selected
){
hdc
=
GetDC
(
0
);
old
=
SelectObject
(
hdc
,
(
HBITMAP
)
hbm
);
}
/* fill out bmi */
GetDIBits
(
hdc
,
(
HBITMAP
)
hbm
,
0
,
0
,
NULL
,
&
bmi
,
DIB_RGB_COLORS
);
abs_height
=
abs
(
bmi
.
bmiHeader
.
biHeight
);
stride
=
bmi
.
bmiHeader
.
biWidth
*
bitspp
/
8
;
stride
=
(
stride
+
3
)
&
~
3
;
buff
=
GdipAlloc
(
stride
*
abs_height
);
if
(
!
buff
)
return
OutOfMemory
;
bmi
.
bmiHeader
.
biBitCount
=
bitspp
;
GetDIBits
(
hdc
,
(
HBITMAP
)
hbm
,
0
,
abs_height
,
buff
,
&
bmi
,
DIB_RGB_COLORS
);
if
(
!
bm_is_selected
){
SelectObject
(
hdc
,
old
);
ReleaseDC
(
0
,
hdc
);
}
lockeddata
->
Width
=
rect
->
Width
;
lockeddata
->
Height
=
rect
->
Height
;
lockeddata
->
PixelFormat
=
format
;
lockeddata
->
Reserved
=
flags
;
if
(
bmi
.
bmiHeader
.
biHeight
>
0
){
lockeddata
->
Stride
=
-
stride
;
lockeddata
->
Scan0
=
buff
+
(
bitspp
/
8
)
*
rect
->
X
+
stride
*
(
abs_height
-
1
-
rect
->
Y
);
}
else
{
lockeddata
->
Stride
=
stride
;
lockeddata
->
Scan0
=
buff
+
(
bitspp
/
8
)
*
rect
->
X
+
stride
*
rect
->
Y
;
}
bitmap
->
lockmode
=
flags
;
bitmap
->
numlocks
++
;
if
(
flags
&
ImageLockModeWrite
)
bitmap
->
bitmapbits
=
buff
;
return
Ok
;
}
GpStatus
WINGDIPAPI
GdipBitmapUnlockBits
(
GpBitmap
*
bitmap
,
BitmapData
*
lockeddata
)
{
OLE_HANDLE
hbm
;
HDC
hdc
;
HBITMAP
old
=
NULL
;
BOOL
bm_is_selected
;
BITMAPINFO
bmi
;
if
(
!
bitmap
||
!
lockeddata
)
return
InvalidParameter
;
if
(
!
bitmap
->
lockmode
)
return
WrongState
;
if
(
lockeddata
->
Reserved
&
ImageLockModeUserInputBuf
)
return
NotImplemented
;
if
(
lockeddata
->
Reserved
&
ImageLockModeRead
){
if
(
!
(
--
bitmap
->
numlocks
))
bitmap
->
lockmode
=
0
;
GdipFree
(
lockeddata
->
Scan0
);
return
Ok
;
}
IPicture_get_Handle
(
bitmap
->
image
.
picture
,
&
hbm
);
IPicture_get_CurDC
(
bitmap
->
image
.
picture
,
&
hdc
);
bm_is_selected
=
(
hdc
!=
0
);
bmi
.
bmiHeader
.
biSize
=
sizeof
(
BITMAPINFOHEADER
);
bmi
.
bmiHeader
.
biBitCount
=
0
;
if
(
!
bm_is_selected
){
hdc
=
GetDC
(
0
);
old
=
SelectObject
(
hdc
,
(
HBITMAP
)
hbm
);
}
GetDIBits
(
hdc
,
(
HBITMAP
)
hbm
,
0
,
0
,
NULL
,
&
bmi
,
DIB_RGB_COLORS
);
bmi
.
bmiHeader
.
biBitCount
=
PIXELFORMATBPP
(
lockeddata
->
PixelFormat
);
SetDIBits
(
hdc
,
(
HBITMAP
)
hbm
,
0
,
abs
(
bmi
.
bmiHeader
.
biHeight
),
bitmap
->
bitmapbits
,
&
bmi
,
DIB_RGB_COLORS
);
if
(
!
bm_is_selected
){
SelectObject
(
hdc
,
old
);
ReleaseDC
(
0
,
hdc
);
}
GdipFree
(
bitmap
->
bitmapbits
);
return
Ok
;
}
GpStatus
WINGDIPAPI
GdipCreateBitmapFromScan0
(
INT
width
,
INT
height
,
INT
stride
,
PixelFormat
format
,
BYTE
*
scan0
,
GpBitmap
**
bitmap
)
{
...
...
include/gdiplusflat.h
View file @
7a9a30d9
...
...
@@ -164,6 +164,8 @@ GpStatus WINGDIPAPI GdipCreateCustomLineCap(GpPath*,GpPath*,GpLineCap,REAL,
GpStatus
WINGDIPAPI
GdipDeleteCustomLineCap
(
GpCustomLineCap
*
);
GpStatus
WINGDIPAPI
GdipBitmapGetPixel
(
GpBitmap
*
,
INT
,
INT
,
ARGB
*
);
GpStatus
WINGDIPAPI
GdipBitmapLockBits
(
GpBitmap
*
,
GDIPCONST
GpRect
*
,
UINT
,
PixelFormat
,
BitmapData
*
);
GpStatus
WINGDIPAPI
GdipCreateBitmapFromScan0
(
INT
,
INT
,
INT
,
PixelFormat
,
BYTE
*
,
GpBitmap
**
);
GpStatus
WINGDIPAPI
GdipCreateBitmapFromStream
(
IStream
*
,
GpBitmap
**
);
...
...
include/gdiplusgpstubs.h
View file @
7a9a30d9
...
...
@@ -67,5 +67,6 @@ typedef DashStyle GpDashStyle;
typedef
MatrixOrder
GpMatrixOrder
;
typedef
Point
GpPoint
;
typedef
WrapMode
GpWrapMode
;
typedef
Rect
GpRect
;
#endif
include/gdiplusimaging.h
View file @
7a9a30d9
...
...
@@ -19,6 +19,13 @@
#ifndef _GDIPLUSIMAGING_H
#define _GDIPLUSIMAGING_H
enum
ImageLockMode
{
ImageLockModeRead
=
1
,
ImageLockModeWrite
=
2
,
ImageLockModeUserInputBuf
=
4
};
#ifdef __cplusplus
class
EncoderParameter
{
...
...
@@ -35,8 +42,22 @@ public:
UINT
Count
;
EncoderParameter
Parameter
[
1
];
};
class
BitmapData
{
public
:
UINT
Width
;
UINT
Height
;
INT
Stride
;
PixelFormat
PixelFormat
;
VOID
*
Scan0
;
UINT_PTR
Reserved
;
};
#else
/* end of c++ typedefs */
typedef
enum
ImageLockMode
ImageLockMode
;
typedef
struct
EncoderParameter
{
GUID
Guid
;
...
...
@@ -51,6 +72,16 @@ typedef struct EncoderParameters
EncoderParameter
Parameter
[
1
];
}
EncoderParameters
;
typedef
struct
BitmapData
{
UINT
Width
;
UINT
Height
;
INT
Stride
;
PixelFormat
PixelFormat
;
VOID
*
Scan0
;
UINT_PTR
Reserved
;
/* undocumented: stores the lock mode */
}
BitmapData
;
#endif
/* end of c typedefs */
#endif
/* _GDIPLUSIMAGING_H */
include/gdiplustypes.h
View file @
7a9a30d9
...
...
@@ -177,6 +177,15 @@ public:
REAL
Height
;
};
class
Rect
{
public
:
INT
X
;
INT
Y
;
INT
Width
;
INT
Height
;
};
#else
/* end of c++ typedefs */
typedef
struct
Point
...
...
@@ -206,6 +215,14 @@ typedef struct RectF
REAL
Height
;
}
RectF
;
typedef
struct
Rect
{
INT
X
;
INT
Y
;
INT
Width
;
INT
Height
;
}
Rect
;
typedef
enum
Status
Status
;
#endif
/* end of c typedefs */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment