Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > media > main > by-pkgid > 0afeee9cca140e167a996902b9a677c5 > files > 2637

php-manual-en-4.3.0-2mdk.noarch.rpm

<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 &#62;= 4.0.5)</P
>SWFBitmap&nbsp;--&nbsp;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
>&#13;     <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
>&#13;     SWFBitmap has the following methods : <B
CLASS="function"
>swfbitmap-&#62;getwidth()</B
>
     and <B
CLASS="function"
>swfbitmap-&#62;getheight()</B
>.
    </P
><P
>&#13;     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"
>&#60;?php
  $s = new SWFShape();
  $f = $s-&#62;addFill(new SWFBitmap("png.dbl"));
  $s-&#62;setRightFill($f);

  $s-&#62;drawLine(32, 0);
  $s-&#62;drawLine(0, 32);
  $s-&#62;drawLine(-32, 0);
  $s-&#62;drawLine(0, -32);

  $m = new SWFMovie();
  $m-&#62;setDimension(32, 32);
  $m-&#62;add($s);

  header('Content-type: application/x-shockwave-flash');
  $m-&#62;output();
?&#62;</PRE
></TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
>
    </P
><P
>&#13;     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"
>&#60;?php

  $s = new SWFShape();

  // .msk file generated with "gif2mask" utility
  $f = $s-&#62;addFill(new SWFBitmap("alphafill.jpg", "alphafill.msk"));
  $s-&#62;setRightFill($f);

  $s-&#62;drawLine(640, 0);
  $s-&#62;drawLine(0, 480);
  $s-&#62;drawLine(-640, 0);
  $s-&#62;drawLine(0, -480);

  $c = new SWFShape();
  $c-&#62;setRightFill($c-&#62;addFill(0x99, 0x99, 0x99));
  $c-&#62;drawLine(40, 0);
  $c-&#62;drawLine(0, 40);
  $c-&#62;drawLine(-40, 0);
  $c-&#62;drawLine(0, -40);

  $m = new SWFMovie();
  $m-&#62;setDimension(640, 480);
  $m-&#62;setBackground(0xcc, 0xcc, 0xcc);

  // draw checkerboard background
  for($y=0; $y&#60;480; $y+=40)
  {
    for($x=0; $x&#60;640; $x+=80)
    {
      $i = $m-&#62;add($c);
      $i-&#62;moveTo($x, $y);
    }

    $y+=40;

    for($x=40; $x&#60;640; $x+=80)
    {
      $i = $m-&#62;add($c);
      $i-&#62;moveTo($x, $y);
    }
  }

  $m-&#62;add($s);

  header('Content-type: application/x-shockwave-flash');
  $m-&#62;output();
?&#62;</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-&#62;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
>