<HTML ><HEAD ><TITLE >SWFBitmap</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="PHP Manual" HREF="index.html"><LINK REL="UP" TITLE="Ming functions for Flash" HREF="ref.ming.html"><LINK REL="PREVIOUS" TITLE="SWFBitmap->getWidth" HREF="function.swfbitmap.getwidth.html"><LINK REL="NEXT" TITLE="swfbutton_keypress" HREF="function.swfbutton-keypress.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=ISO-8859-1"></HEAD ><BODY CLASS="refentry" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >PHP Manual</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.swfbitmap.getwidth.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.swfbutton-keypress.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.swfbitmap" ></A >SWFBitmap</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN53003" ></A ><P > (PHP 4 >= 4.0.5)</P >SWFBitmap -- Loads Bitmap object</DIV ><DIV CLASS="refsect1" ><A NAME="AEN53006" ></A ><H2 >Description</H2 >new <B CLASS="methodname" >swfbitmap</B > ( string filename [, int alphafilename])<BR ></BR ><DIV CLASS="warning" ><P ></P ><TABLE CLASS="warning" BORDER="1" WIDTH="100%" ><TR ><TD ALIGN="CENTER" ><B >Warning</B ></TD ></TR ><TR ><TD ALIGN="LEFT" ><P >This function is <SPAN CLASS="emphasis" ><I CLASS="emphasis" >EXPERIMENTAL</I ></SPAN >. The behaviour of this function, the name of this function, and anything else documented about this function may change without notice in a future release of PHP. Use this function at your own risk.</P ></TD ></TR ></TABLE ></DIV ><P > <B CLASS="function" >swfbitmap()</B > creates a new SWFBitmap object from the Jpeg or DBL file named <TT CLASS="parameter" ><I >filename</I ></TT >. <TT CLASS="parameter" ><I >alphafilename</I ></TT > indicates a MSK file to be used as an alpha mask for a Jpeg image. </P ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >Note: </B > We can only deal with baseline (frame 0) jpegs, no baseline optimized or progressive scan jpegs! </P ></BLOCKQUOTE ></DIV ><P > SWFBitmap has the following methods : <B CLASS="function" >swfbitmap->getwidth()</B > and <B CLASS="function" >swfbitmap->getheight()</B >. </P ><P > You can't import png images directly, though- have to use the png2dbl utility to make a dbl ("define bits lossless") file from the png. The reason for this is that I don't want a dependency on the png library in ming- autoconf should solve this, but that's not set up yet. <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN53030" ></A ><P ><B >Example 1. Import PNG files</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="php" ><?php $s = new SWFShape(); $f = $s->addFill(new SWFBitmap("png.dbl")); $s->setRightFill($f); $s->drawLine(32, 0); $s->drawLine(0, 32); $s->drawLine(-32, 0); $s->drawLine(0, -32); $m = new SWFMovie(); $m->setDimension(32, 32); $m->add($s); header('Content-type: application/x-shockwave-flash'); $m->output(); ?></PRE ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE > </P ><P > And you can put an alpha mask on a jpeg fill. <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN53034" ></A ><P ><B >Example 2. <B CLASS="function" >swfbitmap()</B > example</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="php" ><?php $s = new SWFShape(); // .msk file generated with "gif2mask" utility $f = $s->addFill(new SWFBitmap("alphafill.jpg", "alphafill.msk")); $s->setRightFill($f); $s->drawLine(640, 0); $s->drawLine(0, 480); $s->drawLine(-640, 0); $s->drawLine(0, -480); $c = new SWFShape(); $c->setRightFill($c->addFill(0x99, 0x99, 0x99)); $c->drawLine(40, 0); $c->drawLine(0, 40); $c->drawLine(-40, 0); $c->drawLine(0, -40); $m = new SWFMovie(); $m->setDimension(640, 480); $m->setBackground(0xcc, 0xcc, 0xcc); // draw checkerboard background for($y=0; $y<480; $y+=40) { for($x=0; $x<640; $x+=80) { $i = $m->add($c); $i->moveTo($x, $y); } $y+=40; for($x=40; $x<640; $x+=80) { $i = $m->add($c); $i->moveTo($x, $y); } } $m->add($s); header('Content-type: application/x-shockwave-flash'); $m->output(); ?></PRE ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE > </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.swfbitmap.getwidth.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.swfbutton-keypress.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >SWFBitmap->getWidth</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.ming.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >swfbutton_keypress</TD ></TR ></TABLE ></DIV ></BODY ></HTML >