|
請問大家layout logo是怎麽做得,感覺BMP 單色位轉成layout效果不好,如果采用這個方法要每個字母做成一個cell,然後還要load一個可以自動縮放的script,而且轉成單色位圖片會有很嚴重的毛邊,轉出來會很難看,所以是怎麽做比較好
6 p6 A# O; F3 w2 M) ~6 T; \* b# x- E0 r) f/ O7 A1 u4 D/ u" w
以下是skill
" M' F s( I4 I0 `2 U1 Qlet((win cv bmpfile bmpSize WORD Wnum number Grid Layer row column max_column3 Q' s2 ~ W( }0 g- H
i dot x y signature offset width height pixel ImageSize )% x' Y% |# M. Z- C/ _
' Z6 Y1 E* ?3 |2 b' I: a5 d: n
win = hiGetCurrentWindow()
6 W( [3 L: t6 k, u, e' { cv = getEditRep(win)- ^% O# A4 z. {9 Q% [! w
( H6 R' }5 x9 D( `" ~, B
bmpfile = "~/number_mini.bmp" ;;; Input BMP File0 r6 P% L4 L' w0 P2 U) C4 g
Layer = list("TTOPME" "drawing") ;;; Output Layer
6 b# F7 p, ~3 [$ a( D5 E% { Grid = 1 ;;; Rectangle Size, O# D* a" W% L$ i8 _- D8 J
column = 0
8 U( i6 t, g6 {2 d6 A* ?" u% U% }$ {& _( ~
procedure(MessageForm(text)
+ M0 c8 y8 c+ g( x& t5 U6 k4 a prog( ()
0 G$ g; T+ A; o0 d hiDisplayAppDBox(% S6 _/ K( U1 @5 }$ Z _- v
?name 'JWDBox_Message6 K5 q$ E5 I) J" J6 z
?dboxBanner "Message!!"
' M) T4 s5 v: P7 c, G( d ?buttonLayout 'Close
- b6 p i& o/ m/ P ?dboxText text
) D3 W. \# x/ k( _' B# U \; n )
$ [" n' `. L$ }; Q6 l );prog
% n% O' i: c0 e" z0 M);procedure" \- C; f2 p3 K# Y
: u+ W9 D9 O) f# e$ o& {$ T
;Read BMP file
5 H; p$ y3 ^7 _2 z9 C' A if(InFile = infile(bmpfile) then
+ \7 f6 e" z) m& h bmpSize = fileLength(bmpfile)& ?2 j8 U" k! ]
declare(WORD[bmpSize])
" y( w. @4 W* t. k: D: V: k7 d for(Wnum 0 bmpSize-1 WORD[Wnum] = charToInt(getc(InFile)) )) R) I3 \6 A+ ?* @, e! @" N
close(InFile)3 b3 R7 F* ]) i
else; c0 s6 _/ X/ D3 D* K) u. K
MessageForm("Input file does not exist!")
% f; S% y* s$ \( ^# @ return()* O7 X* A* \" E* q+ {; q
)
$ S+ }; L3 P/ l8 \8 T7 K! v0 [
3 d. j# R# _& ]. J% ^9 Z, r sprintf(signature "%02x%02x" WORD[0] WORD[1])/ ` J, ]' p' ?8 u# ?
offset = (WORD[0x0d]<<24) + (WORD[0x0c]<<16) + (WORD[0x0b]<<8) + WORD[0x0a] ! l2 y# y; b' T# @
width = (WORD[0x15]<<24) + (WORD[0x14]<<16) + (WORD[0x13]<<8) + WORD[0x12]( h& l, I. p& F3 ^- y9 f
height = (WORD[0x19]<<24) + (WORD[0x18]<<16) + (WORD[0x17]<<8) + WORD[0x16]; d" q2 h& I- i+ x1 U5 j
pixel = (WORD[0x1d]<<8) + WORD[0x1c]
6 A+ `) x9 }3 _8 t4 n4 U ImageSize = (WORD[0x25]<<24) + (WORD[0x24]<<16) + (WORD[0x23]<<8) + WORD[0x22]
0 f; `. ~% J- ? I- J6 l9 u- t) d: c
! n: G& P4 p( n! d7 o/ A' i% g printf("--- BMP2LAY Start --- %L\n" getCurrentTime())0 _# L1 i; O% a3 I8 s) \) V! T
printf("offset : 0x%x \n" offset)
* N& D0 `( W; p9 t& u6 ^2 Z printf("width : 0x%x \n" width)
" N7 ~. m5 ^( x5 p2 Q) @ printf("height : 0x%x \n" height)( ?7 A7 D5 q' q) a1 {
printf("ImgSize : 0x%x \n" ImageSize)
. M, w: i y5 m
7 r L; D: P% M( _; Y;check bmp file
u' z; ]3 q5 q2 G7 r if(!equal(signature "424d") then5 ^7 L& J" W0 R" i
MessageForm("*ERROR* Standard Input is not a BMP file")
" F6 z& ]: O) j: |' K return()
- m/ V- y( }9 d7 l! \5 ?2 c" U6 F )
5 e) K M3 ?* w. d( h j, P" j6 w# D+ |# u
;check mono bmp file( I: W) |0 r+ D3 v4 k2 A e$ x
if(!equal(pixel 0x01) then
6 ^2 c- ^. K( f7 h z+ F MessageForm("*ERROR* only supports mono bmp files")
; A+ Q. W7 `6 z' x return()$ X1 r+ |; o" C5 j' s& i: L# o8 t" ~
)/ D; n* u C4 L, C" V
& h% V; ?0 k8 _1 k' r5 J;BMP2LAY
9 `. A( z7 d2 y/ Z; |+ J max_column = ImageSize/height<<3
, m5 R1 r4 M3 t# f& | number = offset+ImageSize-1
D4 h+ E) }3 V# C0 S7 N
1 ~) i2 d l; E$ d! b" w1 y for(Wnum offset number
, O2 h% |: R" o9 g( `6 d9 h+ u; F row = fix((Wnum-offset)/(max_column>>3))- @, b9 X* t0 B- M2 B$ d5 V0 P
y = Grid*row
* B s' J" g5 \2 f$ H( L! g4 r0 C+ |( K; @# x4 g( a
for(i 0 7
: f! j) z: k; W; x dot = bitfield1(WORD[Wnum] 7-i) ; bit<7> ~ bit<0>/ U5 `9 t/ g: I
x = Grid*column0 S' h/ X5 ^# [! ~, \ e; ^/ ]
if(zerop(dot) && column<width then( G0 C$ j* s0 d4 H0 M" m/ ]
geSelectObject(dbCreateRect(cv Layer list(x:y x+Grid:y+Grid)))
V- t/ l' p& \2 Q )8 C, w! D: P5 [8 \$ e1 V
column++
& C. B- n/ e' {% O' u, I );for" d; s2 q2 l5 D7 |8 `
if(equal(column max_column) column=0)
$ ^% _. S9 W- k" S# L7 \; m0 @1 ] Wnum++
( R1 k% I+ I4 u3 i );for! ^1 Y; K8 O2 l1 |
2 v& R& O6 Q, S! Z hiZoomIn(win list(-10:-10 x+10:y+10))
" n) y6 e; t/ c! X. [, e% A printf("--- BMP2LAY End ----- %L\nt\n" getCurrentTime())" _ B7 R/ h% y( D. i# u. |
);let( X ~% n' M7 j& V: e
6 m- b' _$ l! k1 P
|
|