Chip123 科技應用創新平台

 找回密碼
 申請會員

QQ登錄

只需一步,快速開始

Login

用FB帳號登入

搜索
1 2 3 4
查看: 9301|回復: 0
打印 上一主題 下一主題

[問題求助] 關於BMP轉logo

[複製鏈接]
跳轉到指定樓層
1#
發表於 2021-5-7 10:16:51 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
請問大家layout logo是怎麽做得,感覺BMP 單色位轉成layout效果不好,如果采用這個方法要每個字母做成一個cell,然後還要load一個可以自動縮放的script,而且轉成單色位圖片會有很嚴重的毛邊,轉出來會很難看,所以是怎麽做比較好+ T1 K* C. u) n+ }, g4 d

" l2 @$ Y9 i$ \7 _1 [% N以下是skill
$ m4 W& O) j- w3 x* E! V! N8 K; Dlet((win cv bmpfile bmpSize WORD Wnum number Grid Layer row column max_column& R( `- D3 E% v% J/ |7 l2 D2 J
        i dot x y signature offset width height pixel ImageSize )
. c" T- {# F9 P2 P* B! C' Z
9 t; r! Y0 j$ u! k5 O/ {6 r        win = hiGetCurrentWindow()
8 @8 o! @& M- Z+ ^( f4 ]" D( d        cv = getEditRep(win)
4 f2 N+ \# U- O6 Q( @1 L) J
% I0 h( T) \$ ]1 v0 B! S        bmpfile = "~/number_mini.bmp"                        ;;; Input BMP File
5 K% E1 S2 w# N        Layer = list("TTOPME" "drawing")        ;;; Output Layer& \$ w. B# u4 W
        Grid = 1                                ;;; Rectangle Size
1 H& b- N% G; T% g        column = 0! B. K5 b) O( o( R8 h

: _5 k( G( A: `procedure(MessageForm(text)5 S' e$ \& z& a! }0 Q! v
    prog( ()* Y: M! ?" S; I% p0 j
        hiDisplayAppDBox(
; O7 ]- l) ?, D9 h' x& O                ?name 'JWDBox_Message6 }- V* w  D+ a$ }; y7 n; {
                ?dboxBanner "Message!!") V4 Z, b! X: n- e, @# t6 ^
                ?buttonLayout 'Close" g4 V, `4 _* W) W+ n% E1 v% f7 b
                ?dboxText text
1 x6 z$ C" ~) `) G" r( P9 m) K        )" Y! ~( |$ R8 O; |% o1 Q% b
    );prog2 t; O# h- E. U5 u, {
);procedure
) z; i' S/ y4 i+ c$ v: F/ d, {
) B* I$ \- O- e+ ~* d4 d;Read BMP file
/ L* `# j) u; A/ P        if(InFile = infile(bmpfile) then1 p$ D4 l6 ?5 h, d* {$ M
                bmpSize = fileLength(bmpfile)# _+ E" e- J' g) d
                declare(WORD[bmpSize])
: J+ q+ z7 d' l* Y& X% w7 r) G2 l                for(Wnum 0 bmpSize-1        WORD[Wnum] = charToInt(getc(InFile)) )
' ]3 m2 {+ ?. s3 L! Z6 `                close(InFile)
) Y; ^5 J5 g0 t) I; P5 p' O# x: Z, F3 s        else
) a5 U. C! z9 q$ A9 o/ n4 V                MessageForm("Input file does not exist!")
) l+ U9 u- J: x0 }0 _/ g                return()
! \7 x& r! }% w8 L% ?! I        )/ v5 \9 E2 \; P: |

" X. ]) r$ W/ w        sprintf(signature "%02x%02x" WORD[0] WORD[1])
" u( t- j- b8 F2 d$ a        offset = (WORD[0x0d]<<24) + (WORD[0x0c]<<16) + (WORD[0x0b]<<8) + WORD[0x0a]
/ `4 H) z1 m4 t  ~! h$ S2 c9 o        width  = (WORD[0x15]<<24) + (WORD[0x14]<<16) + (WORD[0x13]<<8) + WORD[0x12]) |0 N. x9 g" ^, h2 }$ d9 v4 V
        height = (WORD[0x19]<<24) + (WORD[0x18]<<16) + (WORD[0x17]<<8) + WORD[0x16]
$ @# K# G; O' n% R: t9 D  b        pixel  = (WORD[0x1d]<<8) + WORD[0x1c]
5 v, @3 V; D, M; W: c" `  }$ B        ImageSize = (WORD[0x25]<<24) + (WORD[0x24]<<16) + (WORD[0x23]<<8) + WORD[0x22]7 e/ A/ s: T* C  d7 ]9 G1 |( _
5 N. _+ o6 ]% J: Y" T
        printf("--- BMP2LAY Start --- %L\n" getCurrentTime())
8 a+ W$ ?' @4 Y( H        printf("offset  : 0x%x \n" offset)
# I2 @! V& S* b+ B8 H  i  \        printf("width   : 0x%x \n" width)3 R7 s# l% _7 O+ T, x9 }
        printf("height  : 0x%x \n" height)# j3 I3 @  p( {5 q" \9 j
        printf("ImgSize : 0x%x \n" ImageSize)1 R0 H7 U, s3 \: d+ {$ Q
$ V. Y, ^5 o/ d) Z0 k/ P. _" b+ h
;check bmp file
* V8 t  ]8 t- n& {        if(!equal(signature "424d") then7 N% _* E6 F8 {/ o+ W
                MessageForm("*ERROR* Standard Input is not a BMP file")
- _( z3 v0 m& y* G. X                return()5 K$ R% A% X4 ~4 U8 f4 W  m
        )
9 P( H, I6 o' n$ {. n' N
5 F  \; o' }" I" V' o) X+ R;check mono bmp file
: H! B. `4 L: N: x        if(!equal(pixel 0x01) then) M6 @% n$ Z4 G# Q& m
                MessageForm("*ERROR* only supports mono bmp files")
" Q4 v1 Q' x1 t! Q% l, n( u                return()$ R* V  P! `6 b( T3 h  ^
        )6 f  o( b2 s0 F0 t

$ T, W* N. X# H0 G/ ?3 v;BMP2LAY0 H) _5 _( V, p
        max_column = ImageSize/height<<3
( c* y$ ^: H- l, V; L        number = offset+ImageSize-1
7 M% U$ w  g1 S! H9 V: c% F, T5 J  r8 _3 t
        for(Wnum offset number( @- ?) }( K- J( f& z+ ?- C
                row = fix((Wnum-offset)/(max_column>>3))* |3 ~0 k. e, X" |
                y = Grid*row0 u& k8 s0 B) m
) s% h) ^& h  r6 E
                for(i 0 7
. @; t$ r. c! h' E$ g$ d                        dot = bitfield1(WORD[Wnum] 7-i)                ; bit<7> ~ bit<0>  s# l3 A+ I% q
                        x = Grid*column
5 U4 z$ H  d/ T# T" l7 Y                        if(zerop(dot) && column<width then
1 t$ @& R6 V# V                                geSelectObject(dbCreateRect(cv Layer list(x:y x+Grid:y+Grid)))
& O$ T/ M" b4 \5 J                        )4 a; @# E7 s  n4 ]* _& N' g
                        column++; L/ H& V9 _6 T) r4 r) y0 U
                );for% }: M" D  |' ~' h& i8 i! A3 K
                if(equal(column max_column)        column=0): G. j0 Y/ V  O
                Wnum++
3 O6 B$ p' D) \: E# L: o( ?        );for
% ^$ T1 i  I2 R. K% J- m: k8 F8 P# j) ?* H" x
        hiZoomIn(win list(-10:-10 x+10:y+10))
- e% }' N. ]0 R) R        printf("--- BMP2LAY End ----- %L\nt\n" getCurrentTime())
, {5 E4 L' A6 w);let. @# z3 l% L2 ]# |0 g
( E3 l" a) ?3 O# j- u
分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享分享 頂 踩 分享分享
您需要登錄後才可以回帖 登錄 | 申請會員

本版積分規則

首頁|手機版|Chip123 科技應用創新平台 |新契機國際商機整合股份有限公司

GMT+8, 2024-5-15 09:32 PM , Processed in 0.099513 second(s), 18 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回復 返回頂部 返回列表