File: highlight.pb.fold

package info (click to toggle)
kf6-syntax-highlighting 6.13.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 47,568 kB
  • sloc: xml: 197,750; cpp: 12,850; python: 3,023; sh: 955; perl: 546; ruby: 488; pascal: 393; javascript: 161; php: 150; jsp: 132; lisp: 131; haskell: 124; ada: 119; ansic: 107; makefile: 96; f90: 94; ml: 85; cobol: 81; yacc: 71; csh: 62; erlang: 54; sql: 51; java: 47; objc: 37; awk: 31; asm: 30; tcl: 29; fortran: 18; cs: 10
file content (87 lines) | stat: -rw-r--r-- 2,254 bytes parent folder | download | duplicates (4)
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
; This is a test file for kate's PureBasic highlighting.

; BMP2x Converter by Sven Langenkamp

UseJPEGImageEncoder()
UsePNGImageEncoder()

Declare Convert(JPEG)

<beginfold id='1'>Enumeration </beginfold id='1'>1
    #JPEG
    #PNG
<endfold id='1'>EndEnumeration</endfold id='1'>

<beginfold id='2'>; BEGIN section</beginfold id='2'>


<endfold id='2'>; END</endfold id='2'>

Global Count
Global file.s
Global filename.s
Global fileext.s
Global OutputFormat
Global JPEGQuality

Count        = 0
OutputFormat = 1
JPEGQuality  = -1

; MAIN PROGRAM------------------------------------------------------------------

;Request Options
PrintN("Output Format")
PrintN("  [1] JPEG")
PrintN("  [2] PNG")
Print ("> ")
OutputFormat = Int(Input())

<beginfold id='3'>Select </beginfold id='3'>OutputFormat
    Case #JPEG:
        fileext = ".jpg"
        ;Request JPEG Quality
        PrintN("")
        PrintN("JPEG Quality")
        PrintN("  [0-10]")
        Print ("> ")
        JPEGQuality = Int(Input())
    
    Case #PNG:
        fileext = ".png"
<endfold id='3'>EndSelect</endfold id='3'>

;Convert all BMP files in the current directory
ExamineDirectory(0, "", "*.bmp")
<beginfold id='4'>While </beginfold id='4'>NextDirectoryEntry()   
    file     = DirectoryEntryName()
    filename = GetFilePart(file)
    
    <beginfold id='5'>If </beginfold id='5'>LoadImage(0, file)
        <beginfold id='3'>Select </beginfold id='3'>OutputFormat
	    Case #JPEG:
	      Convert(JPEGQuality)
	      
	    Case #PNG:
	        Convert(-1)
	<endfold id='3'>EndSelect</endfold id='3'>
	Count = Count +1
    <endfold id='5'>EndIf</endfold id='5'>
    
<endfold id='4'>Wend</endfold id='4'>

PrintN(Str(Count) + " files converted")
CloseConsole()

; PROCUDURES--------------------------------------------------------------------

<beginfold id='6'>Procedure </beginfold id='6'>Convert(JPEG)
    Shared filename, fileext
    
    <beginfold id='5'>If </beginfold id='5'>JPEG > -1
        SaveImage(0, filename + fileext, #PB_ImagePlugin_JPEG, JPEG)
    Else
        SaveImage(0, filename + fileext, #PB_ImagePlugin_PNG)    
    <endfold id='5'>EndIf</endfold id='5'>
    PrintN(file + " converted to " + filename + fileext)
<endfold id='6'>EndProcedure</endfold id='6'>