I put each line every point of x, y coordinates to list
The final list the size of the hundreds of W, the convention has more than 1000 W
This leads to frequent GC, easily jammed
4 k largest screen 3840 * 2160
1920 * 1080 * 3 (RGB), for example, a RGB line is composed of 3 sliver pixels,
Equivalent to the screen (1920 * 3) * 1080, in a memory area above the diagonal lines, each the size of the root slash only one byte,
The color value is 0 or 255 (black and white), draw a line that the line according to the algorithm there are 1080 points
New Thread (new Runnable () {
@ Override
Public void the run () {
Try {
Points. The clear ();
//lines is a collection of all sub pixel lines: each line RGB pixel consists of 3 sliver pixel lines
for (int i=0; i
//parameter is the sub pixel line, two points x, y coordinates
//Bresenham line drawing algorithm for each point of the x, y coordinates
GetPXpoint (lines) get (I)) getX_start (), lines, the get (I). GetY_start (), lines, the get (I). GetX_end (), screen_height);
}
Byte value assignment {255,0,0,255,0,0,255,0,0, like that... } to GC
Bytes=new byte [screen_width * 3 * screen_height];
for (int i=0; i
}
Can cause the GC//ARGB
If (rgbaColor!=null)
RgbaColor=null;
RgbaColor=new int [screen_width * screen_height];
Int k=0;
While (k & lt; Screen_width * 3 * screen_height) {
RgbaColor [k/3]=(255 & amp; 0 XFF) & lt; <24 | (bytes [k] & amp; 0 XFF) & lt; <16 | (bytes [k + 1] & amp; 0 XFF) & lt; <8 | (bytes [k + 2] & amp; 0 XFF);
K +=3;
}
//config rgba
If (bitmap!=null)
Bitmap=null;
Bitmap bitmap=createBitmap (rgbaColor, screen_width and screen_height, bitmap. Config. ARGB_8888);