Guest User

Untitled

a guest
Feb 20th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.28 KB | None | 0 0
  1. drawTexturedPath
  2.  
  3. public void drawTexturedPath(int[] xPts,
  4. int[] yPts,
  5. byte[] pointTypes,
  6. int[] offsets,
  7. int xOrigin,
  8. int yOrigin,
  9. int dux,
  10. int dvx,
  11. int duy,
  12. int dvy,
  13. Bitmap textureData)
  14. Draws a set of texture-filled paths.
  15. Use this method to draw one or more texture-filled non-intersecting paths that contain line segments or curves. You specify the x and y coordinates and point types of the paths desired.
  16.  
  17. The offsets indicate the beginnings of each path in the data array. The data in the ith path is defined to be the (xPts,yPts) values from offsets[i] to offsets[i+1]-1 inclusive. Thus if there are N values in offsets, there are N-1 paths defined, where the final value is one greater than the offset where the final point of the final path is located in the points data. If offsets is null, the xPts and yPts data will be treated as a single path, and these arrays must have the same length.
  18.  
  19. The xPts and yPts arrays keep track of each vertex in the polygon and each value in the xPts array must have a corresponding value at the same index in the yPts array, and a corresponding value at the same index in the pointTypes array.
  20.  
  21. None of the edges in a path may cross any other edge in any of the paths (including itself). If edges do cross, the drawing behaviour is undefined. A path may be fully contained within another path, e.g. a "donut" shape.
  22.  
  23. The paths are filled by the "even-odd" rule. Thus if a ray is drawn from any point, the area containing the point will be filled if the ray passes through an odd number of edges and will not be filled if is passes through an even number of edges.
  24.  
  25. The texture used to fill the path is specified as a Bitmap. Starting from the texture origin (as specified in local coordinates by xOrigin and yOrigin), the texture is mapped into the path, being tiled as necessary to fill the region. The scale and angle used to map the texture are specified by the two walk vectors (dux, dvx) and (duy, dvy) (u and v are taked to correspond to x and y, but in texture space rather than in screen space). dux and dvx indicate how many u and v coordinates to skip in the texture per x coordinate on the screen. Likewise, duy and dvy indicate how texture coordinates to skip per y coordinate on the screen. These four values are represented in 15.16 fixed point, allowing for eight bits of decimal precision. Using these walk vectors it is possible to achieve arbitrary rotation, scaling, and skewing on a given texture.
  26.  
  27. Note that each non-null array parameter must be a different array.
  28.  
  29. Parameters:
  30. xPts - Ordered list of x values for each vertex in the paths.
  31. yPts - Ordered list of y values for each vertex in the paths.
  32. pointTypes - One of CURVEDPATH_END_POINT, CURVEDPATH_QUADRATIC_BEZIER_CONTROL_POINT, or CURVEDPATH_CUBIC_BEZIER_CONTROL_POINT. There must be one of these values for each (x,y) point defined. If pointTypes is null, all point are assumed to be of type CURVEDPATH_END_POINT.
  33. If a point's value is CURVEDPATH_END_POINT, then a line or curve ends on this point. If a curve control point is next to this point, a curve will have this point as an endpoint. Otherwise, straight lines are drawn between successive end points.
  34.  
  35. If a point's value is CURVEDPATH_QUADRATIC_BEZIER_CONTROL_POINT, the point is a control point for a quadratic bezier. The control point of a quadratic bezier is the single point that "stretches" the curve away from the end points. If a point is a quadratic bezier control point, the points preceeding and succeeding it must be end points (CURVEDPATH_END_POINT).
  36.  
  37. If a point's value is CURVEDPATH_CUBIC_BEZIER_CONTROL_POINT, the point is a control point for a cubic bezier. A cubic bezier has two control points that "stretch" the curve away from the end points. Cubic bezier control points must come in sets of two, with end points (CURVEDPATH_END_POINT) coming before the first control point and after the second.
  38.  
  39. offsets - List defining the beginnings of each path in the xPts/yPts data arrays, or null to indicate a single path. A path that begins at point (xPts[offsets[i]],yPts[offsets[i]]) will end at point (xPts[offsets[i+1]]-1,yPts[offsets[i+1]]-1).
  40. xOrigin - X component of the texture origin in local screen coordinates.
  41. yOrigin - Y component of the texture origin in local screen coordinates.
  42. dux - Number of u points to skip in the texture per x point on screen (15.16 fixed point).
  43. dvx - Number of v points to skip in the texture per x point on screen (15.16 fixed point).
  44. duy - Number of u points to skip in the texture per y point on screen (15.16 fixed point).
  45. dvy - Number of v points to skip in the texture per y point on screen (15.16 fixed point).
  46. textureData - Non-null bitmap to be used as a texture.
  47. Throws:
  48. IllegalArgumentException - If the data is malformed. For example, the values in offsets is negative or not in increasing order, there are fewer than 2 points in a single path, the values in offsets index outside the points arrays, the values in pointTypes are invalid, or offsets is null and xPts and yPts are not the same length.
  49. Since:
  50. JDE 4.2.0
Add Comment
Please, Sign In to add comment