Labels: style blog HTTP color Java OS for 2014
In processing, the following basic knowledge is required for font Deformation:
1. pgraphics object
2. pixel-based images
The production process is not complex. The Code is as follows:
1 Color ellipse_color = color (0 ); 2 Color line_color = color (0,125 ); 3 Color pgraphics_color = color (0 ); 4 Int Line_length = 25 ; 5 Boolean Reversedrawing = False ; 6 Pgraphics PG; 7 Pfont F = createfont ("", 42 ); 8 Void Setup (){ 9 Size (1280,720 , P2D ); 10 Pg = Creategraphics (width, height, java2d ); 11 Pg. begindraw (); 12 Pg. textfont (f ); 13 Pg. textsize (300 ); 14 Pg. textalign (Center, Center ); 15 Pg. Fill (pgraphics_color ); 16 Pg. Text (" tawei", pg. width/2, pg. Height/2 ); 17 Pg. enddraw (); 18 } 19 Void Draw (){ 20 Int Gridh = ( Int ) Map (mousex, 0, width, 30,100 ); 21 Int Gridv = ( Int ) Map (Mousey, 0, height, 15,100 ); 22 Float W = width/ Gridh; 23 Float H = height/ Gridv; 24 Float R = Min (W, H ); 25 26 Background (255 ); 27 Strokeweight (1 ); 28 For ( Int Y = 0; y <gridv; y ++ ){ 29 For ( Int X = 0; x <gridh; X ++ ){ 30 Float _ X = x * W; 31 Float _ Y = y * H; 32 Color c = pg. Get ( Int (_ X ), Int (_ Y )); 33 Boolean Textdraw = (C = Pgraphics_color ); 34 If (Textdraw ){ 35 Nostroke (); 36 Fill (ellipse_color ); 37 Ellipse (_ x, _ y, R, R ); 38 } Else { 39 Stroke (line_color ); 40 Line (_ x, _ y, _ x + line_length, _ y + Line_length ); 41 } 42 } 43 } 44 }
Among them, the setup part of PG operations are all on the pgraphics object, this object is similar to the canvas, and the two for loops in the draw are the key to implementing font deformation, after the image is pixel-based, the font color and background color can be compared to the font color, and the font can be "scaled" out of the background. Then, if you want to flatten the image or compress it, you can see your preferences ~