|
請問大家layout logo是怎麽做得,感覺BMP 單色位轉成layout效果不好,如果采用這個方法要每個字母做成一個cell,然後還要load一個可以自動縮放的script,而且轉成單色位圖片會有很嚴重的毛邊,轉出來會很難看,所以是怎麽做比較好
) w. t9 Q8 u" b" W/ q7 p: R7 u4 p3 ~6 T* Z. G" _
以下是skill
" M% _" M7 V/ }! v& W9 W Klet((win cv bmpfile bmpSize WORD Wnum number Grid Layer row column max_column
9 m5 m( J: a P+ X1 O. [9 | i dot x y signature offset width height pixel ImageSize )% S8 {& x1 j/ u: s
( p9 @/ b/ y* w$ F$ O, Y win = hiGetCurrentWindow()
( ]' T; j' c& _4 g& d" M, x5 I" l cv = getEditRep(win)
& G5 l7 {0 H) ~/ `
# M; I6 w8 W5 A3 Y w2 R* t bmpfile = "~/number_mini.bmp" ;;; Input BMP File, [& [2 p a4 U. r" a0 G' _
Layer = list("TTOPME" "drawing") ;;; Output Layer
6 d) T8 W" X8 @, s- U9 w. z Grid = 1 ;;; Rectangle Size# ?8 R, e1 t$ _% k) k. |' d! [
column = 0
8 F& Z$ v! X4 D# k4 H
3 Y3 L8 o2 @5 z' K' gprocedure(MessageForm(text)! V2 e2 P% ]/ p% }
prog( ()5 R" a0 X# }3 F( |( N/ k
hiDisplayAppDBox( p0 \" e8 ]4 Q7 \: A
?name 'JWDBox_Message$ u/ F2 ]; S0 e2 `2 l" o- B
?dboxBanner "Message!!"
; n! R: X. c+ ]) y! [2 D/ _ ?buttonLayout 'Close8 b ]1 N8 C R& h7 Z
?dboxText text' i8 K" @6 `- C# r v
), {7 ^& A' [1 t
);prog6 i3 x8 h( Q7 u* Z! e0 z6 Y; P. @
);procedure
- S2 `' B6 W0 P6 v! x; C; e8 P; q' @& @
;Read BMP file
: a5 o( n: e7 C/ {) M8 z2 Y$ G if(InFile = infile(bmpfile) then2 x1 y1 U1 v2 l2 x; N/ j" d
bmpSize = fileLength(bmpfile)
2 \0 C `1 V2 P4 `" U declare(WORD[bmpSize])' q& E9 p7 @1 o& }- D& K9 O; X
for(Wnum 0 bmpSize-1 WORD[Wnum] = charToInt(getc(InFile)) )
?3 z# _2 x$ B |8 l) J( \ close(InFile)2 V3 M. D1 c3 _3 F5 c* t5 g* c
else+ l7 T& ^% Z$ e$ r4 ~6 `
MessageForm("Input file does not exist!")
: M( f+ H: e. y$ h& I return()
/ X1 T4 l" Q# j8 k# k )
, k+ ~" o% P0 O1 J; G5 r1 G$ I. e+ y9 v( U0 t- m A% n
sprintf(signature "%02x%02x" WORD[0] WORD[1])
- H8 r9 m4 j! H: k! k offset = (WORD[0x0d]<<24) + (WORD[0x0c]<<16) + (WORD[0x0b]<<8) + WORD[0x0a] 5 |. X: Y' I' P5 A6 B
width = (WORD[0x15]<<24) + (WORD[0x14]<<16) + (WORD[0x13]<<8) + WORD[0x12]
2 O- x1 a4 h Y" m# ~ height = (WORD[0x19]<<24) + (WORD[0x18]<<16) + (WORD[0x17]<<8) + WORD[0x16]3 g. x9 Y! l' H4 G
pixel = (WORD[0x1d]<<8) + WORD[0x1c]
2 K) y) a1 B9 I9 j% H" W9 {. q2 U ImageSize = (WORD[0x25]<<24) + (WORD[0x24]<<16) + (WORD[0x23]<<8) + WORD[0x22]3 y6 Z7 d1 N* J
2 @ ]# O# s; r& }5 s/ Q* m
printf("--- BMP2LAY Start --- %L\n" getCurrentTime())0 V/ c- S0 x3 g0 |
printf("offset : 0x%x \n" offset)
2 |! \+ Y( ]* C6 P, k printf("width : 0x%x \n" width)
, h ] V, m9 W, H, d# K: Z* { printf("height : 0x%x \n" height)
0 q' B, |$ X3 D/ W M% V `6 | printf("ImgSize : 0x%x \n" ImageSize)/ @; i; z# r1 U; {1 [
) ^8 V7 l" G( ^( E* x( x
;check bmp file
7 W, A/ E$ d, o" l* z/ T @ if(!equal(signature "424d") then3 V: k p) W7 A
MessageForm("*ERROR* Standard Input is not a BMP file")1 o1 p) T- `+ T6 J# }
return()
0 I$ E( D; q+ j' q X )
# H9 n* a8 {' L6 P. ~. f0 ]! z1 ^0 `, ~7 d7 t
;check mono bmp file
* v$ @! T1 E7 {+ w2 C! i if(!equal(pixel 0x01) then
, ~# ^" K: H! l& R* _2 n MessageForm("*ERROR* only supports mono bmp files")2 W+ O4 `1 g2 Z& s! r `3 D) f
return()' ~7 f2 V% e$ r$ x
)' y( d# n$ \7 N8 U% _9 ], E7 K
) V$ p% b* z3 b: t* a! m5 }0 j;BMP2LAY% {3 a1 F+ [3 }! v+ e* z4 ]
max_column = ImageSize/height<<3
k0 Y9 c" m3 U0 @ number = offset+ImageSize-1
" }5 y' n2 ]$ }/ [0 b [9 W$ r" H ?3 [+ |' o5 g$ w4 @
for(Wnum offset number
# ?. V. q* ?& U% C3 x$ {0 Q4 v row = fix((Wnum-offset)/(max_column>>3))
0 o+ O% C& L) k y = Grid*row- ~' M: l5 b; c, X; k* N! G4 ~
5 V6 P( ^/ z# T
for(i 0 77 i7 C* R% m3 I! M
dot = bitfield1(WORD[Wnum] 7-i) ; bit<7> ~ bit<0>
9 N3 \$ R8 J! { W4 F x = Grid*column9 M0 i5 D- _# ^( {
if(zerop(dot) && column<width then
/ D; a: o* e( n: { geSelectObject(dbCreateRect(cv Layer list(x:y x+Grid:y+Grid)))' Q& R) y5 G1 {+ C5 t$ \6 r
)
. p" J; X8 z; K" b( C column++: p, u2 `" X6 O
);for
+ J4 Y" u8 X2 D8 i if(equal(column max_column) column=0)
# h! e, Z, j, N Wnum++4 ~: v4 M" l1 a0 k! u
);for
/ v1 h( m, l: t( [. `4 u
1 E, x! v M& c, s3 W5 k# {3 ^ hiZoomIn(win list(-10:-10 x+10:y+10))) Q% l, w& T5 n4 j8 z& X; R! @
printf("--- BMP2LAY End ----- %L\nt\n" getCurrentTime())
; o% k5 F6 ^& ]0 o);let. [2 E# m1 T" Y( ?
7 W1 W1 l+ F2 l. @2 R9 z0 O
|
|