Waitrud Weber’s blog

things and reminders for memories

3d: Code customization in the Windows Thread: Regulations is the below:

The thread must have the start and end processes, in the code, which is top and bottom best.
We do not return the in the middle of code but skip to end.

f:id:Waitrud_Weber:20201009194236p:plain

 Even no compiler. we haven't mistaken in this coding.
Coding a lot in this pace without compiler, which is better for experienced progranmmer, and then we check the every function, at least we appriciate.

 

int draw_line_buffer (int** canvas, int start_x, int start_y, int end_x, int end_y, int coulour ) {
	int i, j;
	double a = 0.0;
	double flip_a = 0.0;

	a = (double) (end_y- start_y) / (double) (end_x - start_x);
	flip_a = 1.0 / (double) a;

	if ( a < 0.5 ) {
		for ( i=start_x; i<end_x; i++ ) {
			j = i * j ;
			if ( canWrite(canvas) ) == 1 ) {
				canvas[i][j] = colour;
			}
		}
	} else {
		for ( j=start_y; j<end_y; j++ ) {
			i = flip_a * j;
			if ( canWrite(canvas) ) == 1 ) {
				canvas[i][j] = colour;
			}
		}
	}

	return 1;
}



[1] using double dc context: on the windows api: https://qiita.com/kero_dgu/items/981706aaa7fb64daab11