-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathblend_8c.html
1326 lines (1234 loc) · 102 KB
/
blend_8c.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Leptonica: src/blend.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body onload='searchBox.OnSelectItem(0);'>
<!-- Generated by Doxygen 1.7.3 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Search');
--></script>
<script type="text/javascript">
function hasClass(ele,cls) {
return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)'));
}
function addClass(ele,cls) {
if (!this.hasClass(ele,cls)) ele.className += " "+cls;
}
function removeClass(ele,cls) {
if (hasClass(ele,cls)) {
var reg = new RegExp('(\\s|^)'+cls+'(\\s|$)');
ele.className=ele.className.replace(reg,' ');
}
}
function toggleVisibility(linkObj) {
var base = linkObj.getAttribute('id');
var summary = document.getElementById(base + '-summary');
var content = document.getElementById(base + '-content');
var trigger = document.getElementById(base + '-trigger');
if ( hasClass(linkObj,'closed') ) {
summary.style.display = 'none';
content.style.display = 'block';
trigger.src = 'open.png';
removeClass(linkObj,'closed');
addClass(linkObj,'opened');
} else if ( hasClass(linkObj,'opened') ) {
summary.style.display = 'block';
content.style.display = 'none';
trigger.src = 'closed.png';
removeClass(linkObj,'opened');
addClass(linkObj,'closed');
}
return false;
}
</script>
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="moller52-tiny.jpg"></td>
<td style="padding-left: 0.5em;">
<div id="projectname">Leptonica <span id="projectnumber">1.68</span></div>
<div id="projectbrief">C Image Processing Library</div>
</td>
</tr>
</tbody>
</table>
</div>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
<li><a href="dirs.html"><span>Directories</span></a></li>
<li id="searchli">
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
initNavTree('blend_8c.html','');
</script>
<div id="doc-content">
<div class="header">
<div class="summary">
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<h1>blend.c File Reference</h1> </div>
</div>
<div class="contents">
<p>Blend (optionally with a mask) and re-coloring images.
<a href="#_details">More...</a></p>
<div class="textblock"><code>#include <stdio.h></code><br/>
<code>#include <stdlib.h></code><br/>
<code>#include "<a class="el" href="allheaders_8h_source.html">allheaders.h</a>"</code><br/>
</div>
<p><a href="blend_8c_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="blend_8c.html#ad12eec2ea8dff86628c6d5717214da66">blendComponents</a> (<a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> a, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> b, <a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> fract)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="blend_8c.html#aece01093947264a4b0363e6190875035">blendHardLightComponents</a> (<a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> a, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> b, <a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> fract)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="struct_pix.html">PIX</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="blend_8c.html#aa54f843a3af2e59878454fe41d41a614">pixBlend</a> (<a class="el" href="struct_pix.html">PIX</a> *pixs1, <a class="el" href="struct_pix.html">PIX</a> *pixs2, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> x, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> y, <a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> fract)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="struct_pix.html">PIX</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="blend_8c.html#aa3711c698d4fb80d7129018b5162f9c6">pixBlendMask</a> (<a class="el" href="struct_pix.html">PIX</a> *pixd, <a class="el" href="struct_pix.html">PIX</a> *pixs1, <a class="el" href="struct_pix.html">PIX</a> *pixs2, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> x, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> y, <a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> fract, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> type)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="struct_pix.html">PIX</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="blend_8c.html#a4d49fe68f0b6f6c4b487a82a0a78fdd5">pixBlendGray</a> (<a class="el" href="struct_pix.html">PIX</a> *pixd, <a class="el" href="struct_pix.html">PIX</a> *pixs1, <a class="el" href="struct_pix.html">PIX</a> *pixs2, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> x, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> y, <a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> fract, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> type, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> transparent, <a class="el" href="environ_8h.html#a4d4d7254020fc95aef5dde8884405358">l_uint32</a> transpix)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="struct_pix.html">PIX</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="blend_8c.html#a35ed557a91a1ad527ef4a6c00e91e6a1">pixBlendColor</a> (<a class="el" href="struct_pix.html">PIX</a> *pixd, <a class="el" href="struct_pix.html">PIX</a> *pixs1, <a class="el" href="struct_pix.html">PIX</a> *pixs2, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> x, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> y, <a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> fract, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> transparent, <a class="el" href="environ_8h.html#a4d4d7254020fc95aef5dde8884405358">l_uint32</a> transpix)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="struct_pix.html">PIX</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="blend_8c.html#a73515ff61cf772d6f6d93579a876b53e">pixBlendColorByChannel</a> (<a class="el" href="struct_pix.html">PIX</a> *pixd, <a class="el" href="struct_pix.html">PIX</a> *pixs1, <a class="el" href="struct_pix.html">PIX</a> *pixs2, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> x, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> y, <a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> rfract, <a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> gfract, <a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> bfract, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> transparent, <a class="el" href="environ_8h.html#a4d4d7254020fc95aef5dde8884405358">l_uint32</a> transpix)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="struct_pix.html">PIX</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="blend_8c.html#a288c03f9eb9ff330240ff1555e38b0ea">pixBlendGrayAdapt</a> (<a class="el" href="struct_pix.html">PIX</a> *pixd, <a class="el" href="struct_pix.html">PIX</a> *pixs1, <a class="el" href="struct_pix.html">PIX</a> *pixs2, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> x, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> y, <a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> fract, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> shift)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="struct_pix.html">PIX</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="blend_8c.html#a75cf8f041f0819375b30f289fe74249d">pixFadeWithGray</a> (<a class="el" href="struct_pix.html">PIX</a> *pixs, <a class="el" href="struct_pix.html">PIX</a> *pixb, <a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> factor, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> type)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="struct_pix.html">PIX</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="blend_8c.html#adccd01da6572ef3c8b2a4b955ec4c623">pixBlendHardLight</a> (<a class="el" href="struct_pix.html">PIX</a> *pixd, <a class="el" href="struct_pix.html">PIX</a> *pixs1, <a class="el" href="struct_pix.html">PIX</a> *pixs2, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> x, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> y, <a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> fract)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="blend_8c.html#ad4e4745c0c48b3ae04b988e21386d2f3">pixBlendCmap</a> (<a class="el" href="struct_pix.html">PIX</a> *pixs, <a class="el" href="struct_pix.html">PIX</a> *pixb, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> x, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> y, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> sindex)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="struct_pix.html">PIX</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="blend_8c.html#a51d08d3ae19c515a5fabf42db1daf85b">pixBlendWithGrayMask</a> (<a class="el" href="struct_pix.html">PIX</a> *pixs1, <a class="el" href="struct_pix.html">PIX</a> *pixs2, <a class="el" href="struct_pix.html">PIX</a> *pixg, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> x, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> y)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="blend_8c.html#ac5f519c9ae69dfca48ca7c8419c45d0d">pixColorGray</a> (<a class="el" href="struct_pix.html">PIX</a> *pixs, <a class="el" href="struct_box.html">BOX</a> *box, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> type, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> thresh, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> rval, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> gval, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> bval)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="struct_pix.html">PIX</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="blend_8c.html#a76725349efc43bd2cb2e0e6ceeeb4752">pixSnapColor</a> (<a class="el" href="struct_pix.html">PIX</a> *pixd, <a class="el" href="struct_pix.html">PIX</a> *pixs, <a class="el" href="environ_8h.html#a4d4d7254020fc95aef5dde8884405358">l_uint32</a> srcval, <a class="el" href="environ_8h.html#a4d4d7254020fc95aef5dde8884405358">l_uint32</a> dstval, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> diff)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="struct_pix.html">PIX</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="blend_8c.html#aba28c871b7e90d3ccada2794fb4d764e">pixSnapColorCmap</a> (<a class="el" href="struct_pix.html">PIX</a> *pixd, <a class="el" href="struct_pix.html">PIX</a> *pixs, <a class="el" href="environ_8h.html#a4d4d7254020fc95aef5dde8884405358">l_uint32</a> srcval, <a class="el" href="environ_8h.html#a4d4d7254020fc95aef5dde8884405358">l_uint32</a> dstval, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> diff)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="struct_pix.html">PIX</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="blend_8c.html#a6997981bec4c8aa87a355506068d3a09">pixLinearMapToTargetColor</a> (<a class="el" href="struct_pix.html">PIX</a> *pixd, <a class="el" href="struct_pix.html">PIX</a> *pixs, <a class="el" href="environ_8h.html#a4d4d7254020fc95aef5dde8884405358">l_uint32</a> srcval, <a class="el" href="environ_8h.html#a4d4d7254020fc95aef5dde8884405358">l_uint32</a> dstval)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="blend_8c.html#a757fbd3f00aff2464713880c3991bfaf">pixelLinearMapToTargetColor</a> (<a class="el" href="environ_8h.html#a4d4d7254020fc95aef5dde8884405358">l_uint32</a> scolor, <a class="el" href="environ_8h.html#a4d4d7254020fc95aef5dde8884405358">l_uint32</a> srcmap, <a class="el" href="environ_8h.html#a4d4d7254020fc95aef5dde8884405358">l_uint32</a> dstmap, <a class="el" href="environ_8h.html#a4d4d7254020fc95aef5dde8884405358">l_uint32</a> *pdcolor)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="blend_8c.html#a809afc500fb12c76e303e447affda840">pixelFractionalShift</a> (<a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> rval, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> gval, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> bval, <a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> fraction, <a class="el" href="environ_8h.html#a4d4d7254020fc95aef5dde8884405358">l_uint32</a> *ppixel)</td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>Blend (optionally with a mask) and re-coloring images. </p>
<div class="fragment"><pre class="fragment"> Blending two images that are not colormapped
<a class="code" href="struct_pix.html">PIX</a> *<a class="code" href="blend_8c.html#aa54f843a3af2e59878454fe41d41a614">pixBlend</a>()
<a class="code" href="struct_pix.html">PIX</a> *<a class="code" href="blend_8c.html#aa3711c698d4fb80d7129018b5162f9c6">pixBlendMask</a>()
<a class="code" href="struct_pix.html">PIX</a> *<a class="code" href="blend_8c.html#a4d49fe68f0b6f6c4b487a82a0a78fdd5">pixBlendGray</a>()
<a class="code" href="struct_pix.html">PIX</a> *<a class="code" href="blend_8c.html#a35ed557a91a1ad527ef4a6c00e91e6a1">pixBlendColor</a>()
<a class="code" href="struct_pix.html">PIX</a> *<a class="code" href="blend_8c.html#a73515ff61cf772d6f6d93579a876b53e">pixBlendColorByChannel</a>()
<a class="code" href="struct_pix.html">PIX</a> *<a class="code" href="blend_8c.html#a288c03f9eb9ff330240ff1555e38b0ea">pixBlendGrayAdapt</a>()
static <a class="code" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> <a class="code" href="blend_8c.html#ad12eec2ea8dff86628c6d5717214da66">blendComponents</a>()
<a class="code" href="struct_pix.html">PIX</a> *<a class="code" href="blend_8c.html#a75cf8f041f0819375b30f289fe74249d">pixFadeWithGray</a>()
<a class="code" href="struct_pix.html">PIX</a> *<a class="code" href="blend_8c.html#adccd01da6572ef3c8b2a4b955ec4c623">pixBlendHardLight</a>()
static <a class="code" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> <a class="code" href="blend_8c.html#aece01093947264a4b0363e6190875035">blendHardLightComponents</a>()
Blending two colormapped images
<a class="code" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> <a class="code" href="blend_8c.html#ad4e4745c0c48b3ae04b988e21386d2f3">pixBlendCmap</a>()
Blending two images using a third (alpha mask)
<a class="code" href="struct_pix.html">PIX</a> *<a class="code" href="blend_8c.html#a51d08d3ae19c515a5fabf42db1daf85b">pixBlendWithGrayMask</a>()
Coloring "gray" pixels
<a class="code" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> <a class="code" href="blend_8c.html#ac5f519c9ae69dfca48ca7c8419c45d0d">pixColorGray</a>()
Adjusting one or more <a class="code" href="writetext__reg_8c.html#a4ebbf30ad0e54b03f69dd59a5fa97b18">colors</a> to a target color
<a class="code" href="struct_pix.html">PIX</a> *<a class="code" href="blend_8c.html#a76725349efc43bd2cb2e0e6ceeeb4752">pixSnapColor</a>()
<a class="code" href="struct_pix.html">PIX</a> *<a class="code" href="blend_8c.html#aba28c871b7e90d3ccada2794fb4d764e">pixSnapColorCmap</a>()
Mapping <a class="code" href="writetext__reg_8c.html#a4ebbf30ad0e54b03f69dd59a5fa97b18">colors</a> based on a source/target pair
<a class="code" href="struct_pix.html">PIX</a> *<a class="code" href="blend_8c.html#a6997981bec4c8aa87a355506068d3a09">pixLinearMapToTargetColor</a>()
<a class="code" href="environ_8h.html#a4d4d7254020fc95aef5dde8884405358">l_uint32</a> <a class="code" href="blend_8c.html#a757fbd3f00aff2464713880c3991bfaf">pixelLinearMapToTargetColor</a>()
Fractional shift of RGB towards black or white
<a class="code" href="environ_8h.html#a4d4d7254020fc95aef5dde8884405358">l_uint32</a> <a class="code" href="blend_8c.html#a809afc500fb12c76e303e447affda840">pixelFractionalShift</a>()
In blending operations a new pix is produced where typically
a subset of pixels in src1 are changed by the set of pixels
in src2, when src2 is located in a given position relative
to src1. This is similar to rasterop, except that the
blending operations we allow are more complex, and typically
result in dest pixels that are a linear combination of two
pixels, such as src1 and its inverse. I find it convenient
to think of src2 as the "blender" (the one that takes the action)
and src1 as the "blendee" (the one that changes).
Blending works best when src1 is 8 or 32 bpp. We also allow
src1 to be colormapped, but the colormap is removed before blending,
so if src1 is colormapped, we can't allow in-place blending.
Because src2 is typically smaller than src1, we can implement by
clipping src2 to src1 and then transforming some of the dest
pixels that are under the support of src2. In practice, we
do the clipping in the inner pixel loop. For grayscale and
color src2, we also allow a simple form of transparency, where
pixels of a particular value in src2 are transparent; for those pixels,
no blending is done.
The blending functions are categorized by the depth of src2,
the blender, and not that of src1, the blendee.
- If src2 is 1 bpp, we can do one of three things:
(1) <a class="code" href="pix_8h.html#a0944a4353780132eeab7b06e3e42291da8fd0f1d495f371c29d8175c6aac407da">L_BLEND_WITH_INVERSE</a>: Blend a given fraction of src1 with its
inverse color for those pixels in src2 that are fg (ON),
and leave the dest pixels unchanged for pixels in src2 that
are bg (OFF).
(2) <a class="code" href="pix_8h.html#a0944a4353780132eeab7b06e3e42291da885c98d30276d11068bd5b613cbb6510">L_BLEND_TO_WHITE</a>: Fade the src1 pixels toward white by a
given fraction for those pixels in src2 that are fg (ON),
and leave the dest pixels unchanged for pixels in src2 that
are bg (OFF).
(3) <a class="code" href="pix_8h.html#a0944a4353780132eeab7b06e3e42291daa1ef08fc35a77d1716f7c3b7e39acb1c">L_BLEND_TO_BLACK</a>: Fade the src1 pixels toward black by a
given fraction for those pixels in src2 that are fg (ON),
and leave the dest pixels unchanged for pixels in src2 that
are bg (OFF).
The blending function is <a class="code" href="blend_8c.html#aa3711c698d4fb80d7129018b5162f9c6">pixBlendMask</a>().
- If src2 is 8 bpp grayscale, we can do one of two things
(but see <a class="code" href="blend_8c.html#a75cf8f041f0819375b30f289fe74249d">pixFadeWithGray</a>() below):
(1) <a class="code" href="pix_8h.html#a0944a4353780132eeab7b06e3e42291da5f7056c3021d9af1f9cc65d9d1dbf7a2">L_BLEND_GRAY</a>: If src1 is 8 bpp, mix the two values, using
a fraction of src2 and (1 - fraction) of src1.
If src1 is 32 bpp (rgb), mix the fraction of src2 with
each of the color components in src1.
(2) <a class="code" href="pix_8h.html#a0944a4353780132eeab7b06e3e42291dad8b010b4a7f8372a4b36ef2df3dee05f">L_BLEND_GRAY_WITH_INVERSE</a>: Use the grayscale value in src2
to determine how much of the inverse of a src1 pixel is
to be combined with the pixel value. The input fraction
further acts to scale the change in the src1 pixel.
The blending function is <a class="code" href="blend_8c.html#a4d49fe68f0b6f6c4b487a82a0a78fdd5">pixBlendGray</a>().
- If src2 is color, we blend a given fraction of src2 with
src1. If src1 is 8 bpp, the resulting <a class="code" href="colorquant__reg_8c.html#aabec89bef1d1e1f9faf4e7d2e685c317">image</a> is 32 bpp.
The blending function is <a class="code" href="blend_8c.html#a35ed557a91a1ad527ef4a6c00e91e6a1">pixBlendColor</a>().
- For all three blending functions -- <a class="code" href="blend_8c.html#aa3711c698d4fb80d7129018b5162f9c6">pixBlendMask</a>(), <a class="code" href="blend_8c.html#a4d49fe68f0b6f6c4b487a82a0a78fdd5">pixBlendGray</a>()
and <a class="code" href="blend_8c.html#a35ed557a91a1ad527ef4a6c00e91e6a1">pixBlendColor</a>() -- you can apply the blender to the blendee
either in-place or generating a new pix. For the in-place
operation, this requires that the depth of the resulting pix
must equal that of the input pixs1.
- We remove colormaps from src1 and src2 before blending.
Any quantization would have to be done after blending.
We include another function, <a class="code" href="blend_8c.html#a75cf8f041f0819375b30f289fe74249d">pixFadeWithGray</a>(), that blends
a gray or color src1 with a gray src2. It does one of these things:
(1) <a class="code" href="pix_8h.html#a0944a4353780132eeab7b06e3e42291da885c98d30276d11068bd5b613cbb6510">L_BLEND_TO_WHITE</a>: Fade the src1 pixels toward white by
a number times the value in src2.
(2) <a class="code" href="pix_8h.html#a0944a4353780132eeab7b06e3e42291daa1ef08fc35a77d1716f7c3b7e39acb1c">L_BLEND_TO_BLACK</a>: Fade the src1 pixels toward black by
a number times the value in src2.
Also included is a generalization of the so-called "hard light"
blending: <a class="code" href="blend_8c.html#adccd01da6572ef3c8b2a4b955ec4c623">pixBlendHardLight</a>(). We generalize by allowing a fraction < 1.0
of the blender to be admixed with the blendee. The standard function
does full mixing.
</pre></div>
<p>Definition in file <a class="el" href="blend_8c_source.html">blend.c</a>.</p>
</div><hr/><h2>Function Documentation</h2>
<a class="anchor" id="ad12eec2ea8dff86628c6d5717214da66"></a><!-- doxytag: member="blend.c::blendComponents" ref="ad12eec2ea8dff86628c6d5717214da66" args="(l_int32 a, l_int32 b, l_float32 fract)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">static <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> blendComponents </td>
<td>(</td>
<td class="paramtype"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td>
<td class="paramname"><em>a</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td>
<td class="paramname"><em>b</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> </td>
<td class="paramname"><em>fract</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td><code> [static]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="blend_8c_source.html#l00845">845</a> of file <a class="el" href="blend_8c_source.html">blend.c</a>.</p>
<p>Referenced by <a class="el" href="blend_8c_source.html#l00760">pixBlendColorByChannel()</a>.</p>
</div>
</div>
<a class="anchor" id="aece01093947264a4b0363e6190875035"></a><!-- doxytag: member="blend.c::blendHardLightComponents" ref="aece01093947264a4b0363e6190875035" args="(l_int32 a, l_int32 b, l_float32 fract)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">static <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> blendHardLightComponents </td>
<td>(</td>
<td class="paramtype"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td>
<td class="paramname"><em>a</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td>
<td class="paramname"><em>b</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> </td>
<td class="paramname"><em>fract</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td><code> [static]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="blend_8c_source.html#l01318">1318</a> of file <a class="el" href="blend_8c_source.html">blend.c</a>.</p>
<p>Referenced by <a class="el" href="blend_8c_source.html#l01191">pixBlendHardLight()</a>.</p>
</div>
</div>
<a class="anchor" id="aa54f843a3af2e59878454fe41d41a614"></a><!-- doxytag: member="blend.c::pixBlend" ref="aa54f843a3af2e59878454fe41d41a614" args="(PIX *pixs1, PIX *pixs2, l_int32 x, l_int32 y, l_float32 fract)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="struct_pix.html">PIX</a>* pixBlend </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_pix.html">PIX</a> * </td>
<td class="paramname"><em>pixs1</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="struct_pix.html">PIX</a> * </td>
<td class="paramname"><em>pixs2</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td>
<td class="paramname"><em>x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td>
<td class="paramname"><em>y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> </td>
<td class="paramname"><em>fract</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="blend_8c.html#aa54f843a3af2e59878454fe41d41a614">pixBlend()</a></p>
<p>Input: pixs1 (blendee) pixs2 (blender; typ. smaller) x,y (origin (UL corner) of pixs2 relative to the origin of pixs1; can be < 0) fract (blending fraction) Return: pixd (blended image), or null on error</p>
<p>Notes: (1) This is a simple top-level interface. For more flexibility, call directly into <a class="el" href="blend_8c.html#aa3711c698d4fb80d7129018b5162f9c6">pixBlendMask()</a>, etc. </p>
<p>Definition at line <a class="el" href="blend_8c_source.html#l00157">157</a> of file <a class="el" href="blend_8c_source.html">blend.c</a>.</p>
<p>References <a class="el" href="boxbasic_8c_source.html#l00133">boxCreate()</a>, <a class="el" href="boxbasic_8c_source.html#l00242">boxDestroy()</a>, <a class="el" href="environ_8h_source.html#l00250">ERROR_PTR</a>, <a class="el" href="pix_8h_source.html#l00633">L_BLEND_GRAY</a>, <a class="el" href="pix_8h_source.html#l00630">L_BLEND_WITH_INVERSE</a>, <a class="el" href="environ_8h_source.html#l00155">L_MAX</a>, <a class="el" href="environ_8h_source.html#l00257">L_WARNING</a>, <a class="el" href="environ_8h_source.html#l00171">NULL</a>, <a class="el" href="blend_8c_source.html#l00652">pixBlendColor()</a>, <a class="el" href="blend_8c_source.html#l00456">pixBlendGray()</a>, <a class="el" href="blend_8c_source.html#l00240">pixBlendMask()</a>, <a class="el" href="pix5_8c_source.html#l00698">pixClipRectangle()</a>, <a class="el" href="pix1_8c_source.html#l00466">pixDestroy()</a>, <a class="el" href="pix1_8c_source.html#l00863">pixGetDepth()</a>, <a class="el" href="pix1_8c_source.html#l00898">pixGetDimensions()</a>, <a class="el" href="pixconv_8c_source.html#l00223">pixRemoveColormap()</a>, <a class="el" href="environ_8h_source.html#l00249">PROCNAME</a>, and <a class="el" href="pix_8h_source.html#l00181">REMOVE_CMAP_BASED_ON_SRC</a>.</p>
<p>Referenced by <a class="el" href="blendtest1_8c_source.html#l00030">main()</a>.</p>
</div>
</div>
<a class="anchor" id="aa3711c698d4fb80d7129018b5162f9c6"></a><!-- doxytag: member="blend.c::pixBlendMask" ref="aa3711c698d4fb80d7129018b5162f9c6" args="(PIX *pixd, PIX *pixs1, PIX *pixs2, l_int32 x, l_int32 y, l_float32 fract, l_int32 type)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="struct_pix.html">PIX</a>* pixBlendMask </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_pix.html">PIX</a> * </td>
<td class="paramname"><em>pixd</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="struct_pix.html">PIX</a> * </td>
<td class="paramname"><em>pixs1</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="struct_pix.html">PIX</a> * </td>
<td class="paramname"><em>pixs2</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td>
<td class="paramname"><em>x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td>
<td class="paramname"><em>y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> </td>
<td class="paramname"><em>fract</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td>
<td class="paramname"><em>type</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="blend_8c.html#aa3711c698d4fb80d7129018b5162f9c6">pixBlendMask()</a></p>
<p>Input: pixd (<optional>; either NULL or equal to pixs1 for in-place) pixs1 (blendee; depth > 1) pixs2 (blender; typ. smaller in size than pixs1) x,y (origin (UL corner) of pixs2 relative to the origin of pixs1; can be < 0) fract (blending fraction) type (L_BLEND_WITH_INVERSE, L_BLEND_TO_WHITE, L_BLEND_TO_BLACK) Return: pixd if OK; pixs1 on error</p>
<p>Notes: (1) pixs2 must be 1 bpp (2) Clipping of pixs2 to pixs1 is done in the inner pixel loop. (3) If pixs1 has a colormap, it is removed. (4) For inplace operation, call it this way: pixBlendMask(pixs1, pixs1, pixs2, ...) (5) For generating a new pixd: pixd = pixBlendMask(NULL, pixs1, pixs2, ...) (6) Only call in-place if pixs1 does not have a colormap. </p>
<p>Definition at line <a class="el" href="blend_8c_source.html#l00240">240</a> of file <a class="el" href="blend_8c_source.html">blend.c</a>.</p>
<p>References <a class="el" href="pix2_8c_source.html#l02076">composeRGBPixel()</a>, <a class="el" href="environ_8h_source.html#l00250">ERROR_PTR</a>, <a class="el" href="pix2_8c_source.html#l02108">extractRGBValues()</a>, <a class="el" href="environ_8h_source.html#l00179">FALSE</a>, <a class="el" href="arrayaccess_8h_source.html#l00060">GET_DATA_BIT</a>, <a class="el" href="pix_8h_source.html#l00632">L_BLEND_TO_BLACK</a>, <a class="el" href="pix_8h_source.html#l00631">L_BLEND_TO_WHITE</a>, <a class="el" href="pix_8h_source.html#l00630">L_BLEND_WITH_INVERSE</a>, <a class="el" href="environ_8h_source.html#l00257">L_WARNING</a>, <a class="el" href="environ_8h_source.html#l00171">NULL</a>, <a class="el" href="pix1_8c_source.html#l00440">pixClone()</a>, <a class="el" href="pixconv_8c_source.html#l02297">pixConvertTo8()</a>, <a class="el" href="pix1_8c_source.html#l00548">pixCopy()</a>, <a class="el" href="pix1_8c_source.html#l00466">pixDestroy()</a>, <a class="el" href="pix1_8c_source.html#l01288">pixGetColormap()</a>, <a class="el" href="pix1_8c_source.html#l01358">pixGetData()</a>, <a class="el" href="pix1_8c_source.html#l00863">pixGetDepth()</a>, <a class="el" href="pix1_8c_source.html#l00898">pixGetDimensions()</a>, <a class="el" href="pix1_8c_source.html#l00833">pixGetHeight()</a>, <a class="el" href="pix2_8c_source.html#l00148">pixGetPixel()</a>, <a class="el" href="pix1_8c_source.html#l00803">pixGetWidth()</a>, <a class="el" href="pix1_8c_source.html#l00970">pixGetWpl()</a>, <a class="el" href="pixconv_8c_source.html#l00223">pixRemoveColormap()</a>, <a class="el" href="pix2_8c_source.html#l00219">pixSetPixel()</a>, <a class="el" href="environ_8h_source.html#l00249">PROCNAME</a>, and <a class="el" href="pix_8h_source.html#l00181">REMOVE_CMAP_BASED_ON_SRC</a>.</p>
<p>Referenced by <a class="el" href="blend_8c_source.html#l00157">pixBlend()</a>.</p>
</div>
</div>
<a class="anchor" id="a4d49fe68f0b6f6c4b487a82a0a78fdd5"></a><!-- doxytag: member="blend.c::pixBlendGray" ref="a4d49fe68f0b6f6c4b487a82a0a78fdd5" args="(PIX *pixd, PIX *pixs1, PIX *pixs2, l_int32 x, l_int32 y, l_float32 fract, l_int32 type, l_int32 transparent, l_uint32 transpix)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="struct_pix.html">PIX</a>* pixBlendGray </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_pix.html">PIX</a> * </td>
<td class="paramname"><em>pixd</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="struct_pix.html">PIX</a> * </td>
<td class="paramname"><em>pixs1</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="struct_pix.html">PIX</a> * </td>
<td class="paramname"><em>pixs2</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td>
<td class="paramname"><em>x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td>
<td class="paramname"><em>y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> </td>
<td class="paramname"><em>fract</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td>
<td class="paramname"><em>type</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td>
<td class="paramname"><em>transparent</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#a4d4d7254020fc95aef5dde8884405358">l_uint32</a> </td>
<td class="paramname"><em>transpix</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="blend_8c.html#a4d49fe68f0b6f6c4b487a82a0a78fdd5">pixBlendGray()</a></p>
<p>Input: pixd (<optional>; either NULL or equal to pixs1 for in-place) pixs1 (blendee; depth > 1) pixs2 (blender, 8 bpp; typ. smaller in size than pixs1) x,y (origin (UL corner) of pixs2 relative to the origin of pixs1; can be < 0) fract (blending fraction) type (L_BLEND_GRAY, L_BLEND_GRAY_WITH_INVERSE) transparent (1 to use transparency; 0 otherwise) transpix (pixel grayval in pixs2 that is to be transparent) Return: pixd if OK; pixs1 on error</p>
<p>Notes: (1) pixs2 must be 8 bpp, and have no colormap. (2) Clipping of pixs2 to pixs1 is done in the inner pixel loop. (3) If pixs1 has a colormap, it is removed. (4) If pixs1 has depth < 8, it is unpacked to generate a 8 bpp pix. (5) For inplace operation, call it this way: pixBlendGray(pixs1, pixs1, pixs2, ...) (6) For generating a new pixd: pixd = pixBlendGray(NULL, pixs1, pixs2, ...) (7) Only call in-place if pixs1 does not have a colormap; otherwise it is an error. (8) If transparent = 0, the blending fraction (fract) is applied equally to all pixels. (9) If transparent = 1, all pixels of value transpix (typically either 0 or 0xff) in pixs2 are transparent in the blend. (10) After processing pixs1, it is either 8 bpp or 32 bpp:</p>
<ul>
<li>if 8 bpp, the fraction of pixs2 is mixed with pixs1.</li>
<li>if 32 bpp, each component of pixs1 is mixed with the same fraction of pixs2. (11) For L_BLEND_GRAY_WITH_INVERSE, the white values of the blendee (cval == 255 in the code below) result in a delta of 0. Thus, these pixels are intrinsically transparent! The "pivot" value of the src, at which no blending occurs, is 128. Compare with the adaptive pivot in <a class="el" href="blend_8c.html#a288c03f9eb9ff330240ff1555e38b0ea">pixBlendGrayAdapt()</a>. </li>
</ul>
<p>Definition at line <a class="el" href="blend_8c_source.html#l00456">456</a> of file <a class="el" href="blend_8c_source.html">blend.c</a>.</p>
<p>References <a class="el" href="pix2_8c_source.html#l02076">composeRGBPixel()</a>, <a class="el" href="environ_8h_source.html#l00250">ERROR_PTR</a>, <a class="el" href="pix2_8c_source.html#l02108">extractRGBValues()</a>, <a class="el" href="environ_8h_source.html#l00179">FALSE</a>, <a class="el" href="arrayaccess_8h_source.html#l00118">GET_DATA_BYTE</a>, <a class="el" href="pix_8h_source.html#l00633">L_BLEND_GRAY</a>, <a class="el" href="pix_8h_source.html#l00634">L_BLEND_GRAY_WITH_INVERSE</a>, <a class="el" href="environ_8h_source.html#l00257">L_WARNING</a>, <a class="el" href="environ_8h_source.html#l00171">NULL</a>, <a class="el" href="pix1_8c_source.html#l00440">pixClone()</a>, <a class="el" href="pixconv_8c_source.html#l02297">pixConvertTo8()</a>, <a class="el" href="pix1_8c_source.html#l00548">pixCopy()</a>, <a class="el" href="pix1_8c_source.html#l00466">pixDestroy()</a>, <a class="el" href="pix1_8c_source.html#l01288">pixGetColormap()</a>, <a class="el" href="pix1_8c_source.html#l01358">pixGetData()</a>, <a class="el" href="pix1_8c_source.html#l00863">pixGetDepth()</a>, <a class="el" href="pix1_8c_source.html#l00898">pixGetDimensions()</a>, <a class="el" href="pix1_8c_source.html#l00970">pixGetWpl()</a>, <a class="el" href="pixconv_8c_source.html#l00223">pixRemoveColormap()</a>, <a class="el" href="environ_8h_source.html#l00249">PROCNAME</a>, <a class="el" href="pix_8h_source.html#l00181">REMOVE_CMAP_BASED_ON_SRC</a>, and <a class="el" href="arrayaccess_8h_source.html#l00126">SET_DATA_BYTE</a>.</p>
<p>Referenced by <a class="el" href="blend__reg_8c_source.html#l00167">GrayBlend()</a>, <a class="el" href="blendtest1_8c_source.html#l00030">main()</a>, and <a class="el" href="blend_8c_source.html#l00157">pixBlend()</a>.</p>
</div>
</div>
<a class="anchor" id="a35ed557a91a1ad527ef4a6c00e91e6a1"></a><!-- doxytag: member="blend.c::pixBlendColor" ref="a35ed557a91a1ad527ef4a6c00e91e6a1" args="(PIX *pixd, PIX *pixs1, PIX *pixs2, l_int32 x, l_int32 y, l_float32 fract, l_int32 transparent, l_uint32 transpix)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="struct_pix.html">PIX</a>* pixBlendColor </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_pix.html">PIX</a> * </td>
<td class="paramname"><em>pixd</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="struct_pix.html">PIX</a> * </td>
<td class="paramname"><em>pixs1</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="struct_pix.html">PIX</a> * </td>
<td class="paramname"><em>pixs2</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td>
<td class="paramname"><em>x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td>
<td class="paramname"><em>y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> </td>
<td class="paramname"><em>fract</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td>
<td class="paramname"><em>transparent</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#a4d4d7254020fc95aef5dde8884405358">l_uint32</a> </td>
<td class="paramname"><em>transpix</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="blend_8c.html#a35ed557a91a1ad527ef4a6c00e91e6a1">pixBlendColor()</a></p>
<p>Input: pixd (<optional>; either NULL or equal to pixs1 for in-place) pixs1 (blendee; depth > 1) pixs2 (blender, 32 bpp; typ. smaller in size than pixs1) x,y (origin (UL corner) of pixs2 relative to the origin of pixs1) fract (blending fraction) transparent (1 to use transparency; 0 otherwise) transpix (pixel color in pixs2 that is to be transparent) Return: pixd if OK; pixs1 on error</p>
<p>Notes: (1) pixs2 must be 32 bpp, and have no colormap. (2) Clipping of pixs2 to pixs1 is done in the inner pixel loop. (3) If pixs1 has a colormap, it is removed to generate a 32 bpp pix. (4) If pixs1 has depth < 32, it is unpacked to generate a 32 bpp pix. (5) For inplace operation, call it this way: pixBlendColor(pixs1, pixs1, pixs2, ...) (6) For generating a new pixd: pixd = pixBlendColor(NULL, pixs1, pixs2, ...) (7) Only call in-place if pixs1 is 32 bpp; otherwise it is an error. (8) If transparent = 0, the blending fraction (fract) is applied equally to all pixels. (9) If transparent = 1, all pixels of value transpix (typically either 0 or 0xffffff00) in pixs2 are transparent in the blend. </p>
<p>Definition at line <a class="el" href="blend_8c_source.html#l00652">652</a> of file <a class="el" href="blend_8c_source.html">blend.c</a>.</p>
<p>References <a class="el" href="pix2_8c_source.html#l02076">composeRGBPixel()</a>, <a class="el" href="environ_8h_source.html#l00250">ERROR_PTR</a>, <a class="el" href="pix2_8c_source.html#l02108">extractRGBValues()</a>, <a class="el" href="environ_8h_source.html#l00257">L_WARNING</a>, <a class="el" href="environ_8h_source.html#l00171">NULL</a>, <a class="el" href="pix1_8c_source.html#l00440">pixClone()</a>, <a class="el" href="pixconv_8c_source.html#l02453">pixConvertTo32()</a>, <a class="el" href="pix1_8c_source.html#l00548">pixCopy()</a>, <a class="el" href="pix1_8c_source.html#l00466">pixDestroy()</a>, <a class="el" href="pix1_8c_source.html#l01358">pixGetData()</a>, <a class="el" href="pix1_8c_source.html#l00863">pixGetDepth()</a>, <a class="el" href="pix1_8c_source.html#l00898">pixGetDimensions()</a>, <a class="el" href="pix1_8c_source.html#l00970">pixGetWpl()</a>, <a class="el" href="pixconv_8c_source.html#l00223">pixRemoveColormap()</a>, <a class="el" href="environ_8h_source.html#l00249">PROCNAME</a>, and <a class="el" href="pix_8h_source.html#l00180">REMOVE_CMAP_TO_FULL_COLOR</a>.</p>
<p>Referenced by <a class="el" href="blend__reg_8c_source.html#l00224">ColorBlend()</a>, <a class="el" href="blendtest1_8c_source.html#l00030">main()</a>, and <a class="el" href="blend_8c_source.html#l00157">pixBlend()</a>.</p>
</div>
</div>
<a class="anchor" id="a73515ff61cf772d6f6d93579a876b53e"></a><!-- doxytag: member="blend.c::pixBlendColorByChannel" ref="a73515ff61cf772d6f6d93579a876b53e" args="(PIX *pixd, PIX *pixs1, PIX *pixs2, l_int32 x, l_int32 y, l_float32 rfract, l_float32 gfract, l_float32 bfract, l_int32 transparent, l_uint32 transpix)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="struct_pix.html">PIX</a>* pixBlendColorByChannel </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_pix.html">PIX</a> * </td>
<td class="paramname"><em>pixd</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="struct_pix.html">PIX</a> * </td>
<td class="paramname"><em>pixs1</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="struct_pix.html">PIX</a> * </td>
<td class="paramname"><em>pixs2</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td>
<td class="paramname"><em>x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td>
<td class="paramname"><em>y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> </td>
<td class="paramname"><em>rfract</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> </td>
<td class="paramname"><em>gfract</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> </td>
<td class="paramname"><em>bfract</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td>
<td class="paramname"><em>transparent</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#a4d4d7254020fc95aef5dde8884405358">l_uint32</a> </td>
<td class="paramname"><em>transpix</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="blend_8c_source.html#l00760">760</a> of file <a class="el" href="blend_8c_source.html">blend.c</a>.</p>
<p>References <a class="el" href="blend_8c_source.html#l00845">blendComponents()</a>, <a class="el" href="pix2_8c_source.html#l02076">composeRGBPixel()</a>, <a class="el" href="environ_8h_source.html#l00250">ERROR_PTR</a>, <a class="el" href="pix2_8c_source.html#l02108">extractRGBValues()</a>, <a class="el" href="environ_8h_source.html#l00171">NULL</a>, <a class="el" href="pix1_8c_source.html#l00440">pixClone()</a>, <a class="el" href="pixconv_8c_source.html#l02453">pixConvertTo32()</a>, <a class="el" href="pix1_8c_source.html#l00548">pixCopy()</a>, <a class="el" href="pix1_8c_source.html#l00466">pixDestroy()</a>, <a class="el" href="pix1_8c_source.html#l01358">pixGetData()</a>, <a class="el" href="pix1_8c_source.html#l00863">pixGetDepth()</a>, <a class="el" href="pix1_8c_source.html#l00898">pixGetDimensions()</a>, <a class="el" href="pix1_8c_source.html#l00970">pixGetWpl()</a>, <a class="el" href="pixconv_8c_source.html#l00223">pixRemoveColormap()</a>, <a class="el" href="environ_8h_source.html#l00249">PROCNAME</a>, and <a class="el" href="pix_8h_source.html#l00180">REMOVE_CMAP_TO_FULL_COLOR</a>.</p>
</div>
</div>
<a class="anchor" id="a288c03f9eb9ff330240ff1555e38b0ea"></a><!-- doxytag: member="blend.c::pixBlendGrayAdapt" ref="a288c03f9eb9ff330240ff1555e38b0ea" args="(PIX *pixd, PIX *pixs1, PIX *pixs2, l_int32 x, l_int32 y, l_float32 fract, l_int32 shift)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="struct_pix.html">PIX</a>* pixBlendGrayAdapt </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_pix.html">PIX</a> * </td>
<td class="paramname"><em>pixd</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="struct_pix.html">PIX</a> * </td>
<td class="paramname"><em>pixs1</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="struct_pix.html">PIX</a> * </td>
<td class="paramname"><em>pixs2</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td>
<td class="paramname"><em>x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td>
<td class="paramname"><em>y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> </td>
<td class="paramname"><em>fract</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td>
<td class="paramname"><em>shift</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="blend_8c.html#a288c03f9eb9ff330240ff1555e38b0ea">pixBlendGrayAdapt()</a></p>
<p>Input: pixd (<optional>; either NULL or equal to pixs1 for in-place) pixs1 (blendee; depth > 1) pixs2 (blender, 8 bpp; typ. smaller in size than pixs1) x,y (origin (UL corner) of pixs2 relative to the origin of pixs1; can be < 0) fract (blending fraction) shift (>= 0 but <= 128: shift of zero blend value from median source; use -1 for default value; ) Return: pixd if OK; pixs1 on error</p>
<p>Notes: (1) pixs2 must be 8 bpp, and have no colormap. (2) Clipping of pixs2 to pixs1 is done in the inner pixel loop. (3) If pixs1 has a colormap, it is removed. (4) If pixs1 has depth < 8, it is unpacked to generate a 8 bpp pix. (5) For inplace operation, call it this way: pixBlendGray(pixs1, pixs1, pixs2, ...) For generating a new pixd: pixd = pixBlendGray(NULL, pixs1, pixs2, ...) Only call in-place if pixs1 does not have a colormap; otherwise it is an error. (6) This does a blend with inverse. Whereas in pixGlendGray(), the zero blend point is where the blendee pixel is 128, here the zero blend point is found adaptively, with respect to the median of the blendee region. If the median is < 128, the zero blend point is found from median + shift. Otherwise, if the median >= 128, the zero blend point is median - shift. The purpose of shifting the zero blend point away from the median is to prevent a situation in <a class="el" href="blend_8c.html#a4d49fe68f0b6f6c4b487a82a0a78fdd5">pixBlendGray()</a> where the median is 128 and the blender is not visible. The default value of shift is 64. (7) After processing pixs1, it is either 8 bpp or 32 bpp:</p>
<ul>
<li>if 8 bpp, the fraction of pixs2 is mixed with pixs1.</li>
<li>if 32 bpp, each component of pixs1 is mixed with the same fraction of pixs2. (8) The darker the blender, the more it mixes with the blendee. A blender value of 0 has maximum mixing; a value of 255 has no mixing and hence is transparent. </li>
</ul>
<p>Definition at line <a class="el" href="blend_8c_source.html#l00902">902</a> of file <a class="el" href="blend_8c_source.html">blend.c</a>.</p>
<p>References <a class="el" href="boxbasic_8c_source.html#l00133">boxCreate()</a>, <a class="el" href="boxbasic_8c_source.html#l00242">boxDestroy()</a>, <a class="el" href="boxfunc1_8c_source.html#l00102">boxIntersects()</a>, <a class="el" href="pix2_8c_source.html#l02076">composeRGBPixel()</a>, <a class="el" href="environ_8h_source.html#l00250">ERROR_PTR</a>, <a class="el" href="pix2_8c_source.html#l02108">extractRGBValues()</a>, <a class="el" href="environ_8h_source.html#l00179">FALSE</a>, <a class="el" href="arrayaccess_8h_source.html#l00118">GET_DATA_BYTE</a>, <a class="el" href="environ_8h_source.html#l00155">L_MAX</a>, <a class="el" href="environ_8h_source.html#l00257">L_WARNING</a>, <a class="el" href="environ_8h_source.html#l00171">NULL</a>, <a class="el" href="pix5_8c_source.html#l00698">pixClipRectangle()</a>, <a class="el" href="pix1_8c_source.html#l00440">pixClone()</a>, <a class="el" href="pixconv_8c_source.html#l02297">pixConvertTo8()</a>, <a class="el" href="pix1_8c_source.html#l00548">pixCopy()</a>, <a class="el" href="pix1_8c_source.html#l00466">pixDestroy()</a>, <a class="el" href="pix1_8c_source.html#l01288">pixGetColormap()</a>, <a class="el" href="pix1_8c_source.html#l01358">pixGetData()</a>, <a class="el" href="pix1_8c_source.html#l00863">pixGetDepth()</a>, <a class="el" href="pix1_8c_source.html#l00898">pixGetDimensions()</a>, <a class="el" href="pix4_8c_source.html#l00713">pixGetRankValueMasked()</a>, <a class="el" href="pix1_8c_source.html#l00970">pixGetWpl()</a>, <a class="el" href="pixconv_8c_source.html#l00223">pixRemoveColormap()</a>, <a class="el" href="environ_8h_source.html#l00249">PROCNAME</a>, <a class="el" href="pix_8h_source.html#l00181">REMOVE_CMAP_BASED_ON_SRC</a>, and <a class="el" href="arrayaccess_8h_source.html#l00126">SET_DATA_BYTE</a>.</p>
<p>Referenced by <a class="el" href="blend__reg_8c_source.html#l00196">AdaptiveGrayBlend()</a>.</p>
</div>
</div>
<a class="anchor" id="a75cf8f041f0819375b30f289fe74249d"></a><!-- doxytag: member="blend.c::pixFadeWithGray" ref="a75cf8f041f0819375b30f289fe74249d" args="(PIX *pixs, PIX *pixb, l_float32 factor, l_int32 type)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="struct_pix.html">PIX</a>* pixFadeWithGray </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_pix.html">PIX</a> * </td>
<td class="paramname"><em>pixs</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="struct_pix.html">PIX</a> * </td>
<td class="paramname"><em>pixb</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> </td>
<td class="paramname"><em>factor</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td>
<td class="paramname"><em>type</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="blend_8c.html#a75cf8f041f0819375b30f289fe74249d">pixFadeWithGray()</a></p>
<p>Input: pixs (colormapped or 8 bpp or 32 bpp) pixb (8 bpp blender) factor (multiplicative factor to apply to blender value) type (L_BLEND_TO_WHITE, L_BLEND_TO_BLACK) Return: pixd, or null on error</p>
<p>Notes: (1) This function combines two pix aligned to the UL corner; they need not be the same size. (2) Each pixel in pixb is multiplied by 'factor' divided by 255, and clipped to the range [0 ... 1]. This gives the fade fraction to be appied to pixs. Fade either to white (L_BLEND_TO_WHITE) or to black (L_BLEND_TO_BLACK). </p>
<p>Definition at line <a class="el" href="blend_8c_source.html#l01079">1079</a> of file <a class="el" href="blend_8c_source.html">blend.c</a>.</p>
<p>References <a class="el" href="pix2_8c_source.html#l02076">composeRGBPixel()</a>, <a class="el" href="environ_8h_source.html#l00250">ERROR_PTR</a>, <a class="el" href="pix2_8c_source.html#l02108">extractRGBValues()</a>, <a class="el" href="arrayaccess_8h_source.html#l00118">GET_DATA_BYTE</a>, <a class="el" href="pix_8h_source.html#l00632">L_BLEND_TO_BLACK</a>, <a class="el" href="pix_8h_source.html#l00631">L_BLEND_TO_WHITE</a>, <a class="el" href="environ_8h_source.html#l00151">L_MIN</a>, <a class="el" href="environ_8h_source.html#l00171">NULL</a>, <a class="el" href="pix1_8c_source.html#l00548">pixCopy()</a>, <a class="el" href="pix1_8c_source.html#l01288">pixGetColormap()</a>, <a class="el" href="pix1_8c_source.html#l01358">pixGetData()</a>, <a class="el" href="pix1_8c_source.html#l00863">pixGetDepth()</a>, <a class="el" href="pix1_8c_source.html#l00898">pixGetDimensions()</a>, <a class="el" href="pix1_8c_source.html#l00970">pixGetWpl()</a>, <a class="el" href="pixconv_8c_source.html#l00223">pixRemoveColormap()</a>, <a class="el" href="environ_8h_source.html#l00249">PROCNAME</a>, <a class="el" href="pix_8h_source.html#l00181">REMOVE_CMAP_BASED_ON_SRC</a>, and <a class="el" href="arrayaccess_8h_source.html#l00126">SET_DATA_BYTE</a>.</p>
</div>
</div>
<a class="anchor" id="adccd01da6572ef3c8b2a4b955ec4c623"></a><!-- doxytag: member="blend.c::pixBlendHardLight" ref="adccd01da6572ef3c8b2a4b955ec4c623" args="(PIX *pixd, PIX *pixs1, PIX *pixs2, l_int32 x, l_int32 y, l_float32 fract)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="struct_pix.html">PIX</a>* pixBlendHardLight </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_pix.html">PIX</a> * </td>
<td class="paramname"><em>pixd</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="struct_pix.html">PIX</a> * </td>
<td class="paramname"><em>pixs1</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="struct_pix.html">PIX</a> * </td>
<td class="paramname"><em>pixs2</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td>
<td class="paramname"><em>x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td>
<td class="paramname"><em>y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> </td>
<td class="paramname"><em>fract</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="blend_8c_source.html#l01191">1191</a> of file <a class="el" href="blend_8c_source.html">blend.c</a>.</p>
<p>References <a class="el" href="blend_8c_source.html#l01318">blendHardLightComponents()</a>, <a class="el" href="pix2_8c_source.html#l02076">composeRGBPixel()</a>, <a class="el" href="environ_8h_source.html#l00250">ERROR_PTR</a>, <a class="el" href="pix2_8c_source.html#l02108">extractRGBValues()</a>, <a class="el" href="arrayaccess_8h_source.html#l00118">GET_DATA_BYTE</a>, <a class="el" href="environ_8h_source.html#l00257">L_WARNING</a>, <a class="el" href="pix1_8c_source.html#l00440">pixClone()</a>, <a class="el" href="pixconv_8c_source.html#l02453">pixConvertTo32()</a>, <a class="el" href="pix1_8c_source.html#l00548">pixCopy()</a>, <a class="el" href="pix1_8c_source.html#l00466">pixDestroy()</a>, <a class="el" href="pix1_8c_source.html#l01288">pixGetColormap()</a>, <a class="el" href="pix1_8c_source.html#l01358">pixGetData()</a>, <a class="el" href="pix1_8c_source.html#l00863">pixGetDepth()</a>, <a class="el" href="pix1_8c_source.html#l00898">pixGetDimensions()</a>, <a class="el" href="pix1_8c_source.html#l00970">pixGetWpl()</a>, <a class="el" href="pixconv_8c_source.html#l00223">pixRemoveColormap()</a>, <a class="el" href="environ_8h_source.html#l00249">PROCNAME</a>, <a class="el" href="pix_8h_source.html#l00181">REMOVE_CMAP_BASED_ON_SRC</a>, <a class="el" href="pix_8h_source.html#l00180">REMOVE_CMAP_TO_FULL_COLOR</a>, and <a class="el" href="arrayaccess_8h_source.html#l00126">SET_DATA_BYTE</a>.</p>
<p>Referenced by <a class="el" href="hardlight__reg_8c_source.html#l00056">TestHardlight()</a>.</p>
</div>
</div>
<a class="anchor" id="ad4e4745c0c48b3ae04b988e21386d2f3"></a><!-- doxytag: member="blend.c::pixBlendCmap" ref="ad4e4745c0c48b3ae04b988e21386d2f3" args="(PIX *pixs, PIX *pixb, l_int32 x, l_int32 y, l_int32 sindex)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> pixBlendCmap </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_pix.html">PIX</a> * </td>
<td class="paramname"><em>pixs</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="struct_pix.html">PIX</a> * </td>
<td class="paramname"><em>pixb</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td>
<td class="paramname"><em>x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td>
<td class="paramname"><em>y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td>
<td class="paramname"><em>sindex</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="blend_8c.html#ad4e4745c0c48b3ae04b988e21386d2f3">pixBlendCmap()</a></p>
<p>Input: pixs (2, 4 or 8 bpp, with colormap) pixb (colormapped blender) x, y (UL corner of blender relative to pixs) sindex (colormap index of pixels in pixs to be changed) Return: 0 if OK, 1 on error</p>
<p>Note: (1) This function combines two colormaps, and replaces the pixels in pixs that have a specified color value with those in pixb. (2) sindex must be in the existing colormap; otherwise an error is returned. In use, sindex will typically be the index for white (255, 255, 255). (3) Blender colors that already exist in the colormap are used; others are added. If any blender colors cannot be stored in the colormap, an error is returned. (4) In the implementation, a mapping is generated from each original blender colormap index to the corresponding index in the expanded colormap for pixs. Then for each pixel in pixs with value sindex, and which is covered by a blender pixel, the new index corresponding to the blender pixel is substituted for sindex. </p>
<p>Definition at line <a class="el" href="blend_8c_source.html#l01361">1361</a> of file <a class="el" href="blend_8c_source.html">blend.c</a>.</p>
<p>References <a class="el" href="environ_8h_source.html#l00251">ERROR_INT</a>, <a class="el" href="arrayaccess_8h_source.html#l00118">GET_DATA_BYTE</a>, <a class="el" href="arrayaccess_8h_source.html#l00080">GET_DATA_DIBIT</a>, <a class="el" href="arrayaccess_8h_source.html#l00097">GET_DATA_QBIT</a>, <a class="el" href="environ_8h_source.html#l00171">NULL</a>, <a class="el" href="colormap_8c_source.html#l00271">pixcmapAddColor()</a>, <a class="el" href="colormap_8c_source.html#l00207">pixcmapCopy()</a>, <a class="el" href="colormap_8c_source.html#l00238">pixcmapDestroy()</a>, <a class="el" href="colormap_8c_source.html#l00632">pixcmapGetColor()</a>, <a class="el" href="colormap_8c_source.html#l00517">pixcmapGetCount()</a>, <a class="el" href="colormap_8c_source.html#l00739">pixcmapGetIndex()</a>, <a class="el" href="pix1_8c_source.html#l01288">pixGetColormap()</a>, <a class="el" href="pix1_8c_source.html#l01358">pixGetData()</a>, <a class="el" href="pix1_8c_source.html#l00898">pixGetDimensions()</a>, <a class="el" href="pix2_8c_source.html#l00148">pixGetPixel()</a>, <a class="el" href="pix1_8c_source.html#l00970">pixGetWpl()</a>, <a class="el" href="pix1_8c_source.html#l01312">pixSetColormap()</a>, <a class="el" href="environ_8h_source.html#l00249">PROCNAME</a>, <a class="el" href="arrayaccess_8h_source.html#l00126">SET_DATA_BYTE</a>, <a class="el" href="arrayaccess_8h_source.html#l00083">SET_DATA_DIBIT</a>, and <a class="el" href="arrayaccess_8h_source.html#l00100">SET_DATA_QBIT</a>.</p>
<p>Referenced by <a class="el" href="blendcmaptest_8c_source.html#l00030">main()</a>.</p>
</div>
</div>
<a class="anchor" id="a51d08d3ae19c515a5fabf42db1daf85b"></a><!-- doxytag: member="blend.c::pixBlendWithGrayMask" ref="a51d08d3ae19c515a5fabf42db1daf85b" args="(PIX *pixs1, PIX *pixs2, PIX *pixg, l_int32 x, l_int32 y)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="struct_pix.html">PIX</a>* pixBlendWithGrayMask </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_pix.html">PIX</a> * </td>
<td class="paramname"><em>pixs1</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="struct_pix.html">PIX</a> * </td>
<td class="paramname"><em>pixs2</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="struct_pix.html">PIX</a> * </td>
<td class="paramname"><em>pixg</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td>
<td class="paramname"><em>x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td>
<td class="paramname"><em>y</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="blend_8c.html#a51d08d3ae19c515a5fabf42db1daf85b">pixBlendWithGrayMask()</a></p>
<p>Input: pixs1 (8 bpp gray, rgb or colormapped) pixs2 (8 bpp gray, rgb or colormapped) pixg (8 bpp gray, for transparency of pixs2; can be null) x, y (UL corner of pixg with respect to pixs1) Return: pixd (blended image), or null on error</p>
<p>Notes: (1) The result is 8 bpp grayscale if both pixs1 and pixs2 are 8 bpp gray. Otherwise, the result is 32 bpp rgb. (2) pixg is an 8 bpp transparency image, where 0 is transparent and 255 is opaque. It determines the transparency of pixs2 when applied over pixs1. It can be null if pixs2 is rgb, in which case we use the alpha component of pixs2. (3) If pixg exists, both it and pixs2 must be the same size, and they are applied with both their UL corners at the location (x, y) in pixs1. (4) The pixels in pixd are a combination of those in pixs1 and pixs2, where the amount from pixs2 is proportional to the value of the pixel (p) in pixg, and the amount from pixs1 is proportional to (255 - p). Thus pixg is a transparency image (usually called an alpha blender) where each pixel can be associated with a pixel in pixs2, and determines the amount of the pixs2 pixel in the final result. For example, if pixg is all 0, pixs2 is transparent and the result in pixd is simply pixs1. (5) A typical use is for the pixs2/pixg combination to be a small watermark that is applied to pixs1. </p>
<p>Definition at line <a class="el" href="blend_8c_source.html#l01495">1495</a> of file <a class="el" href="blend_8c_source.html">blend.c</a>.</p>
<p>References <a class="el" href="pix2_8c_source.html#l02076">composeRGBPixel()</a>, <a class="el" href="environ_8h_source.html#l00250">ERROR_PTR</a>, <a class="el" href="pix2_8c_source.html#l02108">extractRGBValues()</a>, <a class="el" href="environ_8h_source.html#l00179">FALSE</a>, <a class="el" href="arrayaccess_8h_source.html#l00118">GET_DATA_BYTE</a>, <a class="el" href="pix_8h_source.html#l00146">L_ALPHA_CHANNEL</a>, <a class="el" href="environ_8h_source.html#l00151">L_MIN</a>, <a class="el" href="environ_8h_source.html#l00171">NULL</a>, <a class="el" href="pix1_8c_source.html#l00440">pixClone()</a>, <a class="el" href="pixconv_8c_source.html#l02453">pixConvertTo32()</a>, <a class="el" href="pixconv_8c_source.html#l02297">pixConvertTo8()</a>, <a class="el" href="pix1_8c_source.html#l00548">pixCopy()</a>, <a class="el" href="pix1_8c_source.html#l00466">pixDestroy()</a>, <a class="el" href="pix1_8c_source.html#l01288">pixGetColormap()</a>, <a class="el" href="pix1_8c_source.html#l01358">pixGetData()</a>, <a class="el" href="pix1_8c_source.html#l00863">pixGetDepth()</a>, <a class="el" href="pix1_8c_source.html#l00898">pixGetDimensions()</a>, <a class="el" href="pix2_8c_source.html#l01883">pixGetRGBComponent()</a>, <a class="el" href="pix1_8c_source.html#l00970">pixGetWpl()</a>, <a class="el" href="pixconv_8c_source.html#l00223">pixRemoveColormap()</a>, <a class="el" href="environ_8h_source.html#l00249">PROCNAME</a>, <a class="el" href="pix_8h_source.html#l00181">REMOVE_CMAP_BASED_ON_SRC</a>, and <a class="el" href="arrayaccess_8h_source.html#l00126">SET_DATA_BYTE</a>.</p>
<p>Referenced by <a class="el" href="alphaclean__reg_8c_source.html#l00028">main()</a>.</p>
</div>
</div>
<a class="anchor" id="ac5f519c9ae69dfca48ca7c8419c45d0d"></a><!-- doxytag: member="blend.c::pixColorGray" ref="ac5f519c9ae69dfca48ca7c8419c45d0d" args="(PIX *pixs, BOX *box, l_int32 type, l_int32 thresh, l_int32 rval, l_int32 gval, l_int32 bval)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> pixColorGray </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_pix.html">PIX</a> * </td>
<td class="paramname"><em>pixs</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="struct_box.html">BOX</a> * </td>
<td class="paramname"><em>box</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td>
<td class="paramname"><em>type</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>