|
請問大家layout logo是怎麽做得,感覺BMP 單色位轉成layout效果不好,如果采用這個方法要每個字母做成一個cell,然後還要load一個可以自動縮放的script,而且轉成單色位圖片會有很嚴重的毛邊,轉出來會很難看,所以是怎麽做比較好
: j: |5 ?) Y* L6 s% I5 Z7 E5 Q x0 D! u& U f
以下是skill
; N5 a, ]3 I. m! nlet((win cv bmpfile bmpSize WORD Wnum number Grid Layer row column max_column
" o" ^ l$ ?0 J- {9 L i dot x y signature offset width height pixel ImageSize )5 g6 C. C7 b$ k5 P/ T
3 R( x$ _6 C% t7 I* X( l+ D/ T: T
win = hiGetCurrentWindow(): Y5 G1 S/ B b! K
cv = getEditRep(win)
( C7 g- _7 l, L9 @. h) G, j: O1 P5 u2 u9 e3 Q1 V
bmpfile = "~/number_mini.bmp" ;;; Input BMP File
" C% r- i+ c3 @- C/ S# d Layer = list("TTOPME" "drawing") ;;; Output Layer
& X. E( w* u: _# o5 v% u1 K Grid = 1 ;;; Rectangle Size
/ H# r# t+ j) T# O6 D$ p$ p% q, g column = 0
1 t/ g% J; W h; |5 @& \% X ?. o: B* T0 q ^
procedure(MessageForm(text)
( r2 x: m' V5 R. x7 }( R8 K prog( ()
5 ^4 F# m1 E* s6 d6 W# o9 x2 O hiDisplayAppDBox(
6 {3 O% T- e% q9 r# G ?name 'JWDBox_Message% S6 [8 F- l j# n0 l
?dboxBanner "Message!!"
$ t, Q" Q {9 B6 [* d7 B9 b ?buttonLayout 'Close* ~6 g1 u! S+ s
?dboxText text
& ]6 b. R5 R! h. f )
1 A( T; [/ o- [! D% L9 R3 A& M7 B9 O );prog
. t3 Q# p( _5 l2 B8 I0 |# E);procedure5 z5 S6 P2 i1 R
" U7 }7 K+ m3 I" \/ z' M& W `# M;Read BMP file
9 l: Y, V2 T) ]/ ~ c7 q if(InFile = infile(bmpfile) then
' D3 `8 t0 w" t* O. q+ A bmpSize = fileLength(bmpfile)$ B) s2 ]- z6 ^( W! B* V
declare(WORD[bmpSize])4 B- |& j: l, ]1 ~# Z' x* V! m
for(Wnum 0 bmpSize-1 WORD[Wnum] = charToInt(getc(InFile)) )! G9 C% g4 h; d2 Q' T1 [7 @$ p
close(InFile)7 z: [# F: ]7 e1 U; W
else; q7 @: ?) \. S6 ^$ r
MessageForm("Input file does not exist!")' L* ^9 r+ ?* ~% A/ t B2 X. ?2 i$ W
return()
N6 u4 K% J7 }7 G/ h# V% @ )6 ]+ E3 n; l; L- I8 L; x3 Z- ]
8 R4 b; H( N3 e6 `6 g0 d, `8 ?% x4 Z sprintf(signature "%02x%02x" WORD[0] WORD[1])- y. w0 d0 n, l& X
offset = (WORD[0x0d]<<24) + (WORD[0x0c]<<16) + (WORD[0x0b]<<8) + WORD[0x0a]
( u8 W' ~& C; x width = (WORD[0x15]<<24) + (WORD[0x14]<<16) + (WORD[0x13]<<8) + WORD[0x12]' d$ R5 ]- ?1 N1 m! E' j
height = (WORD[0x19]<<24) + (WORD[0x18]<<16) + (WORD[0x17]<<8) + WORD[0x16]1 ?) [! w r# Q7 Z2 T
pixel = (WORD[0x1d]<<8) + WORD[0x1c]: L+ F+ ~. Z0 |
ImageSize = (WORD[0x25]<<24) + (WORD[0x24]<<16) + (WORD[0x23]<<8) + WORD[0x22]
* w7 K0 Q1 V5 C: u" S) I3 |+ s' u/ m% B! t6 r
printf("--- BMP2LAY Start --- %L\n" getCurrentTime())
/ O' _9 K, j# ]& T; { printf("offset : 0x%x \n" offset)
2 o5 ^' j- n4 s1 O8 p printf("width : 0x%x \n" width)1 D% e; _# e" o4 ^5 n' B+ W3 F
printf("height : 0x%x \n" height)7 g$ l* c0 n0 r( n) }
printf("ImgSize : 0x%x \n" ImageSize)
4 ^+ I+ S! w3 j+ E$ s6 H! o* }- ^. E" w$ v" x, K
;check bmp file8 ]/ C: h9 ?1 c! g w
if(!equal(signature "424d") then x& l) p' W8 V
MessageForm("*ERROR* Standard Input is not a BMP file")
* p( g0 {/ e( ^( [5 R2 d return()0 _1 p( O% k9 Y
) W/ H: j" D, n4 P x$ ~: j% R
@4 K/ H6 e1 o& ~5 A9 c;check mono bmp file- |9 a1 A+ E2 p" x+ {
if(!equal(pixel 0x01) then6 H( b1 N( L0 ~2 @2 }6 i
MessageForm("*ERROR* only supports mono bmp files")9 e0 C% n0 J+ N- g
return()
( ?0 {7 _- r8 m/ }4 E, {- k )
1 i6 I% `% H- Y. ?& O; l* f3 G. f* h7 J+ l5 D, z; M- [
;BMP2LAY
/ H& P+ ^& P. q! z max_column = ImageSize/height<<3: K7 e( a' n. U$ r8 t' {7 V4 t
number = offset+ImageSize-1: x$ Q3 o9 N: M" R- D
) T% I. h) ?0 Z for(Wnum offset number& k+ K4 [8 t6 e* U: K! C( }- _
row = fix((Wnum-offset)/(max_column>>3))
/ C3 b3 `: R8 P1 N+ U y = Grid*row
/ W/ g' I% P& a( k3 i5 ]/ y
}' c4 L4 y, m, U# I" U5 A for(i 0 76 [2 X- ~ F3 F5 ~! A9 O3 Q
dot = bitfield1(WORD[Wnum] 7-i) ; bit<7> ~ bit<0>5 w5 n6 ]. c9 F/ c+ l$ L. Z
x = Grid*column
! V+ Z* g6 Q& V6 R% [" |5 ^# ] if(zerop(dot) && column<width then
- K6 f5 V: q7 r! ~( K$ w geSelectObject(dbCreateRect(cv Layer list(x:y x+Grid:y+Grid)))
% _6 v9 G" d p# o; r# s ); y" U1 ~) J1 I# N, W
column++
6 ]; p: N9 a# B$ |$ m );for
4 _' a, I# E2 J: L) r if(equal(column max_column) column=0)8 ^3 r+ i, X3 F" K
Wnum++
* {+ g+ L5 _: J1 N) ^ );for4 M" B, |- L. x$ X- ]" }( v
- Q8 }( M* ] P% ~8 u
hiZoomIn(win list(-10:-10 x+10:y+10))
; ?6 }1 `) T. m: ] printf("--- BMP2LAY End ----- %L\nt\n" getCurrentTime()), i. ^. L1 Q. Z+ z" J! U
);let
# B( B3 B- f5 F7 p# H# N7 N! F+ h$ u, K7 Q$ x2 W4 v" }
|
|