|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jniwrapper.Parameter
com.jniwrapper.Pointer.Void
com.jniwrapper.win32.Handle
com.jniwrapper.win32.gdi.DC
public class DC
This class provides methods for working with Windows device contexts (DC). It corresponds to HDC Windows data type.
Nested Class Summary | |
---|---|
static class |
DC.MappingMode
Enumeration of available mapping modes. |
static class |
DC.RasterOperation
The RasterOperation class represents the enumeration of raster operations. |
Field Summary | |
---|---|
static int |
BKMODE_LAST
|
static int |
BKMODE_OPAQUE
|
static int |
BKMODE_TRANSPARENT
Background modes. |
static int |
DC_PEN
|
static int |
DT_RIGHT
|
static long |
GRADIENT_FILL_RECT_H
|
static long |
GRADIENT_FILL_RECT_V
|
Fields inherited from class com.jniwrapper.win32.Handle |
---|
INFINITE_TIMEOUT, INVALID_HANDLE_VALUE, STATUS_ABANDONED_WAIT_0, STATUS_TIMEOUT, STATUS_WAIT_0 |
Fields inherited from class com.jniwrapper.Parameter |
---|
LICENSE_TYPE, V |
Constructor Summary | |
---|---|
DC()
|
|
DC(long value)
|
Method Summary | |
---|---|
boolean |
alphaBlend(int xDest,
int yDest,
int widthDest,
int heightDest,
DC hdcSrc,
int xSrc,
int ySrc,
int widthSrc,
int heightSrc,
BlendFunction blendFunction)
Copies an image with transparent pixels to the destination rectangle of the DC. |
static void |
bitBlt(DC hdcDest,
int xDest,
int yDest,
int width,
int height,
DC hdcSrc,
int xSrc,
int ySrc,
DC.RasterOperation rop)
Performs a bit-block transfer of the color data corresponding to a rectangle of pixels from the specified source device context into a destination device context. |
static DC |
createCompatibleDC(DC dc)
Creates a compatible DC for a given DC. |
static void |
deleteDC(DC dc)
Deletes the specified DC. |
void |
drawGrayed(DC srcDC,
Rect destRect)
Draws the grayed picture from source DC on the current DC. |
boolean |
drawIcon(int x,
int y,
Icon icon)
Draws a specified icon in this device context. |
void |
drawIconEx(int x,
int y,
Icon icon,
int width,
int heght,
int frameIndex,
Handle bgBrush,
int flags)
Draws a specified icon in this device context. |
boolean |
drawRectangle(Rect rect)
|
void |
drawText(java.lang.String text,
Rect clipRect,
com.jniwrapper.UInt uFormat)
Draws a specified text. |
void |
fillRect(Rect rect,
Brush brush)
Fills a given rectangle with a specified brush. |
boolean |
fillRectangle(int left,
int top,
int right,
int bottom)
|
void |
fillRegion(Region region,
Brush brush)
Fills a region by using the specified brush. |
void |
frameRegion(Region region,
Brush brush,
int width,
int heigh)
Draws a border around the specified region by using the specified brush. |
int |
getDeviceCaps(int index)
Returns device-specific information for the specified device. |
ColorRef |
getPixel(int x,
int y)
Returns a color (by ColorRef) of the specified pixel on this device context. |
int |
getPolyFillMode()
Retrieves the current polygon fill mode. |
Size |
getTextExtentPoint32(DC dc,
java.lang.String str)
Returns the size of a specified text. |
boolean |
gradientFill(Rect rect,
java.awt.Color leftColor,
java.awt.Color rightColor)
Fills a rectangle by horisontal gradient. |
int |
intersectClipRect(int left,
int top,
int right,
int bottom)
Creates a new clipping region from the intersection of the current clipping region and the specified rectangle. |
boolean |
invertRegion(Region region)
Inverts the colors in the specified region. |
boolean |
lineTo(int x,
int y)
|
void |
maskBlt(Bitmap.PredefinedBitmap predefinedMaskBitmap,
int x,
int y,
Brush fgBrush)
Paints a bitmap using a mask. |
boolean |
moveTo(int x,
int y)
|
void |
paintBitmap(Bitmap bitmap,
int x,
int y)
Paints a bitmap on this device context. |
void |
paintOpaqueBitmap(Bitmap bitmap,
int x,
int y)
Paints an opaque bitmap on this device context. |
boolean |
paintRegion(Region region)
Paints the specified region by using the brush currently selected into the device context. |
boolean |
patBlt(int xLeft,
int yLeft,
int width,
int height,
DC.RasterOperation rasterOp)
This method paints the specified rectangle using the brush that is currently selected into the specified device context. |
boolean |
rectangle(int left,
int top,
int right,
int bottom)
|
void |
release()
Releases the current DC by calling its delete method. |
boolean |
roundRect(int left,
int top,
int right,
int bottom,
int arcWidth,
int arcHeight)
|
void |
selectClipRgn(Region region)
Selects a given region as the current clipping region. |
Bitmap |
selectObject(Bitmap bitmap)
Selects a specified bitmap in the device context. |
Brush |
selectObject(Brush brush)
Selects a specified brush in the device context. |
Font |
selectObject(Font font)
Selects a specified font in the device context. |
Pen |
selectObject(Pen pen)
Selects a specified pen in the device context. |
Region |
selectObject(Region region)
Selects the passed region in the device context. |
ColorRef |
setBkColor(ColorRef color)
Sets the background color in this device context. |
int |
setBkMode(int bgMode)
Sets the background mode in this device context. |
static ColorRef |
setDCBrushColor(DC hDC,
ColorRef clrref)
This method sets the current device context (DC) brush color to the specified color value. |
ColorRef |
setDCPenColor(DC hDC,
ColorRef colorRef)
This method sets the current device context (DC) pen color to the specified color value or the nearest to the specified color value in case when the device cannot set the specified color value. |
DC.MappingMode |
setMapMode(DC.MappingMode mode)
Sets the mapping mode of the specified device context. |
void |
setPolyFillMode(PolyFillMode polyFillMode)
Sets the polygon fill mode for functions that fill polygons. |
ColorRef |
setTextColor(ColorRef color)
Sets the text color in this device context. |
static boolean |
stretchBlt(DC hDCDest,
int xOriginDest,
int yOriginDest,
int widthDest,
int heightDest,
DC hDCSrc,
int xOriginSrc,
int yOriginSrc,
int widthSrc,
int heightSrc,
DC.RasterOperation rasterOp)
Copies a bitmap from a source rectangle into a destination rectangle, stretching or shrinking to fit the dimensions of the destination rectangle, if necessary. |
void |
textOut(int x,
int y,
java.lang.String text)
Draws the text at given coordinates. |
void |
transparentBlt(Bitmap bitmap,
int x,
int y)
Paints a transparent bitmap on screen DC. |
Methods inherited from class com.jniwrapper.win32.Handle |
---|
clone, closeHandle, equals, waitFor, waitFor |
Methods inherited from class com.jniwrapper.Pointer.Void |
---|
asFunction, asFunction, asTypedPointer, castTo, castTo, getDebugInfo, getLength, getValue, hashCode, isNull, read, setValue, toString, write |
Methods inherited from class com.jniwrapper.Parameter |
---|
|
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int DC_PEN
public static final int BKMODE_TRANSPARENT
public static final int BKMODE_OPAQUE
public static final int BKMODE_LAST
public static final long GRADIENT_FILL_RECT_H
public static final long GRADIENT_FILL_RECT_V
public static final int DT_RIGHT
Constructor Detail |
---|
public DC()
public DC(long value)
Method Detail |
---|
public static DC createCompatibleDC(DC dc)
dc
- DC to create a compatible one from.
public Brush selectObject(Brush brush)
brush
- a brush to select.
public Pen selectObject(Pen pen)
pen
- a pen to select.
public Bitmap selectObject(Bitmap bitmap)
bitmap
- a bitmap to select.
public Font selectObject(Font font)
font
- a font to select.
public Region selectObject(Region region)
region
- the region to select
public static void bitBlt(DC hdcDest, int xDest, int yDest, int width, int height, DC hdcSrc, int xSrc, int ySrc, DC.RasterOperation rop)
bitBlt
does only clipping on the
destination DC.
xDest
- the x-coordinate of the upper-left corner of the destination
rectangle.yDest
- the y-coordinate of the upper-left corner of the destination
rectangle.width
- the width of the source and destination rectangles.height
- the height of the source and the destination rectangles.xSrc
- the x-coordinate of the upper-left corner of the source
rectangle.ySrc
- the y-coordinate of the upper-left corner of the source
rectangle.rop
- a raster-operation code.public static boolean stretchBlt(DC hDCDest, int xOriginDest, int yOriginDest, int widthDest, int heightDest, DC hDCSrc, int xOriginSrc, int yOriginSrc, int widthSrc, int heightSrc, DC.RasterOperation rasterOp)
hDCDest
- a destination device context.xOriginDest
- the x-coordinate of the upper-left corner of the
destination rectangle.yOriginDest
- the y-coordinate of the upper-left corner of the
destination rectangle.widthDest
- the width of the destination rectangle.heightDest
- the height of the destination rectangle.hDCSrc
- source device context.xOriginSrc
- the x-coordinate of the upper-left corner of the source
rectangle.yOriginSrc
- the y-coordinate of the upper-left corner of the source
rectangle.widthSrc
- specifies the width of the source rectangle.heightSrc
- specifies the height of the source rectangle.rasterOp
- specifies the raster operation to be performed. Raster
operation codes define how the system combines colors in output
operations that involve a brush, a source bitmap, and a destination
bitmap.
public boolean patBlt(int xLeft, int yLeft, int width, int height, DC.RasterOperation rasterOp)
rastOps
parameter for this method are a limited subset of the full 256 ternary
raster-operation codes; in particular, an operation code that refers to a
source rectangle cannot be used.
xLeft
- specifies the x-coordinate, in logical units, of the
upper-left corner of the rectangle to be filled.yLeft
- specifies the y-coordinate, in logical units, of the
upper-left corner of the rectangle to be filled.width
- specifies the width, in logical units, of the rectangle.height
- specifies the height, in logical units, of the rectangle.rasterOp
- specifies the raster operation code. This code can be one
of the following values:public void release()
public static void deleteDC(DC dc)
dc
- DC to be deleted.public void textOut(int x, int y, java.lang.String text)
x
- the x-coordinate of the upper-left corner.y
- the y-coordinate of the upper-left corner.text
- a text to display.public void drawText(java.lang.String text, Rect clipRect, com.jniwrapper.UInt uFormat)
text
- a text to be drawn.clipRect
- a clip rectangle for drawing.uFormat
- drawing format.public Size getTextExtentPoint32(DC dc, java.lang.String str)
dc
- unusedstr
- a text to be measured.
public void drawIconEx(int x, int y, Icon icon, int width, int heght, int frameIndex, Handle bgBrush, int flags)
x
- the x-coordinate of the image.y
- the y-coordinate of the image.icon
- the icon to be drawn.width
- the width of the drawn icon.heght
- the height of the drawn icon.frameIndex
- the frame index.bgBrush
- the background brush.flags
- drawing flags.public boolean drawIcon(int x, int y, Icon icon)
x
- the x-coordinate of the image.y
- the y-coordinate of the image.icon
- the icon to be drawn.
public int setBkMode(int bgMode)
bgMode
- a new background mode.
public ColorRef setBkColor(ColorRef color)
color
- the background color.
public ColorRef setTextColor(ColorRef color)
color
- the text color.
public void selectClipRgn(Region region)
region
- the region to be selected.public void fillRegion(Region region, Brush brush)
region
- the region to fill.brush
- a brush to be used for painting.public void frameRegion(Region region, Brush brush, int width, int heigh)
region
- brush
- width
- heigh
- public int getPolyFillMode()
public boolean invertRegion(Region region)
region
-
public boolean paintRegion(Region region)
region
-
public void setPolyFillMode(PolyFillMode polyFillMode)
polyFillMode
- public ColorRef getPixel(int x, int y)
x
- the x-coordinate of pixel.y
- the y-coordinate of pixel.
public static ColorRef setDCBrushColor(DC hDC, ColorRef clrref)
hDC
- an instance of the DC
class
representing the current device context.clrref
- an instance of the ColorRef
class representing the color for the brush.
ColorRef
value. If the method fails, the
return value is CLR_INVALID.public ColorRef setDCPenColor(DC hDC, ColorRef colorRef)
hDC
- an instance of the DC
class.colorRef
- an instance of the ColorRef
class.
ColorRef
class.public void transparentBlt(Bitmap bitmap, int x, int y)
bitmap
- x
- y
- public void paintBitmap(Bitmap bitmap, int x, int y)
bitmap
- a bitmap to be painted.x
- the x-coordinate of the image.y
- the y-coordinate of the image.public void paintOpaqueBitmap(Bitmap bitmap, int x, int y)
bitmap
- a bitmap to be painted.x
- the x-coordinate of the image.y
- the y-coordinate of the image.public boolean alphaBlend(int xDest, int yDest, int widthDest, int heightDest, DC hdcSrc, int xSrc, int ySrc, int widthSrc, int heightSrc, BlendFunction blendFunction)
xDest
- the x-coordinate of the upper-left corner for the
destination rectangle.yDest
- the y-coordinate of the upper-left corner for the
destination rectangle.widthDest
- the width of the destination rectangle.heightDest
- the height of the destination rectangle.hdcSrc
- DC that contains the image.xSrc
- the x-coordinate of the upper-left corner for the image.ySrc
- the y-coordinate of the upper-left corner for the image.widthSrc
- the width of the image.heightSrc
- the height of the image.blendFunction
- blend function.
public void drawGrayed(DC srcDC, Rect destRect)
Usage: paint some text, a transparent picture on a white background, and then use this function for screen DC (i.e. current DC must be screen DC).
srcDC
- source DC.destRect
- a destination rectangle.public void fillRect(Rect rect, Brush brush)
rect
- a rectangle to be filled.brush
- a brush to use for filling.public void maskBlt(Bitmap.PredefinedBitmap predefinedMaskBitmap, int x, int y, Brush fgBrush)
Precondition: the current DC is screen DC.
predefinedMaskBitmap
- a predefined bitmap for the mask.x
- the x-coordinate of the upper corner for the destination
rectangle.y
- the y-coordinate of the upper corner for the destination
rectangle.fgBrush
- a brush for the foreground color.public boolean gradientFill(Rect rect, java.awt.Color leftColor, java.awt.Color rightColor)
rect
- a rectangle for fill.
public boolean lineTo(int x, int y)
public boolean moveTo(int x, int y)
public boolean drawRectangle(Rect rect)
public DC.MappingMode setMapMode(DC.MappingMode mode)
mode
- Specifies the new mapping mode.
public int getDeviceCaps(int index)
index
- index of capability.
public int intersectClipRect(int left, int top, int right, int bottom)
left
- x-coord of upper-left cornertop
- y-coord of upper-left cornerright
- x-coord of lower-right cornerbottom
- y-coord of lower-right corner
public boolean rectangle(int left, int top, int right, int bottom)
public boolean roundRect(int left, int top, int right, int bottom, int arcWidth, int arcHeight)
public boolean fillRectangle(int left, int top, int right, int bottom)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |